[PATCH] D112081: Define __STDC_NO_THREADS__ when targeting windows-msvc (PR48704)
Hans Wennborg via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Oct 19 08:41:30 PDT 2021
hans created this revision.
hans added reviewers: aaron.ballman, rnk.
hans requested review of this revision.
Herald added a project: clang.
MSVC's libc doesn't provide thread.h, so we should set the macro to indicate that.
We could just set it in C mode, but I noticed that Darwin sets it unconditionally, so perhaps we should do the same here.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D112081
Files:
clang/lib/Basic/Targets/OSTargets.cpp
clang/test/Preprocessor/init.c
Index: clang/test/Preprocessor/init.c
===================================================================
--- clang/test/Preprocessor/init.c
+++ clang/test/Preprocessor/init.c
@@ -192,6 +192,7 @@
//
// MSEXT-NOT:#define __STDC__
// MSEXT:#define _INTEGRAL_MAX_BITS 64
+// MSEXT:#define __STDC_NO_THREADS__ 1
// MSEXT-NOT:#define _NATIVE_WCHAR_T_DEFINED 1
// MSEXT-NOT:#define _WCHAR_T_DEFINED 1
//
Index: clang/lib/Basic/Targets/OSTargets.cpp
===================================================================
--- clang/lib/Basic/Targets/OSTargets.cpp
+++ clang/lib/Basic/Targets/OSTargets.cpp
@@ -201,6 +201,7 @@
}
Builder.defineMacro("_INTEGRAL_MAX_BITS", "64");
+ Builder.defineMacro("__STDC_NO_THREADS__");
}
void addWindowsDefines(const llvm::Triple &Triple, const LangOptions &Opts,
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D112081.380704.patch
Type: text/x-patch
Size: 809 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20211019/4111f263/attachment.bin>
More information about the cfe-commits
mailing list