[clang-cl] Ignore /Wv and /Wv:17 flags
[llvm-project.git] / clang / test / Analysis / func.c
blob7fea41d1f0652241b86a51f8c5044cc194d44917
1 // RUN: %clang_analyze_cc1 -analyzer-checker=core,alpha.core,debug.ExprInspection -analyzer-store=region -verify -analyzer-config eagerly-assume=false %s
3 void clang_analyzer_eval(int);
4 void clang_analyzer_warnIfReached(void);
6 void f(void) {
7 void (*p)(void);
8 p = f;
9 p = &f;
10 p();
11 (*p)();
14 void g(void (*fp)(void));
16 void f2(void) {
17 g(f);
20 void f3(void (*f)(void), void (*g)(void)) {
21 clang_analyzer_eval(!f); // expected-warning{{UNKNOWN}}
22 f();
23 clang_analyzer_eval(!f); // expected-warning{{FALSE}}
25 clang_analyzer_eval(!g); // expected-warning{{UNKNOWN}}
26 (*g)();
27 clang_analyzer_eval(!g); // expected-warning{{FALSE}}
30 void nullFunctionPointerConstant(void) {
31 void (*f)(void) = 0;
32 f(); // expected-warning{{Called function pointer is null}}
33 clang_analyzer_warnIfReached(); // no-warning
36 void nullFunctionPointerConstraint(void (*f)(void)) {
37 if (f)
38 return;
39 f(); // expected-warning{{Called function pointer is null}}
40 clang_analyzer_warnIfReached(); // no-warning