1 // RUN: not clang-tidy %s \
2 // RUN:     -checks="-*,bugprone-suspicious-semicolon" -- -DERROR 2>&1 \
3 // RUN:   | FileCheck %s -check-prefix=CHECK-ERROR \
4 // RUN:       -implicit-check-not="{{warning|error}}:"
5 // RUN: not clang-tidy %s \
6 // RUN:     -checks="-*,bugprone-suspicious-semicolon,clang-diagnostic*" \
7 // RUN:    -- -DWERROR -Wno-everything -Werror=unused-variable 2>&1 \
8 // RUN:   | FileCheck %s -check-prefix=CHECK-WERROR \
9 // RUN:       -implicit-check-not="{{warning|error}}:"
10 
11 // Note: This test verifies that, the checker does not emit any warning for
12 //       files that do not compile.
13 
14 bool g();
15 
f()16 void f() {
17   if (g());
18   // CHECK-WERROR: :[[@LINE-1]]:11: warning: potentially unintended semicolon [bugprone-suspicious-semicolon]
19 #if ERROR
20   int a
21   // CHECK-ERROR: :[[@LINE-1]]:8: error: expected ';' at end of declaration [clang-diagnostic-error]
22 #elif WERROR
23   int a;
24   // CHECK-WERROR: :[[@LINE-1]]:7: error: unused variable 'a' [clang-diagnostic-unused-variable]
25 #else
26 #error "One of ERROR or WERROR should be defined.
27 #endif
28 }
29