[clang] [clang] __STDC_NO_THREADS__ is no longer necessary for VS 2022 1939 and above (PR #117149)
Aaron Ballman via cfe-commits
cfe-commits at lists.llvm.org
Fri Jan 24 06:23:41 PST 2025
================
@@ -259,8 +259,11 @@ static void addVisualCDefines(const LangOptions &Opts, MacroBuilder &Builder) {
Builder.defineMacro("_KERNEL_MODE");
Builder.defineMacro("_INTEGRAL_MAX_BITS", "64");
- Builder.defineMacro("__STDC_NO_THREADS__");
-
+ // Define __STDC_NO_THREADS__ based on MSVC version, threads.h availability,
+ // and language standard.
+ if (!(Opts.isCompatibleWithMSVC(LangOptions::MSVC2022_9) && (Opts.LangStd >= LangStandard::lang_c11))) {
+ Builder.defineMacro("__STDC_NO_THREADS__");
+ }
----------------
AaronBallman wrote:
```suggestion
if (!(Opts.isCompatibleWithMSVC(LangOptions::MSVC2022_9) && Opts.C11))
Builder.defineMacro("__STDC_NO_THREADS__");
```
Simplifying and fixing for our goofy coding style guidelines. There's no need to check >= c11 because C11 will also be true in C17, C23, etc.
https://github.com/llvm/llvm-project/pull/117149
More information about the cfe-commits
mailing list