]> granicus.if.org Git - clang/commitdiff
fix PR3768, Clang does -D__STDC_HOSTED__=1, even if -ffreestanding is passed.
authorChris Lattner <sabre@nondot.org>
Mon, 9 Mar 2009 21:50:12 +0000 (21:50 +0000)
committerChris Lattner <sabre@nondot.org>
Mon, 9 Mar 2009 21:50:12 +0000 (21:50 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66474 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Lex/Preprocessor.cpp

index e20b42ac6405f1bd400a522d0ef4f0d27d8efc15..de706440c845c52e4a7bb106af0468ea29c6c116 100644 (file)
@@ -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)