diff options
Diffstat (limited to 'clang-tools-extra/test/clang-tidy/misc-static-assert.cpp')
| -rw-r--r-- | clang-tools-extra/test/clang-tidy/misc-static-assert.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/clang-tools-extra/test/clang-tidy/misc-static-assert.cpp b/clang-tools-extra/test/clang-tidy/misc-static-assert.cpp index 8375531e2b2..b2c72ea8e80 100644 --- a/clang-tools-extra/test/clang-tidy/misc-static-assert.cpp +++ b/clang-tools-extra/test/clang-tidy/misc-static-assert.cpp @@ -10,6 +10,8 @@ void abort() {} abort() #endif +void print(...); + #define ZERO_MACRO 0 #define False false @@ -126,5 +128,14 @@ int main() { assert(strlen("12345") == 5); // CHECK-FIXES: {{^ }}assert(strlen("12345") == 5); +#define assert(e) (__builtin_expect(!(e), 0) ? print (#e, __FILE__, __LINE__) : (void)0) + assert(false); + // CHECK-FIXES: {{^ }}assert(false); + + assert(10 == 5 + 5); + // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: found assert() that could be + // CHECK-FIXES: {{^ }}static_assert(10 == 5 + 5, ""); +#undef assert + return 0; } |

