[PATCH v8 1/8] nptl: Add C11 threads thrd_* functions
Florian Weimer
fweimer@redhat.com
Thu Jul 12 19:26:00 GMT 2018
On 07/12/2018 09:19 PM, Adhemerval Zanella wrote:
> Also on GCC BZ#53769 [1] Joseph wrote that check for __STDC_VERSION__
> and/or __STDC_NO_THREADS__ is not meaningful to documented incomplete
> compiler support for language standard. This is at least for GCC
> standpoint, not sure about other compilers.
>
> We could add a check like:
>
> #if (defined (__GNUC__) && !__GNUC_PREREQ (4.9))
> || (!defined (__cpluscplus) && __cplusplus < 201103L)
> # define __STDC_NO_THREADS__ 1
> #endif
>
> [1]https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53769
I think your first patch was fine. The <threads.h> header exists after
your change.
We could polish the definition of thread_local in the header file with
some conditionals, though, so that we fall back to __thread for GCC
prior to 4.9. The definition of the thread_local macro will be
non-confirming, but that's what you get for using a non-conforming
implementation.
(If the C compiler is not known to be C, we need to use _Thread_local,
even though __thread probably covers more old implementations out there.)
Thanks,
Florian
More information about the Libc-alpha
mailing list