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
0 answers

how can I run cppcheck in Jenkins?

I have a playground pipeline and I am trying to start using cppcheck, but when I execute the command in the cmd (I am running windows 10) it works fine, but if executing the command inside the pipeline, it returns 'cppcheck' is not recognized as an…
Jesus Fernandez
  • 500
  • 1
  • 7
  • 20
0
votes
1 answer

how to publish cppcheck results on jenkins pipeline?

I am learning about Jenkins on my own, and I wanted to try the cppcheck plugin, I have setup the following sample pipeline: pipeline { agent any stages { stage('analysis') { steps { script{ …
Jesus Fernandez
  • 500
  • 1
  • 7
  • 20
0
votes
1 answer

How to check if a statement string contains a word in C++?

I want to check in C++ if a statement string contains a word. Now the problem is that all over the internet they use string::find or the boost library but the problem with these methods is that it only detect the word in a string with no spaces so…
0
votes
0 answers

How do i use overloading with friend function

I am new to coding with c++ and I am confused about how to fix the error message popping out with the code below. The error message reads: /tmp/cc3Qc0nv.0: In function 'main': main.cpp:(.text+0x73a): undefined reference to 'operator>>(std::istream&,…
0
votes
0 answers

How do I compile and integrate Cppcheck with CMake on VS code?

I am setting the build system for my C++ project first time. I am trying to integrate the Cppcheck static analysis tool with the CMake build system generator. I have tried to set a few things and those seem is not working for me. Please find…
Avi
  • 310
  • 2
  • 4
  • 16
0
votes
1 answer

What is the use of --clang= and --addon-python= in cppcheck?

What is the use of --clang= and --addon-python= in cppcheck? Please explain how to use these options with cppcheck??
rama
  • 1
0
votes
1 answer

CppCheck with custom Malloc functions

I am working on a codebase that has a vast amount of legacy code and I am trying to update CppCheck to the latest version. This code relies on a number of custom malloc style functions with the following signature: Status osMemAlloc(void** ptr,…
mark
  • 7,381
  • 5
  • 36
  • 61
0
votes
1 answer

Sphere online judge ( Life, the Universe, and Everything )

Your program is to use the brute-force approach in order to find the Answer to Life, the Universe, and Everything. More precisely... rewrite small numbers from input to output. Stop processing input after reading in the number 42. All numbers at…
artgoblin
  • 15
  • 3
0
votes
1 answer

Bringing Cppcheck and VCL together

Cppcheck now has a check to detect references to temporary which leads to false positives (danglingTemporaryLifetime) for code involving VCL classes (of C++Builder6). Here is…
Wolf
  • 9,679
  • 7
  • 62
  • 108
0
votes
0 answers

CMAKE_C_CPPCHECK how to ignore a special file or folder

I am using cppcheck with cmake. Which works as expected but I would like to exclude some files or folders from the check. I tried some different things with --supress and --supress-list andi -i but I did not get any solution right now. lets say i…
mgiaco
  • 319
  • 1
  • 5
  • 17
0
votes
0 answers

invalid output when change from argc=1 to 3 in cpp

i have a program with 2 cases. argc=1 = interactive mode argc=3 = input output file if(argc == 1){ bool finish= false; while (!finish){ try{ std::cout<<"Gcalc>"; std::string line; …
Ido
  • 55
  • 7
0
votes
3 answers

Unset define in cppcheck analyze from cmake generated command

I have project which i check with cppcheck 1.90, but i want to unset few defines, because it takes a lot of time to check with all defines. Example: tests.cpp: int main() { int x,y; #ifdef A x = 5; #else x = 10; #endif #ifdef B y =…
AlexBG
  • 386
  • 1
  • 7
0
votes
3 answers

How to cast int pointer to float pointer

I am running cppcheck (c++11) against a library that contains many casts similar to the below: // Allocates various buffers int* i_buffer = (int*) calloc (500, sizeof (int)); float* f_buffer = (float*) i_buffer; For these casts, I see the…
didjek
  • 393
  • 5
  • 16
0
votes
1 answer

CppCheck rule not show #define, comment

I'm create custom rule for cppCheck. When I create rule like not allow #define in project. But --rule=.+ not show #define in my test project. Is there any option or flag for cppcheck to show #define in my code ? my rule file:
BulletRain
  • 92
  • 9
0
votes
2 answers

cppcheck: Syntax error with using/typedef

I have a syntax error with cppcheck and using/typedef declarations. I have a struct that contains struct inferior { using visitor = int; template bool operator()(const T &a, const T &b) const { return a < b; …
cppart
  • 1
  • 2