[cfe-commits] r78283 - /cfe/trunk/lib/Frontend/InitPreprocessor.cpp
Douglas Gregor
dgregor at apple.com
Wed Aug 5 21:09:41 PDT 2009
Author: dgregor
Date: Wed Aug 5 23:09:28 2009
New Revision: 78283
URL: http://llvm.org/viewvc/llvm-project?rev=78283&view=rev
Log:
Predefine __cplusplus to the right value (199711L), except when in GNU mode.
Modified:
cfe/trunk/lib/Frontend/InitPreprocessor.cpp
Modified: cfe/trunk/lib/Frontend/InitPreprocessor.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/InitPreprocessor.cpp?rev=78283&r1=78282&r2=78283&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/InitPreprocessor.cpp (original)
+++ cfe/trunk/lib/Frontend/InitPreprocessor.cpp Wed Aug 5 23:09:28 2009
@@ -305,7 +305,13 @@
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");
}
More information about the cfe-commits
mailing list