Commit Graph

12817 Commits

Author SHA1 Message Date
chrchr-github 1eee68f039
Fix FN deallocuse with function call (refs #11409) (#5822) 2024-01-04 22:10:24 +01:00
Oliver Stöneberg 87540e6ca6
testrunner: do not suppress duplicated error messages (#5736) 2024-01-04 21:46:42 +01:00
Oliver Stöneberg b2e0b3b425
refs #12171 - start generating unmatched suppressions with `FileSettings` / improved TestSuppressions / some cleanups (#5827) 2024-01-04 21:32:21 +01:00
Oliver Stöneberg 615e4c01c4
bumped minimum requirements to GCC 5.1 / Clang 3.5 / Visual Studio 2015 / CMake 3.5 (#5398)
The current versions only have partial C++11 support which fortunately
has caused us only few issues so far but it would be good to finally
have fully working C++11 support. This also gets rid of several CI
builds on very outdated platforms.

The outdated platforms were used to also test CMake 2.8 but as future
versions of CMake will drop combability with CMake < 3.5 this is a good
time to also drop that requirement on our part.

This PR does not remove or update any outdated code.
2024-01-04 21:31:08 +01:00
chrchr-github f24c7fdae9
Fix #12311 FP duplInheritedMember for const overload (#5829) 2024-01-04 20:59:09 +01:00
chrchr-github 73187e6e12
Fix #11998 FN (regression): comparisonError (#5826) 2024-01-04 20:58:39 +01:00
Maarten van der Schrieck 21a9de7d42
addons/namingng.py: Reinstate dict-with-regexps, cosmetic overhaul. (#5824)
`namingng.py` somewhat supported specifying a dict instead of a list for
regular expressions, until the feature was broken by a patch of mine
recently. This PR contains a patch rewriting the feature and expanding
relevant unit tests.

To improve maintainability, a second patch is added that refactors the
code for better readability and structure.
2024-01-04 16:26:54 +01:00
chrchr-github 481d4578ab
Fix #12301 FP doubleFree with GTK functions (#5823) 2024-01-04 11:02:59 +01:00
thingsconnected 8261ded475
addons/namingng.py: Improve output and unit test. (#5820)
For naming issues reported, column was always set to `0`, which is now
fixed.

Global variable naming errors were reported as "Public member" issues,
which is also fixed.

The unit test now covers namespaces, class names, public and private
member variables.
2024-01-03 14:00:47 +01:00
chrchr-github 5e59652fd3
Add tests for #1644, #3929, #6109 (#5821) 2024-01-03 11:50:28 +01:00
Oliver Stöneberg dd869cf808
added CMake option `EXTERNALS_AS_SYSTEM` to treat external includes as `SYSTEM` ones (#5386)
Although these files are part of our repo changes are being done via
their original projects so it might make sense to treat these as system
includes for some people instead of local ones.

Co-authored-by: Daniel Marjamäki <daniel.marjamaki@gmail.com>
2024-01-03 11:05:32 +01:00
chrchr-github 8d64d12e5d
Fix #12252 Regression: constParameterPointer (#5819) 2024-01-02 20:07:35 +01:00
chrchr-github 14627ca6d2
Add tests for #2199, #11207, #11464 (#5817) 2024-01-02 15:49:47 +01:00
thingsconnected 98b9244bcb
addons/namingng.py: Add tests for include guards, config file validation. (#5815)
Include guard naming can be validated against various patterns:
- prefixes/suffixes (`_FILE_H`, `PROJECT_FILE_H`, `FILE_H_`)
- basename/full path (`FILE_H`, `SUB_DIR_INC_FILE_H`)
- upper- or lowercase (`FILE_H`, `file_h`)
- any combination of the above (`project_sub_dir_inc_file_h_`)

A regexp can be specified to match header filenames. The example matches
any filename not starting with / and ending with `.h`, intended to match
C header files while exluding system files.

The test is not limited to naming only; validity and presence of include
guards can also be tested by setting `"required":true` in the config
file.

Enabling this feature requires adding the key `"include_guard"` to the
namingng config file used.

The namingng unit test is extended to test various features of the
include guard test.

Also, config handling is improved, adding (superficial) validation and a
unit test.
2024-01-02 15:01:02 +01:00
chrchr-github d9d23d979d
Partial fix for #12302 internalAstError using lambda (#5816) 2024-01-02 13:33:22 +01:00
thingsconnected 24133d4a59
addons/namingng.py: Fix commandline use. (#5793)
namingng.py was only usable in standalone mode, but now supports CLI
mode, i.e. with cppcheck --addon=namingng. It uses the generic reporting
provided by cppcheckdata.reportError(). All output other than reported
errors is suppressed.

A local function reportNamingError() is implemented to call through to
cppcheckdata.reportError(), filling in common defaults.

The collection of errors and the --verify feature are removed, including
related workflow and a test file. These are replaced by a unit test.
2023-12-30 20:54:03 +01:00
Paul Fultz II 4d9e69e42c
Fix 11985: False positive: uninitvar (valueflow) (#5781) 2023-12-27 18:11:57 +01:00
thingsconnected 403e7f1f7d
lib/addoninfo.cpp: When loading a JSON addon, test 'script' key. (#5797)
In case a user accidentally uses a wrong JSON file (e.g. naming.json,
which is the config file for namingng.py), the code could give a
confusing exception. This happens when the key 'script' is not defined
as a string.

This is solved by testing the key for existence and type. In case
'script' is not a key or refers to a type other than a string, a clear
error is given, stating for example: 'Loading naming.json failed. script
must be set to a string value.'

The message is kept in line with other messages. Maybe it can be
clarified further, e.g. 'Loading naming.json failed. A key "script" must
be set with a string value referring to a Python script.' - in which
case the errors relating to other keys may also be clarified.
2023-12-25 05:49:17 +01:00
chrchr-github a7baf88d4f
Fix #12289 FN (regression): memory leak not shown when strcpy is used (#5809) 2023-12-24 14:42:07 +01:00
olabetskyi e553940e23
#12158: improve check: variableScope is not reported when there is el… (#5758)
variableScope is not reported when there is else if
2023-12-24 14:01:01 +01:00
chrchr-github 9118d330d3
Fix test failure on 32bit platform (#5803) 2023-12-23 20:59:59 +01:00
chrchr-github 17ee4093fa
Fix #10905, #11665 FN deallocuse (#5751) 2023-12-23 11:31:27 +01:00
Paul Fultz II 7f0234e7d5
Fix 12032: False positive: uninitialized variable, flags with same value (#5754) 2023-12-23 10:57:40 +01:00
Paul Fultz II 77157a678a
Fix 12033: false negative: uninitialized data passed as const data to function (#5747) 2023-12-23 10:55:39 +01:00
Daniel Marjamäki 5a222b80a1
CI: fix --version tests (#5790) 2023-12-22 19:57:55 +01:00
Daniel Marjamäki 49da3e3821
Fixed #12281 (IDE plugin integration is broken by checkers report) (#5779) 2023-12-19 15:55:29 +01:00
Daniel Marjamäki 5aa1710dd0
Fix #12071 (Add safety mode that makes cppcheck more strict about critical errors) (#5777) 2023-12-18 18:26:23 +01:00
Oliver Stöneberg aa7629d969
aligned and optimized unique error handling (#5280)
The handling in `CppCheck::reportErr()` and `Executor::hasToLog()` was
slightly different. I hope this can somehow be shared after the executor
reworking.

We were also using a very inappropriate container for the error list
which caused a lot of overhead.

`-D__GNUC__ --debug-warnings --template=daca2 --check-library -j2
../test/testsymboldatabase.cpp`

Clang 15
main process  `284,218,587` -> `175,691,241`
worker process `9,123,697,183` -> `8,951,903,360`
2023-12-17 21:59:06 +01:00
Daniel Marjamäki 2932ab7592
Revert "Fixed #12071 (suppressing critical error, no indication to user that analysis of file fails) (#5771)" (#5775)
This reverts commit 7c316fb76d.
2023-12-17 19:13:14 +01:00
Daniel Marjamäki 7c316fb76d
Fixed #12071 (suppressing critical error, no indication to user that analysis of file fails) (#5771) 2023-12-17 15:42:17 +01:00
Oliver Stöneberg 086ceea333
fixed #12111 - memory leak with `-j2` and `--cppcheck-build-dir` (#5589) 2023-12-17 15:07:13 +01:00
Oliver Stöneberg f2622a673f
more cleanups in handling of ignored files (#5767) 2023-12-16 21:04:45 +01:00
Paul Fultz II ef27c29f27
Fix assertion failure in evalSameCondition (#5770) 2023-12-16 19:27:26 +01:00
olabetskyi 7191ed92b9
#12263: Constant Error 'missingInclude' (#5769)
Small adjustment of the log of the error.

- printed only when there was `--enabled=information` and no mentioning
of `missingInclude`
2023-12-16 18:38:30 +01:00
chrchr-github 3329e2f633
Fix #11741 FP knownConditionTrueFalse minus/negation confuses check (#5766) 2023-12-16 17:03:56 +01:00
Oliver Stöneberg 1135520aa8
run more tests in sanitizer workflows (#5744) 2023-12-16 17:03:03 +01:00
olabetskyi 42547aac9e
REOPENED #12260 (false positive: unusedVariable with side effects in member initialization) (#5764) 2023-12-15 11:35:55 +01:00
chrchr-github 02fed7a266
Fix #12235 performance regression (hang) in 2.13dev (#5715)
Co-authored-by: chrchr-github <chrchr@github>
2023-12-15 11:01:08 +01:00
Oliver Stöneberg fcb41e2533
small cleanup of handling of ignored paths (#5757) 2023-12-14 16:55:42 +01:00
olabetskyi 61127950b0
Fixed #12260 (false positive: unusedVariable with side effects in member initialization) (#5762)
revert old changes
2023-12-14 15:16:30 +01:00
chrchr-github 8205b4a4b3
Fix #10572 FP nullPointerRedundantCheck with try/catch / #10701 FP knownConditionTrueFalse with nested try/catch (#5761) 2023-12-13 19:22:54 +01:00
chrchr-github b26b78b86d
Fix #12258 Assert failure in setSymbolic() (#5759) 2023-12-12 22:37:33 +01:00
chrchr-github 2c54f31bfe
Fix #12251 internalError while cppcheck tries to parse Clang AST (#5755) 2023-12-12 20:47:58 +01:00
chrchr-github 30e8814ecb
Fix #12255 Crash in executeMultiCondition() (#5752) 2023-12-11 17:15:21 +01:00
Paul Fultz II 243fa66bd3
Fix 12031: False positive: uninitialized variable (#5637) 2023-12-10 19:42:35 +01:00
chrchr-github 233e27b579
Add tests for #8399/#10646/#10833 (#5743) 2023-12-09 00:36:55 +01:00
Oliver Stöneberg 7452e681dd
fixed #12221 - de-duplicate input source files (regression) (#5740) 2023-12-08 22:17:22 +01:00
Daniel Marjamäki 1af83ad821
Fix #12091 (False negative: Uninitialized variable read in subfunction (regression)) (#5739) 2023-12-08 21:54:23 +01:00
chrchr-github f5109df632
Add tests for #9822/#9823 (#5742) 2023-12-08 21:20:10 +01:00
chrchr-github 1bdb7133e8
Fix #9684 New check: find unnecessary copy in range loop (#5738) 2023-12-08 16:58:43 +01:00