mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2024-12-21 06:52:10 +00:00
[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:
parent
7370a489b1
commit
f10cee91ae
@ -172,10 +172,7 @@ int Foo() { int A[T]; return sizeof(T); }
|
|||||||
template <typename T>
|
template <typename T>
|
||||||
int Bar() { T A[5]; return sizeof(A[0]) / sizeof(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)'
|
// CHECK-MESSAGES: :[[@LINE-1]]:28: warning: suspicious usage of sizeof pointer 'sizeof(T)/sizeof(T)'
|
||||||
template <__int128_t N>
|
int Test3() { return Foo<42>() + Bar<char>(); }
|
||||||
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>(); }
|
|
||||||
|
|
||||||
static const char* kABC = "abc";
|
static const char* kABC = "abc";
|
||||||
static const wchar_t* kDEF = L"def";
|
static const wchar_t* kDEF = L"def";
|
||||||
@ -289,6 +286,13 @@ int Test6() {
|
|||||||
return sum;
|
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 ValidExpressions() {
|
||||||
int A[] = {1, 2, 3, 4};
|
int A[] = {1, 2, 3, 4};
|
||||||
static const char str[] = "hello";
|
static const char str[] = "hello";
|
||||||
|
Loading…
Reference in New Issue
Block a user