[clang] Handle __declspec() attributes in using
[llvm-project.git] / clang / test / Analysis / _Bool-increment-decrement.c
blob6e55b0731a69405676ecdda11d65d4692fa8d63a
1 // RUN: %clang_analyze_cc1 -analyzer-checker=debug.ExprInspection -verify -std=c99 -Dbool=_Bool -Dtrue=1 -Dfalse=0 %s
2 // RUN: %clang_analyze_cc1 -analyzer-checker=debug.ExprInspection -verify -std=c11 -Dbool=_Bool -Dtrue=1 -Dfalse=0 %s
3 extern void clang_analyzer_eval(bool);
5 void test__Bool_value(void) {
7 bool b = true;
8 clang_analyzer_eval(b == 1); // expected-warning{{TRUE}}
12 bool b = false;
13 clang_analyzer_eval(b == 0); // expected-warning{{TRUE}}
17 bool b = -10;
18 clang_analyzer_eval(b == 1); // expected-warning{{TRUE}}
22 bool b = 10;
23 clang_analyzer_eval(b == 1); // expected-warning{{TRUE}}
27 bool b = 10;
28 b++;
29 clang_analyzer_eval(b == 1); // expected-warning{{TRUE}}
33 bool b = 0;
34 b++;
35 clang_analyzer_eval(b == 1); // expected-warning{{TRUE}}
39 void test__Bool_increment(void) {
41 bool b = true;
42 b++;
43 clang_analyzer_eval(b == 1); // expected-warning{{TRUE}}
47 bool b = false;
48 b++;
49 clang_analyzer_eval(b == 1); // expected-warning{{TRUE}}
53 bool b = true;
54 ++b;
55 clang_analyzer_eval(b == 1); // expected-warning{{TRUE}}
59 bool b = false;
60 ++b;
61 clang_analyzer_eval(b == 1); // expected-warning{{TRUE}}
65 bool b = 0;
66 ++b;
67 clang_analyzer_eval(b == 1); // expected-warning{{TRUE}}
71 bool b = 10;
72 ++b;
73 ++b;
74 clang_analyzer_eval(b == 1); // expected-warning{{TRUE}}
78 bool b = -10;
79 ++b;
80 clang_analyzer_eval(b == 1); // expected-warning{{TRUE}}
84 bool b = -1;
85 ++b;
86 clang_analyzer_eval(b == 1); // expected-warning{{TRUE}}
90 void test__Bool_decrement(void) {
92 bool b = true;
93 b--;
94 clang_analyzer_eval(b == 0); // expected-warning{{TRUE}}
98 bool b = false;
99 b--;
100 clang_analyzer_eval(b == 1); // expected-warning{{TRUE}}
104 bool b = true;
105 --b;
106 clang_analyzer_eval(b == 0); // expected-warning{{TRUE}}
110 bool b = false;
111 --b;
112 clang_analyzer_eval(b == 1); // expected-warning{{TRUE}}
116 bool b = 0;
117 --b;
118 clang_analyzer_eval(b == 1); // expected-warning{{TRUE}}
122 bool b = 10;
123 --b;
124 clang_analyzer_eval(b == 0); // expected-warning{{TRUE}}
125 --b;
126 clang_analyzer_eval(b == 1); // expected-warning{{TRUE}}
130 bool b = -10;
131 --b;
132 clang_analyzer_eval(b == 0); // expected-warning{{TRUE}}
136 bool b = 1;
137 --b;
138 clang_analyzer_eval(b == 0); // expected-warning{{TRUE}}