[PATCH] D157334: [clang] Define _MSC_EXTENSIONS on -gnu if -fms-extensions is set
Aiden Grossman via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Aug 8 23:32:26 PDT 2023
aidengrossman updated this revision to Diff 548473.
aidengrossman added a comment.
Reformat using arc as manually uploading patch messes up formatting.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D157334/new/
https://reviews.llvm.org/D157334
Files:
clang/lib/Basic/Targets/OSTargets.cpp
clang/test/Preprocessor/predefined-win-macros.c
Index: clang/test/Preprocessor/predefined-win-macros.c
===================================================================
--- clang/test/Preprocessor/predefined-win-macros.c
+++ clang/test/Preprocessor/predefined-win-macros.c
@@ -120,6 +120,11 @@
// CHECK-AMD64-MINGW: #define _WIN32 1
// CHECK-AMD64-MINGW: #define _WIN64 1
+// RUN: %clang_cc1 -triple x86_64-windows-gnu %s -E -dM -o - -fms-extensions \
+// RUN: | FileCheck -match-full-lines %s --check-prefix=CHECK-AMD64-MINGW-MSE
+
+// CHECK-AMD64-MINGW-MSE: #define _MSC_EXTENSIONS 1
+
// RUN: %clang_cc1 -triple aarch64-windows-gnu %s -E -dM -o - \
// RUN: | FileCheck -match-full-lines %s --check-prefix=CHECK-ARM64-MINGW
Index: clang/lib/Basic/Targets/OSTargets.cpp
===================================================================
--- clang/lib/Basic/Targets/OSTargets.cpp
+++ clang/lib/Basic/Targets/OSTargets.cpp
@@ -226,16 +226,6 @@
}
}
- if (Opts.MicrosoftExt) {
- Builder.defineMacro("_MSC_EXTENSIONS");
-
- if (Opts.CPlusPlus11) {
- Builder.defineMacro("_RVALUE_REFERENCES_V2_SUPPORTED");
- Builder.defineMacro("_RVALUE_REFERENCES_SUPPORTED");
- Builder.defineMacro("_NATIVE_NULLPTR_SUPPORTED");
- }
- }
-
if (!Opts.MSVolatile)
Builder.defineMacro("_ISO_VOLATILE");
@@ -264,6 +254,16 @@
else if (Triple.isKnownWindowsMSVCEnvironment() ||
(Triple.isWindowsItaniumEnvironment() && Opts.MSVCCompat))
addVisualCDefines(Opts, Builder);
+
+ if (Opts.MicrosoftExt) {
+ Builder.defineMacro("_MSC_EXTENSIONS");
+
+ if (Opts.CPlusPlus11) {
+ Builder.defineMacro("_RVALUE_REFERENCES_V2_SUPPORTED");
+ Builder.defineMacro("_RVALUE_REFERENCES_SUPPORTED");
+ Builder.defineMacro("_NATIVE_NULLPTR_SUPPORTED");
+ }
+ }
}
} // namespace targets
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D157334.548473.patch
Type: text/x-patch
Size: 1804 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230809/87327b33/attachment.bin>
More information about the cfe-commits
mailing list