aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Frontend/InitPreprocessor.cpp
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
commitd106a98fe93766843546db32d7c31f24f11b9e1c (patch)
treeee285f4d4747017c512e998f31acc7e1774873c4 /clang/lib/Frontend/InitPreprocessor.cpp
parentd4cf35d77576c8de1e958937aed5445a81f6989b (diff)
downloadllvm-d106a98fe93766843546db32d7c31f24f11b9e1c.zip
llvm-d106a98fe93766843546db32d7c31f24f11b9e1c.tar.gz
llvm-d106a98fe93766843546db32d7c31f24f11b9e1c.tar.bz2
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. llvm-svn: 156113
Diffstat (limited to 'clang/lib/Frontend/InitPreprocessor.cpp')
-rw-r--r--clang/lib/Frontend/InitPreprocessor.cpp24
1 files changed, 10 insertions, 14 deletions
diff --git a/clang/lib/Frontend/InitPreprocessor.cpp b/clang/lib/Frontend/InitPreprocessor.cpp
index 93d49b0..4df7cfd 100644
--- a/clang/lib/Frontend/InitPreprocessor.cpp
+++ b/clang/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)