From: Chris Lattner Date: Thu, 5 Feb 2009 07:19:24 +0000 (+0000) Subject: fix some differences between apple gcc and clang on darwin/x86-32. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=d427ad4cceab4481be0ac5cc2a190148ccc181e2;p=clang fix some differences between apple gcc and clang on darwin/x86-32. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63846 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Basic/Targets.cpp b/lib/Basic/Targets.cpp index c3e1a68d20..d79787615a 100644 --- a/lib/Basic/Targets.cpp +++ b/lib/Basic/Targets.cpp @@ -120,6 +120,9 @@ static bool getDarwinNumber(const char *Triple, unsigned &Maj, unsigned &Min) { static void getDarwinDefines(std::vector &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 @@ public: 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"; diff --git a/lib/Lex/Preprocessor.cpp b/lib/Lex/Preprocessor.cpp index 3861e7d320..14bddd6826 100644 --- a/lib/Lex/Preprocessor.cpp +++ b/lib/Lex/Preprocessor.cpp @@ -406,6 +406,8 @@ static void DefineFloatMacros(std::vector &Buf, const char *Prefix, 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 @@ static void InitializePredefinedMacros(Preprocessor &PP, 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 @@ static void InitializePredefinedMacros(Preprocessor &PP, 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()); diff --git a/utils/CheckBuiltinMacros.sh b/utils/CheckBuiltinMacros.sh index 6a8573c0c1..1c0b88a60b 100755 --- a/utils/CheckBuiltinMacros.sh +++ b/utils/CheckBuiltinMacros.sh @@ -2,7 +2,7 @@ set -ex if [ -z "$CC" ]; then - CC="gcc" + CC="/Developer/usr/bin/gcc-4.2" fi SRCLANG=c