29 lines · cpp
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 for12// files that do not compile.13 14bool g();15 16void f() {17 if (g());18 // CHECK-WERROR: :[[@LINE-1]]:11: warning: potentially unintended semicolon [bugprone-suspicious-semicolon]19#if ERROR20 int a21 // CHECK-ERROR: :[[@LINE-1]]:8: error: expected ';' at end of declaration [clang-diagnostic-error]22#elif WERROR23 int a;24 // CHECK-WERROR: :[[@LINE-1]]:7: error: unused variable 'a' [clang-diagnostic-unused-variable]25#else26#error "One of ERROR or WERROR should be defined.27#endif28}29