Commit Graph

241 Commits

Author SHA1 Message Date
Paul Fultz II 7f358b2bed
Format with uncrustify (#3388) 2021-08-07 20:51:18 +02:00
Paul Fultz II 59a1c1a9d8
Refactor: Remove variable analyzer (#3339) 2021-07-18 07:46:31 +02:00
Daniel Marjamäki 797de4ef92 Fixed #10363 (FP: compareValueOutOfTypeRangeError) 2021-07-16 19:08:08 +02:00
Daniel Marjamäki cbb07b6247 misra; implement rule 14.3 2021-07-15 09:43:38 +02:00
Daniel Marjamäki 9769afe434 knownConditionTrueFalse; avoid several warnings when nonzero expression is compared to see if it is positive or negative 2021-06-25 16:25:25 +02:00
Paul Fultz II 563c9dd9cc
Fix issue 10208: FP: knownConditionTrueFalse in for loop with function that assigns by ref (#3198) 2021-04-18 21:42:27 +02:00
Daniel Marjamäki c8e661f61f assignmentInCondition: Clarify error message 2021-04-07 19:46:00 +02:00
Daniel Marjamäki 72802554c9 Fixed #3593 (New Check: Check for assignment within conditional expression) 2021-04-07 17:21:34 +02:00
Oliver Stöneberg 6397e29f84
cleaned up includes based on include-what-you-use (#3141) 2021-04-03 21:30:50 +02:00
Daniel Marjamäki 42437277dc Update Copyright year 2021-03-21 20:58:32 +01:00
PKEuS 141d2ac215 Refactorization: Improved internal implementation of severity and certainty levels
Backported from LCppC.
2021-02-24 22:00:06 +01:00
Paul Fultz II d80f2fb46f
Reapply f1cc3ad and fix performance regression (#3076) 2021-01-23 08:47:39 +01:00
Daniel Marjamäki 0fa89ff2ba Revert 14365ffc7 and f1cc3ada8, there was a performance regression 2021-01-22 10:51:46 +01:00
Paul Fultz II f1cc3ada86
Refactor valueFlowTerminatingCondition to handle inner conditions and complex conditions (#3060) 2021-01-21 20:18:53 +01:00
Daniel Marjamäki 76f759fcc4 Fixed #9702 (False positive: Opposite inner condition when modifying member variable used by inner condition) 2021-01-15 20:51:47 +01:00
Paul Fultz II bc3f5554a4
Fix issue 8871: improve check: mismatching container size conditions (#2988) 2021-01-10 13:30:00 +01:00
Daniel Marjamäki b3b7ecc7ea Removed integerOverflowOptimization checking and merged functionality into invalidTestForOverflow 2021-01-05 11:38:19 +01:00
Oliver Stöneberg fbf5858f76
fixed and enabled several clang-tidy warnings (#2816) 2021-01-02 19:10:25 +01:00
Paul Fultz II 904d52acac
Fix issue 10004: ValueFlow: pointer value, wrongly set known value (#2931) 2020-12-03 07:15:31 +01:00
Rikard Falkeborn 829c543331
TestCondition: Don't warn when sizeof is involved (#2896) 2020-11-11 08:01:11 +01:00
Daniel Marjamäki 33844b28ab Another fix for the crash 2020-10-22 06:59:13 +02:00
Daniel Marjamäki bcc7c5cd50 Use astIsPointer to avoid crashes 2020-10-22 06:55:48 +02:00
Ken-Patrick Lehrmann e4a54a24db
Fix regression in CheckCondition (#2854)
Introduced by e2a81a382f.
2020-10-20 07:56:41 +02:00
Paul Fultz II a4f43fc2ad
Fix issue 8234: false negative: (warning) Opposite inner 'if' condition leads to a dead code block. (#2781) 2020-09-07 07:53:41 +02:00
Paul Fultz II 1c5f496350
Fix issue 8373: false negative: invalid iterator (#2761) 2020-08-31 08:46:56 +02:00
Daniel Marjamäki df99d8aa0a
Merge pull request #2719 from pfultz2/fp-unreachable-alias
Fix issue 9807: False positive: ValueFlow in unreachable code, || lhs is true
2020-07-23 09:52:54 +02:00
Paul dbb410cdae Merge branch 'main' into condition-in-expr 2020-07-21 13:28:59 -05:00
Paul 5bc5c96c8f Fix cppcheck error 2020-07-21 13:20:39 -05:00
Rikard Falkeborn 9ced26a7a1 Refactor: Use visitAstNodes in checkcondition 2020-07-20 11:03:29 +02:00
Daniel Marjamäki e0be224f4e
Merge pull request #2709 from pfultz2/fp-duplicate-cond-this
Fix FP of duplicateCondition when modifying the this variable
2020-07-13 21:14:58 +02:00
Paul 519f2a537a Format 2020-07-13 13:55:45 -05:00
Paul 450bdfedf3 Fix FP of duplicateCondition when modifying the this variable 2020-07-13 12:40:01 -05:00
Rikard Falkeborn d8e7e9176b Fix FN with known condition and sizeof
cppcheck behaved differently if sizeof was to the left or right of the
comparison. In order to fix this, we cannot break the while loop until
all operands have been processed.
2020-07-10 23:39:16 +02:00
Daniel Marjamäki f56a17bf3d Fixed #8858 (FP: identicalConditionAfterEarlyExit when there is #if) 2020-07-01 07:48:32 +02:00
Paul d5b6d49d96 Fix issue 9578: false negative: (style) Condition '...' is always false 2020-06-28 15:28:08 -05:00
Oliver Stöneberg 37bc0483a4
made check.h less heavy (#2633) 2020-05-23 07:16:49 +02:00
Daniel Marjamäki 08ddd84780 Update copyright year 2020-05-10 11:16:32 +02:00
Daniel Marjamäki 3e0218299b Revert "Update copyright year"
This reverts commit 6eec6c4bd5.
2020-05-10 11:13:05 +02:00
Daniel Marjamäki 6eec6c4bd5 Update copyright year 2020-05-10 11:11:34 +02:00
Oliver Stöneberg 1af959af2c
fixed -Wextra-semi-stmt Clang warnings (#2553)
* fixed -Wextra-semi-stmt Clang warnings

* adjusted REDIRECT macro to require a semicolon

* testmathlib.cpp: rolled back accidental change
2020-04-21 17:27:51 +02:00
Paul Fultz II 3773d0e875
Find more redundant conditions (#2597) 2020-04-07 07:15:15 +02:00
Daniel Marjamäki 4f1e8bc5e7 astyle formatting
[ci skip]
2020-01-04 18:47:05 +01:00
Ken-Patrick Lehrmann a9d423eef2 Fix #8938: FP identicalInnerCondition (#2471) 2020-01-04 11:38:56 +01:00
Paul Fultz II dd05839a7e Fix false positives in knownConditionTrueFalse when using expressions with const variables (#2469) 2020-01-03 19:35:28 +01:00
Daniel Marjamäki 7cd7aff60a Fixed #9285 (Misleading warning message) 2019-11-16 17:24:54 +01:00
Daniel Marjamäki 9094ff01d3 Fixed #9363 (knownConditionTrueFalse: False positive about function parameter) 2019-10-31 08:34:09 +01:00
Paul Fultz II a903aa7070 Fix issue 9351: false negative: (style) Condition '...' is always true (#2201) 2019-09-23 08:49:04 +02:00
Paul Fultz II ad8abdb0c3 Add impossible values to ValueFlow (#2186)
* Add impossible category

* Replace values

* Try to adjust known values

* Add ! for impossible values

* Add impossible with possible values

* Remove contradictions

* Add values when the branch is not dead

* Only copy possible values

* Dont bail on while loops

* Load std lib in valueflow

* Check for function calls

* Fix stl errors

* Fix incorrect impossible check

* Fix heap-after-use error

* Remove impossible values when they are lowered

* Show the bound and remove overlaps

* Infer conditions

* Dont push pointer values through dynamic_cast

* Add test for dynamic_cast issue

* Add shifttoomanybits test

* Add test for div by zero

* Add a test for issue 9315

* Dont make impossible value inconclusive

* Fix FP with shift operator

* Improve handleKnownValuesInLoop for impossible values

* Fix cppcheck warning

* Fix impossible values for ctu

* Bailout for streams

* Check equality conditions

* Fix overflows

* Add regression test for 9332

* Remove duplicate conditions

* Skip impossible values for invalid value

* Check for null

* Rename bound to range

* Formatting
2019-09-20 15:06:37 +02:00
Paul Fultz II 3e0d1141d3 Fix issue 9277: FP: Dont warn for knwon conditions in if constexpr (#2085) 2019-08-16 07:56:39 +02:00
Daniel Marjamäki 5dc4f44091 Replace 'unsigned' with 'nonneg' in checkcondition 2019-07-16 08:21:25 +02:00