This is the mail archive of the
libc-alpha@sources.redhat.com
mailing list for the glibc project.
Re: Fix weak handling with GCC 3.4+
Richard Henderson <rth@twiddle.net> writes:
> 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
Another underspecified GCC extension!
I would expect that in
__thread int foo = 0;
extern __typeof (foo) foo;
the second declaration would have no effect, just as in
static int foo = 0;
extern __typeof (foo) foo;
because 'extern' is not a storage class specifier.
--
- Geoffrey Keating <geoffk@geoffk.org>