From 3f4d51bb04012d56417e8b362a558f809be802bd Mon Sep 17 00:00:00 2001 From: Douglas Gregor Date: Thu, 6 Aug 2009 04:09:28 +0000 Subject: Predefine __cplusplus to the right value (199711L), except when in GNU mode. llvm-svn: 78283 --- clang/lib/Frontend/InitPreprocessor.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'clang/lib/Frontend') diff --git a/clang/lib/Frontend/InitPreprocessor.cpp b/clang/lib/Frontend/InitPreprocessor.cpp index 3ab59315c8b..877c788a1fd 100644 --- a/clang/lib/Frontend/InitPreprocessor.cpp +++ b/clang/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"); } -- cgit v1.2.3