]> granicus.if.org Git - clang/commitdiff
Adjust tests to have consistent integer sizes.
authorRichard Trieu <rtrieu@google.com>
Mon, 11 Apr 2016 20:37:04 +0000 (20:37 +0000)
committerRichard Trieu <rtrieu@google.com>
Mon, 11 Apr 2016 20:37:04 +0000 (20:37 +0000)
Add a triple to the run lines so that integers will the same sizes across runs.
Also add a compile time check to ensure the assumptions about sizes are met.

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

test/Sema/integer-overflow.c
test/SemaCXX/integer-overflow.cpp

index 02d99b3fc5caa2000f230da712ea51fd6b46c257..e74bc119798b86926d68cbc45c8c916d3fcdb65f 100644 (file)
@@ -1,6 +1,11 @@
-// RUN: %clang_cc1 %s -verify -fsyntax-only
+// RUN: %clang_cc1 %s -verify -fsyntax-only -triple x86_64-pc-linux-gnu
 typedef unsigned long long uint64_t;
-typedef unsigned long long uint32_t;
+typedef unsigned int uint32_t;
+
+// Check integer sizes.
+int array64[sizeof(uint64_t) == 8 ? 1 : -1];
+int array32[sizeof(uint32_t) == 4 ? 1 : -1];
+int arrayint[sizeof(int) < sizeof(uint64_t) ? 1 : -1];
 
 uint64_t f0(uint64_t);
 uint64_t f1(uint64_t, uint32_t);
index 566bb05fa0cb1c227ad986eefee1ddcb2eed2b31..a119f0eabe3a4fb059d380fc92b2c6229c6ad95c 100644 (file)
@@ -1,6 +1,11 @@
-// RUN: %clang_cc1 %s -verify -fsyntax-only -std=gnu++98
+// RUN: %clang_cc1 %s -verify -fsyntax-only -std=gnu++98 -triple x86_64-pc-linux-gnu
 typedef unsigned long long uint64_t;
-typedef unsigned long long uint32_t;
+typedef unsigned int uint32_t;
+
+// Check integer sizes.
+int array64[sizeof(uint64_t) == 8 ? 1 : -1];
+int array32[sizeof(uint32_t) == 4 ? 1 : -1];
+int arrayint[sizeof(int) < sizeof(uint64_t) ? 1 : -1];
 
 uint64_t f0(uint64_t);
 uint64_t f1(uint64_t, uint32_t);