Fix weak handling with GCC 3.4+

Richard Henderson rth@twiddle.net
Fri Jan 3 22:43:00 GMT 2003


On Fri, Jan 03, 2003 at 02:34:50PM -0800, Ulrich Drepper wrote:
> __thread int foo = 0;
> extern __typeof (foo) foo __attribute ((weak));
> 
> 
> __typeof() apparently does not include the __thread information.  I'd
> call it a gcc bug.

Why do you say that?  __thread is a storage class specifier, not a
type specifier.  It would be just as incorrect if __typeof somehow
copied "static" or "extern".

IMO this idiom is simply incorrect wrt __thread.

It would work if you used

  extern __thread __typeof(foo) foo __attribute((weak));

or just 

  #pragma weak foo


r~



More information about the Libc-alpha mailing list