Daniel Marjamäki
915ae4b845
ValueFlow: Fix crash
2022-03-02 21:12:37 +01:00
chrchr-github
9c50136571
Fix #10824 FN unreadVariable for pointer assignment when destructor exists (regression) ( #3864 )
...
* Fix #10824 FN unreadVariable for pointer assignment when destructor exists (regression)
* unused variable
* Issue warning for missing cfg
* Format
2022-03-02 11:11:44 +01:00
Oliver Stöneberg
4a63af02ed
enabled functionConst and functionStatic in selfcheck ( #3862 )
...
* fixed functionConst findings and enabled it in selfcheck
* fixed functionStatic findings and enabled it in selfcheck
* .travis_suppressions: adjusted comment
* testimportproject.cpp: added missing asserts
2022-03-02 07:46:47 +01:00
chrchr-github
8e8e6b1170
Fix FP operatorEqVarError with class hierarchy ( #3868 )
2022-03-02 07:46:23 +01:00
chrchr-github
01de8256ea
Fix #10798 cppcheckError with enum class and typedefs ( #3867 )
...
* Fix #10798 cppcheckError with enum class and typedefs
* Format
* Format
* Leave enum class scope
* Remove comment
2022-03-02 07:46:15 +01:00
chrchr-github
43fb3dd047
Fix regression: wrong varid with using namespace ( #3866 )
...
* Fix #10059 missing varId with using namespace
* Undo
* Fix test
* Limit namespace candidates, duplicateBranch
* rvalue ref
* Undo
* Undo
* Undo
* Format
* Fix condition
* Fix regression: wrong varid with using namespace
2022-03-02 07:46:04 +01:00
Paul Fultz II
0b310b9d07
Fix 10702: FP knownConditionTrueFalse - Member variable modified ( #3857 )
...
* Fix 10702: FP knownConditionTrueFalse - Member variable modified
* Format
* Make parameter const
* Fix FP
* Fix FP
* Update
* Format
2022-02-28 18:54:55 +01:00
chrchr-github
6a8bd981b5
Fix #10825 CheckClass::isMemberVar found used member variable with varid 0 ( #3863 )
...
* Fix #10825 CheckClass::isMemberVar found used member variable with varid 0
* Restore call to simpleMatch()
2022-02-28 18:28:23 +01:00
José Martins
b1e92fc399
Misra false positive fixes for rules 8.7 and 5.9 ( #3844 )
...
* Fix misra 8.7 false positives on single function usage
When there is a single usage of a function, we should first check if the
file it is used in, is the same one it was defined in. When this is not the
case, there is no violatior to be reported.
* Fix misra rule 5.9 false positives for exception
The exception for rule 5.9 described in the guidelines allows for
multiple definitions of internal linkage obejcts when these regard a
static inlined function defined in the same header file.
* Fix neglecting of inline keyword flag upon simplifications
When the inline keyword is being "simplified" and the inline flag is
degated to the next token. However, this information might be lost if the next
token itself is simplified/deleted in a futher pass. Therefore, we must
propagated the flag to all the next named tokens, so we can make sure the
function name token itself is tagged with this property.
* add tests for misra addon rules 8.7 and 5.9
2022-02-27 19:17:48 +01:00
chrchr-github
05a6d09c5f
Fix #10360 FP uninitMemberVar from copy constructor [inconclusive] ( #3748 )
2022-02-27 19:15:19 +01:00
chrchr-github
ddb0a8bb0b
Fix #10059 missing varId with using namespace ( #3860 )
...
* Fix #10059 missing varId with using namespace
* Undo
* Fix test
* Limit namespace candidates, duplicateBranch
* rvalue ref
* Undo
* Undo
* Undo
* Format
* Fix condition
2022-02-27 09:03:24 +01:00
chrchr-github
d79d6e60db
Fix #10828 Internal error. Token::Match called with varid 0 ( #3859 )
...
* Fix #10828 Internal error. Token::Match called with varid 0
* Fix test
2022-02-26 23:48:29 +01:00
chrchr-github
441b437cea
Fix #10826 FN: unusedStructMember ( #3858 )
2022-02-26 18:53:00 +01:00
Paul Fultz II
dbc80787e1
Fix 10821: FN: containerOutOfBounds ( #3856 )
...
* Fix 10821: FN: containerOutOfBounds
* Format
* Fix cppcheck warning
* Add valueflow tests
* Format
* Fix some bugs
* Format
2022-02-25 05:53:51 +01:00
Paul Fultz II
45de9a7d08
Refactor: Use getEndOfExprScope instead of getEndOfVarScope ( #3855 )
2022-02-24 06:50:34 +01:00
chrchr-github
f53793c413
Fix #10823 FP cstyleCast with function pointer and calling convention ( #3853 )
2022-02-23 09:12:14 +01:00
Oliver Stöneberg
51371f7929
added CMake option USE_THREADS to be able to use threads instead of fork() / cleanups ( #3852 )
2022-02-23 09:04:35 +01:00
chrchr-github
172aafdeb8
Fix #7908 FN: redundant assignment in loop ( #3650 )
2022-02-22 09:51:44 +01:00
Paul Fultz II
1ac16413ea
Another fix for 10800: Hang / memory exhaustion on numerical code ( #3851 )
...
* Another fix for 10800: Hang / memory exhaustion on numerical code
* Format
2022-02-22 07:21:26 +01:00
Paul Fultz II
72d0f3e444
Fix 10808: cppcheckError AST cyclic dependency with decltype ( #3850 )
...
* Fix 10808: cppcheckError AST cyclic dependency with decltype
* Format
2022-02-22 06:30:17 +01:00
Oliver Stöneberg
b6876d22e6
use inline suppressions for varid0 in selfcheck ( #3842 )
2022-02-21 18:35:02 +01:00
Bart vdr. Meulen
20601c1b01
Restore symbol names from cache
...
When reading earlier reported errors from the cache file the symbol names are not handled. This causes suppressions to no longer match when rerunning cppcheck.
2022-02-21 18:19:05 +01:00
chrchr-github
734e3ac6da
Fix cppcheckError with for loop ( #3847 )
2022-02-21 18:14:20 +01:00
chrchr-github
bedde0a1df
Fix #10391 bug hunting; crash for small C-code ( #3846 )
2022-02-21 18:09:46 +01:00
chrchr-github
d77fa64051
Fix #10256 Function::addArguments found argument 'x' with varid 0 ( #3845 )
2022-02-21 18:06:26 +01:00
chrchr-github
5574e41b86
Fix #10065 CheckClass::isMemberVar found used member variable with varid 0 ( #3843 )
2022-02-20 18:17:47 +01:00
chrchr-github
18e00bb4fd
Fix #10817 Crash in checkPassByReference() / #10810 Stack overflow with decltype / #10763 Crash on invalid code ( #3840 )
...
* Fix #10817 Crash in checkPassByReference()
* Format
* Fix #10810 Stack overflow with decltype
* Fix #10763 Crash on invalid code in TemplateSimplifier::templateParameters
2022-02-18 12:59:21 +01:00
chrchr-github
6635e6cc07
Fix #10795 cppcheckError with for loop ( #3841 )
2022-02-17 22:12:19 +01:00
chrchr-github
b07814f329
Fix #3462 FN missed class members in copy operator of derived class ( #3837 )
2022-02-16 21:30:19 +01:00
Daniel Marjamäki
c968aeaf73
Import project: do not crash when importing compile database generated by IAR workbench
2022-02-16 08:35:47 +01:00
chrchr-github
9582032906
Fix #8485 FP uninitMemberVar - ctor calls function with smart pointer argument ( #3835 )
2022-02-16 07:02:26 +01:00
chrchr-github
52f549fa87
Fix crash on garbage code ( #3834 )
2022-02-15 20:19:03 +01:00
chrchr-github
907218254e
#8126 Fix previous commit ( #3833 )
...
* Fix #8126 unsafeClassCanLeak missing for array of pointers
* #8126 Fix previous commit
* Format
* Format
2022-02-15 20:03:02 +01:00
chrchr-github
e7e2439347
Fix #8126 unsafeClassCanLeak missing for array of pointers ( #3832 )
2022-02-15 14:28:19 +01:00
Oliver Stöneberg
75b6e8d258
inline visitAstNodes() calls ( #3828 )
2022-02-13 20:46:01 +01:00
Daniel Marjamäki
d5ef25e477
Add constParameter and constParameterCallback in --errorlist output
2022-02-13 16:17:53 +01:00
José Martins
c8211ec6f6
Fix check for misra addon in executeAddons. ( #3819 )
...
In the CppCheck::executeAddons function, a check that specifically tests
for the misra add-on, was not taking into account the cases when the
addon is identified with the '.py' extension or indirectly via json.
This resulted in the add-on not being executed a second time which is
needed to detected some of the misra violations. By using the AddonInfo
class name field, the addon name is uniformized for all these cases and
the add-on executed a second time.
Signed-off-by: Jose Martins <josemartins90@gmail.com>
2022-02-13 11:58:42 +01:00
Daniel Marjamäki
f2420509c9
Revert "constPointer: Fix false positives when pointer is not read"
...
This reverts commit 6427b4888b
.
If variable/parameter is unused it is better to warn about that.
2022-02-13 08:40:45 +01:00
Daniel Marjamäki
6427b4888b
constPointer: Fix false positives when pointer is not read
2022-02-12 22:23:25 +01:00
chrchr-github
0a99e3b6fc
Partial fix for #9407 FN redundant assignment/unreadVariable ( #3651 )
2022-02-12 15:32:08 +01:00
Daniel Marjamäki
30cec97cc8
Tokenizer: Support C++20 default bit-field member initializer
2022-02-12 12:19:08 +01:00
Oliver Stöneberg
06d10b7474
fixed and enabled performance-for-range-copy clang-tidy warning ( #3682 )
2022-02-12 08:20:45 +01:00
chrchr-github
edc5106237
Fix #9092 FN missingOverride - subclass in namespace ( #3793 )
2022-02-12 08:19:07 +01:00
chrchr-github
c5ab936088
Fix #10405 FN shadowVariable in range-based for loop ( #3789 )
2022-02-12 08:10:53 +01:00
Rikard Falkeborn
d4cd249c21
10671 fix const iterator function const take two ( #3802 )
...
* Revert "Revert "Fix #10671 : functionConst FN with begin/end and const_iterator (#3749 )""
This reverts commit 9f6a36c1a8
.
* Fix crash by adding missing null check
2022-02-11 21:23:23 +01:00
Oliver Stöneberg
6e57cc4323
small utils.h cleanup ( #3821 )
2022-02-11 19:44:08 +01:00
chrchr-github
5f3ddabd56
Fix FP constParameter with std::map ( #3823 )
2022-02-11 19:40:11 +01:00
Paul Fultz II
78228599da
Fix 10800: Hang / memory exhaustion on numerical code ( #3822 )
...
* Fix 10800: Hang / memory exhaustion on numerical code
* Format
* Add another test
* Format
2022-02-11 06:52:28 +01:00
Oliver Stöneberg
f32583e097
removed OVERRIDE and FINAL defines and use the keywords directly ( #3767 )
2022-02-10 23:02:24 +01:00
Julien Marrec
2535bf984b
Allow passing std::string_view by value ( #3817 )
2022-02-10 21:01:12 +01:00