[cfe-commits] r133437 - in /cfe/trunk: lib/Frontend/InitPreprocessor.cpp test/Preprocessor/init.c
Douglas Gregor
dgregor at apple.com
Mon Jun 20 08:00:58 PDT 2011
Author: dgregor
Date: Mon Jun 20 10:00:58 2011
New Revision: 133437
URL: http://llvm.org/viewvc/llvm-project?rev=133437&view=rev
Log:
Define __cplusplus to 201103L when in (non-GNU) C++0x mode.
Modified:
cfe/trunk/lib/Frontend/InitPreprocessor.cpp
cfe/trunk/test/Preprocessor/init.c
Modified: cfe/trunk/lib/Frontend/InitPreprocessor.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/InitPreprocessor.cpp?rev=133437&r1=133436&r2=133437&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/InitPreprocessor.cpp (original)
+++ cfe/trunk/lib/Frontend/InitPreprocessor.cpp Mon Jun 20 10:00:58 2011
@@ -359,11 +359,18 @@
} else {
if (LangOpts.GNUMode)
Builder.defineMacro("__cplusplus");
- else
- // C++ [cpp.predefined]p1:
+ else {
+ // C++0x [cpp.predefined]p1:
+ // The name_ _cplusplus is defined to the value 201103L when compiling a
+ // C++ translation unit.
+ if (LangOpts.CPlusPlus0x)
+ Builder.defineMacro("__cplusplus", "201103L");
+ // C++03 [cpp.predefined]p1:
// The name_ _cplusplus is defined to the value 199711L when compiling a
// C++ translation unit.
- Builder.defineMacro("__cplusplus", "199711L");
+ else
+ Builder.defineMacro("__cplusplus", "199711L");
+ }
}
if (LangOpts.ObjC1)
Modified: cfe/trunk/test/Preprocessor/init.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Preprocessor/init.c?rev=133437&r1=133436&r2=133437&view=diff
==============================================================================
--- cfe/trunk/test/Preprocessor/init.c (original)
+++ cfe/trunk/test/Preprocessor/init.c Mon Jun 20 10:00:58 2011
@@ -15,7 +15,7 @@
// CXX0X:#define __GXX_EXPERIMENTAL_CXX0X__ 1
// CXX0X:#define __GXX_RTTI 1
// CXX0X:#define __GXX_WEAK__ 1
-// CXX0X:#define __cplusplus 199711L
+// CXX0X:#define __cplusplus 201103L
// CXX0X:#define __private_extern__ extern
//
//
More information about the cfe-commits
mailing list