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

CppCheck suppress obsolete function

I cannot inline suppress obsoleteFunctiosgets warning from cppcheck. I tried: // cppcheck-suppress obsoleteFunctionsgets with no success. Did any of you experience this warning? Any hint? Thanks.
miguel azevedo
  • 537
  • 1
  • 4
  • 5
1
vote
2 answers

How to configure cppcheck to detect memory leaks in linux souce code

I want to try some open source static analysis tools to check their performance in detecting leaks on linux source code.I am starting with cppchecker. In linux most of the memory allocation calls are made through functions like kmalloc(), kzalloc()…
dsingh
  • 270
  • 1
  • 5
  • 17
1
vote
0 answers

Know the line in a C file, how to find the function name it belongs to?

I am dealing with the following problem: Given a number of source code written in C. They are scanned with CppCheck and the output is the CppCheck XML output format. The output per each error found is simply: error: $filePath,…
userOverflow
  • 33
  • 1
  • 4
1
vote
2 answers

Cppcheck: Custom rule for check Comments for all functions

Cppcheck is the tool which analyses our CPP code. I want to create custom rule for Cppcheck to check whether all functions have comments or not. For that I need a PCRE (Pearl regex) pattern. Or any other predefined rules to address this scenarios.
Hariram
  • 11
  • 2
1
vote
3 answers

global buffer overflow, Windows environment

I've asked a question about buffer overflow detection few days ago ( sprintf buffer global data overflow - how to detect it, Windows ) and problem can by only solved by cppcheck with standard function ( not secure _s version ). I went deeper and…
bataliero1234
  • 145
  • 10
1
vote
1 answer

make cppcheck skip the PACKAGE definition

I'm using the GUI version of cppcheck 1.64 for static code analysis on C++-Builde-6 code. For DLL exports and imports, the definition of PACKAGE is necessary: /// A dialog exported from a BPL (a VCL-specific kind of DLL) class PACKAGE MySharedDialog…
Wolf
  • 9,679
  • 7
  • 62
  • 108
1
vote
2 answers

How to get valid binary path for cppcheck?

I am trying to install cppcheclipse from this website: http://code.google.com/a/eclipselabs.org/p/cppcheclipse/wiki/Installation I have followed the instructions there, however, when trying to configure it, it says the there is no valid binary…
kaiven 123
  • 11
  • 1
  • 3
1
vote
1 answer

"<<" operand doesn't work with an array of string in visual studio2012

This is the class "Date.h" class Date { private: int day; int month; int year; public: void PrintDateV2(); Date(int, int, int); ~Date(); }; This is "Date.cpp" with the…
yshikita
  • 23
  • 4
1
vote
2 answers

Which error format should be used for Vim and Cppcheck?

I use the following script to integrate Cppcheck with gVim: " vimcppcheck.vim " =================================================================== " Code Checking with cppcheck (1) " …
1
vote
1 answer

searching a pattern with cppcheck (pcre) regular expression

I have a code snippet int t.c like val = (val1 << 8) | (val >> 8 ); val = (val2 << 16) | (val >> 8 ); val = (val3 << 32) | (val >> 8 ); val = (val << 8); I will get ouput if I grep as grep -nhE "(<<.*|).*(>>)" t.c 1:val = (val1 << 8) | (val…
dday
  • 47
  • 4
1
vote
2 answers

Clang static analyzer output in xml format

Is it possible to get output in XML format from Clang scan-build analyzer? Currently following command generates output in html format to view in webbrowser. scan-build xcodebuild -configuration Debug -sdk iphonesimulator CppCheck on windows…
1
vote
1 answer

cppcheck: same expression on both sides maybe wrong

#ifdef TEST #define INVALID_HANDLE_VALUE 0 #else #include #endif int main() { HANDLE hf = 0; if (hf==0 || hf==INVALID_HANDLE_VALUE) {} } above is my test code, when I use cppcheck.exe(1.58) to check this code, cppcheck will give me a…
oppo
  • 169
  • 8
1
vote
1 answer

Problems using C++ community plugin in sonar. Cppcheck doesn't work

sonar doesn't launch cppcheck when I use sonar-runner. I'm using the last version off all (sonar, c++ community pluguin and sonar-runner) in ubuntu 12.04. If someone has sonar working correctly with cppcheck (and the other plugins too, but now I…
user1248057
  • 11
  • 1
  • 4
1
vote
2 answers

Sending Cppcheck result/report on email from Jenkins using email-ext plugin

I'm trying to send cppcheck report on an email using email-ext plugin from a Jenkins build. So far, only way seems to be by creating a custom template -- jelly or groovy. From this post -- "Can I configure jenkins to send an email with a static…
wonderer
  • 11
  • 2
1
vote
1 answer

cppcheck does not detect resource leak due to include paths

Can anyone plz help? When I was analysing my source code simply via "cppcheck file" it out puts analysis results like Checking ../bst_hal/daemon_rls/src/event_handler.c... Checking ../bst_hal/daemon_rls/src/event_handler.c: CFG_ARCH_ARM... Checking…
yunfei
  • 526
  • 2
  • 6
  • 20