@@ -2085,7 +2085,7 @@ def test_def_undef(tmp_path):
20852085void f()
20862086{
20872087#ifndef DEF_1
2088- {int i = *((int*)0);}
2088+ (void)( *((int*)0));
20892089#endif
20902090}
20912091""" )
@@ -2103,7 +2103,7 @@ def test_def_undef(tmp_path):
21032103 'Checking {}: DEF_1=1...' .format (test_file ) # TODO: should not print DEF_1 - see #13335
21042104 ]
21052105 assert stderr .splitlines () == [
2106- '{}:5:16 : error: Null pointer dereference: (int*)0 [nullPointer]' .format (test_file )
2106+ '{}:5:14 : error: Null pointer dereference: (int*)0 [nullPointer]' .format (test_file )
21072107 ]
21082108
21092109
@@ -2115,10 +2115,10 @@ def test_def_def(tmp_path): # #13334
21152115void f()
21162116{
21172117#if DEF_1 == 3
2118- {int i = *((int*)0);}
2118+ (void)( *((int*)0));
21192119#endif
21202120#if DEF_1 == 7
2121- {int i = *((int*)0);}
2121+ (void)( *((int*)0));
21222122#endif
21232123}
21242124""" )
@@ -2136,7 +2136,7 @@ def test_def_def(tmp_path): # #13334
21362136 'Checking {}: DEF_1=3;DEF_1=7...' .format (test_file ) # TODO: should not print DEF_1 twice - see #13335
21372137 ]
21382138 assert stderr .splitlines () == [
2139- '{}:8:16 : error: Null pointer dereference: (int*)0 [nullPointer]' .format (test_file )
2139+ '{}:8:14 : error: Null pointer dereference: (int*)0 [nullPointer]' .format (test_file )
21402140 ]
21412141
21422142
@@ -2148,7 +2148,7 @@ def test_def_undef_def(tmp_path): # #13334
21482148void f()
21492149{
21502150#ifdef DEF_1
2151- {int i = *((int*)0);}
2151+ (void)( *((int*)0));
21522152#endif
21532153}
21542154""" )
@@ -2167,7 +2167,7 @@ def test_def_undef_def(tmp_path): # #13334
21672167 'Checking {}: DEF_1=1;DEF_1=1...' .format (test_file ) # TODO: should not print DEF_1 twice - see #13335
21682168 ]
21692169 assert stderr .splitlines () == [
2170- '{}:5:16 : error: Null pointer dereference: (int*)0 [nullPointer]' .format (test_file )
2170+ '{}:5:14 : error: Null pointer dereference: (int*)0 [nullPointer]' .format (test_file )
21712171 ]
21722172
21732173
@@ -2178,7 +2178,7 @@ def test_undef(tmp_path):
21782178void f()
21792179{
21802180#ifndef DEF_1
2181- {int i = *((int*)0);}
2181+ (void)( *((int*)0));
21822182#endif
21832183}
21842184""" )
@@ -2194,7 +2194,7 @@ def test_undef(tmp_path):
21942194 'Checking {} ...' .format (test_file )
21952195 ]
21962196 assert stderr .splitlines () == [
2197- '{}:5:16 : error: Null pointer dereference: (int*)0 [nullPointer]' .format (test_file )
2197+ '{}:5:14 : error: Null pointer dereference: (int*)0 [nullPointer]' .format (test_file )
21982198 ]
21992199
22002200
@@ -2208,7 +2208,7 @@ def test_undef_src(tmp_path): # #13340
22082208void f()
22092209{
22102210#ifdef DEF_1
2211- {int i = *((int*)0);}
2211+ (void)( *((int*)0));
22122212#endif
22132213}
22142214""" )
@@ -2224,7 +2224,7 @@ def test_undef_src(tmp_path): # #13340
22242224 'Checking {} ...' .format (test_file )
22252225 ]
22262226 assert stderr .splitlines () == [
2227- '{}:7:16 : error: Null pointer dereference: (int*)0 [nullPointer]' .format (test_file )
2227+ '{}:7:14 : error: Null pointer dereference: (int*)0 [nullPointer]' .format (test_file )
22282228 ]
22292229
22302230
@@ -2623,7 +2623,7 @@ def test_debug(tmp_path):
26232623 f .write (
26242624"""void f
26252625{
2626- (void)*((int*)0);
2626+ (void)( *((int*)0) );
26272627}
26282628""" )
26292629
@@ -2649,7 +2649,7 @@ def test_debug_xml(tmp_path):
26492649 f .write (
26502650"""void f
26512651{
2652- (void)*((int*)0);
2652+ (void)( *((int*)0) );
26532653}
26542654""" )
26552655
@@ -2691,7 +2691,7 @@ def test_debug_verbose(tmp_path):
26912691 f .write (
26922692"""void f
26932693{
2694- (void)*((int*)0);
2694+ (void)( *((int*)0) );
26952695}
26962696""" )
26972697
@@ -2718,7 +2718,7 @@ def test_debug_verbose_xml(tmp_path):
27182718 f .write (
27192719"""void f
27202720{
2721- (void)*((int*)0);
2721+ (void)( *((int*)0) );
27222722}
27232723""" )
27242724
@@ -2764,7 +2764,7 @@ def __test_debug_template(tmp_path, verbose=False, debug=False):
27642764"""template<class T> class TemplCl;
27652765void f()
27662766{
2767- (void)*((int*)nullptr);
2767+ (void)( *((int*)nullptr) );
27682768}
27692769""" )
27702770
@@ -2803,7 +2803,7 @@ def __test_debug_template(tmp_path, verbose=False, debug=False):
28032803 else :
28042804 assert stdout .count ('### Template Simplifier pass ' ) == 1
28052805 assert stderr .splitlines () == [
2806- '{}:4:13 : error: Null pointer dereference: (int*)nullptr [nullPointer]' .format (test_file )
2806+ '{}:4:14 : error: Null pointer dereference: (int*)nullptr [nullPointer]' .format (test_file )
28072807 ]
28082808 return stdout
28092809
@@ -3408,7 +3408,7 @@ def __test_debug_normal(tmp_path, verbose):
34083408 f .write (
34093409"""void f()
34103410{
3411- (void)*((int*)0);
3411+ (void)( *((int*)0) );
34123412}
34133413""" )
34143414
@@ -3436,7 +3436,7 @@ def __test_debug_normal(tmp_path, verbose):
34363436 assert stdout .find ('##AST' ) == - 1
34373437 assert stdout .find ('### Template Simplifier pass ' ) == - 1
34383438 assert stderr .splitlines () == [
3439- '{}:3:13 : error: Null pointer dereference: (int*)0 [nullPointer]' .format (test_file )
3439+ '{}:3:14 : error: Null pointer dereference: (int*)0 [nullPointer]' .format (test_file )
34403440 ]
34413441 return stdout
34423442
@@ -3458,7 +3458,7 @@ def __test_debug_simplified(tmp_path, verbose):
34583458 f .write (
34593459"""void f()
34603460{
3461- (void)*((int*)0);
3461+ (void)( *((int*)0) );
34623462}
34633463""" )
34643464
@@ -3480,7 +3480,7 @@ def __test_debug_simplified(tmp_path, verbose):
34803480 assert stdout .find ('##AST' ) == - 1
34813481 assert stdout .find ('### Template Simplifier pass ' ) == - 1
34823482 assert stderr .splitlines () == [
3483- '{}:3:13 : error: Null pointer dereference: (int*)0 [nullPointer]' .format (test_file )
3483+ '{}:3:14 : error: Null pointer dereference: (int*)0 [nullPointer]' .format (test_file )
34843484 ]
34853485 return stdout
34863486
@@ -3501,7 +3501,7 @@ def __test_debug_symdb(tmp_path, verbose):
35013501 f .write (
35023502"""void f()
35033503{
3504- (void)*((int*)0);
3504+ (void)( *((int*)0) );
35053505}
35063506""" )
35073507
@@ -3523,7 +3523,7 @@ def __test_debug_symdb(tmp_path, verbose):
35233523 assert stdout .find ('##AST' ) == - 1
35243524 assert stdout .find ('### Template Simplifier pass ' ) == - 1
35253525 assert stderr .splitlines () == [
3526- '{}:3:13 : error: Null pointer dereference: (int*)0 [nullPointer]' .format (test_file )
3526+ '{}:3:14 : error: Null pointer dereference: (int*)0 [nullPointer]' .format (test_file )
35273527 ]
35283528 return stdout
35293529
@@ -3545,7 +3545,7 @@ def __test_debug_ast(tmp_path, verbose):
35453545 f .write (
35463546"""void f()
35473547{
3548- (void)*((int*)0);
3548+ (void)( *((int*)0) );
35493549}
35503550""" )
35513551
@@ -3567,7 +3567,7 @@ def __test_debug_ast(tmp_path, verbose):
35673567 assert stdout .find ('##AST' ) != - 1
35683568 assert stdout .find ('### Template Simplifier pass ' ) == - 1
35693569 assert stderr .splitlines () == [
3570- '{}:3:13 : error: Null pointer dereference: (int*)0 [nullPointer]' .format (test_file )
3570+ '{}:3:14 : error: Null pointer dereference: (int*)0 [nullPointer]' .format (test_file )
35713571 ]
35723572 return stdout
35733573
@@ -3588,7 +3588,7 @@ def __test_debug_valueflow(tmp_path, verbose):
35883588 f .write (
35893589"""void f()
35903590{
3591- (void)*((int*)0);
3591+ (void)( *((int*)0) );
35923592}
35933593""" )
35943594
@@ -3610,7 +3610,7 @@ def __test_debug_valueflow(tmp_path, verbose):
36103610 assert stdout .find ('##AST' ) == - 1
36113611 assert stdout .find ('### Template Simplifier pass ' ) == - 1
36123612 assert stderr .splitlines () == [
3613- '{}:3:13 : error: Null pointer dereference: (int*)0 [nullPointer]' .format (test_file )
3613+ '{}:3:14 : error: Null pointer dereference: (int*)0 [nullPointer]' .format (test_file )
36143614 ]
36153615 return stdout
36163616
@@ -3632,7 +3632,7 @@ def test_debug_syntaxerror_c(tmp_path):
36323632template<class T> class TemplCl;
36333633void f()
36343634{
3635- (void)*((int*)0);
3635+ (void)( *((int*)0) );
36363636}
36373637""" )
36383638
0 commit comments