@@ -18,7 +18,7 @@ void *operator new(std::size_t, const std::nothrow_t &) noexcept;
18
18
void *operator new [](std::size_t , const std::nothrow_t &) noexcept ;
19
19
20
20
void bad_new_in_condition () {
21
- if (!(new int )) { // BAD [NOT DETECTED]
21
+ if (!(new int )) { // BAD
22
22
return ;
23
23
}
24
24
}
@@ -30,7 +30,7 @@ void bad_new_missing_exception_handling() {
30
30
if (p1 == 0 )
31
31
return ;
32
32
33
- int *p2 = new int [100 ]; // BAD [NOT DETECTED]
33
+ int *p2 = new int [100 ]; // BAD
34
34
if (!p2)
35
35
return ;
36
36
@@ -42,15 +42,15 @@ void bad_new_missing_exception_handling() {
42
42
if (p4 == nullptr )
43
43
return ;
44
44
45
- int *p5 = new int [100 ]; // BAD [NOT DETECTED]
45
+ int *p5 = new int [100 ]; // BAD
46
46
if (p5) {} else return ;
47
47
48
48
int *p6;
49
49
p6 = new int [100 ]; // BAD
50
50
if (p6 == 0 ) return ;
51
51
52
52
int *p7;
53
- p7 = new int [100 ]; // BAD [NOT DETECTED]
53
+ p7 = new int [100 ]; // BAD
54
54
if (!p7)
55
55
return ;
56
56
@@ -66,13 +66,13 @@ void bad_new_missing_exception_handling() {
66
66
return ;
67
67
68
68
int *p10;
69
- p10 = new int [100 ]; // BAD [NOT DETECTED]
69
+ p10 = new int [100 ]; // BAD
70
70
if (p10 != 0 ) {
71
71
}
72
72
73
73
int *p11;
74
74
do {
75
- p11 = new int [100 ]; // BAD [NOT DETECTED]
75
+ p11 = new int [100 ]; // BAD
76
76
} while (!p11);
77
77
78
78
int * p12 = new int [100 ];
@@ -154,7 +154,7 @@ void bad_placement_new_with_exception_handling() {
154
154
155
155
void good_placement_new_with_exception_handling () {
156
156
char buffer[1024 ];
157
- try { new (buffer) Foo (42 ); } // GOOD: Foo constructor might throw [FALSE POSITIVE]
157
+ try { new (buffer) Foo (42 ); } // GOOD: Foo constructor might throw
158
158
catch (...) { }
159
159
}
160
160
@@ -179,17 +179,17 @@ void calls_non_throwing(int* p) {
179
179
180
180
void good_new_with_throwing_call () {
181
181
try {
182
- int * p1 = new (std::nothrow) int ; // GOOD [FALSE POSITIVE]
182
+ int * p1 = new (std::nothrow) int ; // GOOD
183
183
may_throw ();
184
184
} catch (...) { }
185
185
186
186
try {
187
- int * p2 = new (std::nothrow) int ; // GOOD [FALSE POSITIVE]
187
+ int * p2 = new (std::nothrow) int ; // GOOD
188
188
Foo f (10 );
189
189
} catch (...) { }
190
190
191
191
try {
192
- int * p3 = new (std::nothrow) int ; // GOOD [FALSE POSITIVE]
192
+ int * p3 = new (std::nothrow) int ; // GOOD
193
193
calls_throwing_code (p3);
194
194
} catch (...) { }
195
195
}
@@ -201,7 +201,7 @@ void bad_new_with_nonthrowing_call() {
201
201
} catch (...) { }
202
202
203
203
try {
204
- int * p2 = new (std::nothrow) int ; // GOOD: boolean conversion constructor might throw [FALSE POSITIVE]
204
+ int * p2 = new (std::nothrow) int ; // GOOD: boolean conversion constructor might throw
205
205
Foo f (12 );
206
206
if (f) { }
207
207
} catch (...) { }
0 commit comments