👌 Improved C++ parser:
- wrong operands in ast
- 👍 better simplification of templates
👌 Improved clang import, various fixes.
👌 Improved value flow analysis
🛠 Fixed false positives
👌 Improved configuration in library files
- ✅ googletest.cfg
- 🏁 windows.cfg
➕ Added several Misra rules:
➕ Added platforms:
- elbrus e1c+
🆕 New checks:
- 🔒 incorrect usage of mutexes and lock guards
- Dereference end iterator
- Iterating a known empty container
- outOfBounds check for iterators to containers
✂ Removed 'operator=' check that ensures reference to self is returned. That is not about safety.
👌 Improved parser
- 🛠 various ast fixes
📜 Clang parser
- The Clang import feature in Cppcheck should be considered to be experimental for now. There are problems.
👌 Improved bug hunting
- variable constraints
- handling of multidimension arrays
- function calls, execute functions that are in same TU
- 👌 improved handling of containers
- several improvements for uninitialized variables check
- 👌 improved analysis of for loops
- ➕ added a hash value for warnings that can be used for suppressions
👌 Improved data flow
- one more heuristic for ternary operators
- 👌 improved data flow for containers
- 🛠 Fixed some addon execution problems when there are spaces etc
- 🛠 Fix handling of tags
- Exclude files
- several result files can be combined into 1 output
- comments can be added at end of suppression in suppressions file
🚀 This is a minor release.
🏗 We have tweaked build scripts.
- 👍 When you use USE_Z3=yes, we will handle new versions of z3 better. If you have an old z3 library and get compilation problems you will need to add a z3_version.h in externals.
- ⚡️ The cmake scripts was updated.
🛠 There was a couple of bug fixes.
🆕 New check:
- for "expression % 1" the result is always 0.
💻 The command line is not changed drastically. Your old cppcheck scripts should work as before.
Compiling: There is a new dependency Z3. When compiling with the Makefile it is highly recommended to use "USE_Z3=yes".
👌 Improved clang-tidy integration
🛠 Several fixes to;
- 👌 improve parsing
- detect more bugs with existing checks
- 🛠 fix false alarms
📜 Clang is a C/C++ compiler that has a very robust and well made parser.
0️⃣ Cppcheck will always use its internal parser by default. However there is now an option to use the Clang parser instead.
0️⃣ It is recommended that you use the default internal Cppcheck parser unless you notice that it fails to parse your code properly (syntax errors, strange false alarms).
🐛 Bug hunting
There is a new "soundy" analysis in Cppcheck that should detect most bugs. You should expect false alarms, however the false alarms will not be overwhelming.
This new "soundy" analysis is not intended to replace normal Cppcheck analysis. There are use cases where false alarms can not be tolerated.
We have added 1 checker and that checks for division by zero:
- ✅ It detects all "integer division by zero" bugs in the Juliet test suite.
- ✅ It detects all "division by zero" bugs in the ITC test suite.
- 👀 There was 28 division by zero CVEs published in 2019 for C/C++ open source projects, and we could quickly see that 21 of the bugs are found by Cppcheck. There is no CVE bug that we know Cppcheck fails to diagnose. But there are 7 CVEs that would require additional investigation to establish if it is really detected or not.
You can read more about this analysis in the "Bug hunting" chapter in the manual.
🆕 New check:
- alias to vector element invalid after vector is changed
👌 Improved checking:
- 👌 improved value flow analysis for struct members
- 👌 improved value flow analysis for pointer alias
- ➕ Added ENV33-C: Do not call system()
- ➕ Added rule 2.7
- ➕ Added rule 3.2
- ➕ Added rule 4.2
- ➕ Added rule 14.2
- ➕ Added rule 21.1
- ➕ Added rule 21.12
💻 Command line:
- ⚠ The default warning message format was changed. The new format is similar to GCC. If you want to get warnings in the old format, add --template=cppcheck1 to the command line.
- From now on, use FILESDIR instead of CFGDIR to specify the path for Cppcheck data files. The readme.txt describes the available flags.
👌 Improved checking:
- 👌 improved value flow analysis for pointer aliases
- 👌 improved checking for uninitialized variables/structs
- 👍 better checking of smart pointers
- 👍 better checking of global variables
- Added Cppcheck annotations cppcheck_low (VALUE) and cppcheck_high (VALUE)
- shadow variables; warn when argument is shadowed
- warn if local reference variable can be const
- ➕ Added API01-C: Avoid laying out strings in memory directly before sensitive data
- ➕ Added MSC24-C: Do not use deprecated or obsolescent functions
- ➕ Added STR11-C: Do not specify the bound of a character array initialized with a string literal
- ➕ Added rule 17.2
- ➕ Added rule 18.4
- ➕ Added rule 18.7
- Minor tweaks
🆕 New checks:
- Comparing pointers that point to different objects
- ➕ Address of local variable 'x' is accessed at non-zero index
- STL usage: unnecessary search before insertion
- Duplicate expression for condition and assignment: if (x==3) x=3;
➕ Added --library configuration files for:
👍 Better handling of C++14 and C++17
💻 Command line:
- 🆕 New command line option --addon used to run addons directly from Cppcheck.
- Some advanced options are only available in GUI:
- remove unused declarations in header files to speedup analysis
- remove unused templates to speedup analysis
- when checking visual studio project, only check 1 configuration
- max whole-program-analysis call stack depth
💻 To get these features in command line tool, create a GUI project file and import that on command line using --project.
- 👍 started implementing theme support
🏗 Please use MATCHCOMPILER=yes instead of SRCDIR=build when compiling to enable the match compiler.
- ➕ add check exp15-c
- ➕ add check str03-c
- ➕ add check str05-c
- ➕ add check str07-c
- ➕ Add check 17.7
- ➕ Add check 20.7
- ➕ Add check 20.10
💻 Command line interface:
- --project can now import Cppcheck GUI projects.
🆕 New checks:
- Condition is always true when array address is compared with 0.
- function argument expression calculation has known result (#8830)
- 👍 Better lifetime checking (using pointer/reference that points at deleted object)
- 👌 Improved whole program analysis
- 👍 Better handling of language extension [email protected].
- 📜 Many improvements in parser to handle templates, type aliases, etc better
- 🆕 new configuration for boost
- 🔧 much better wxwidgets configuration
- 🆕 New addon for checking naming conventions. Naming conventions are configured in json file.
According to [email protected] Cppcheck-1.87 is in average 10% faster than Cppcheck-1.86.
- 🛠 Many fixes in the template simplifier
- 🛠 Several fixes in the abstract syntax tree.
- 🆕 New check: passing address of char to function that expects a strz
- 🆕 New check: shadow variables
- 👌 Improved lifetime checking
- 👌 Improved STL iterators checking
- 👌 Improved data flow analysis
🆕 New libraries:
- ✅ googletest
- 🛠 misra.py: Fixes for suppressions and exclusions
- namingng.py: New addon to check naming conventions. Rules are specified in json file.
- 👍 We are modernizing the Cppcheck code. Support for MSVC 2010 and GCC 4.4 is dropped. You now need a compiler that is at least as good as MSVC 2013 or GCC 4.6.
- According to "[email protected]" (http://cppcheck.osuosl.org:8000)
- There are fewer crashes.
- Cppcheck-1.85 is ~25% slower than Cppcheck-1.84
- 🆕 New check: Suggest STL algorithms instead of hard-coded for loops
- 🆕 New check: Warn about ineffective algorithms (same iterator passed)
- 🆕 New check: Mismatching iterators used together in operators
- Container (STL/Qt/WxWidgets/etc) access out of bounds
- 👌 Improved the checkers that warns about same/opposite expressions, track variable values better.
- logical conjunctions
- identical/opposite inner expressions
- same expressions around operator
- Variable scope: warn about references also
Graphical user interface:
- You can specify undefines in the project file dialog
- 🛠 Fixed configuration of suppressions
- 🏁 Windows: Fixed issue of wrong/no theme being applied to UI elements
- 👌 support per file excludes from cppcheck
- 👌 support per file suppressions from cppcheck
- summary will now summarize results for all files again
- 🛠 a few false positives were fixed