[cfe-commits] r66474 - /cfe/trunk/lib/Lex/Preprocessor.cpp

Chris Lattner sabre at nondot.org
Mon Mar 9 14:50:12 PDT 2009


Author: lattner
Date: Mon Mar  9 16:50:12 2009
New Revision: 66474

URL: http://llvm.org/viewvc/llvm-project?rev=66474&view=rev
Log:
fix PR3768, Clang does -D__STDC_HOSTED__=1, even if -ffreestanding is passed.

Modified:
    cfe/trunk/lib/Lex/Preprocessor.cpp

Modified: cfe/trunk/lib/Lex/Preprocessor.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/Preprocessor.cpp?rev=66474&r1=66473&r2=66474&view=diff

==============================================================================
--- cfe/trunk/lib/Lex/Preprocessor.cpp (original)
+++ cfe/trunk/lib/Lex/Preprocessor.cpp Mon Mar  9 16:50:12 2009
@@ -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)





More information about the cfe-commits mailing list