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
0
votes
1 answer

Why does CppCheck flag static constexpr members as unusedStructMember, when it is used later in the struct definition

CppCheck is flagging the definition of BufLen as an unusedStructMember, even though it is used on the next line to define the length of the array. (style) struct member 'TxDetails_t::BufLen' is never used. [unusedStructMember] static struct…
JonathanN
  • 233
  • 2
  • 5
0
votes
1 answer

CPPCheck Null pointer dereference

I maintain some embedded C code (No OS). I have made some updates an run CPPCheck on my changes. CPPCheck has brought up the error 'Null pointer dereference: (volatile unsigned int*)0'. This is not in my code changes but I am keen to understand what…
ORYG
  • 13
  • 4
0
votes
0 answers

import eclipse project / makefile into cppcheck

I am searching for a trick how to get a config for cppcheck from an existing (huge) Eclipse-Project and or the generated Makefile(s) Any Ideas how to do that? Mainly List of sourcefiles, List of Includes PS: any of the cppcheck plugins fail to…
schnedan
  • 234
  • 1
  • 9
0
votes
1 answer

How to use .hpi files for vim

I have downloaded a .hpi file for cppcheck as plugin but i don't know how to use. Can anybody help me in this regard. Thanks.
learner
  • 11
  • 3
0
votes
1 answer

Cppcheck ignores -i and checks all files after clean build

My project has pretty complex structure. It looks something like this: App/ Inc/ Src/ OtherDir/ ManyOtherDirsInc/ ManyOtherDirsSrc/ OtherDirs/ThatAre/Inside/OtherDirs/Inc build/ I am building it using CMake with extra…
vict
  • 158
  • 1
  • 11
0
votes
2 answers

cppcheck warning: access of forwarded variable

On the following code #include template void g(F&& f, ArgsType&&... args) { if constexpr (i < 1) { f(std::forward(args)...); g<1>(std::forward(f),…
francesco
  • 7,189
  • 7
  • 22
  • 49
0
votes
0 answers

CPPCheck: Errors in local header files are not caught

I have a project that uses CMake with a top level CMakeLists which references subdirectories each with their own targets and CMakeLists. Each subdirectory includes src, include dirs. I'm trying to execute Cppcheck on my code base using the following…
Mo Kanj
  • 107
  • 7
0
votes
1 answer

cppcheck don't see some subfolders with error: could not find or open any of the paths given

Running cppcheck as cppcheck.exe --enable=all --xml-version=2 2> out.xml folder\subfolder And for some subfolders(3 out of 5) got error error: could not find or open any of the paths given. If I rename the folder still same error. And when I run …
Name
  • 37
  • 4
0
votes
1 answer

cppcheck --suppress command line parameter doesn't work

want to suppress all error checks in some file. My command line command is cppcheck --enable=all -j 4 --output-file=out.txt --project=solution.sln --suppress=*:file.cpp But I got errors from file.cpp in my output file. I used to have quite…
Name
  • 37
  • 4
0
votes
0 answers

how do you specify cppcheck parameters in jenkins

how do you specify cppcheck parameters in jenkins? I can see from the console output that the following is being run: + cppcheck --output-file=cppcheck.xml --enable=all --inconclusive --xml --xml-version=2 ../ I don't know where the cppcheck…
asdasdxx
  • 1
  • 1
0
votes
1 answer

CppCheck reports less errors whith headerfolders using -I in call then without

This call to CppCheck reports 16 errors: cppcheck -j 4 path --enable=all --inconclusive -UIMAQ_IMPORT -UIMAQ_STDCALL -iExternals --xml --xml-version=2 Source 2> cppcheck.xml The same call to CppCheck but with header folders added using -I reports 10…
0
votes
0 answers

When an external function is called, cppcheck cannot check for an uninitialized variable error

#include "test.h" static int test(){ test_t i; init(i); } static test_t init(test_t const a){ test_c(&a); return a; } When I use Cppcheck to check this file ,it reports uninitialized variable at init(i);. But it does not report uninitialized…
Jw.zhang
  • 1
  • 1
0
votes
1 answer

cppcheck considers that variables used in macro are not used

For example, I have this snippet: const int array_type = model.accessors[accessor_index].type; Assert(array_type == TypeCode(), ""); And I get this error: Src/Engine/Animation/GltfLib.cpp:103:26: style: Variable 'array_type' is assigned a value…
Makogan
  • 8,208
  • 7
  • 44
  • 112
0
votes
1 answer

Does cppcheck analyses over multiple files

is cppcheck able to keep track of malloc/dealloc or data flow over multiple files? Or does it analyse only single files seperately?
Joerg
  • 1
0
votes
0 answers

How to suppress specific cases of syntaxError with CppCheck

I'm running CppCheck over some files containing CLI code. As the CLI portions of the file make use of '^)' characters, I'm trying to suppress the "false positive" syntaxError generated by CppCheck due to those characters. Rather than using inline…