[llvm-bugs] [Bug 48704] Default to C11 standard and missing __STDC_NO_THREADS__ ( windows)

via llvm-bugs llvm-bugs at lists.llvm.org
Sun Oct 17 06:37:35 PDT 2021


Aaron Ballman <aaron at aaronballman.com> changed:

           What    |Removed                     |Added
                 CC|                            |aaron at aaronballman.com
             Status|NEW                         |RESOLVED
         Resolution|---                         |WONTFIX

--- Comment #3 from Aaron Ballman <aaron at aaronballman.com> ---
> One day maybe Visual C++ will provide threads.h, so the most we can do is do the __has_include test internally in the compiler to power this macro.

We really can't even do that much because 7.26.1p2 says: "Implementations that
define the macro __STDC_NO_THREADS__ need not provide this header nor support
any of its facilities."

Note how it doesn't say implementations that define the macro to a particular
value, just whether implementations define the macro at all.

The trouble is: Clang doesn't ship the full C implementation, it only ships the
compiler and the library portions that need to come from the compiler, which
does not include <threads.h>. We rely on the target platform to provide the
rest of the C standard library interfaces, so the compiler doesn't know whether
to define the macro or not. Some versions of glibc support <threads.h> and some
do not, no version of MSVC CRT supports <threads.h> currently, etc.

Users have to rely on the C standard library implementation to provide this
macro or not.

You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20211017/751db750/attachment-0001.html>

More information about the llvm-bugs mailing list