Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 28 additions & 28 deletions test/cli/other_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -2085,7 +2085,7 @@ def test_def_undef(tmp_path):
void f()
{
#ifndef DEF_1
{int i = *((int*)0);}
(void)(*((int*)0));
#endif
}
""")
Expand All @@ -2103,7 +2103,7 @@ def test_def_undef(tmp_path):
'Checking {}: DEF_1=1...'.format(test_file) # TODO: should not print DEF_1 - see #13335
]
assert stderr.splitlines() == [
'{}:5:16: error: Null pointer dereference: (int*)0 [nullPointer]'.format(test_file)
'{}:5:14: error: Null pointer dereference: (int*)0 [nullPointer]'.format(test_file)
]


Expand All @@ -2115,10 +2115,10 @@ def test_def_def(tmp_path): # #13334
void f()
{
#if DEF_1 == 3
{int i = *((int*)0);}
(void)(*((int*)0));
#endif
#if DEF_1 == 7
{int i = *((int*)0);}
(void)(*((int*)0));
#endif
}
""")
Expand All @@ -2136,7 +2136,7 @@ def test_def_def(tmp_path): # #13334
'Checking {}: DEF_1=3;DEF_1=7...'.format(test_file) # TODO: should not print DEF_1 twice - see #13335
]
assert stderr.splitlines() == [
'{}:8:16: error: Null pointer dereference: (int*)0 [nullPointer]'.format(test_file)
'{}:8:14: error: Null pointer dereference: (int*)0 [nullPointer]'.format(test_file)
]


Expand All @@ -2148,7 +2148,7 @@ def test_def_undef_def(tmp_path): # #13334
void f()
{
#ifdef DEF_1
{int i = *((int*)0);}
(void)(*((int*)0));
#endif
}
""")
Expand All @@ -2167,7 +2167,7 @@ def test_def_undef_def(tmp_path): # #13334
'Checking {}: DEF_1=1;DEF_1=1...'.format(test_file) # TODO: should not print DEF_1 twice - see #13335
]
assert stderr.splitlines() == [
'{}:5:16: error: Null pointer dereference: (int*)0 [nullPointer]'.format(test_file)
'{}:5:14: error: Null pointer dereference: (int*)0 [nullPointer]'.format(test_file)
]


Expand All @@ -2178,7 +2178,7 @@ def test_undef(tmp_path):
void f()
{
#ifndef DEF_1
{int i = *((int*)0);}
(void)(*((int*)0));
#endif
}
""")
Expand All @@ -2194,7 +2194,7 @@ def test_undef(tmp_path):
'Checking {} ...'.format(test_file)
]
assert stderr.splitlines() == [
'{}:5:16: error: Null pointer dereference: (int*)0 [nullPointer]'.format(test_file)
'{}:5:14: error: Null pointer dereference: (int*)0 [nullPointer]'.format(test_file)
]


