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 e20b42a..de70644 100644
--- a/lib/Lex/Preprocessor.cpp
+++ b/lib/Lex/Preprocessor.cpp
@@ -488,7 +488,11 @@
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)