cppcheck Questions

3

Recently, I had the following struct data { std::vector<int> V; }; data get_vector(int n) { std::vector<int> V(n,0); return {V}; } The problem with this code is that when the st...
Mandamandaean asked 2/1, 2020 at 8:38

2

Solved

I am not asking about the various available third-party modules that support Cppcheck in one way or the other. With CMake 3.10, CMake seems to have gained some official Cppcheck support. See CMAKE_...
Sou asked 5/2, 2018 at 15:6

2

Solved

With clang-tidy static analyzer I can keep a file (.clang-tidy) in the root of the project with the warnings I want to activate or deactivate. clang-tidy will look for this file (as far I know) and...
Kuban asked 21/9, 2021 at 16:0

6

I've been trying to use clang-modernize with CMAKE_EXPORT_COMPILE_COMMANDS as recommended in the help of this tool. With this option cmake generates a JSON file containing compile info like includ...
Cerate asked 18/11, 2013 at 22:51

3

Is there way to get rid or find by linting (or maybe seding/regexping) these nasty situations when your have just one line of code after if/for statement, without curly braces? Like this one: if(co...
Disillusionize asked 27/1, 2023 at 8:4

6

I'm trying to install Cppcheck via telnet on a Linux box. I have the cppcheck-1.67.tar file and I untar it. I don't see anything that will install it for me. Am I approaching this the correct way? ...
Orcutt asked 18/12, 2014 at 17:20

2

Solved

I found that --suppress=unmatchedSuppression only suppresses unmatched suppression types in cppcheck options, but NOT unmatched inline suppressions. Is this the expected behavior? test.c Li...
Gen asked 9/12, 2016 at 16:16

4

Solved

I use cppcheck on a project using the boost library. The headers in this library contain a huge amount of macro that I don't even use in my sources. Nevertheless, cppcheck explore paths depending o...
Rienzi asked 2/11, 2015 at 9:3

2

Solved

I have a dependency as source in my project that I have no control over. I'm using cmake's clang-tidy integration to analyze my code, and this dependency is firing A LOT of warnings. Is there a way...
Wabash asked 31/3, 2018 at 19:54

2

I created a project in CppCheck named CppCheck_MainRls.cppcheck that includes several directories, i can run the project from the gui and it's working. my project is huge so i only need a few direc...
Orthodontia asked 8/1, 2014 at 7:8

7

Solved

I already found out with another question that Windows/MingW doesn't provide the nanosleep() and setitimer() alternatives to the obsolete usleep(). But my goal is to fix all warnings that cppcheck ...
Plumbago asked 27/4, 2011 at 9:15

3

I am using Cppcheck GUI to scan my projects (new in Cppcheck, just starded to use it) and want to exclude some sub folders when I am scanning my project. How to exclude some sub folder when scanni...
Murrain asked 20/6, 2015 at 13:5

6

If i launch my cppcheck i get following error: cppcheck ListLib.c (information) Failed to load std.cfg. Your Cppcheck installation is broken, please re-install. The Cppcheck binary was compiled w...
Steenbok asked 18/3, 2014 at 17:22

1

Solved

I'm struggling with a warning that cppcheck (version 1.85 on a Linux machine) is reporting: someFile.h:23:29: warning: Redundant code: Found a statement that begins with string constant. [constS...
Gilges asked 1/11, 2018 at 10:23

3

Solved

Cppcheck allows you to create your own rules files, but I don't know how much of cppcheck's functionality is exposed. Is anyone working on a set that would enforce JSF or MISRA rules?

1

I have a semi-large Visual Studio solution, with a series of different build configurations, and various platforms. I really only want to check one or two configurations, on a single platform. Howe...
Burtonburty asked 27/3, 2017 at 15:27

3

I call cppcheck on our own files in our source base. However, some source files include header files from third party libraries, say from ./lib/some_library/. These are automatically parsed by cppc...
Satiny asked 3/6, 2016 at 8:36

2

Solved

Since version 1.80, Cppcheck tells me that Expression 'msg[ipos++]=checksum(&msg[1],ipos-1)' depends on order of evaluation of side effects in this code sequence (simplified, data is a var...
Blackington asked 29/8, 2017 at 11:22

0

Tools: SonarQube Server 6.0, Sonar Scanner 3.0.3, Jenkins running on a Linux Build Slave with pipeline format, CppuTest, gcovr, Bitbucket, git, JDK 8 Problem: The Coverage measure on the sonarqube...
Confiscable asked 23/8, 2017 at 20:9

4

Solved

In a C/C++ hybrid project, I found some code that I could reduce to #include <mem.h> struct StructContainingDouble { double d; /// other elements omitted }; void clear(StructContainingDou...
Yttrium asked 3/8, 2017 at 10:23

0

I want to make a plugin which runs cppcheck tool inside a Sensor class. In order to reuse an existing and supported plugin I would like to use sonar-cxx plugin to import my plugin's results. How d...
Ecclesiastic asked 29/6, 2017 at 15:12

3

I try to run a cppcheck analysis over my code, which has the following file structure: /code/module_1/src/a.cpp /code/module_1/src/b.cpp /code/module_1/test/c.cpp /code/module_2/src/d.cpp /code/mo...
Frieder asked 21/5, 2015 at 13:25

1

I would like to redirect the output of cppcheck to a text file. It prints a lot of information to stdout but if I run cppcheck --enable=all --verbose . > /srv/samba/share/tmp/cppcheck.out, I do ...
Barometry asked 7/6, 2017 at 18:23

1

On a recent bug hunt, I found an issue with returning a pointer to a member of a temporary variable. The offending (simplified) code was: struct S { S(int i) : i(i) {} int i; int* ptr() { retur...
Vibrate asked 8/11, 2016 at 21:16

2

Solved

I use cppcheck for static code analysis in my project and TeamCity for continuous integration. It would be nice if build server didn't build the project when cppcheck finds some errors or warnings....
Antarctica asked 6/9, 2013 at 14:54

© 2022 - 2024 — McMap. All rights reserved.