Commit Graph

11328 Commits

Author SHA1 Message Date
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
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
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
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 c132235a76
Add test for #10398 (#3752)
* Fix #10200 False positive: uninitStructMember

* Fix #9828 False positive: unreadVariable alias

* Use Token::Match

* Add test for #10398
2022-01-25 22:05:54 +01:00
orbitcowboy cf6d30f358 Merge branch 'main' of https://github.com/danmar/cppcheck into main 2022-01-25 13:08:25 +01:00
orbitcowboy 00997283cb Code formatting 2022-01-25 13:08:05 +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
chrchr-github b491fcc489
Add test cases for #9850, #9910 (#3747) 2022-01-24 15:06:40 +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
chrchr-github 7f9ef8c321
Add test cases for #7899, #7974, #9256 (#3726)
* Add test case for #7899 and #7974

* Add test case for ##9256
2022-01-20 16:15:38 +01:00
chrchr-github 4d44d0c079
Fix #9781 FP deallocuse after auto_ptr (#3724) 2022-01-19 21:39:45 +01:00
chrchr-github 089ca67d78
Use TODO_ASSERT (#3704) 2022-01-18 22:03:52 +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
orbitcowboy b6c010c17e Added regression test for Ticket 7981. 2022-01-18 13:09: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
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 9220c8175d
Remove todo assert (#3714) 2022-01-16 12:32:46 +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
chrchr-github 12abf85d1d
Add test case for #5777, use TODO_ASSERT, enable test case (#3703)
* Add test case for #5777, use TODO_ASSERT, enable test case

* Comment
2022-01-13 19:52:02 +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
Maurice Gilden 44b182c9a7
Improve definitions for googletest ASSERT_* macros (#3694)
This avoids assertWithSideEffect and follows more closely what the real macros
are doing, similar to the ones in boost.cfg and cppunit.cfg.
2022-01-12 22:09:17 +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 e4c8798974
Fix #10556 FP containerOutOfBounds with QList [inconclusive] (#3688) 2022-01-12 22:03:57 +01:00
chrchr-github 1670805a8d
Fix #10490 FP unreadVariable with std::shared_lock (#3672) 2022-01-10 07:43:02 +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
orbitcowboy 4a3a287248 Improved test case for ticket 1586 2022-01-08 18:39:19 +01:00
orbitcowboy 89e60af516 Ticket #1586 - Added regression test 2022-01-08 17:45:45 +01:00
Paul Fultz II 0c9eb5d190
Fix 10681: FP ctuuninitvar with array member (#3686) 2022-01-08 10:47:28 +01:00
chrchr-github 635c09643d
Add tests for #8498, #9887 (#3680) 2022-01-07 12:34:57 +01:00
shaneasd 8f7996211b
remove nullScope from TestSymbolDatabase (#3679) 2022-01-06 15:23:43 +01:00
chrchr-github 9fda86eb6d
Fix #9998 (#3676) 2022-01-06 15:21:05 +01:00
chrchr-github 6c55f9cf88
Add test for #10133 (#3675) 2022-01-06 15:19:10 +01:00
Paul Fultz II 1682344a80
Fix 10678: FP nullPointerArithmeticRedundantCheck in while loop (#3674) 2022-01-04 21:19:45 +01:00
chrchr-github fe077fc141
Add test for #10312 (#3673) 2022-01-04 20:50:00 +01:00
Oliver Stöneberg 0ba9cb4e64
fixed some unusedFunction warnings (#3618) 2022-01-04 15:48:08 +01:00
chrchr-github c05e2cc6c4
Fix #10154 False positive: objectIndex (#3666) 2022-01-04 10:37:16 +01:00
Paul Fultz II 119ec0582a
Fix 10676: FP: Array index -1 is out of bounds. (#3670) 2022-01-04 10:21:54 +01:00
Daniel Marjamäki 3524a0a3eb exprengine: reduce max buffer size to int_max 2022-01-03 20:55:46 +01:00
Daniel Marjamäki 33305ef4ec exprengine: better checking for uninit variables 2022-01-03 12:47:13 +01:00
Oliver Stöneberg 6739995e79
removed or annotated some code which is only used in test code (#3656) 2022-01-03 12:40:20 +01:00
Paul Fultz II 01a8890d6d
Fix 9760: False positive: constParameter on parameter used to take non-const pointer via array decaying (#3660) 2022-01-02 08:15:38 +01:00
Paul Fultz II 71a44395c8
Fix 10659: FP knownConditionTrueFalse - C++17 structured binding (#3662) 2022-01-02 08:14:50 +01:00
KenPatrickLehrmann af289c8357
Handle (&foo)-> in isVariableChanged (#3624) 2022-01-02 08:14:10 +01:00
Armin Müller d5daba331f
Typos found by running "codespell" (#3659) 2022-01-02 08:12:08 +01:00
Paul Fultz II 50862d1ace
Fix 10665: Crash in ExpressionAnalyzer (#3661) 2022-01-02 08:09:23 +01:00
Paul Fultz II 4b04c86249
Add regression for 9917: false positive: bitwiseOnBoolean when lhs is non-boolean (#3664) 2022-01-02 08:08:28 +01:00
Paul Fultz II 0c952ca05d
Fix 10223: ValueFlow; known value for a volatile variable (#3658) 2022-01-01 23:15:14 +01:00
Paul Fultz II 7bf0ca8d00
Fix 10672: crash: CheckAutoVariables (#3657) 2022-01-01 00:14:36 +01:00
chrchr-github 922e27de4c
Fix #7754 FP Same expression on both sides of '||' (#3635) 2021-12-31 08:24:05 +01:00
Rikard Falkeborn 8537331ad6
AutovarDeallocation: Fix grammar in error message (#3654) 2021-12-23 20:09:55 +01:00
Paul Fultz II d36aa590cd
Fix 10553: FP uninitvar with strcpy (#3652) 2021-12-23 08:22:41 +01:00
Daniel Marjamäki e6ccf299b9 Fixed #10598 (SymbolDatabase: final class is not parsed properly) 2021-12-22 21:48:01 +01:00
Chris Lalancette df1d6cf026
Fix the ability to recognize return types when simplifying attributes. (#3637)
* Fix the ability to recognize return types when simplifying attributes.

When parsing attributes to remove them, we have to allow for
the case where the return type of the function that follows
the attribute has a namespaced C++ type, like foo::bar .
That means that :: has to be recognized as a valid token.
Fix this in simplifyAttribute, and add tests for this as well.
2021-12-22 19:02:38 +01:00
chrchr-github 5a95ece15e
#10591: add TODO (#3647) 2021-12-21 10:24:38 +01:00
chrchr-github ca4e5ac527
Fix #7038 false negative for string argument in the CheckIO (#3649) 2021-12-20 17:22:39 +01:00
chrchr-github e6091cbe54
Add tests for #4647, #5979, #8763, #10101 (#3648) 2021-12-20 13:12:19 +01:00
Paul Fultz II 73f24b43f9
Fix 10437: FP knownConditionTrueFalse after pointer check (#3646) 2021-12-20 07:28:40 +01:00
orbitcowboy b2d81f0870 Ticket #8640: Added regression test 2021-12-19 17:43:32 +01:00
Paul Fultz II d69257e8cd
Fix 9740: FP accessMoved related to designated initialization (#3644) 2021-12-19 12:36:48 +01:00