codechecker icon indicating copy to clipboard operation
codechecker copied to clipboard

Incompatibility between CodeChecker 6.24.4 and cppcheck 2.17.1

Open plexilcrf opened this issue 9 months ago • 6 comments

Describe the bug cppcheck 2.17.1 fails with error message: cppcheck: error: suppression 'unusedFunction' already exists

CodeChecker version Installed via pip Base package version | 6.24.4
Package build date | 2024-10-28T15:46
Git commit ID (hash) | 454d978191ed42c8202a2244dc092dfb6fd8c83a Git tag information | 6.24.4-tainted

cppcheck version Installed via homebrew Cppcheck 2.17.1

To Reproduce Steps to reproduce the behaviour:

  1. Run setup.sh (sets up Python virtual environment, some configuration files)
  2. Run run-codechecker (shell script)
  3. Observe output:
Logging the build...
Analyzing...
Analysis of some files failed. Continuing.
Generating report...
Done. See /Users/cfry/src/planner_test/CodeChecker_build/report.txt
  1. Examine report.txt

See attached files requirements.txt, report.txt. (Unable to upload shell scripts, CodeChecker configuration files)

requirements.txt report.txt

Expected behaviour Expected cppcheck to run normally.

Desktop (please complete the following information)

  • Hardware: MacBook Pro 16-inch, 2019 (Intel), 32 GB RAM
  • OS: macOS Sonoma 14.7.4
  • Python: Python 3.12.9, installed via homebrew
  • Browser: not relevant to this report

Additional context Unable to upload configuration files or shell scripts. unusedFunction occurs nowhere in them.

plexilcrf avatar Mar 20 '25 17:03 plexilcrf

Can you name an older version of cppcheck which is working well?

amai2012 avatar Mar 26 '25 08:03 amai2012

Experiencing the same problem here(

SweetVishnya avatar Mar 27 '25 16:03 SweetVishnya

Can you name an older version of cppcheck which is working well?

I don't have an answer for this yet, I've run into unrelated issues trying to get cppcheck 2.16.0 working with CodeChecker. Will report back when I have an answer.

plexilcrf avatar Mar 27 '25 16:03 plexilcrf

It seems that Cppcheck 2.16.2 works fine with CodeChecker

SweetVishnya avatar Mar 27 '25 17:03 SweetVishnya

I changed the following to make it work. I am not aware of the consequences.

--- a/analyzer/codechecker_analyzer/analyzers/cppcheck/analyzer.py
+++ b/analyzer/codechecker_analyzer/analyzers/cppcheck/analyzer.py
@@ -218,7 +218,7 @@ class Cppcheck(analyzer_base.SourceAnalyzer):
 
             # unusedFunction check is for whole program analysis,
             # which is not compatible with per source file analysis.
-            analyzer_cmd.append('--suppress=unusedFunction')
+            # analyzer_cmd.append('--suppress=unusedFunction')
 
             # Add extra arguments.
             analyzer_cmd.extend(config.analyzer_extra_arguments)
-- 
2.47.2

aag-norbert-lange avatar Apr 09 '25 08:04 aag-norbert-lange

Can confirm, after applying this patch, cppcheck was able to run successfully.

Seneral avatar May 16 '25 00:05 Seneral