Match declaration of __clz_tab in longlong.h to definition (patch)

Hans-Peter Nilsson hp@bitrange.com
Wed Feb 16 06:33:00 GMT 2000


The __clz_tab in libgcc2.c is defined as static.  It is defined multiple
times, when compiling _udivdi3, _divdi3, _umoddi3 and _moddi3.  Perhaps it
should really be extern and compiled using its own L_ thingy, but I go for
suggesting the simplest change for now.

This matters for implementations where extern and static definitions are
handled differently, like using a different name.  Alternatively, perhaps
someone could give me a hint on an better ENCODE_SECTION_INFO test for
local-nonvisible/static vs. publicly-visible/extern definitions than:
  if ((TREE_CODE (decl) == VAR_DECL
       && (DECL_EXTERNAL (decl) || TREE_PUBLIC (decl))
       && ! TREE_STATIC (decl))
      || (TREE_CODE (decl) == FUNCTION_DECL
	  && (DECL_EXTERNAL (decl) || TREE_PUBLIC (decl))))
     ...
which fails for things that are declared extern but defined as static.

Is this ok to commit?

Wed Feb 16 15:14:38 2000  Hans-Peter Nilsson  <hp@bitrange.com>

	* longlong.h (__clz_tab): Declare as static to match definition.

Index: longlong.h
===================================================================
RCS file: /cvs/gcc/egcs/gcc/longlong.h,v
retrieving revision 1.16
diff -p -c -r1.16 longlong.h
*** longlong.h	2000/02/06 04:48:20	1.16
--- longlong.h	2000/02/16 14:11:41
***************
*** 1,5 ****
  /* longlong.h -- definitions for mixed size 32/64 bit arithmetic.
!    Copyright (C) 1991,92,94,95,96,97,98,99 Free Software Foundation, Inc.
  
     This definition file is free software; you can redistribute it
     and/or modify it under the terms of the GNU General Public
--- 1,5 ----
  /* longlong.h -- definitions for mixed size 32/64 bit arithmetic.
!    Copyright (C) 1991,92,94,95,96,97,98,99, 2000 Free Software Foundation, Inc.
  
     This definition file is free software; you can redistribute it
     and/or modify it under the terms of the GNU General Public
*************** UDItype __umulsidi3 (USItype, USItype);
*** 1444,1450 ****
  #endif
  
  #if !defined (count_leading_zeros)
! extern const UQItype __clz_tab[];
  #define count_leading_zeros(count, x) \
    do {									\
      UWtype __xr = (x);							\
--- 1444,1450 ----
  #endif
  
  #if !defined (count_leading_zeros)
! static const UQItype __clz_tab[];
  #define count_leading_zeros(count, x) \
    do {									\
      UWtype __xr = (x);							\

brgds, H-P



More information about the Gcc-patches mailing list