Skip to content

Commit 2abd7da

Browse files
Fix #14029 Information message normalCheckLevelMaxBranches reported unconditionally (#7692)
1 parent e1cc0e2 commit 2abd7da

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

lib/forwardanalyzer.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -684,7 +684,9 @@ namespace {
684684
Token::simpleMatch(tok->linkAt(1), ") {")) {
685685
if ((settings.vfOptions.maxForwardBranches > 0) && (++branchCount > settings.vfOptions.maxForwardBranches)) {
686686
// TODO: should be logged on function-level instead of file-level
687-
reportError(Severity::information, "normalCheckLevelMaxBranches", "Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches.");
687+
if (settings.severity.isEnabled(Severity::information)) {
688+
reportError(Severity::information, "normalCheckLevelMaxBranches", "Limiting analysis of branches. Use --check-level=exhaustive to analyze all branches.");
689+
}
688690
return Break(Analyzer::Terminate::Bail);
689691
}
690692
Token* endCond = tok->linkAt(1);

test/cli/other_test.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2038,6 +2038,17 @@ def test_builddir_hash_check_level(tmp_path): # #13376
20382038
build_dir = tmp_path / 'b1'
20392039
os.mkdir(build_dir)
20402040

2041+
args = [ # // #14029
2042+
'--enable=warning', # to execute the code which generates the normalCheckLevelMaxBranches message
2043+
'--cppcheck-build-dir={}'.format(build_dir),
2044+
'--template=simple',
2045+
str(test_file)
2046+
]
2047+
2048+
exitcode, stdout, stderr = cppcheck(args)
2049+
assert exitcode == 0, stdout
2050+
assert stderr == ''
2051+
20412052
args = [
20422053
'--enable=warning', # to execute the code which generates the normalCheckLevelMaxBranches message
20432054
'--enable=information', # to show the normalCheckLevelMaxBranches message

0 commit comments

Comments
 (0)