From 8d4a9d37fd636684d2334c55a5eb1f4163a6746f Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Mon, 9 Mar 2009 21:50:12 +0000 Subject: [PATCH] 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 --- lib/Lex/Preprocessor.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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) -- 2.50.1