[clang-tidy] Fix test failing on 32-bit architectures due to missing __int128_t

This was caused by ff60af91ac. The reason for the failure is that
the type `__int128_t` is not available on 32-bit architectures. So just exclude the test case if
128-bit integers are not available.
This commit is contained in:
Danny Mösch 2022-03-29 17:58:05 +02:00
parent 7370a489b1
commit f10cee91ae

View File

@ -172,10 +172,7 @@ int Foo() { int A[T]; return sizeof(T); }
template <typename T>
int Bar() { T A[5]; return sizeof(A[0]) / sizeof(T); }
// CHECK-MESSAGES: :[[@LINE-1]]:28: warning: suspicious usage of sizeof pointer 'sizeof(T)/sizeof(T)'
template <__int128_t N>
bool Baz() { return sizeof(A) < N; }
// CHECK-MESSAGES: :[[@LINE-1]]:21: warning: suspicious comparison of 'sizeof(expr)' to a constant
int Test3() { return Foo<42>() + Bar<char>() + Baz<-1>(); }
int Test3() { return Foo<42>() + Bar<char>(); }
static const char* kABC = "abc";
static const wchar_t* kDEF = L"def";
@ -289,6 +286,13 @@ int Test6() {
return sum;
}
#ifdef __SIZEOF_INT128__
template <__int128_t N>
bool Baz() { return sizeof(A) < N; }
// CHECK-MESSAGES: :[[@LINE-1]]:21: warning: suspicious comparison of 'sizeof(expr)' to a constant
bool Test7() { return Baz<-1>(); }
#endif
int ValidExpressions() {
int A[] = {1, 2, 3, 4};
static const char str[] = "hello";