[cfe-commits] r58556 - in /cfe/trunk/lib/Basic: TargetInfo.cpp Targets.cpp

Eli Friedman eli.friedman at gmail.com
Sat Nov 1 19:43:55 PDT 2008


Author: efriedma
Date: Sat Nov  1 21:43:55 2008
New Revision: 58556

URL: http://llvm.org/viewvc/llvm-project?rev=58556&view=rev
Log:
More fallout from r58501: primary fix is some more corrections to make 
the types for size_t and ptrdiff_t more accurate.  I think all of these
are correct, but please compare the defines for __PTRDIFF_TYPE__ and 
__SIZE_TYPE__ to gcc to double-check; this particularly applies to 
those on BSD variants, since I'm not sure what they do here; I assume 
here that they're the same as on Linux.

Fixes wchar_t to be "int", not "unsigned int" (which I think is 
correct on everything but Windows).

Fixes ptrdiff_t to be "int" rather than "short" on PIC16; "short" is an 
somewhat strange choice because it normally gets promoted, and it's not 
consistent with the choice for size_t.


Modified:
    cfe/trunk/lib/Basic/TargetInfo.cpp
    cfe/trunk/lib/Basic/Targets.cpp

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

==============================================================================
--- cfe/trunk/lib/Basic/TargetInfo.cpp (original)
+++ cfe/trunk/lib/Basic/TargetInfo.cpp Sat Nov  1 21:43:55 2008
@@ -35,10 +35,10 @@
   LongDoubleWidth = 64;
   LongDoubleAlign = 64;
   SizeType = UnsignedLong;
+  PtrDiffType = SignedLong;
   IntMaxType = SignedLongLong;
   UIntMaxType = UnsignedLongLong;
-  PtrDiffType = SignedLongLong;
-  WCharType = UnsignedInt;
+  WCharType = SignedInt;
   FloatFormat = &llvm::APFloat::IEEEsingle;
   DoubleFormat = &llvm::APFloat::IEEEdouble;
   LongDoubleFormat = &llvm::APFloat::IEEEdouble;

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

==============================================================================
--- cfe/trunk/lib/Basic/Targets.cpp (original)
+++ cfe/trunk/lib/Basic/Targets.cpp Sat Nov  1 21:43:55 2008
@@ -534,7 +534,10 @@
 // x86-32 FreeBSD target
 class FreeBSDX86_32TargetInfo : public X86_32TargetInfo {
 public:
-  FreeBSDX86_32TargetInfo(const std::string& triple) : X86_32TargetInfo(triple) {
+  FreeBSDX86_32TargetInfo(const std::string& triple) :
+      X86_32TargetInfo(triple) {
+    SizeType = UnsignedInt;
+    PtrDiffType = SignedInt;
   }
   virtual void getTargetDefines(std::vector<char> &Defines) const {
     X86_32TargetInfo::getTargetDefines(Defines);
@@ -547,7 +550,10 @@
 // x86-32 DragonFly target
 class DragonFlyX86_32TargetInfo : public X86_32TargetInfo {
 public:
-  DragonFlyX86_32TargetInfo(const std::string& triple) : X86_32TargetInfo(triple) {
+  DragonFlyX86_32TargetInfo(const std::string& triple) :
+      X86_32TargetInfo(triple) {
+    SizeType = UnsignedInt;
+    PtrDiffType = SignedInt;
   }
   virtual void getTargetDefines(std::vector<char> &Defines) const {
     X86_32TargetInfo::getTargetDefines(Defines);
@@ -562,6 +568,8 @@
 public:
   LinuxX86_32TargetInfo(const std::string& triple) : X86_32TargetInfo(triple) {
     UserLabelPrefix = "";
+    SizeType = UnsignedInt;
+    PtrDiffType = SignedInt;
   }
   virtual void getTargetDefines(std::vector<char> &Defines) const {
     X86_32TargetInfo::getTargetDefines(Defines);
@@ -579,6 +587,8 @@
     // FIXME: Fix wchar_t.
     // FIXME: We should probably enable -fms-extensions by default for
     // this target.
+    SizeType = UnsignedInt;
+    PtrDiffType = SignedInt;
   }
   virtual void getTargetDefines(std::vector<char> &Defines) const {
     X86_32TargetInfo::getTargetDefines(Defines);
@@ -626,8 +636,7 @@
 // x86-64 FreeBSD target
 class FreeBSDX86_64TargetInfo : public X86_64TargetInfo {
 public:
-  FreeBSDX86_64TargetInfo(const std::string& triple) : X86_64TargetInfo(triple) {
-  }
+  FreeBSDX86_64TargetInfo(const std::string& triple) : X86_64TargetInfo(triple) {}
   virtual void getTargetDefines(std::vector<char> &Defines) const {
     X86_64TargetInfo::getTargetDefines(Defines);
     getFreeBSDDefines(Defines, 1, getTargetTriple());
@@ -788,7 +797,10 @@
 class SolarisSparcV8TargetInfo : public SparcV8TargetInfo {
 public:
   SolarisSparcV8TargetInfo(const std::string& triple) :
-    SparcV8TargetInfo(triple) {}
+      SparcV8TargetInfo(triple) {
+    SizeType = UnsignedInt;
+    PtrDiffType = SignedInt;
+  }
 
   virtual void getTargetDefines(std::vector<char> &Defines) const {
     SparcV8TargetInfo::getTargetDefines(Defines);
@@ -810,8 +822,7 @@
       SizeType = UnsignedInt;
       IntMaxType = SignedLong;
       UIntMaxType = UnsignedLong;
-      PtrDiffType = SignedShort;
-      WCharType = UnsignedInt;
+      PtrDiffType = SignedInt;
       DescriptionString = "e-p:16:8:8-i8:8:8-i16:8:8-i32:8:8";
     }
     virtual uint64_t getPointerWidthV(unsigned AddrSpace) const { return 16; }





More information about the cfe-commits mailing list