Commit Graph

566 Commits

Author SHA1 Message Date
chrchr-github 4b9f3c68fb
Fix #12188 FN uninitvar with increment of struct member (#5665) 2023-11-16 18:11:12 +01:00
Oliver Stöneberg e47300016b
moved some classes/structs into anonymous namespace (#5669) 2023-11-16 15:49:41 +01:00
chrchr-github a6b7a8c1cc
Fix #12170 FP knownPointerToBool with function pointer (#5646) 2023-11-12 10:20:18 +01:00
chrchr-github cf64ccea22
Fix #12147 false negative: passedByValue (#5626) 2023-11-07 22:50:31 +01:00
Daniel Marjamäki fc8c244675
CI: Add selfcheck using Cppcheck Premium. Activates Misra C++ 2008 and Cert C++ 2016 checkers. (#5623) 2023-11-06 15:31:47 +01:00
chrchr-github 77bfec4317
Fix #12119 FN constVariablePointer with reassigned pointer (#5592) 2023-10-28 16:48:39 +02:00
chrchr-github 6bc164e0d0
Fix #12122 FP knownConditionTrueFalse with type traits (#5595) 2023-10-26 23:33:35 +02:00
chrchr-github 7e2fcea3d9
Fix #12044 FN knownConditionTrueFalse comparing qualified constant with number (#5518) 2023-10-23 11:18:05 +02:00
chrchr-github 26ba29c303
Fix #12086 FN passedByValue with index operator and namespaced function call (#5574) 2023-10-21 12:41:39 +02:00
chrchr-github 41bd28c0b3
Fix #12087 Library: add Container::Action::FIND_CONST (#5579) 2023-10-20 21:22:06 +02:00
Paul Fultz II f2c8153231
Set the lower and upper bounds for variable that are only incremented or decremented (#5523)
Also, changed `isExpressionChanged` and `isThisChanged` to return the
token that is being modified and renamed the functions to
`findExpressionChanged` and `findThisChanged`.
2023-10-19 18:42:52 +02:00
chrchr-github 09f426d980
Fix #12082 FP uninitvar for assignment to array member in conditional (#5570) 2023-10-18 18:50:49 +02:00
chrchr-github f56677a99d
Fix #11857 FP constParameterReference with std::map (#5551) 2023-10-13 18:08:40 +02:00
chrchr-github 787da43dc9
Fix #12036 FN knownConditionTrueFalse comparing enum with number (#5510) 2023-10-05 18:15:18 +02:00
Daniel Marjamäki c4fe5ac8b7
Fix #12012 (FP: uninitvar, address of variable is casted to uintptr_t that is passed to function) (#5494) 2023-09-28 13:47:11 +02:00
Paul Fultz II 58a7519cbb
Fix 11992: FN (regression): uninitvar (#5465) 2023-09-20 06:43:58 +02:00
Paul Fultz II e6632d93e3
Fix 11983: False positive: uninitialized variable (#5443) 2023-09-13 23:27:08 +02:00
Paul Fultz II a1078f446a
Fix 11980: False positive returnDanglingLifetime returning pointer to stack array as std::string (by way of struct return value constructor) (#5445) 2023-09-13 21:26:37 +02:00
chrchr-github 18ee859737
Fix #11976 FP incorrectStringBooleanError in assert (#5415) 2023-09-12 10:05:51 +02:00
chrchr-github c6721688e2
Fix #11929 FP knownPointerToBool with dynamic_cast (#5416) 2023-09-11 18:04:36 +02:00
Oliver Stöneberg 91070ca794
utils.h: added `startsWith()` and started using it (#5381)
This makes the code much more readable. It also makes it less prone to
errors because we do not need to specify the length of the string to
match and the returnvalue is clear.

The code with the bad returnvalue check was never executed and I added a
test to show that.
2023-09-08 19:30:25 +02:00
chrchr-github 7a79366ba0
Fix #11914 Crash when checking widelands (#5404) 2023-09-05 11:12:04 +02:00
Paul Fultz II fd12baaf89
Fix 11898: FP knownEmptyContainer (#5394) 2023-09-02 14:30:35 +02:00
Oliver Stöneberg e7dd9cd793
enabled `readability-use-anyofallof` clang-tidy warning / added more checks to evaluate (#5339) 2023-08-31 09:04:51 +02:00
Daniel Marjamäki 7c992ced4c
Fixed #11901 (Performance regression: large array with strings) (#5375)
Analysis has slowed down a lot when there are many strings in an array.
2023-08-30 19:35:43 +02:00
chrchr-github 394996581e
Fix FP incorrectCharBooleanError with known condition (#5365) 2023-08-24 10:36:01 +02:00
chrchr-github 4654b6561b
Fix #11890 FP uninitvar for address taken in init list (#5360) 2023-08-24 10:35:33 +02:00
chrchr-github 8cd61941dc
Unified checks for unevaluated context (#5362) 2023-08-23 12:07:47 +02:00
Paul Fultz II 2adaafd20e
Fix 11887: FP knownPointerToBool with const_cast (#5357) 2023-08-23 01:07:49 +02:00
chrchr-github 725c431ecc
Fix #11881 FP returnStdMoveLocal / Fix FP incorrectStringBooleanError / Support std::string::starts/ends_with() (#5347) 2023-08-21 10:43:54 +02:00
Paul Fultz II 03b952d5eb
Fix 11579: false negative: knownConditionTrueFalse with non-bool as bool parameter (#5349)
This adds a new checker to check for pointer to bool conversions that
are always known. I removed the previous knownConditionTrueFalse checks
since this was too noisy.
2023-08-20 22:32:41 +02:00
Oliver Stöneberg a92b10ca3b
fixes #11104 (avoid C++-only parsing when processing C code in parsedecl()) / also avoid remaining `Library::detect*()` calls (#5346) 2023-08-18 22:48:24 +02:00
chrchr-github 827e87afe7
Fix #11579 FN knownConditionTrueFalse with non-bool as bool parameter / #9450 string literal to bool conversion in function call (#5338) 2023-08-18 10:32:52 +02:00
Oliver Stöneberg 3cf9100198
fixed #6316 (Use std::to_string() in place of MathLib::toString() ...) - deleted default implementation of `Mathlib::toString()` (#5341)
It was also used inconsistently and seemed to imply there is some
special handling which wasn't the case. It was just an alias for
`std::to_string()` for non-`double` types. So there was no need for it.

---------

Co-authored-by: Robert Reif <reif@earthlink.net>
2023-08-17 16:46:32 +02:00
Paul Fultz II 8aa9d710d1
Fix 11844: FP negativeIndex for known loop (#5282) 2023-08-14 15:17:05 +02:00
Paul Fultz II 48c91abba6
Fix issue 11867: Assert failure in valueFlowContainerSize() (#5317) 2023-08-13 22:31:38 +02:00
chrchr-github d4d77edeae
Fix FP uninitStructMember / cleanup from #5311 (#5315) 2023-08-12 23:46:31 +02:00
chrchr-github a7d487f6db
Fix #11805 FP uninitvar for stringstream into deref pointer to uninit var / #11804 FP uninitvar for array in struct in struct (#5311) 2023-08-11 18:45:58 +02:00
chrchr-github 838b6b86e3
Fix #11862 FN constParameterPointer with increment (#5291) 2023-08-08 10:38:03 +02:00
chrchr-github 99f7f88f39
Fix FN constParameterPointer (#5270)
Co-authored-by: chrchr-github <chrchr@github>
2023-07-27 20:54:12 +02:00
Paul Fultz II 92caa835b6
Fix 11806: FP uninitvar for reference to unitvar in ternary ?: operator (#5247) 2023-07-17 10:34:54 +02:00
chrchr-github 218650dc85
Fix #11820 FP duplicateExpression with double negation (#5227) 2023-07-07 23:30:59 +02:00
chrchr-github cc38ef4168
Fix #11818 FP constParameterReference / #11819 FP stlcstrConstructor / #11814 FP unknownMacro (#5224) 2023-07-07 15:54:07 +02:00
chrchr-github 4f71bbe986
Detect lambda with template argument (#5202) 2023-06-27 16:19:12 +02:00
chrchr-github bb962e2bc3
Enable and mitigate readability-else-after-return (#5175) 2023-06-20 18:43:21 +02:00
Daniel Marjamäki 9a290c959f
Fix #11776 (False positive: uninitialized variable, struct array member initialized in function) (#5165) 2023-06-17 10:20:20 +02:00
Daniel Marjamäki aca6c47024
Fix #11774 (False positive: passing struct pointer to function that initialize it) (#5162) 2023-06-16 18:43:32 +02:00
Daniel Marjamäki f934d6e5d0
Fix #11767 (False positive: uninitialized member after assignment) (#5157) 2023-06-15 14:42:58 +02:00
chrchr-github ec4267a2bd
Don't suggest const for smartptr::get() (#5126)
* Don't suggest const for smartptr::get()

* Fix test

* Fix merge

* get() doesn't change a smartpointer

* Parentheses
2023-06-07 20:45:48 +02:00
chrchr-github 0b44429a7c
Fix spurious lambda detection (#5101) 2023-05-31 20:55:39 +02:00