[llvm-bugs] [Bug 32377] New: __STDC_NO_THREADS__ undefined with glibc
llvm-bugs at lists.llvm.org
Wed Mar 22 09:41:48 PDT 2017
Bug ID: 32377
Summary: __STDC_NO_THREADS__ undefined with glibc
Assignee: unassignedclangbugs at nondot.org
Reporter: clang at evan.coeusgroup.com
CC: llvm-bugs at lists.llvm.org
glibc doesn't support the C11 threads API but clang doesn't define
__STDC_NO_THREADS__, even in C11 mode, as is required by the C11 spec (§
I know this is partially a libc issue, since it's really up to the standard
library (not the compiler) to support the API. glibc does contain a `#define
__STDC_NO_THREADS__ 1` (as of 2.16) in stdc-predef.h, but clang doesn't
automatically include that file (GCC does).
I'm working around this issue right now by including stdc-predef.h (indirectly,
for portability reasons; limits.h -> features.h -> stdc-predef.h), but AFAIK
this shouldn't be necessary for a conformant implementation of C11. I should
be able to have something like
#if defined(__STDC_VERSION__) && \
(__STDC_VERSION__ >= 201102L) && \
# include <threads.h>
as the first few lines in my code, and have it work as expected.
It seems like the most straightforward solution would be to include
<stdc-predef.h> on glibc just like GCC does
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the llvm-bugs