Commit Graph

13614 Commits

Author SHA1 Message Date
Daniel Marjamäki 8f386e15fd Remove bug hunting. This feature will be provided in Cppcheck premium. 2022-04-11 07:31:33 +02:00
Paul Fultz II 99757c6d06
ValueFlow: Set values to parameters to escape functions (#3994)
* ValueFlow: Set values to parameters to escape functions

* Format
2022-04-11 07:23:58 +02:00
Paul Fultz II d97942d3c6
Fix 6577: Detect pointer to uninitialised memory with clock_settime() (#3993)
* Fix 6577: Detect pointer to uninitialised memory with clock_settime()

* Format
2022-04-11 07:23:44 +02:00
Paul Fultz II 45b4580554
Fix 10957: Crash on valid code (#3991) 2022-04-10 22:47:58 +02:00
chrchr-github bd9f5231b8
Fix #10179 FP divideSizeof with dereferenced pointer-to-pointer (#3786) 2022-04-10 22:47:27 +02:00
chrchr-github c8936d04f6
Fix #3886 New Check : Return value of "new" ignored (#3884) 2022-04-09 19:06:32 +02:00
Oliver Stöneberg 25ef9eeb26
use std::string::empty() (#3910) 2022-04-09 19:02:37 +02:00
chrchr-github 0636018df3
Fix #10368 FP: unassignedVariable with structured binding (#3990) 2022-04-09 14:50:30 +02:00
chrchr-github 2bccde0e3b
Fix #9789 FP Logical condition considered always false (#3985) 2022-04-09 14:09:10 +02:00
chrchr-github 38bc0ad4c3
Fix regression: wrong member variable (#3987) 2022-04-08 08:23:10 +02:00
Paul Fultz II d2a0b0f78e
Fix 10951: FP knownEmptyContainer with east-const (#3988)
* Fix 10951: FP knownEmptyContainer with east-const

* Format

* Use simpleMatch
2022-04-08 08:22:39 +02:00
chrchr-github ceb86afc22
Fix #10952 FP constStatement with cast in return (#3986) 2022-04-07 14:11:14 +02:00
Paul Fultz II 4c1aeb0cb1
Remove old pointer alias check (#3983) 2022-04-07 11:36:15 +02:00
chrchr-github 52b4aeb279
Fix #10792 FP knownConditionTrueFalse with double to int cast (#3964) 2022-04-07 10:42:57 +02:00
Paul Fultz II dad10f2ab7
Fix 7684: ValueFlow: function call 'X::GetSize()' (#3984)
* Improve getting function to calculate the return

* Add test

* Format

* Move to cpp to avoid FP

* Format
2022-04-07 06:49:25 +02:00
Paul Fultz II 74667d1e2a
Fix 10418: false negative: knownConditionTrueFalse (#3981)
* Improve handling inverted condition

* Fix tests

* Rename variables for clarity

* Add initial test

* Add another test

* Format

* Fix FP
2022-04-07 06:48:13 +02:00
Paul Fultz II 09c8cfb2ae
Fix 6624: false negative: std::vector out of bounds access not detected (#3980)
* Fix 6624: false negative: std::vector out of bounds access not detected

* Format

* Add test for auto

* Fix tests

* Format
2022-04-07 06:47:15 +02:00
Paul Fultz II bb640c4879
Fix 10950: Crash on function declaration (#3979)
* Fix 10950: Crash on function declaration

* Format
2022-04-06 19:00:05 +02:00
chrchr-github b73aeeda0e
Fix FP constStatement with comma operator (#3978)
* Fix FP constStatement with comma operator

* Format
2022-04-06 16:58:17 +02:00
Paul Fultz II 4fde7f8b18
Fix 10449: Regression: knownConditionTrueFalse (strlen/wcslen) (#3977)
* Refactor library function usage

* Evaluate library function in program memory

* Fix and add tests

* Format
2022-04-06 06:35:38 +02:00
Paul Fultz II 1d92665ad2
Fix 10867: false negative: containerOutOfBounds with std::array (regression) (#3976)
* Fix 10867: false negative: containerOutOfBounds with std::array (regression)

* Format
2022-04-06 06:25:28 +02:00
chrchr-github 4c375e7224
Fix #9815 FP redundantInitialization with lambda / #10864 debug: valueFlowConditionExpressions bailout (#3970)
* Fix #9815 FP redundantInitialization with lambda

* Fix #10864 debug: valueFlowConditionExpressions bailout

* Format
2022-04-05 23:19:17 +02:00
chrchr-github f5313dc519
Fix crash with defaulted destructor (#3975) 2022-04-05 23:18:08 +02:00
chrchr-github c4dcfef385
Fix #10260 debug: Executable scope 'x' with unknown function. (#3974)
* Fix #10174 debug: Executable scope 'x' with unknown function

* Format

* Add test for #10198

* Fix #10260 debug: Executable scope 'x' with unknown function.
2022-04-05 15:52:16 +02:00
chrchr-github cfbbeb4b1b
Partial fix for #10867 FN containerOutOfBounds with std::array (#3971)
* Partial fix for #10867 FN containerOutOfBounds with std::array

* Format

* Format

* Optimize
2022-04-05 07:34:20 +02:00
chrchr-github b79885c6af
Fix #10174 debug: Executable scope 'x' with unknown function (#3972)
* Fix #10174 debug: Executable scope 'x' with unknown function

* Format
2022-04-05 07:34:06 +02:00
chrchr-github aae810dd2c
Fix #10107 FP: duplicateValueTenary (#3969) 2022-04-04 06:33:54 +02:00
chrchr-github 955d6d8fc6
Fix #10793 internalAstError with brace-init in ternary (#3966)
* Fix #10793 internalAstError with brace-init in ternary

* Undo
2022-04-03 20:05:03 +02:00
Paul Fultz II 39265f8ce0
Fix 10931: Assert failure in setSymbolic() (#3967)
* Fix 10931: Assert failure in setSymbolic()

* Format
2022-04-03 20:04:18 +02:00
Paul Fultz II 0547cbcd26
Fix 10647: FN knownConditionTrueFalse for impossible Boolean value (#3968)
* Add impossible values for bool

* Fix valueflow tests

* Fix assertion failure

* Add test

* Format
2022-04-03 20:04:05 +02:00
chrchr-github 7a7b3e40eb
Fix regression FN constVariable with static arrays (#3965)
* Fix regression FN constVariable with static arrays

* Fix test case
2022-04-02 20:39:45 +02:00
chrchr-github a9f29fbc09
Fix #10307 FP functionStatic with class template and east-const / #10471 FP constParameter with std::array and east-const (#3963) 2022-04-01 23:26:44 +02:00
Daniel Marjamäki ea63b8e2bb misra: fix void parameter check 2022-04-01 21:34:47 +02:00
chrchr-github 4bf8718dcb
Fix #10849 FP constStatement with pointers in lambda (#3961) 2022-04-01 19:50:40 +02:00
Paul Fultz II 5bea50cd36
Fix 10908: FP: uninitvar after for-loop (#3942) 2022-03-31 21:24:20 +02:00
chrchr-github 183969cd4b
Fix #10936 FP constStatement with extern declaration (#3960) 2022-03-31 21:08:04 +02:00
chrchr-github c85e7e7d2f
Fix FP constStatement with more complex expression (#3959) 2022-03-30 22:00:57 +02:00
Paul Fultz II 32ded1602b
Fix warnings in switch statements on clang (#3943) 2022-03-30 19:30:02 +02:00
Jens Yllman 34a11c1673
Fix unmatched suppression (#5704) (#3886) 2022-03-30 19:24:53 +02:00
chrchr-github 343a23135d
Fix #10932 FP constStatement with reference and direct initialization (#3952) 2022-03-30 19:22:01 +02:00
chrchr-github 47ba053054
Fix #10744 FP constVariable with static pointer (#3957) 2022-03-30 19:21:09 +02:00
chrchr-github 86ff360946
Fix #10917 FP constStatement with immediately evaluated lambda (#3956) 2022-03-29 06:10:57 +02:00
chrchr-github 81bcbfa7fe
Fix #10920 FP missingOverride with friend (#3955) 2022-03-28 22:44:04 +02:00
chrchr-github 49147f95fe
Fix #10918 FP constStatement with dynamic_cast (#3954) 2022-03-28 22:15:40 +02:00
chrchr-github 8d49fc252c
Fix FP constStatement ',' with Eigen, OpenCV etc. (#3950) 2022-03-28 22:06:44 +02:00
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