[PATCH] size_t is unsigned long on Bitrig

Patrick Wildt mail at patrick-wildt.de
Thu Feb 19 05:01:20 PST 2015


Hi,

even on AAPCS, size_t is unsigned long on Bitrig.

Best regards,
Patrick

diff --git a/lib/Basic/Targets.cpp b/lib/Basic/Targets.cpp
index f9da2bf..d783464 100644
--- a/lib/Basic/Targets.cpp
+++ b/lib/Basic/Targets.cpp
@@ -3814,8 +3814,9 @@ class ARMTargetInfo : public TargetInfo {
     DoubleAlign = LongLongAlign = LongDoubleAlign = SuitableAlign = 64;
     const llvm::Triple &T = getTriple();
 
-    // size_t is unsigned long on MachO-derived environments and NetBSD.
-    if (T.isOSBinFormatMachO() || T.getOS() == llvm::Triple::NetBSD)
+    // size_t is unsigned long on MachO-derived environments, NetBSD and Bitrig.
+    if (T.isOSBinFormatMachO() || T.getOS() == llvm::Triple::NetBSD ||
+        T.getOS() == llvm::Triple::Bitrig)
       SizeType = UnsignedLong;
     else
       SizeType = UnsignedInt;
diff --git a/test/Preprocessor/init.c b/test/Preprocessor/init.c
index 41fe812..5171854 100644
--- a/test/Preprocessor/init.c
+++ b/test/Preprocessor/init.c
@@ -2165,6 +2165,12 @@
 // ARM-DARWIN-NO-EABI-NOT: #define __ARM_EABI__ 1
 // ARM-DARWIN-EABI: #define __ARM_EABI__ 1
 
+// RUN: %clang_cc1 -E -dM -ffreestanding -triple=armv7-bitrig-gnueabihf < /dev/null | FileCheck -check-prefix ARM-BITRIG %s
+// ARM-BITRIG:#define __SIZEOF_SIZE_T__ 4
+// ARM-BITRIG:#define __SIZE_MAX__ 4294967295U
+// ARM-BITRIG:#define __SIZE_TYPE__ long unsigned int
+// ARM-BITRIG:#define __SIZE_WIDTH__ 32
+
 // Check that -mhwdiv works properly for targets which don't have the hwdiv feature enabled by default.
 
 // RUN: %clang -target arm -mhwdiv=arm -x c -E -dM %s -o - | FileCheck --check-prefix=ARMHWDIV-ARM %s




More information about the cfe-commits mailing list