From e6a56db2e62eeaa62ec6cfaa099298ba3356b9fd Mon Sep 17 00:00:00 2001 From: Richard Smith Date: Thu, 29 Nov 2012 05:41:51 +0000 Subject: Reject uses of __int128 on platforms that don't support it. Also move the ugly 'getPointerWidth(0) >= 64' test to be a method on TargetInfo, ready to be properly cleaned up. llvm-svn: 168856 --- clang/test/Sema/128bitint.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'clang/test/Sema/128bitint.c') diff --git a/clang/test/Sema/128bitint.c b/clang/test/Sema/128bitint.c index 600c25a630c..bb8e3d155e5 100644 --- a/clang/test/Sema/128bitint.c +++ b/clang/test/Sema/128bitint.c @@ -1,9 +1,13 @@ -// RUN: %clang_cc1 -fsyntax-only -verify -triple x86_64-apple-darwin9 -fms-extensions %s +// RUN: %clang_cc1 -fsyntax-only -verify -triple x86_64-apple-darwin9 -fms-extensions %s -DHAVE +// RUN: %clang_cc1 -fsyntax-only -verify -triple i686-linux-gnu -fms-extensions %s -DHAVE_NOT + +#ifdef HAVE typedef int i128 __attribute__((__mode__(TI))); typedef unsigned u128 __attribute__((__mode__(TI))); int a[((i128)-1 ^ (i128)-2) == 1 ? 1 : -1]; int a[(u128)-1 > 1LL ? 1 : -1]; +int a[__SIZEOF_INT128__ == 16 ? 1 : -1]; // PR5435 __uint128_t b = (__uint128_t)-1; @@ -36,4 +40,12 @@ void test(int *buf) { MPI_Send(buf, 0x10000000000000001i128); // expected-warning {{implicit conversion from '__int128' to 'int' changes value}} } +#else + +__int128 n; // expected-error {{__int128 is not supported on this target}} + +#if defined(__SIZEOF_INT128__) +#error __SIZEOF_INT128__ should not be defined +#endif +#endif -- cgit v1.2.3