Commit Graph

13669 Commits

Author SHA1 Message Date
chrchr-github 11cbb2eb00
Fix AST cyclic dependency [cppcheckError] 3 (#3953) 2022-03-28 22:05:41 +02:00
chrchr-github d57d536f01
Fix #10882 FP constStatement with negation and cast (#3951) 2022-03-28 21:52:08 +02:00
chrchr-github 7b97230dd2
Fix #10505 FP unreadVariable for lock_guard variable (#3938) 2022-03-28 21:45:49 +02:00
Oliver Stöneberg 8bf8070923
fixed build with SmallVector (noExplicitConstructor warning and incorrect C++ standard for Visual Studio `*-PCRE` configuration) (#3937) 2022-03-28 21:40:44 +02:00
Paul Fultz II 54fbfd7c0f
Fix 10895: FP danglingTempReference with emplace() (#3948)
* Fix 10895: FP danglingTempReference with emplace()

* Format
2022-03-27 10:02:30 +02:00
Paul Fultz II 21b8c36eb1
Fix 10916: FP: uninitvar (#3949) 2022-03-27 10:01:58 +02:00
chrchr-github 63d96e49fc
Fix #10928, #10930 FP constStatement (#3946)
* Fix #10928, #10930 FP constStatement

* Fix test cases (first one did not compile)
2022-03-27 07:59:29 +02:00
chrchr-github 401f0de18b
Fix #10929 FP constStatement with new (#3947) 2022-03-27 07:59:19 +02:00
chrchr-github 1dd19dcaef
Fix AST cyclic dependency [cppcheckError] (#3945) 2022-03-26 22:39:14 +01:00
chrchr-github 5ed521622f
Fix #10923 FP constStatement with ptr to ptr to ptr (#3944)
* Fix #10923 FP constStatement with ptr to ptr to ptr

* simpleMatch
2022-03-26 06:12:26 +01:00
chrchr-github fe7d0eeffc
Fix #10919 FP: constStatement with template type (#3941) 2022-03-25 17:03:54 +01:00
chrchr-github 12cb19bdf2
Fix AST cyclic dependency [cppcheckError] (#3940) 2022-03-25 14:03:32 +01:00
chrchr-github e54ad24d2c
Fix #10870 FN constStatement with arrays (#3904) 2022-03-25 11:32:16 +01:00
chrchr-github 796ad6c008
Fix #10913 FP variableScope - vector referenced via iterator (#3936) 2022-03-25 09:21:17 +01:00
Daniel Marjamäki 212ac6c214 compile_commands.json: ensure that order of include paths are kept 2022-03-24 22:50:04 +01:00
Daniel Marjamäki 4365704f14 cppcheck.cfg: support custom productname and about message 2022-03-24 22:44:47 +01:00
chrchr-github 3630e9c49d
Fix #10874 FP constStatement with extra parentheses in declaration (#3931) 2022-03-24 22:07:21 +01:00
chrchr-github 479af21405
Fix #10698 FP uninitvar with new and braced initializer (#3934) 2022-03-24 20:08:51 +01:00
Paul Fultz II 4b4037540a
valueFlowUninit: Handle arrays and pod types (#3917)
* valueFlowUninit: Handle arrays and pod types

* Format

* Catch another array case
2022-03-24 06:35:44 +01:00
Daniel Marjamäki 3bcbba598d Fixed #10887 (compile database: include path with space is not handled) 2022-03-23 21:13:51 +01:00
chrchr-github 0d2af9a5b7
Fix #10880 FP constStatement with init list in function call (#3929) 2022-03-23 18:10:33 +01:00
chrchr-github e0830693c3
Fix FP uninitMemberVarPrivate with anonymous union (#3927) 2022-03-23 07:35:41 +01:00
chrchr-github 39567ea8c8
Fix #8541 FP variableScope (std::for_each with lambda) (#3924) 2022-03-22 21:50:46 +01:00
chrchr-github 40c2687ac4
Fix #10875 FP constStatement with delete (#3926) 2022-03-22 18:39:02 +01:00
chrchr-github 3faff5e9fc
Fix #10248 FP knownConditionTrueFalse static variable with direct initialization (#3922) 2022-03-22 07:24:40 +01:00
chrchr-github 18a7a805df
Fix #10502 FP doubleFree (#3921) 2022-03-21 22:17:50 +01:00
Daniel Marjamäki 1fe7cd348a exename: Set proper exename when cppcheck is executed from PATH and argv[0] does not contain path information 2022-03-21 18:35:53 +01:00
chrchr-github 0e147502cc
Fix #10888 FN variableScope with enum and struct (#3920)
* Fix #10888 FN variableScope with enum and struct

* Scope reduction

* Scope reduction
2022-03-21 16:05:38 +01:00
Oliver Stöneberg 9d4fb16d7d
added SmallVector alias with conditional boost::container version (#3799)
* printInfo.cmake: small cleanup

* added SmallVector alias with conditional boost::container version

Co-authored-by: Ken-Patrick Lehrmann <kp.lehrmann+github@gmail.com>

* smallvector.h: added custom allocator to regular SmallVector version

Co-authored-by: Ken-Patrick Lehrmann <kp.lehrmann+github@gmail.com>
Co-authored-by: Paul Fultz II <pfultz2@yahoo.com>
2022-03-20 10:13:32 +01:00
chrchr-github 2baf8f6cd4
Fix FP virtualCallInConstructor with function pointer (#3913) 2022-03-19 20:00:06 +01:00
chrchr-github 297b0b5c60
Fix #10886 FP: Label 'enum' is not used. [unusedLabel] (#3912) 2022-03-17 17:38:23 +01:00
chrchr-github 97ce569859
Fix #10873 FP constStatement with extra parentheses in function call (#3911)
* Fix #10873 FP constStatement with extra parentheses in function call

* Format
2022-03-17 12:47:27 +01:00
chrchr-github e073860e62
Fix #10841 FN uninitMemberVar when member is being used in constructor (regression) (#3909) 2022-03-16 20:35:55 +01:00
Paul Fultz II 40ff9edad6
Fix 10843: FP: danglingTemporaryLifetime (#3908)
* Fix 10843: FP: danglingTemporaryLifetime

* Format
2022-03-16 17:11:49 +01:00
chrchr-github fb1170b10b
Fix #10872 FP constStatement with variable called std (#3906) 2022-03-16 15:29:34 +01:00
chrchr-github b8ba0ae00e
Fix #10877 FP constStatement with ternary and comma operator (#3905) 2022-03-16 15:28:59 +01:00
Armin Müller 7cc45fb393
Typos found by running "codespell" (#3907)
Co-authored-by: Armin Müller <mueller.armin@foestergroup.de>
2022-03-16 15:28:44 +01:00
chrchr-github 1aff160411
Fix #9303 FP uninitvar after lambda expression (#3903)
* Fix #9303 FP uninitvar after lambda expression

* Format
2022-03-15 14:32:33 +01:00
chrchr-github 200b098471
Fix #10516 FP for unused private function if address of function is taken (#3901) 2022-03-14 19:15:48 +01:00
chrchr-github 6376bac5bb
Fix #10451 syntaxError with typedef and lambda (#3900)
* Fix #10451 syntaxError with typedef and lambda

* Don't insert union into template argument list, add test

* Format

* Revert "Format"

This reverts commit 8c52d49c8b.

* Format
2022-03-14 17:59:29 +01:00
chrchr-github d3d40fd599
Fix #10868/#10869 FN: constStatement, handle unused character constants (#3898)
* Fix #10868 FN: constStatement, handle unused character constants

* simpleMatch

* Fix #10869 FN: constStatement

* Format
2022-03-14 14:14:32 +01:00
Oliver Stöneberg 0d336b868c
avoid some Clang compiler warnings (#3896) 2022-03-13 20:07:58 +01:00
chrchr-github 2eed660b32
Fix #8496 Clarify warnings for uninitMemberVar (#3760) 2022-03-13 17:33:31 +01:00
chrchr-github 190506db40
Fix #10737 Regression: unusedStructMember (#3894)
* Fix #10737 Regression: unusedStructMember

* Add test for #9161

* simpleMatch
2022-03-13 06:27:17 +01:00
chrchr-github c3506b5186
Fix #10691 regressions with static variables and multiple assignments (#3895)
* Fix regressions with static variables and multiple assignments

* Fix test

* Fix test cases
2022-03-13 06:26:21 +01:00
Oliver Stöneberg 757287b13c
removed unnecessary varid0 inline suppressions (#3893) 2022-03-12 18:02:40 +01:00
chrchr-github 3df170c191
Fix #10865 FN: constStatementError, streamline error messages (#3892) 2022-03-12 14:52:18 +01:00
chrchr-github d1f740a289
Partial fix for #9384 varid 0 with lambda (II) (#3889)
* Partial fix for #9384 varid 0 with lamba

* Format

* Undo

* Undo

* Partial fix for #9384 varid 0 with lambda (II)
2022-03-12 06:17:37 +01:00
chrchr-github 4c85ac0d7b
Fix #10852 FP unused struct member (inner struct in C code) (#3890)
* Fix #10852 FP unused struct member (inner struct in C code)

* Redundant findType() call, add test
2022-03-12 06:16:29 +01:00
Paul Fultz II ff902369e0
Fix 10851: False positive: known variable value below for loop (#3891)
* Fix 10851: False positive: known variable value below for loop

* Format

* Add test for 10863

* Format
2022-03-12 06:15:35 +01:00
chrchr-github 705931266c
constStatementError: don't warn for casts with possible side effects,… (#3885)
* constStatementError: don't warn for casts with possible side effects, handle bool constants

* Recursive call, add tests

* Restore test

* Don't warn for C++ casts to void

* Don't warn for cast to void*
2022-03-11 21:45:51 +01:00
chrchr-github ffd9f9a93f
Fix FP missingOverride with unnamed parameters (#3887) 2022-03-11 21:44:13 +01:00
Binho 8b3647edd7 Fix false positive in memory leak 2022-03-10 08:29:05 +01:00
chrchr-github 2616046461
Partial fix for #10848 FP: unusedStructMember (#3880) 2022-03-09 20:25:58 +01:00
chrchr-github 557263acde
Partial fix for #10848 FP: unusedStructMember (II) (#3881)
* Preliminary

* Fix member search, add tests
2022-03-09 18:22:30 +01:00
chrchr-github 850ad0fed9
#8451: Add error message for unused casts, log unhandled errors (#3883)
* #8451: Add error message for unused casts, log unhandled errors

* Fix TODO

* Fix TODO
2022-03-09 18:21:47 +01:00
chrchr-github c9f47dec8b
Partial fix for #9384 varid 0 with lambda (#3875) 2022-03-08 20:10:51 +01:00
chrchr-github fbdfb60809
Warn about buffer overruns when allocating memory with new (#3879)
* Warn about buffer overruns when allocating memory with new

* Format

* Avoid FP
2022-03-07 19:43:40 +01:00
chrchr-github 3a5931b417
Fix #5499 C++11 default values not for all class fields and missing constructor (#3876) 2022-03-07 08:39:19 +01:00
chrchr-github 7f682d544e
Partial fix for #6615 FN buffer access out of bounds: std::vector (#3873)
* Fix #10779 FN: stlOutOfBounds (off by one)

* Format

* Simplify

* Partial fix for #6615 FN buffer access out of bounds: std::vector

* Undo

* Format

* Fix test case
2022-03-06 07:41:09 +01:00
chrchr-github 0b0a8cad39
Fix #10846 FP unreadVariable within a macro (regression) (#3874)
* Fix #10846 FP unreadVariable within a macro (regression)

* Format

* Format
2022-03-05 08:14:57 +01:00
chrchr-github 27baa20f38
Fix #10779 FN: stlOutOfBounds (off by one) (#3872)
* Fix #10779 FN: stlOutOfBounds (off by one)

* Format

* Simplify
2022-03-04 17:13:13 +01:00
chrchr-github 2dd6c75b35
Fix #10838 Crash/nullptr deref in getEndOfExprScope() (#3870)
* Fix #10838 Crash/nullptr deref in getEndOfExprScope()

* Format
2022-03-03 17:08:23 +01:00
chrchr-github 78dd29ada3
Fix #10770 FP noConstructor with function pointer member (#3751) 2022-03-03 13:56:24 +01:00
chrchr-github 8a7992c6ac
Suppress operatorEqVarError for known non-copyable types (#3869)
* Fix FP operatorEqVarError with class hierarchy

* Suppress operatorEqVarError for std::mutex

* Add test, non-copyable Qt types

* Update cppcheck-cfg.rng
2022-03-03 09:41:26 +01:00
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
chrchr-github cd7532df21
Fix #7709 FN C-style pointer casting with built-in or typedef types /… (#3814) 2022-02-10 20:48:51 +01:00
Paul Fultz II 5d25050b06
Fix 10788: False positive: zerodivcond when using an assert (#3816) 2022-02-10 20:22:14 +01:00
chrchr-github 24e9859158
Fix #10357 FP stlcstrParam due to incorrect overload resolution (#3813)
* Fix #10357 FP stlcstrParam due to incorrect overload resolution

* Variable shadowing
2022-02-10 11:17:06 +01:00
Paul Fultz II a50452517d
Fix 10794: Crash in MultiValueFlowAnalyzer::getProgramState() (#3815)
* Fix 10794: Crash in MultiValueFlowAnalyzer::getProgramState()

* Format
2022-02-10 07:43:27 +01:00
chrchr-github 2c7948102a
Fix #10145 FP AssignmentAddressToInteger with enum class (#3810) 2022-02-08 16:12:35 +01:00
chrchr-github e64ea20089
Fix #10527 FP variableScope for if with init-statement (#3811) 2022-02-08 16:12:09 +01:00
Paul Fultz II 20a5224d7e
Fix 10784: False positive: returnDanglingLifetime using std::tie with variadic template parameters (#3805) 2022-02-08 09:03:51 +01:00
Oliver Stöneberg b5ed13c8bc
checkstl.cpp: removed unused global containers and made a std::string a literal so it can be matchcompiled (#3801) 2022-02-08 09:02:59 +01:00
Daniel Marjamäki cfe2392709 ImportProject: Fix loading of sln without BOM 2022-02-08 08:52:39 +01:00
Paul Fultz II 260d155bb6
Fix 10785: False positive: constParameter when using member pointer (#3807) 2022-02-07 18:45:32 +01:00
Oliver Stöneberg 047930fd17
removed some unused/unread member variables (and related code) found by CLion "Unused global declaration" inspection (#3808) 2022-02-07 15:34:34 +01:00
Paul Fultz II f2a419653c
Refactor ProgramMemory to store the expression tokens instead of exprIds (#3798) 2022-02-06 20:15:45 +01:00
Paul Fultz II 569332a50a
Fix 10786: False positive: arrayIndexOutOfBoundsCond (#3803) 2022-02-06 20:14:13 +01:00
Paul Fultz II a639c59780
Fix 10787: False positive: knownConditionTrueFalse with a conditional exit (#3804) 2022-02-06 20:13:44 +01:00
Daniel Marjamäki 631a9eefd2 2.7: Set versions 2022-02-05 12:17:54 +01:00
Daniel Marjamäki 3989408738 Update copyright year 2022-02-05 11:45:17 +01:00
chrchr-github 7f28edbe26
Fix #10789 Crash in CheckMemoryLeakInClass (#3797) 2022-02-04 19:32:23 +01:00
chrchr-github 17b538210d
Fix #10151 FP eraseDereference when returning iterator from loop (#3787) 2022-02-03 21:13:48 +01:00
Daniel Marjamäki 9f6a36c1a8 Revert "Fix #10671: functionConst FN with begin/end and const_iterator (#3749)"
This reverts commit 2cacb13f85.
2022-02-03 11:04:02 +01:00
chrchr-github a20465eaea
Fix #10484 FP knownConditionTrueFalse with static variable and direct initialization / partial fix for #10248 (#3728) 2022-02-02 22:30:49 +01:00
Daniel Marjamäki 4d9a1427b2 CheckClass: Write separate errorid for missing member copy instead of uninitMember 2022-02-02 20:44:22 +01:00
chrchr-github 511520d623
Fix #10679 FP constParameter with const/nonconst overload (#3780) 2022-02-02 19:38:32 +01:00
Rikard Falkeborn 2cacb13f85
Fix #10671: functionConst FN with begin/end and const_iterator (#3749)
Check if the iterator is assigned to a const_iterator or
const_revese_iterator, in which case it is possible the function can be
const. Unfortunately, it is not possible to remove the hard coding of
cbegin, cend, crbegin and crend due to the need to handle auto, as in
the following code snippet:

    void cbegin_auto(void)
    {
        for (auto it = m_str.cbegin(); it != m_str.cend(); ++it) {;}
    }
2022-02-02 19:37:06 +01:00
chrchr-github dad64bfcc8
Fix #10091 FP shadowFunction with default destructor implementation / Tests for #8635, #9776, #9940, #9951, #10018 (#3763) 2022-02-02 19:30:49 +01:00
chrchr-github 8cf5c8fbf2
Fix #10684 FP unusedStructMember with static object (#3681) 2022-02-02 19:28:16 +01:00
chrchr-github 94a1f76ec4
Fix 10158 FP memleak when pointer is stored in a sub-object (#3764) 2022-02-02 13:13:12 +01:00
Paul Fultz II 11387cbb41
Fix 10768: performance regression (#3788) 2022-02-02 13:01:44 +01:00
chrchr-github 2b13a27140
Fix #9696 FP uninitdata - writing pointer to stream (#3772) 2022-02-02 12:24:32 +01:00
shaneasd 4127885282
improve noConstructor message (#3750) 2022-02-01 17:24:26 +01:00
Oliver Stöneberg 8f7770f512
added an include-what-you-use GitHub Action (#3759) 2022-02-01 17:19:19 +01:00
chrchr-github 0807924d32
Fix FP passedByValue for unions / FN passedByValue for array members (#3784) 2022-02-01 17:17:08 +01:00
chrchr-github 127b3bb1c4
Fix #9471 FP unreadVariable caused by invalid template injection (#3783) 2022-02-01 17:15:27 +01:00
Daniel Marjamäki 637aca8d59 Fixed #10752 (False positive: shadow variable in static method) 2022-01-28 16:03:06 +01:00
Oliver Stöneberg 38420c8ecf
added some more missing copyright headers (#3766) 2022-01-28 15:56:11 +01:00
chrchr-github d55010c441
Fix #9247 FP uninitMemberVar (inconclusive) (#3765) 2022-01-28 15:05:13 +01:00
chrchr-github c74eeb6bad
Fix FN uninitVar with std::array (#3707) 2022-01-27 19:45:27 +01:00
chrchr-github f429245da2
Fix #8557 FP format string requires unsigned long (for sizeof(var)) (#3727) 2022-01-27 19:43:52 +01:00
Oliver Stöneberg 171da2e6f9
avoid dependency on transitive includes - based on include-what-you-use (#3757) 2022-01-27 19:03:20 +01:00
Oliver Stöneberg a2a9c90142
added some missing copyright headers (#3758) 2022-01-26 19:02:20 +01:00
Paul Fultz II 40147c1e4b
Fix 10719: Crash in valueFlowIterators() (#3756)
* Fix 10719: Crash in valueFlowIterators()

* Format
2022-01-26 06:42:41 +01:00
Paul Fultz II 1a949c00b0
Fix 10723: Assertion 'tok && tok->exprId() > 0 && "Missing expr id for symbolic value"' in valueFlowSmartPointer() (#3755)
* Fix 10723:  Assertion 'tok && tok->exprId() > 0 && "Missing expr id for symbolic value"' in valueFlowSmartPointer()

* Format
2022-01-26 06:28:13 +01:00
chrchr-github f49cfcd23c
Fix #10200 False positive: uninitStructMember (#3741) 2022-01-25 12:14:20 +01:00
chrchr-github ea81ce933e
Fix #10754 FP invalidFunctionArg with resize() (#3737) 2022-01-25 12:13:49 +01:00
chrchr-github d05e43ce15
Fix #9828 False positive: unreadVariable alias (#3744) 2022-01-24 21:52:45 +01:00
chrchr-github 9d6e5c2a05
Fix #10237 uninitMemberVar - member initialized via function call (#3745) 2022-01-24 21:52:00 +01:00
chrchr-github 158f3d494e
Fix #10143 false positive: redundantInitialization with std::shared_ptr (#3746) 2022-01-24 21:50:50 +01:00
chrchr-github d64dadcd31
Fix #10758 Crash in CheckClass::checkConstFunc() (#3740) 2022-01-24 21:50:01 +01:00
Oliver Stöneberg 8179226b18
astutils.cpp: optimized visitAstNodesGeneric() a bit more by avoiding unnecessary checks and std::stack usage (#3732) 2022-01-24 21:44:09 +01:00
Paul Fultz II 01e14a12f1
Fix 10755: Assertion "!maxValue->isKnown()" from valueFlowInferCondition (#3739)
* Fix 10755: Assertion "!maxValue->isKnown()" from valueFlowInferCondition

* Format
2022-01-22 12:25:20 +01:00
Paul Fultz II 8b1ed9cbe1
Another fix for 10739: internalAstError with decltype (#3738)
* Another fix for 10739: internalAstError with decltype

* Format
2022-01-22 07:22:57 +01:00
chrchr-github b23ca879ed
Fix #10735 FP functionConst with overloaded operator[] [inconclusive] (#3733) 2022-01-21 20:40:10 +01:00
Paul Fultz II a7dbd288c4
Fix 10738: FP knownEmptyContainer with auto reference (#3734)
* Fix 10738: FP knownEmptyContainer with auto reference

* Format
2022-01-21 09:56:55 +01:00
Paul Fultz II 6c2b1f093d
Another fix for 10728: Crash in CheckStl::checkDereferenceInvalidIterator2() (#3735)
* Another fix for 10728: Crash in CheckStl::checkDereferenceInvalidIterator2()

* Format
2022-01-21 09:56:41 +01:00
Paul Fultz II 0737cc4d8c
Fix 10708: Assertion "!maxValue->isKnown()" from valueFlowInferCondition (#3736)
* Fix 10708: Assertion "!maxValue->isKnown()" from valueFlowInferCondition

* Format
2022-01-21 09:56:24 +01:00
Paul Fultz II 57b50e4b00
Fix 10739: internalAstError with decltype (#3723) 2022-01-20 21:36:48 +01:00
Daniel Marjamäki ebd1fbbfd8 cert: improved check for int31-c 2022-01-20 21:09:39 +01:00
chrchr-github 4d44d0c079
Fix #9781 FP deallocuse after auto_ptr (#3724) 2022-01-19 21:39:45 +01:00
Oliver Stöneberg 55ff684f34
added unusedFunction self check to CI / cleanups (#3526) 2022-01-18 22:02:25 +01:00
Rikard Falkeborn e106654993
Fix #10729: Uncaughty exception in CheckMemoryLeak::getReallocationType() (#3717) 2022-01-18 20:50:06 +01:00
chrchr-github 1e2863cd33
Fix #10520 FP functionConst with aggregate initialization [inconclusive] (#3720) 2022-01-18 20:49:35 +01:00
chrchr-github ca2e0ca287
Fix FP functionConst with extra parentheses (#3722) 2022-01-18 20:21:25 +01:00
chrchr-github cb5a50c6a7
Fix #10710 FN passedByValue with QString (#3696) 2022-01-18 20:17:05 +01:00
Paul Fultz II 7b793af451
Fix 10728: Crash in CheckStl::checkDereferenceInvalidIterator2 (#3721)
* Fix 10728: Crash in CheckStl::checkDereferenceInvalidIterator2

* Format
2022-01-18 14:48:02 +01:00
chrchr-github c2fc4973ad
Fix #10515 False positive for explicit one-argument constructor if co… (#3718) 2022-01-17 20:51:23 +01:00
chrchr-github 9c56e7ea8d
Fix #6475 FN uninitialized variable usage not detected (#3700) 2022-01-17 20:35:30 +01:00
Oliver Stöneberg 2148b8b165
astutils.cpp: optimized visitAstNodesGeneric() a bit (#3716) 2022-01-17 20:34:35 +01:00
chrchr-github 605fd7cf98
Fix #10146 FP functionConst (inconclusive) with nested members (#3719) 2022-01-17 20:33:32 +01:00
Paul Fultz II 7406dd8c94
Fix 10721: Crash in Tokenizer::simplifyTokenList1 (#3712) 2022-01-16 12:46:20 +01:00
Paul Fultz II abb0563cef
Fix 10726: Crash in CheckExceptionSafety::checkRethrowCopy (#3711) 2022-01-16 12:35:51 +01:00
Paul Fultz II 89bc226738
Fix 10718: Crash in CheckOther::checkDuplicateExpression (#3713) 2022-01-16 12:34:20 +01:00
Paul Fultz II 4af98f21d6
Fix 10588: crash (#3691) 2022-01-16 12:33:31 +01:00
Paul Fultz II 55ff010df3
Fix 10717: Crash in SymbolDatabase::setValueTypeInTokenList (#3710)
* Fix 10717: Crash in SymbolDatabase::setValueTypeInTokenList

* Format
2022-01-15 07:56:56 +01:00
Paul Fultz II 0b1cd8626d
Fix 10664: Crash in Token::linkAt (#3708)
* Fix 10664: Crash in Token::linkAt

* Format
2022-01-14 23:51:01 +01:00
Paul Fultz II 2b6a89e30e
Fix 10716: Crash in CheckStl::checkDereferenceInvalidIterator2 (#3709)
* Fix 10716: Crash in CheckStl::checkDereferenceInvalidIterator2

* Format
2022-01-14 23:50:33 +01:00
chrchr-github 781a145680
Fix regression: functionStatic related to overload resolution (#3705) 2022-01-14 17:55:50 +01:00
Armin Müller 5a05631c84
Typos found by running "codespell" (#3702) 2022-01-13 17:24:26 +01:00
chrchr-github 95dc05b21d
Fix #7732 false negative: (style) Unused variable: std::pair (#3695) 2022-01-13 08:05:05 +01:00
chrchr-github af0a585a70
Partial fix for #9157 False negative: stlOutOfBounds, cast (#3699) 2022-01-13 08:03:24 +01:00
chrchr-github 59837be152
Remove redundant type check (#3689) 2022-01-12 22:25:37 +01:00
chrchr-github 7aa0ec3e95
Fix regression: unreadVariable for trivial initialization (#3698) 2022-01-12 22:06:03 +01:00
chrchr-github 1b89c998f5
Fix #10469 FP returnTempReference with overloaded operator+= (#3678) 2022-01-12 22:05:30 +01:00
Paul Fultz II fa651272f0
Fix 10001: Syntax error on valid C++ code (#3697) 2022-01-12 22:04:28 +01:00
chrchr-github df3da38483
Fix #10682 Unused QString / #10686 unused std::array / #10005 unused variable with c++11 braced initializer not detected (#3684) 2022-01-10 07:36:49 +01:00
Paul Fultz II 4ef20f8f1e
Fix 10683: FP danglingTemporaryLifetime with pointer to vector (#3685) 2022-01-10 07:34:26 +01:00
Paul Fultz II fe7595cd9d
Fix 10677: crash during valueFlowInferCondition (#3687) 2022-01-09 22:43:08 +01:00