r265991 - Adjust tests to have consistent integer sizes.

Richard Trieu via cfe-commits cfe-commits at lists.llvm.org
Mon Apr 11 13:37:07 PDT 2016


Author: rtrieu
Date: Mon Apr 11 15:37:04 2016
New Revision: 265991

URL: http://llvm.org/viewvc/llvm-project?rev=265991&view=rev
Log:
Adjust tests to have consistent integer sizes.

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.

Modified:
    cfe/trunk/test/Sema/integer-overflow.c
    cfe/trunk/test/SemaCXX/integer-overflow.cpp

Modified: cfe/trunk/test/Sema/integer-overflow.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/integer-overflow.c?rev=265991&r1=265990&r2=265991&view=diff
==============================================================================
--- cfe/trunk/test/Sema/integer-overflow.c (original)
+++ cfe/trunk/test/Sema/integer-overflow.c Mon Apr 11 15:37:04 2016
@@ -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);

Modified: cfe/trunk/test/SemaCXX/integer-overflow.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/integer-overflow.cpp?rev=265991&r1=265990&r2=265991&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/integer-overflow.cpp (original)
+++ cfe/trunk/test/SemaCXX/integer-overflow.cpp Mon Apr 11 15:37:04 2016
@@ -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);




More information about the cfe-commits mailing list