]> granicus.if.org Git - clang/commitdiff
Predefine __cplusplus to the right value (199711L), except when in GNU mode.
authorDouglas Gregor <dgregor@apple.com>
Thu, 6 Aug 2009 04:09:28 +0000 (04:09 +0000)
committerDouglas Gregor <dgregor@apple.com>
Thu, 6 Aug 2009 04:09:28 +0000 (04:09 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@78283 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Frontend/InitPreprocessor.cpp

index 3ab59315c8b1e3a54ed1233e1d20046b626701fb..877c788a1fdc2b43bb03dd6d8809f96515e3984a 100644 (file)
@@ -305,7 +305,13 @@ static void InitializePredefinedMacros(const TargetInfo &TI,
     DefineBuiltinMacro(Buf, "__EXCEPTIONS=1");
     DefineBuiltinMacro(Buf, "__GNUG__=4");
     DefineBuiltinMacro(Buf, "__GXX_WEAK__=1");
-    DefineBuiltinMacro(Buf, "__cplusplus=1");
+    if (LangOpts.GNUMode)
+      DefineBuiltinMacro(Buf, "__cplusplus=1");
+    else 
+      // C++ [cpp.predefined]p1:
+      //   The name_ _cplusplusis defined to the value199711Lwhen compiling a 
+      //   C++ translation unit.
+      DefineBuiltinMacro(Buf, "__cplusplus=199711L");
     DefineBuiltinMacro(Buf, "__private_extern__=extern");
   }