]> granicus.if.org Git - clang/commitdiff
No longer defining GNUC mode when compiling for Microsoft compatibility. This allows...
authorAaron Ballman <aaron@aaronballman.com>
Sat, 10 Mar 2012 22:21:14 +0000 (22:21 +0000)
committerAaron Ballman <aaron@aaronballman.com>
Sat, 10 Mar 2012 22:21:14 +0000 (22:21 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152512 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Frontend/InitPreprocessor.cpp
test/Preprocessor/predefined-macros.c

index 2052a3a6b1f67c3e69e09707ca20fec08e1946c8..2caab7c5dd36e99c0f8cfee33555c9149307caa7 100644 (file)
@@ -319,11 +319,14 @@ static void InitializePredefinedMacros(const TargetInfo &TI,
                       + getClangFullRepositoryVersion() + ")\"");
 #undef TOSTR
 #undef TOSTR2
-  // Currently claim to be compatible with GCC 4.2.1-5621.
-  Builder.defineMacro("__GNUC_MINOR__", "2");
-  Builder.defineMacro("__GNUC_PATCHLEVEL__", "1");
-  Builder.defineMacro("__GNUC__", "4");
-  Builder.defineMacro("__GXX_ABI_VERSION", "1002");
+  if (!LangOpts.MicrosoftMode) {
+    // Currently claim to be compatible with GCC 4.2.1-5621, but only if we're
+    // not compiling for MSVC compatibility
+    Builder.defineMacro("__GNUC_MINOR__", "2");
+    Builder.defineMacro("__GNUC_PATCHLEVEL__", "1");
+    Builder.defineMacro("__GNUC__", "4");
+    Builder.defineMacro("__GXX_ABI_VERSION", "1002");
+  }
 
   // Define macros for the C11 / C++11 memory orderings
   Builder.defineMacro("__ATOMIC_RELAXED", "0");
index 5b03872c1f67bf0a3902abae2b3834848ef11f29..8ec4d7ecf67a679c3976e646d2f9a61cd405d5d2 100644 (file)
@@ -8,6 +8,7 @@
 // CHECK-MS: #define _M_IX86 600
 // CHECK-MS: #define _M_IX86_FP
 // CHECK-MS: #define _WIN32 1
+// CHECK-MS-NOT: #define __GNUC__
 //
 // RUN: %clang_cc1 %s -E -dM -ffast-math -o - \
 // RUN:   | FileCheck %s --check-prefix=CHECK-FAST-MATH