Dear maintainers,
The C standard (6.10.8.3-1 Conditional feature macros) reads:
> _ _STDC_NO_THREADS_ _ The integer constant 1 intended to
> indicate that the implementation does not support the <threads.h>
> header.
I've tried the following program with mingw-11.0 gcc-11.4 in Cygwin,
mingw-12.0 gcc-13.2 in MSYS2:
#if !defined(__STDC_NO_THREADS__)
#include <threads.h>
#endif
thread_local int x;
x86_64-w64-mingw32-gcc -Wall -std=c17 -c test.c
test.c:2:10: fatal error: threads.h: No such file or directory
2 | #include <threads.h>
| ^~~~~~~~~~~
compilation terminated.
I've looked for the __STDC_NO_THREADS__ string in the latest mingw-w64
sources, but could not find it. It would be useful to me to have this
macro defined, to write portable C code across platforms, compilers,
and to make the code work on C23.
Is it possible to add it? Where would be the best location?
For reference, in glibc, the macro was added here:
https://github.com/bminor/glibc/commit/6d74dd09d29f77ac2b22410f45687def349ba3da
and removed here when C11 <threads.h> support was added
https://github.com/bminor/glibc/blob/ce7528f637f7b9cddb3c22081d7e09b2a26c89bf/include/stdc-predef.h
Thanks for the hard work!
-- Antonin
_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public