Commit Graph

27569 Commits

Author SHA1 Message Date
Oliver Stöneberg 9cf0342f9d
optimized `ProgramMemory` a bit (#5668)
Scanning `common/file.c` of the `xrdp` project with `--force --std=c11
--std=c++11 --inline-suppr --enable=warning`:

Clang 16 `4,208,373,435` -> `4,156,024,955`
GCC 13 `4,336,042,153` -> `4,277,293,971`
2023-11-16 14:35:25 +01:00
chrchr-github 85172fe770
Don't report checkLibraryUseIgnore for known functions (refs #7719) (#5664) 2023-11-16 14:23:08 +01:00
Swasti Shrivastava 1ce901385a
Fix #12172:False positive: misra-11.1 function pointer assigned to array (#5667) 2023-11-16 13:57:27 +01:00
Oliver Stöneberg 682901ac2a
fixed #10760 - added file name to ValueFlow `--debug` output (#5655) 2023-11-16 13:44:50 +01:00
Oliver Stöneberg 8b69ccadd4
CppCheckExecutor: extracted logging instance related code into separate implementation class (#5658) 2023-11-16 10:35:43 +01:00
Swasti Shrivastava 81a03e7341
Fix #12184: false positive: misra 11.6, cast expression '0U' to 'void*' (#5666) 2023-11-16 09:06:58 +01:00
Daniel Marjamäki ae3f7bd800
Fixed #12187 (Windows build GUI with cmake) (#5662) 2023-11-15 16:56:46 +01:00
Oliver Stöneberg d3a8eb1ae2
config.h: improved and cleaned up some preprocessor checks (#5663) 2023-11-15 15:31:12 +01:00
Oliver Stöneberg e7f8985173
disabled some expensive and/or unnecessary clang-tidy checks (#5660)
Running clang-tidy with `--enable-check-profile` provides an overview of
the run-time of each check. This revealed some checks which take a
considerable amount of time which could be disabled.

Here's the times for the checks in question. The times are very similar
across most files:
```
   ---User Time---   --System Time--   --User+System--   ---Wall Time---  --- Name ---
...
   0.4531 (  4.7%)   0.3906 (  6.1%)   0.8438 (  5.2%)   0.8127 (  5.1%)  misc-unused-using-decls
...
   0.3281 (  3.4%)   0.2344 (  3.7%)   0.5625 (  3.5%)   0.4509 (  2.8%)  modernize-macro-to-enum
...
   0.2188 (  2.2%)   0.2031 (  3.2%)   0.4219 (  2.6%)   0.3621 (  2.3%)  modernize-use-nullptr
```
2023-11-15 11:24:25 +01:00
chrchr-github 3bd5a034bd
Fix #12176 false positive: unassignedVariable (#5656) 2023-11-14 12:26:12 +01:00
chrchr-github 6ac804d209
Fix #12178 extern "C++" scope generates valueflow (#5654) 2023-11-14 10:02:41 +01:00
Oliver Stöneberg 9228b9e424
iwyu.yml: fixed `include-what-you-use` job / cleaned up includes (#5657)
As usual when the base clang version of a distro changes iwyu ends up
broken and needs additional packages and/or options applied to work
again.
2023-11-13 23:24:06 +01:00
Stefan van Kessel d3520943ad
Minor: fix msvc warning "not all control paths return a value" (#5650)
When building with /Od - default cmake debug build for me, the
__assume(false); trick does not work to get rid of the C4714 warnings

https://godbolt.org/z/a6xGnfP7d

D:\tmp\cppcheck\lib\keywords.cpp(205): warning C4715:
'Keywords::getOnly': not all control paths return a value
D:\tmp\cppcheck\lib\keywords.cpp(226): warning C4715:
'Keywords::getOnly': not all control paths return a value
D:\tmp\cppcheck\lib\keywords.cpp(168): warning C4715:
'Keywords::getAll': not all control paths return a value
D:\tmp\cppcheck\lib\keywords.cpp(188): warning C4715:
'Keywords::getAll': not all control paths return a value

Proposed fix: also define NORETURN to [[noreturn]] when according to
__has_cpp_attribute [[noreturn]] is supported
https://en.cppreference.com/w/cpp/feature_test

(For previous discussion see also
https://github.com/danmar/cppcheck/pull/5497)
2023-11-12 17:30:06 +01:00
orbitcowboy b201ef26cb
windows.cfg: Improved configuration of OpenThread() (#5653) 2023-11-12 11:37:29 +01:00
chrchr-github a6b7a8c1cc
Fix #12170 FP knownPointerToBool with function pointer (#5646) 2023-11-12 10:20:18 +01:00
chrchr-github 212d2141d3
Fix #12173 FP danglingTempReference with loop over init list (#5652) 2023-11-12 10:19:45 +01:00
orbitcowboy f4df28d5ec
windows.cfg: Improved configuration for OpenProcess(). (#5651) 2023-11-11 14:08:21 +01:00
chrchr-github 2d232dcaac
Fix varid0 with rvalue reference typedef (#5649) 2023-11-11 10:09:08 +01:00
chrchr-github 328daeceb4
Fix #11334 debug: varid0 with anonymous union (#5648) 2023-11-11 10:01:03 +01:00
Daniel Marjamäki 282c195a6f
Fix #12169 (False positive: wrong misra-config variable with accessing object in memory) (#5645) 2023-11-09 12:25:42 +01:00
Oliver Stöneberg b0cde34d1a
refs #12167 - moved ordering of markup files into shared code / removed related test cases from executor tests (#5642)
This is not completely fixing the issue yet. `test-qml.py` still fails
when using multiple threads.
2023-11-09 10:17:30 +01:00
chrchr-github d24074f7b1
Fix #12166 debug: varid0 with reference typedef (#5643)
Why do we even split any declarations in the first place?
2023-11-09 10:11:34 +01:00
Daniel Marjamäki 780b742568
Fix #12165 (simplifyTypedef: the "enum" token is not inserted) (#5641) 2023-11-09 07:48:33 +01:00
chrchr-github 30bf5cac0a
Partial fix for #12162 false negative: functionConst (#5639) 2023-11-08 22:37:45 +01:00
Daniel Marjamäki 8f432880fa
Fix #12164 (False positive: operator precedence warning even though there are parentheses) (#5640) 2023-11-08 18:54:40 +01:00
Daniel Marjamäki 617b7a39cd
Fix #12163 (misra.py: crashes when ctu-info line does not have certain attributes) (#5638) 2023-11-08 15:23:50 +01:00
chrchr-github 1fa785d81d
Fix #12159 FP CastAddressToIntegerAtReturn with std::future (#5634) 2023-11-08 13:12:50 +01:00
Oliver Stöneberg f61003d954
scriptcheck.yml: make dmake a separate job and run it on multiple platforms (#5632)
This is essentially an unit test for the `FileLister` so we should make
sure we have proper coverage.
2023-11-08 09:29:40 +01:00
Oliver Stöneberg 2a15428096
fixed #12059 - added `--fsigned-char` and `--funsigned-char` command-line options (#5580) 2023-11-08 09:28:33 +01:00
chrchr-github cf64ccea22
Fix #12147 false negative: passedByValue (#5626) 2023-11-07 22:50:31 +01:00
Oliver Stöneberg bc174c502a
fixed #12145 - provided order of source files is not preserved (#5625) 2023-11-07 21:21:24 +01:00
Daniel Marjamäki 8c63c8ced1
Fix #12156 (AST: do not create AST for variable declaration 'bool& var') (#5631) 2023-11-07 20:48:56 +01:00
Oliver Stöneberg 87886576fc
TokenList: actually consider configured standard in `isKeyword()` (#5619) 2023-11-07 20:39:44 +01:00
chrchr-github d3d70dcc4e
Fix #12157 SymbolDatabase: Token::type() is not set properly when inn… (#5635)
…er enum has same name as outer class
2023-11-07 19:57:45 +01:00
Daniel Marjamäki c1aed9681d
Fix #12151 (Tokenizer::arraySize: enum constant used as index in array initialization) (#5633) 2023-11-07 19:19:19 +01:00
chrchr-github 13e74507dd
Update releasenotes.txt [skip ci] (#5636) 2023-11-07 15:11:41 +01:00
chrchr-github d26022ac9a
Fix #11302 debug: SymbolDatabase::isFunction found C function 'main' without a return type. (#5630) 2023-11-06 21:03:11 +01:00
chrchr-github a57fc9ace6
Partial fix for #12153 FN returnReference (#5629) 2023-11-06 20:29:13 +01:00
Oliver Stöneberg 704b862a2d
cleaned up the file filtering code and improved testing of it (#5622) 2023-11-06 19:06:22 +01:00
chrchr-github de2cfb05b0
Fix #12150 FP uninitialized member array, initialized in range for loop (#5627) 2023-11-06 16:15:47 +01:00
Daniel Marjamäki fc8c244675
CI: Add selfcheck using Cppcheck Premium. Activates Misra C++ 2008 and Cert C++ 2016 checkers. (#5623) 2023-11-06 15:31:47 +01:00
chrchr-github 83ac6bfa0f
Fix crash when calling estimateSize() (f'up to #12139) (#5628) 2023-11-06 15:22:59 +01:00
orbitcowboy 966a89d5f4
Removed -DTIXML_USE_STL flag (#5624)
Updated version of https://github.com/danmar/cppcheck/pull/5145
2023-11-05 15:54:22 +01:00
Daniel Marjamäki 0dc53ac7fe
Fix #12144 (Error messages from addons has the wrong file0) (#5621) 2023-11-04 17:07:30 +01:00
chrchr-github 72a36172aa
Fix #12142 FP uninitStructMember, unreadVariable with pointer to member (#5618) 2023-11-04 13:40:06 +01:00
chrchr-github fa7891e37b
Fix #12139 FP redundantCopyLocalConst for small type (#5617) 2023-11-04 13:38:02 +01:00
chrchr-github 789c032e42
Fix #12138 FP passedByValue with anonymous union (#5611) 2023-11-04 13:34:08 +01:00
Oliver Stöneberg df860a937d
do not explicitly load `windows.cfg` during command-line parsing (#5613)
As we now fail early on loading of all libraries we no longer need to
explicitly bail out on mandatory ones. This would have also caused
`libraries` and `library` to go out-of-sync and possibly lead to
duplicated loading of the library. It also allows for a
`CppCheckExecutor` to be made private.
2023-11-04 13:33:10 +01:00
Oliver Stöneberg ca6d1aafdb
moved `fileSettings` out of `Settings` (#5608)
Moved the `FileSettings` out of the `Settings` and pass them around
explicitly. They can never be specified at the same time and are used
exclusively. The code hasn't been fully adjusted to reflect this as this
is only the refactoring without any functional changes.
2023-11-03 23:24:04 +01:00
Oliver Stöneberg 8b0916c319
ValueFlow: improved `checkLevelNormal` message (#5584) 2023-11-03 21:05:56 +01:00