Questions tagged [cppcheck]

Cppcheck is an open source tool for static C/C++ code analysis that tries to detect bugs that a C/C++ compiler doesn't see.

Cppcheck - A tool for static C/C++ code analysis

Cppcheck is an analysis tool for C/C++ code. Unlike C/C++ compilers and many other analysis tools, we don't detect syntax errors. Cppcheck only detects the types of bugs that the compilers normally fail to detect. The goal is no false positives.

389 questions
1
vote
2 answers

CppCheck output to xml file from Powershell

I would like to run CppCheck on our code as part of our build. However, I cannot make it save the output to a file if not executed from a command prompt. From a regular (windows) command prompt, or with hard coded paths inside a .bat file the…
Kim
  • 37
  • 7
1
vote
3 answers

What is cppcheck rule-file syntax?

I've poked around for a while, and can't find this anywhere. I have found a nice example of a cppcheck rule-file that shows a simple pattern; if \( p \) { free \( p \) ; }
CAB
  • 1,015
  • 1
  • 14
  • 24
0
votes
0 answers

How to add headerfile path in Cppcheck

Cppcheck fails to detect a header file during analyses so it incorrectly reports a MISRA C:2012 violation of Rule 8.4. The code is written correctly (see this) but I can't find where to add a header file or path: How do I add a header file in…
dw N
  • 1
  • 2
0
votes
1 answer

why is cppcheck not accepting my xml rule file

I'm having trouble getting cppcheck to recognize and apply my custom XML rules file. I've followed the documentation and advice, but still, cppcheck doesn't seem to trigger any warnings based on my rules. I'm wondering if anyone else has encountered…
migela
  • 1
  • 1
0
votes
1 answer

Missing lots of scope types after cppcheck parsing

We've started using Cppcheck recently and everything is working great except scopes. I might have misunderstood something but aren't there supposed to be separate scopes for enums, structs, unions etc. in the resulted .dump file after parsing ? I…
Nikeau
  • 1
  • 2
0
votes
0 answers

Getting Error variable not defined while sending cc_library's name as argument to python file demo.py through cmd in defined in genrule

Getting Error variable not defined while sending cc_library's name as argument to python file demo.py through cmd defined in genrule. I want to pass cc_library's name(string) as argument to python file demo.py through cmd in defined in genrule. When…
0
votes
0 answers

Can we use cppcheck for detection of kernel memory leaks?

Can we use cppcheck for detection of kernel memory leaks (memory created by kzalloc or kmalloc)? if yes, please provide some example how we can use it. I have tried writing .cfg file ex: mem.cfg it has content file name mem.cfg
suresh
  • 1
0
votes
0 answers

How to use cppcheck file on the command line and use misra addon

I created a cppcheck project in the GUI version and enabled the misra addon and specified the location of my misra rules text file. This works and shows me the misra rule violations. Now, when I run cppcheck on the command line with: cppcheck…
Joe
  • 37
  • 8
0
votes
1 answer

How can I get a single cppcheck / clang-tidy result report file for all modules in my project?

in my project I have a multiple modules and I want to integrate cppcheck or clang-tidy with cmake. The problem is that in case of integration mentioned tools in cmake and perform static analysis I get report only for last checked module. Is there a…
emes9
  • 1
0
votes
1 answer

How can I solve the error that I get on ubuntu Terminal: cppcheck: error: unrecognized command line option: "--std=c++0x"?

I am using a static docker that checks the codes of a project. ( See https://github.com/Ericsson/codechecker/blob/master/docs/usage.md for more details). I got a C++ Project that I needed to analyse. I built the Project on eclipse and the rebuilt it…
Ramref
  • 1
0
votes
0 answers

Can Cppcheck find incorrect check of function return value (CWE 253) bugs?

I want to ask if cppcheck supports incorrect check of function return value detection Cppcheck can find unchecked return value by using the user defined configuration file. However, I didn't find a configuration to support incorrect check return…
lxc
  • 1
0
votes
1 answer

codelite scan could not locate mingw any on your machine error

I installed mingw and checked it in cmd by writing c++ --version it runs sucessful but whenever i open my codelite it says could not locate any mingw on your machine i have tried reinstalling both mingw and codelite few times nothing works someone…
0
votes
0 answers

how to exclude multiple files using cppcheck with command line

I'm using cppcheck to analyse C source code Using this command : cppcheck --enable=warning inputpath1 inputpath2 inputpath3 -iexcludepath1 excludepath2 --xml -U_DEBUG 2> .\CppCheckReport.xml I'm able to generate an XMl report which contains the…
0
votes
0 answers

How to use cppcheck command the input path from txt file

I'm using Cppchek to analyse my source codes By this command : cppcheck inputPath1 inputPath2 --enable=warning --xml 2> cppcheck-result.xml the report was well generated, However, I require a method to store the inputPath in a text file so that it…
0
votes
0 answers

cppcheck returns success in case of error

I have the following setting in my config for cppcheck to warn me if old API is used. DONT USE When I run cppcheck, then I have 'error' in ourput as it should…
Bill Lumbert
  • 4,633
  • 3
  • 20
  • 30