aboutsummaryrefslogtreecommitdiff
path: root/lib/Frontend
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2012-05-03 22:18:20 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2012-05-03 22:18:20 +0000
commit0513448ae71478fd08d7e925bab46db1ddac3dfa (patch)
treefcf439c5e7cc88855c3830f89bc09905738fbf7a /lib/Frontend
parentd54dff026b02303a35147224de72bb44cbb53c79 (diff)
Use the standard values for the __cplusplus macro, even when in GNU mode. GCC
dropped its prior behavior of always defining __cplusplus to 1 in GNU mode in version 4.7. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156113 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Frontend')
-rw-r--r--lib/Frontend/InitPreprocessor.cpp24
1 files changed, 10 insertions, 14 deletions
diff --git a/lib/Frontend/InitPreprocessor.cpp b/lib/Frontend/InitPreprocessor.cpp
index 93d49b0563..4df7cfd5be 100644
--- a/lib/Frontend/InitPreprocessor.cpp
+++ b/lib/Frontend/InitPreprocessor.cpp
@@ -288,20 +288,16 @@ static void InitializeStandardPredefinedMacros(const TargetInfo &TI,
else if (!LangOpts.GNUMode && LangOpts.Digraphs)
Builder.defineMacro("__STDC_VERSION__", "199409L");
} else {
- if (LangOpts.GNUMode)
- Builder.defineMacro("__cplusplus");
- 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.
- else
- Builder.defineMacro("__cplusplus", "199711L");
- }
+ // C++11 [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.
+ else
+ Builder.defineMacro("__cplusplus", "199711L");
}
if (LangOpts.ObjC1)