From 36dd131b4981f31c4520c5430d21f4d159954c4d Mon Sep 17 00:00:00 2001 From: Douglas Gregor Date: Thu, 6 Aug 2009 04:09:28 +0000 Subject: [PATCH] Predefine __cplusplus to the right value (199711L), except when in GNU mode. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@78283 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Frontend/InitPreprocessor.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/Frontend/InitPreprocessor.cpp b/lib/Frontend/InitPreprocessor.cpp index 3ab59315c8..877c788a1f 100644 --- a/lib/Frontend/InitPreprocessor.cpp +++ b/lib/Frontend/InitPreprocessor.cpp @@ -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"); } -- 2.40.0