@@ -3374,6 +3374,42 @@ def test_suppress_unmatched_wildcard(tmp_path): # #13660
33743374 ]
33753375
33763376
3377+ def test_suppress_unmatched_wildcard_cached (tmp_path ): # #14585
3378+ test_file = tmp_path / 'test.c'
3379+ with open (test_file , 'wt' ) as f :
3380+ f .write (
3381+ """void f()
3382+ {
3383+ (void)(*((int*)0));
3384+ }
3385+ """ )
3386+
3387+ build_dir = tmp_path / 'b1'
3388+ os .makedirs (build_dir )
3389+
3390+ # need to run in the temporary folder because the path of the suppression has to match
3391+ args = [
3392+ '-q' ,
3393+ '--template=simple' ,
3394+ '--enable=information' ,
3395+ '--cppcheck-build-dir={}' .format (build_dir ),
3396+ '--suppress=nullPointer:test*.c'
3397+ 'test.c'
3398+ ]
3399+
3400+ stderr_exp = []
3401+
3402+ exitcode , stdout , stderr = cppcheck (args , cwd = tmp_path )
3403+ assert exitcode == 0 , stdout
3404+ assert stdout .splitlines () == []
3405+ assert stderr .splitlines () == stderr_exp
3406+
3407+ exitcode , stdout , stderr = cppcheck (args , cwd = tmp_path )
3408+ assert exitcode == 0 , stdout
3409+ assert stdout .splitlines () == []
3410+ assert stderr .splitlines () == stderr_exp
3411+
3412+
33773413def test_suppress_unmatched_wildcard_unchecked (tmp_path ):
33783414 # make sure that unmatched wildcards suppressions are reported if files matching the expressions were processesd
33793415 # but isSuppressed() has never been called (i.e. no findings in file at all)
0 commit comments