https://bugs.llvm.org/show_bug.cgi?id=32377
Bug ID: 32377
Summary: __STDC_NO_THREADS__ undefined with glibc
Product: clang
Version: 3.9
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: Driver
Assignee: unassignedclangb...@nondot.org
Reporter: cl...@evan.coeusgroup.com
CC: llvm-bugs@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 (ยง
6.10.8.3).
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) && \
!defined(__STDC_NO_THREADS__)
# include <threads.h>
#endif
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
(<https://gcc.gnu.org/viewcvs/gcc/trunk/gcc/config/glibc-c.c?view=markup#l26>).
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs