Commit Graph

14826 Commits

Author SHA1 Message Date
Oliver Stöneberg 8e1ae7e412
CmdLineParser: various refactorings and cleanups as well as testing improvements (#5676) 2023-11-25 21:12:24 +01:00
Oliver Stöneberg 86bb7c98e4
enabled and mitigated `readability-const-return-type` clang-tidy warnings (#5644) 2023-11-24 18:45:48 +01:00
chrchr-github 331db40d3b
Revert recent changes in checkConstVariable(), add tests (refs #12203) (#5696) 2023-11-22 19:20:56 +01:00
chrchr-github 83b5cb5b2f
Fix #12203 false negative: constParameterReference when taking address (#5682) 2023-11-22 14:05:53 +01:00
Daniel Marjamäki 727d086dc4
Fix #12217 (misra 11.4: report conversion in macro) (#5692) 2023-11-22 12:47:48 +01:00
chrchr-github 8b6cbe2e9e
Fix crash in SymbolDatabase::addClassFunction() (f'up to #12209) (#5689) 2023-11-21 12:57:38 +01:00
Oliver Stöneberg 2b61c9ef2f
Tokenizer: moved `VariableMap` into anonymous namespace (#5686) 2023-11-21 11:35:17 +01:00
chrchr-github f5630e7049
Fix #12209 "debug: Executable scope 'x' with unknown function." with anonymous namespace (#5688) 2023-11-20 22:28:38 +01:00
chrchr-github f9521cfb4e
Fix #12208 FN constParameterReference with nested struct/class (#5685) 2023-11-20 22:01:22 +01:00
chrchr-github d09a6514cd
Fix #11012 FP unassignedVariable when passed in init list (#5684) 2023-11-20 19:43:29 +01:00
chrchr-github d7c7a39afe
Fix crash in CheckLeakAutoVar (f'up to #12186) (#5683) 2023-11-20 18:26:05 +01:00
Daniel Marjamäki 036df0aca9
Fix #12181 (Suppressions: allow that id with * is added) (#5681) 2023-11-20 11:54:41 +01:00
chrchr-github cd21918520
Fix FP memleak with outparam allocation (f'up to #12186) (#5677)
I wonder if it is worth trying to get this right. We also have FPs when
the return value is assigned to a variable, and that seems much harder
to fix.
2023-11-19 19:51:32 +01:00
Daniel Marjamäki 56c7ac3771
Fix #12182 (speedup valueFlow by only running valueFlowNumber once) (#5678) 2023-11-19 18:56:48 +01:00
chrchr-github 61bd8fddbf
Partial fix for #11469 FP mismatchingContainerExpression warning (#5674) 2023-11-17 17:12:38 +01:00
chrchr-github 3e47acd580
Fix FP memleak (f'up to #12186) (#5671) 2023-11-16 18:35:32 +01:00
chrchr-github 4b9f3c68fb
Fix #12188 FN uninitvar with increment of struct member (#5665) 2023-11-16 18:11:12 +01:00
chrchr-github 831aec5c03
Fix #12185 FN constVariablePointer with stream (#5659) 2023-11-16 17:43:20 +01:00
Daniel Marjamäki e01e090f1c
Fix #10866 (no preprocessorErrorDirective and code generated in case of unconditional #error) (#5670) 2023-11-16 17:25:49 +01:00
Oliver Stöneberg e47300016b
moved some classes/structs into anonymous namespace (#5669) 2023-11-16 15:49:41 +01:00
chrchr-github 63a5a71c20
Fix #12186 FN memleak with outparam allocation (#5661) 2023-11-16 15:23:40 +01:00
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
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 d3a8eb1ae2
config.h: improved and cleaned up some preprocessor checks (#5663) 2023-11-15 15:31:12 +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
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
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
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
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
chrchr-github 1fa785d81d
Fix #12159 FP CastAddressToIntegerAtReturn with std::future (#5634) 2023-11-08 13:12:50 +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 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
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
Daniel Marjamäki 0dc53ac7fe
Fix #12144 (Error messages from addons has the wrong file0) (#5621) 2023-11-04 17:07:30 +01:00