]> granicus.if.org Git - clang/commitdiff
OpenBSD/sparc64 uses long long for int64_t and intmax_t.
authorJakob Stoklund Olesen <stoklund@2pi.dk>
Sun, 19 May 2013 17:53:37 +0000 (17:53 +0000)
committerJakob Stoklund Olesen <stoklund@2pi.dk>
Sun, 19 May 2013 17:53:37 +0000 (17:53 +0000)
Other operating systems, including FreeBSD and NetBSD, use long.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182215 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Basic/Targets.cpp
test/Preprocessor/init.c

index 0086f05bb48e5f2bc8995a16474a92c629359135..496893885c688ebf4fc4949b28216498839bcf73 100644 (file)
@@ -4307,9 +4307,16 @@ public:
                         "i64:64:64-f32:32:32-f64:64:64-v64:64:64-n32:64-S128";
     // This is an LP64 platform.
     LongWidth = LongAlign = PointerWidth = PointerAlign = 64;
-    IntMaxType = SignedLong;
-    UIntMaxType = UnsignedLong;
-    Int64Type = SignedLong;
+
+    // OpenBSD uses long long for int64_t and intmax_t.
+    if (getTriple().getOS() == llvm::Triple::OpenBSD) {
+      IntMaxType = SignedLongLong;
+      UIntMaxType = UnsignedLongLong;
+    } else {
+      IntMaxType = SignedLong;
+      UIntMaxType = UnsignedLong;
+    }
+    Int64Type = IntMaxType;
   }
 
   virtual void getTargetDefines(const LangOptions &Opts,
index 5ae2d9831d7c77597373130d38efc37f3decad8f..40dc638851723c10610e6cfdb347bb4e9958be77 100644 (file)
 // X86_64-LINUX:#define __x86_64__ 1
 //
 // RUN: %clang_cc1 -E -dM -ffreestanding -triple=sparc64-none-none < /dev/null | FileCheck -check-prefix SPARCV9 %s
+// SPARCV9:#define __INT64_TYPE__ long int
 // SPARCV9:#define __INTMAX_TYPE__ long int
 // SPARCV9:#define __INTPTR_TYPE__ long int
 // SPARCV9:#define __LONG_MAX__ 9223372036854775807L
 // SPARCV9:#define __SIZEOF_LONG__ 8
 // SPARCV9:#define __SIZEOF_POINTER__ 8
 //
+// RUN: %clang_cc1 -E -dM -ffreestanding -triple=sparc64-none-openbsd < /dev/null | FileCheck -check-prefix SPARC64-OBSD %s
+// SPARC64-OBSD:#define __INT64_TYPE__ long long int
+// SPARC64-OBSD:#define __INTMAX_TYPE__ long long int
+// SPARC64-OBSD:#define __UINTMAX_TYPE__ long long unsigned int
+//
 // RUN: %clang_cc1 -x c++ -triple i686-pc-linux-gnu -fobjc-runtime=gcc -E -dM < /dev/null | FileCheck -check-prefix GNUSOURCE %s
 // GNUSOURCE:#define _GNU_SOURCE 1
 //