Expand All @@ -2208,7 +2208,7 @@ def test_undef_src(tmp_path): # #13340
void f()
{
#ifdef DEF_1
{int i = *((int*)0);}
(void)(*((int*)0));
#endif
}
""")
Expand All @@ -2224,7 +2224,7 @@ def test_undef_src(tmp_path): # #13340
'Checking {} ...'.format(test_file)
]
assert stderr.splitlines() == [
'{}:7:16: error: Null pointer dereference: (int*)0 [nullPointer]'.format(test_file)
'{}:7:14: error: Null pointer dereference: (int*)0 [nullPointer]'.format(test_file)
]


Expand Down Expand Up @@ -2623,7 +2623,7 @@ def test_debug(tmp_path):
f.write(
"""void f
{
(void)*((int*)0);
(void)(*((int*)0));
}
""")

Expand All @@ -2649,7 +2649,7 @@ def test_debug_xml(tmp_path):
f.write(
"""void f
{
(void)*((int*)0);
(void)(*((int*)0));
}
""")

Expand Down Expand Up @@ -2691,7 +2691,7 @@ def test_debug_verbose(tmp_path):
f.write(
"""void f
{
(void)*((int*)0);
(void)(*((int*)0));
}
""")

Expand All @@ -2718,7 +2718,7 @@ def test_debug_verbose_xml(tmp_path):
f.write(
"""void f
{
(void)*((int*)0);
(void)(*((int*)0));
}
""")

Expand Down Expand Up @@ -2764,7 +2764,7 @@ def __test_debug_template(tmp_path, verbose=False, debug=False):
"""template<class T> class TemplCl;
void f()
{
(void)*((int*)nullptr);
(void)(*((int*)nullptr));
}
""")

Expand Down Expand Up @@ -2803,7 +2803,7 @@ def __test_debug_template(tmp_path, verbose=False, debug=False):
else:
assert stdout.count('### Template Simplifier pass ') == 1
assert stderr.splitlines() == [
'{}:4:13: error: Null pointer dereference: (int*)nullptr [nullPointer]'.format(test_file)
'{}:4:14: error: Null pointer dereference: (int*)nullptr [nullPointer]'.format(test_file)
]
return stdout

Expand Down Expand Up @@ -3408,7 +3408,7 @@ def __test_debug_normal(tmp_path, verbose):
f.write(
"""void f()
{
(void)*((int*)0);
(void)(*((int*)0));
}
""")

Expand Down Expand Up @@ -3436,7 +3436,7 @@ def __test_debug_normal(tmp_path, verbose):
assert stdout.find('##AST') == -1
assert stdout.find('### Template Simplifier pass ') == -1
assert stderr.splitlines() == [
'{}:3:13: error: Null pointer dereference: (int*)0 [nullPointer]'.format(test_file)
'{}:3:14: error: Null pointer dereference: (int*)0 [nullPointer]'.format(test_file)
]
return stdout

Expand All @@ -3458,7 +3458,7 @@ def __test_debug_simplified(tmp_path, verbose):
f.write(
"""void f()
{
(void)*((int*)0);
(void)(*((int*)0));
}
""")

Expand All @@ -3480,7 +3480,7 @@ def __test_debug_simplified(tmp_path, verbose):
assert stdout.find('##AST') == -1
assert stdout.find('### Template Simplifier pass ') == -1
assert stderr.splitlines() == [
'{}:3:13: error: Null pointer dereference: (int*)0 [nullPointer]'.format(test_file)
'{}:3:14: error: Null pointer dereference: (int*)0 [nullPointer]'.format(test_file)
]
return stdout

Expand All @@ -3501,7 +3501,7 @@ def __test_debug_symdb(tmp_path, verbose):
f.write(
"""void f()
{
(void)*((int*)0);
(void)(*((int*)0));
}
""")

Expand All @@ -3523,7 +3523,7 @@ def __test_debug_symdb(tmp_path, verbose):
assert stdout.find('##AST') == -1
assert stdout.find('### Template Simplifier pass ') == -1
assert stderr.splitlines() == [
'{}:3:13: error: Null pointer dereference: (int*)0 [nullPointer]'.format(test_file)
'{}:3:14: error: Null pointer dereference: (int*)0 [nullPointer]'.format(test_file)
]
return stdout

Expand All @@ -3545,7 +3545,7 @@ def __test_debug_ast(tmp_path, verbose):
f.write(
"""void f()
{
(void)*((int*)0);
(void)(*((int*)0));
}
""")

Expand All @@ -3567,7 +3567,7 @@ def __test_debug_ast(tmp_path, verbose):
assert stdout.find('##AST') != -1
assert stdout.find('### Template Simplifier pass ') == -1
assert stderr.splitlines() == [
'{}:3:13: error: Null pointer dereference: (int*)0 [nullPointer]'.format(test_file)
'{}:3:14: error: Null pointer dereference: (int*)0 [nullPointer]'.format(test_file)
]
return stdout

Expand All @@ -3588,7 +3588,7 @@ def __test_debug_valueflow(tmp_path, verbose):
f.write(
"""void f()
{
(void)*((int*)0);
(void)(*((int*)0));
}
""")

Expand All @@ -3610,7 +3610,7 @@ def __test_debug_valueflow(tmp_path, verbose):
assert stdout.find('##AST') == -1
assert stdout.find('### Template Simplifier pass ') == -1
assert stderr.splitlines() == [
'{}:3:13: error: Null pointer dereference: (int*)0 [nullPointer]'.format(test_file)
'{}:3:14: error: Null pointer dereference: (int*)0 [nullPointer]'.format(test_file)
]
return stdout

Expand All @@ -3632,7 +3632,7 @@ def test_debug_syntaxerror_c(tmp_path):
template<class T> class TemplCl;
void f()
{
(void)*((int*)0);
(void)(*((int*)0));
}
""")

Expand Down
Loading