[PATCH] Allow _MSC_EXTENSIONS macro on non-Windows targets
Yunzhong Gao
Yunzhong_Gao at playstation.sony.com
Wed Mar 12 18:58:26 PDT 2014
Hi David,
Thanks for the suggestions.
I am uploading a patch for implementing a msvc_keywords extension.
- Gao
http://llvm-reviews.chandlerc.com/D3034
CHANGE SINCE LAST DIFF
http://llvm-reviews.chandlerc.com/D3034?vs=7721&id=7788#toc
Files:
lib/Lex/PPMacroExpansion.cpp
test/Lexer/has_extension.c
Index: lib/Lex/PPMacroExpansion.cpp
===================================================================
--- lib/Lex/PPMacroExpansion.cpp
+++ lib/Lex/PPMacroExpansion.cpp
@@ -1040,6 +1040,7 @@
.Case("cxx_binary_literals", true)
.Case("cxx_init_captures", LangOpts.CPlusPlus11)
.Case("cxx_variable_templates", LangOpts.CPlusPlus)
+ .Case("msvc_keywords", LangOpts.MicrosoftExt)
.Default(false);
}
Index: test/Lexer/has_extension.c
===================================================================
--- test/Lexer/has_extension.c
+++ test/Lexer/has_extension.c
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 -E %s -o - | FileCheck --check-prefix=CHECK-PED-NONE %s
+// RUN: %clang_cc1 -E -fms-extensions %s -o - | FileCheck --check-prefix=CHECK-MS-EXT %s
// RUN: %clang_cc1 -pedantic-errors -E %s -o - | FileCheck --check-prefix=CHECK-PED-ERR %s
// CHECK-PED-NONE: no_dummy_extension
@@ -42,3 +43,11 @@
#if __has_extension(__c_alignas__)
int has_double_underscores();
#endif
+
+// CHECK-PED-NONE: no_ms_keywords
+// CHECK-MS-EXT: has_ms_keywords
+#if __has_extension(msvc_keywords)
+int has_ms_keywords();
+#else
+int no_ms_keywords();
+#endif
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D3034.2.patch
Type: text/x-patch
Size: 1198 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20140312/f2e2fe83/attachment.bin>
More information about the cfe-commits
mailing list