[cfe-commits] r63846 - in /cfe/trunk: lib/Basic/Targets.cpp lib/Lex/Preprocessor.cpp utils/CheckBuiltinMacros.sh

Chris Lattner sabre at nondot.org
Wed Feb 4 23:19:25 PST 2009


Author: lattner
Date: Thu Feb  5 01:19:24 2009
New Revision: 63846

URL: http://llvm.org/viewvc/llvm-project?rev=63846&view=rev
Log:
fix some differences between apple gcc and clang on darwin/x86-32.

Modified:
    cfe/trunk/lib/Basic/Targets.cpp
    cfe/trunk/lib/Lex/Preprocessor.cpp
    cfe/trunk/utils/CheckBuiltinMacros.sh

Modified: cfe/trunk/lib/Basic/Targets.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets.cpp?rev=63846&r1=63845&r2=63846&view=diff

==============================================================================
--- cfe/trunk/lib/Basic/Targets.cpp (original)
+++ cfe/trunk/lib/Basic/Targets.cpp Thu Feb  5 01:19:24 2009
@@ -120,6 +120,9 @@
 static void getDarwinDefines(std::vector<char> &Defs, const char *Triple) {
   Define(Defs, "__APPLE__");
   Define(Defs, "__MACH__");
+  Define(Defs, "OBJC_NEW_PROPERTIES");
+  
+  // FIXME: OBJC_ZEROCOST_EXCEPTIONS when using zero cost eh.
   
   // Figure out which "darwin number" the target triple is.  "darwin9" -> 10.5.
   unsigned Maj, Min;
@@ -563,6 +566,7 @@
   DarwinI386TargetInfo(const std::string& triple) : X86_32TargetInfo(triple) {
     LongDoubleWidth = 128;
     LongDoubleAlign = 128;
+    PtrDiffType = SignedInt;
     DescriptionString = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-"
                         "i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-"
                         "a0:0:64-f80:128:128";

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

==============================================================================
--- cfe/trunk/lib/Lex/Preprocessor.cpp (original)
+++ cfe/trunk/lib/Lex/Preprocessor.cpp Thu Feb  5 01:19:24 2009
@@ -406,6 +406,8 @@
   DefineBuiltinMacro(Buf, MacroBuf);
   sprintf(MacroBuf, "__%s_MIN__=%s", Prefix, Min);
   DefineBuiltinMacro(Buf, MacroBuf);
+  sprintf(MacroBuf, "__%s_HAS_DENORM__=1", Prefix);
+  DefineBuiltinMacro(Buf, MacroBuf);
 }
 
 
@@ -571,8 +573,10 @@
     DefineBuiltinMacro(Buf, "__PTRDIFF_TYPE__=long int");
   else if (TI.getPtrDiffType(0) == TargetInfo::UnsignedInt)
     DefineBuiltinMacro(Buf, "__PTRDIFF_TYPE__=unsigned int");
-  else
+  else {
+    assert(TI.getPtrDiffType(0) == TargetInfo::SignedInt);
     DefineBuiltinMacro(Buf, "__PTRDIFF_TYPE__=int");
+  }
   
   if (TI.getSizeType() == TargetInfo::UnsignedLongLong)
     DefineBuiltinMacro(Buf, "__SIZE_TYPE__=unsigned long long int");
@@ -586,8 +590,10 @@
     DefineBuiltinMacro(Buf, "__SIZE_TYPE__=unsigned int");
   else if (TI.getSizeType() == TargetInfo::SignedInt)
     DefineBuiltinMacro(Buf, "__SIZE_TYPE__=int");
-  else
+  else {
+    assert(TI.getPtrDiffType(0) == TargetInfo::UnsignedShort);
     DefineBuiltinMacro(Buf, "__SIZE_TYPE__=unsigned short");
+  }
   
   DefineFloatMacros(Buf, "FLT", &TI.getFloatFormat());
   DefineFloatMacros(Buf, "DBL", &TI.getDoubleFormat());

Modified: cfe/trunk/utils/CheckBuiltinMacros.sh
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/utils/CheckBuiltinMacros.sh?rev=63846&r1=63845&r2=63846&view=diff

==============================================================================
--- cfe/trunk/utils/CheckBuiltinMacros.sh (original)
+++ cfe/trunk/utils/CheckBuiltinMacros.sh Thu Feb  5 01:19:24 2009
@@ -2,7 +2,7 @@
 set -ex
 
 if [ -z "$CC" ]; then
-    CC="gcc"
+    CC="/Developer/usr/bin/gcc-4.2"
 fi
 
 SRCLANG=c





More information about the cfe-commits mailing list