You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -7747,15 +7751,15 @@ class TestClass : public TestFixture {
7747
7751
}
7748
7752
7749
7753
voidqualifiedNameMember() { // #10872
7750
-
const Settings s = settingsBuilder().severity(Severity::style).debugwarnings().library("std.cfg").build();
7754
+
const Settings s = settingsBuilder().severity(Severity::style).debugwarnings().library("std.cfg").certainty(Certainty::inconclusive).build();
7751
7755
checkConst("struct data {};\n"
7752
7756
" struct S {\n"
7753
7757
" std::vector<data> std;\n"
7754
7758
" void f();\n"
7755
7759
"};\n"
7756
7760
"void S::f() {\n"
7757
7761
" std::vector<data>::const_iterator end = std.end();\n"
7758
-
"}\n", dinit(CheckConstOptions, $.s = &s));
7762
+
"}\n", s);
7759
7763
ASSERT_EQUALS("[test.cpp:4:10] -> [test.cpp:6:9]: (style, inconclusive) Technically the member function 'S::f' can be const. [functionConst]\n", errout_str());
@@ -1309,27 +1311,27 @@ class TestCondition : public TestFixture {
1309
1311
const Settings s = settingsBuilder(settings0).certainty(Certainty::inconclusive).build();
1310
1312
check("void f(char x) {\n"
1311
1313
" if (x == '1' || x == '2') {}\n"
1312
-
"}", dinit(CheckOptions, $.s = &s));
1314
+
"}", s);
1313
1315
ASSERT_EQUALS("", errout_str());
1314
1316
1315
1317
check("void f(char x) {\n"
1316
1318
" if (x == '1' && x == '2') {}\n"
1317
-
"}", dinit(CheckOptions, $.s = &s));
1319
+
"}", s);
1318
1320
ASSERT_EQUALS("[test.cpp:2:16]: (warning) Logical conjunction always evaluates to false: x == '1' && x == '2'. [incorrectLogicOperator]\n", errout_str());
1319
1321
1320
1322
check("int f(char c) {\n"
1321
1323
" return (c >= 'a' && c <= 'z');\n"
1322
-
"}", dinit(CheckOptions, $.s = &s));
1324
+
"}", s);
1323
1325
ASSERT_EQUALS("", errout_str());
1324
1326
1325
1327
check("int f(char c) {\n"
1326
1328
" return (c <= 'a' && c >= 'z');\n"
1327
-
"}", dinit(CheckOptions, $.s = &s));
1329
+
"}", s);
1328
1330
ASSERT_EQUALS("[test.cpp:2:20]: (warning, inconclusive) Logical conjunction always evaluates to false: c <= 'a' && c >= 'z'. [incorrectLogicOperator]\n", errout_str());
1329
1331
1330
1332
check("int f(char c) {\n"
1331
1333
" return (c <= 'a' && c >= 'z');\n"
1332
-
"}");
1334
+
"}");// TODO: use s?
1333
1335
ASSERT_EQUALS("[test.cpp:2:13] -> [test.cpp:2:25]: (style) Return value 'c>='z'' is always false [knownConditionTrueFalse]\n", errout_str());
1334
1336
}
1335
1337
@@ -6142,65 +6144,65 @@ class TestCondition : public TestFixture {
6142
6144
6143
6145
check("void f(unsigned char c) {\n"
6144
6146
" if (c == 256) {}\n"
6145
-
"}", dinit(CheckOptions, $.s = &settingsUnix64));
6147
+
"}", settingsUnix64);
6146
6148
ASSERT_EQUALS("[test.cpp:2:12]: (style) Comparing expression of type 'unsigned char' against value 256. Condition is always false. [compareValueOutOfTypeRangeError]\n", errout_str());
6147
6149
6148
6150
check("void f(unsigned char* b, int i) {\n"// #6372
6149
6151
" if (b[i] == 256) {}\n"
6150
-
"}", dinit(CheckOptions, $.s = &settingsUnix64));
6152
+
"}", settingsUnix64);
6151
6153
ASSERT_EQUALS("[test.cpp:2:15]: (style) Comparing expression of type 'unsigned char' against value 256. Condition is always false. [compareValueOutOfTypeRangeError]\n", errout_str());
6152
6154
6153
6155
check("void f(unsigned char c) {\n"
6154
6156
" if (c == 255) {}\n"
6155
-
"}", dinit(CheckOptions, $.s = &settingsUnix64));
6157
+
"}", settingsUnix64);
6156
6158
ASSERT_EQUALS("", errout_str());
6157
6159
6158
6160
check("void f(bool b) {\n"
6159
6161
" if (b == true) {}\n"
6160
-
"}", dinit(CheckOptions, $.s = &settingsUnix64));
6162
+
"}", settingsUnix64);
6161
6163
ASSERT_EQUALS("", errout_str());
6162
6164
6163
6165
// #10372
6164
6166
check("void f(signed char x) {\n"
6165
6167
" if (x == 0xff) {}\n"
6166
-
"}", dinit(CheckOptions, $.s = &settingsUnix64));
6168
+
"}", settingsUnix64);
6167
6169
ASSERT_EQUALS("[test.cpp:2:12]: (style) Comparing expression of type 'signed char' against value 255. Condition is always false. [compareValueOutOfTypeRangeError]\n", errout_str());
6168
6170
6169
6171
check("void f(short x) {\n"
6170
6172
" if (x == 0xffff) {}\n"
6171
-
"}", dinit(CheckOptions, $.s = &settingsUnix64));
6173
+
"}", settingsUnix64);
6172
6174
ASSERT_EQUALS("[test.cpp:2:12]: (style) Comparing expression of type 'signed short' against value 65535. Condition is always false. [compareValueOutOfTypeRangeError]\n", errout_str());
6173
6175
6174
6176
check("void f(int x) {\n"
6175
6177
" if (x == 0xffffffff) {}\n"
6176
-
"}", dinit(CheckOptions, $.s = &settingsUnix64));
6178
+
"}", settingsUnix64);
6177
6179
ASSERT_EQUALS("", errout_str());
6178
6180
6179
6181
check("void f(long x) {\n"
6180
6182
" if (x == ~0L) {}\n"
6181
-
"}", dinit(CheckOptions, $.s = &settingsUnix64));
6183
+
"}", settingsUnix64);
6182
6184
ASSERT_EQUALS("", errout_str());
6183
6185
6184
6186
check("void f(long long x) {\n"
6185
6187
" if (x == ~0LL) {}\n"
6186
-
"}", dinit(CheckOptions, $.s = &settingsUnix64));
6188
+
"}", settingsUnix64);
6187
6189
ASSERT_EQUALS("", errout_str());
6188
6190
6189
6191
check("int f(int x) {\n"
6190
6192
" const int i = 0xFFFFFFFF;\n"
6191
6193
" if (x == i) {}\n"
6192
-
"}", dinit(CheckOptions, $.s = &settingsUnix64));
6194
+
"}", settingsUnix64);
6193
6195
ASSERT_EQUALS("", errout_str());
6194
6196
6195
6197
check("void f() {\n"
6196
6198
" char c;\n"
6197
6199
" if ((c = foo()) != -1) {}\n"
6198
-
"}", dinit(CheckOptions, $.s = &settingsUnix64));
6200
+
"}", settingsUnix64);
6199
6201
ASSERT_EQUALS("", errout_str());
6200
6202
6201
6203
check("void f(int x) {\n"
6202
6204
" if (x < 3000000000) {}\n"
6203
-
"}", dinit(CheckOptions, $.s = &settingsUnix64));
6205
+
"}", settingsUnix64);
6204
6206
ASSERT_EQUALS("[test.cpp:2:11]: (style) Comparing expression of type 'signed int' against value 3000000000. Condition is always true. [compareValueOutOfTypeRangeError]\n", errout_str());
6205
6207
6206
6208
check("void f(const signed char i) {\n"// #8545
@@ -6210,7 +6212,7 @@ class TestCondition : public TestFixture {
ASSERT_EQUALS("[test.cpp:2:15]: (style) Comparing expression of type 'const signed char' against value -129. Condition is always true. [compareValueOutOfTypeRangeError]\n"
6215
6217
"[test.cpp:3:15]: (style) Comparing expression of type 'const signed char' against value -128. Condition is always true. [compareValueOutOfTypeRangeError]\n"
6216
6218
"[test.cpp:5:15]: (style) Comparing expression of type 'const signed char' against value 128. Condition is always true. [compareValueOutOfTypeRangeError]\n"
@@ -6234,7 +6236,7 @@ class TestCondition : public TestFixture {
ASSERT_EQUALS("[test.cpp:3:14]: (style) Comparing expression of type 'const unsigned char' against value 0. Condition is always false. [compareValueOutOfTypeRangeError]\n"
6239
6241
"[test.cpp:4:14]: (style) Comparing expression of type 'const unsigned char' against value 0. Condition is always true. [compareValueOutOfTypeRangeError]\n"
6240
6242
"[test.cpp:6:14]: (style) Comparing expression of type 'const unsigned char' against value 255. Condition is always false. [compareValueOutOfTypeRangeError]\n"
@@ -6247,7 +6249,7 @@ class TestCondition : public TestFixture {
ASSERT_EQUALS("[test.cpp:2:14]: (style) Comparing expression of type 'bool' against value 2. Condition is always true. [compareValueOutOfTypeRangeError]\n",
voidcheck_(constchar* file, int line, constchar (&code)[size], const Settings& settings1) {
47
51
SimpleTokenizer tokenizer(settings1, *this);
48
52
ASSERT_LOC(tokenizer.tokenize(code), file, line);
49
53
@@ -1593,7 +1597,7 @@ class TestConstructors : public TestFixture {
1593
1597
" Fred();\n"
1594
1598
"};\n"
1595
1599
"Fred::Fred()\n"
1596
-
"{ }", dinit(CheckOptions, $.s = &s));
1600
+
"{ }", s);
1597
1601
ASSERT_EQUALS("[test.cpp:7:7]: (warning) Member variable 'Fred::var' is not initialized in the constructor. [uninitMemberVarPrivate]\n", errout_str());
1598
1602
}
1599
1603
@@ -1606,7 +1610,7 @@ class TestConstructors : public TestFixture {
1606
1610
" Fred();\n"
1607
1611
"};\n"
1608
1612
"Fred::Fred()\n"
1609
-
"{ }", dinit(CheckOptions, $.s = &s));
1613
+
"{ }", s);
1610
1614
ASSERT_EQUALS("", errout_str());
1611
1615
}
1612
1616
}
@@ -2064,7 +2068,7 @@ class TestConstructors : public TestFixture {
2064
2068
" d = rhs.get();\n"
2065
2069
" }\n"
2066
2070
" double d;\n"
2067
-
"};", dinit(CheckOptions, $.s = &s));
2071
+
"};", s);
2068
2072
ASSERT_EQUALS("", errout_str());
2069
2073
2070
2074
check("struct S {\n"// #8485
@@ -2098,7 +2102,7 @@ class TestConstructors : public TestFixture {
2098
2102
check("struct S {\n"
2099
2103
" S& operator=(const S& s) { return *this; }\n"
2100
2104
" std::mutex m;\n"
2101
-
"};\n", dinit(CheckOptions, $.s = &s));
2105
+
"};\n", s);
2102
2106
ASSERT_EQUALS("", errout_str());
2103
2107
}
2104
2108
@@ -3046,7 +3050,7 @@ class TestConstructors : public TestFixture {
3046
3050
check("struct C {\n"// #13989
3047
3051
" C() = default;\n"
3048
3052
" std::list<int>::const_iterator it;\n"
3049
-
"};\n", dinit(CheckOptions, $.s = &s));
3053
+
"};\n", s);
3050
3054
ASSERT_EQUALS("[test.cpp:2:5]: (warning) Member variable 'C::it' is not initialized in the constructor. [uninitMemberVar]\n", errout_str());
3051
3055
}
3052
3056
@@ -3257,7 +3261,7 @@ class TestConstructors : public TestFixture {
3257
3261
" std::array<std::string, 2> e;\n"
3258
3262
" std::array<U, 2> f;\n"
3259
3263
"S() {}\n"
3260
-
"};\n", dinit(CheckOptions, $.s = &s));
3264
+
"};\n", s);
3261
3265
3262
3266
ASSERT_EQUALS("[test.cpp:10:1]: (warning) Member variable 'S::a' is not initialized in the constructor. [uninitMemberVar]\n"
3263
3267
"[test.cpp:10:1]: (warning) Member variable 'S::b' is not initialized in the constructor. [uninitMemberVar]\n"
@@ -3689,7 +3693,7 @@ class TestConstructors : public TestFixture {
3689
3693
check("class Foo {\n"
3690
3694
" int foo;\n"
3691
3695
" Foo() { }\n"
3692
-
"};", dinit(CheckOptions, $.s = &s));
3696
+
"};", s);
3693
3697
ASSERT_EQUALS("", errout_str());
3694
3698
}
3695
3699
@@ -3698,7 +3702,7 @@ class TestConstructors : public TestFixture {
3698
3702
check("class Foo {\n"
3699
3703
" int foo;\n"
3700
3704
" Foo() { }\n"
3701
-
"};", dinit(CheckOptions, $.s = &s));
3705
+
"};", s);
3702
3706
ASSERT_EQUALS("[test.cpp:3:5]: (warning) Member variable 'Foo::foo' is not initialized in the constructor. [uninitMemberVarPrivate]\n", errout_str());
3703
3707
}
3704
3708
}
@@ -3760,7 +3764,7 @@ class TestConstructors : public TestFixture {
0 commit comments