r206415 - Revert "Move -fms-extensions predefined macros into InitPreprocessor"

Reid Kleckner reid at kleckner.net
Wed Apr 16 13:10:16 PDT 2014


Author: rnk
Date: Wed Apr 16 15:10:16 2014
New Revision: 206415

URL: http://llvm.org/viewvc/llvm-project?rev=206415&view=rev
Log:
Revert "Move -fms-extensions predefined macros into InitPreprocessor"

This reverts commit r206413.

This was proposed before, but it's not clear if this is really a good
idea:
http://reviews.llvm.org/D3034

Modified:
    cfe/trunk/lib/Basic/Targets.cpp
    cfe/trunk/lib/Frontend/InitPreprocessor.cpp
    cfe/trunk/test/Preprocessor/microsoft-ext.c

Modified: cfe/trunk/lib/Basic/Targets.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets.cpp?rev=206415&r1=206414&r2=206415&view=diff
==============================================================================
--- cfe/trunk/lib/Basic/Targets.cpp (original)
+++ cfe/trunk/lib/Basic/Targets.cpp Wed Apr 16 15:10:16 2014
@@ -577,6 +577,19 @@ protected:
     if (Opts.POSIXThreads)
       Builder.defineMacro("_MT");
 
+    if (Opts.MSCVersion != 0)
+      Builder.defineMacro("_MSC_VER", Twine(Opts.MSCVersion));
+
+    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");
+      }
+    }
+
     Builder.defineMacro("_INTEGRAL_MAX_BITS", "64");
   }
 

Modified: cfe/trunk/lib/Frontend/InitPreprocessor.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/InitPreprocessor.cpp?rev=206415&r1=206414&r2=206415&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/InitPreprocessor.cpp (original)
+++ cfe/trunk/lib/Frontend/InitPreprocessor.cpp Wed Apr 16 15:10:16 2014
@@ -507,19 +507,7 @@ static void InitializePredefinedMacros(c
     Builder.defineMacro("__private_extern__", "extern");
   }
 
-  if (LangOpts.MSCVersion != 0)
-    Builder.defineMacro("_MSC_VER", Twine(LangOpts.MSCVersion));
-
   if (LangOpts.MicrosoftExt) {
-    // Define feature support macros that MSVC provides.
-    Builder.defineMacro("_MSC_EXTENSIONS");
-
-    if (LangOpts.CPlusPlus11) {
-      Builder.defineMacro("_RVALUE_REFERENCES_V2_SUPPORTED");
-      Builder.defineMacro("_RVALUE_REFERENCES_SUPPORTED");
-      Builder.defineMacro("_NATIVE_NULLPTR_SUPPORTED");
-    }
-
     if (LangOpts.WChar) {
       // wchar_t supported as a keyword.
       Builder.defineMacro("_WCHAR_T_DEFINED");

Modified: cfe/trunk/test/Preprocessor/microsoft-ext.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Preprocessor/microsoft-ext.c?rev=206415&r1=206414&r2=206415&view=diff
==============================================================================
--- cfe/trunk/test/Preprocessor/microsoft-ext.c (original)
+++ cfe/trunk/test/Preprocessor/microsoft-ext.c Wed Apr 16 15:10:16 2014
@@ -1,9 +1,5 @@
-// RUN: %clang_cc1 -triple i686-pc-win32 -E -fms-extensions -fms-compatibility %s -o - | FileCheck %s
-// RUN: %clang_cc1 -triple i686-linux-gnu -E -fms-extensions -fms-compatibility %s -o - | FileCheck %s
-
-#ifndef _MSC_EXTENSIONS
-# error "_MSC_EXTENSIONS not defined with -fms-extensions"
-#endif
+// RUN: %clang_cc1 -E -fms-compatibility %s -o %t
+// RUN: FileCheck %s < %t
 
 # define M2(x, y) x + y
 # define P(x, y) {x, y}





More information about the cfe-commits mailing list