Hi! Thanks for the reply.

> I think we can add a dummy 'threads.h' that contains solely:

I should be able to test this macro to choose to include `threads.h`
or not, even if it is not predefined, it cannot be located in
'threads.h'.

> ISO C seems to require it to be a predefined macro without inclusion
> of any headers (6.10.8 1 Predefined macro names, N1570, ISO/IEC
> 9899:201x),

Is there no mechanism to allow this? gcc+glibc used to support it.
Clang currently has the correct behaviour on most systems.

https://github.com/search?q=repo%3Allvm%2Fllvm-project%20__STDC_NO_THREADS__&type=code


```
#define __STDC_NO_THREADS__ 1

#if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L)  /* C11
and not C++  */
#  define thread_local  _Thread_local
#endif
```

I see some problems here, although it is allowed to define
__STDC_VERSION__ in C++ mode, most compilers don't define
this macro in C++.
`thread_local` is already a C++11 keyword.

In C23 the macro `thread_local` is removed, and `thread_local` becomes
a keyword too. The `_Thread_local` type specifier is removed.

Besides, providing an incomplete `threads.h` without all the C11
thread functions wouldn't be compliant, and quite counter-intuitive.

To fix my issue, I might define __STDC_NO_THREADS__ at
configure-time if the 'threads.h' header cannot be found.

Best regards,
-- Antonin


_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to