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

Use -I instead of -isystem when using CMake find_package in compile_commands.json

My question is basically the inverse of this SO question - Use -isystem instead of -I with CMake I have a library I'm testing and the test application brings in the library via CMake's find_package # CMakeLists.txt ... find_package(as…
Tom
  • 1,956
  • 2
  • 18
  • 23
0
votes
1 answer

Why does JetAttachDatabase return error -550?

stack, I need help, JetAttachDatabase returning error -550. JET_paramRecovery is switched off. What should I do that it starts work? I've already tried to restore instance, but I have no restore file... I don't know what should I do. Now I have code…
Tim
  • 25
  • 2
0
votes
3 answers

tricky situations with cppcheck

I am facing a situation where i need cppchecks to pass but it gets tricky sometimes. What do you generally do in such circumstances ? For example. #include using namespace std; void fun1(); int fun2(); int main() { fun1(); } void…
badri
  • 575
  • 2
  • 8
  • 22
0
votes
3 answers

How to find if a function is present in a cpp file using cppcheck?

I wanted to find whether the cpp file has a certain function implemented. For example if a() is present in the cpp file. How do I write a rule for this? I want it throw exception, if it is not present.
0
votes
1 answer

How can I run cppcheck for specific files following a pattern?

I wanted to run the cppcheck only for specific type of files and not all files. For example, I want to run cppcheck for all files ending with "Operation.cpp" recursively (basically for *Operation.cpp). I don't find an option in cppcheck, doing the…
0
votes
2 answers

Buffer is accessed out of bounds in cppcheck

Code can be compiled and result is fine. But cppcheck will report an error of it. #define BUF_SIZE 1024 #define MAX_LENG 80 static unsigned char path[MAX_LENG]; unsigned char file_buf[BUF_SIZE*2]; memset(file_buf, 0,…
BigDongle
  • 253
  • 2
  • 10
0
votes
1 answer

cppcheck seems to work but no lint results appear (Subilme Text 3, Mac)

I'm using Sublime Text 3(Version 3.1.1, build 3176) on macOS High Sierra(Version 10.13.3). I want to make SublimeLinter-cppcheck plugin & cppcheck work in my Sublime Text 3, so I installed them according to this link and other web sites. Now my…
ASHIJANKEN
  • 11
  • 8
0
votes
2 answers

How to interpret Null pointer dereference by Cppcheck?

I have come across a code during review and when i used cpp check it states an null pointer dereference error. I am unable to figure out the reason. Below is the code: CopyMemory(NULL, dummyMatrixManager.GetConstDataPtr(),…
user8183713
0
votes
1 answer

How to handle different versions of dependencies?

I have got a make file project which uses several tools such as cppcheck or asn1c. There are several developers which use this project on their local custom linux machines. The problem is, that every linux machine has a different version of the…
eDeviser
  • 1,605
  • 2
  • 17
  • 44
0
votes
0 answers

How do I integrate Cppcheck with CMake through CMakeLists.txt files?

In Ubuntu I am trying to integrate Cppcheck with CMake through a CMakeLists.txt file: add_custom_target( cppcheck COMMAND /usr/bin/cppcheck *.cpp --xml 2>cppcheck_result.xml …
Rishitha
  • 1
  • 2
0
votes
1 answer

process.StandardOutput.ReadToEnd() does not get the total StandardOutput

I have a C# application, which accesses the command line tool "cppcheck" and is then supposed to save the output of this command line tool to the variable "output". Here is the code: System.Diagnostics.Process process = new…
steady_progress
  • 3,311
  • 10
  • 31
  • 62
0
votes
2 answers

cppcheck stops analysis of whole file when array of struct is declared

I am running static code analysis using cppcheck. I have a cpp source file which as bugs like "null pointer dereferenced" etc. There is a piece of code in file. A structure is declared inside a class class Example{ public: typedef struct…
0
votes
1 answer

How to increase the thread count of running cppcheck process in linux

I trying to increase the thread count of running cppcheck process by using following command cppcheck -j9 --enable=warning,style,performance,portability,information,missingInclude but still only one thread is running in background. Can anyone help…
Tehniyat
  • 1
  • 1
0
votes
1 answer

If statement is not working in my code

//a is an integer but if an alphabet is press on run time the code keeps running without any input instead showing invalid output and repeat the loop turn again. for (int j = 0; j <= 8; j++) { if (j % 2 == 0){ boad(arr); cout <<…
0
votes
3 answers

How can i make the cppcheck.xml to be published on jenkins using the jenkinsfile itself?

Currently I have a multibranch pipeline job where a build happens and the cppcheck is used to analyse the code. However there is no 'post build actions' tab available available in the multibranch pipeline to enable 'publish cppcheck results'. I have…