From: Chris Lattner Date: Mon, 9 Mar 2009 21:50:12 +0000 (+0000) Subject: fix PR3768, Clang does -D__STDC_HOSTED__=1, even if -ffreestanding is passed. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=8d4a9d37fd636684d2334c55a5eb1f4163a6746f;p=clang fix PR3768, Clang does -D__STDC_HOSTED__=1, even if -ffreestanding is passed. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66474 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Lex/Preprocessor.cpp b/lib/Lex/Preprocessor.cpp index e20b42ac64..de706440c8 100644 --- a/lib/Lex/Preprocessor.cpp +++ b/lib/Lex/Preprocessor.cpp @@ -488,7 +488,11 @@ static void InitializePredefinedMacros(Preprocessor &PP, else if (0) // STDC94 ? DefineBuiltinMacro(Buf, "__STDC_VERSION__=199409L"); - DefineBuiltinMacro(Buf, "__STDC_HOSTED__=1"); + if (PP.getLangOptions().Freestanding) + DefineBuiltinMacro(Buf, "__STDC_HOSTED__=0"); + else + DefineBuiltinMacro(Buf, "__STDC_HOSTED__=1"); + if (PP.getLangOptions().ObjC1) { DefineBuiltinMacro(Buf, "__OBJC__=1"); if (PP.getLangOptions().ObjCNonFragileABI)