Commit Graph

14127 Commits

Author SHA1 Message Date
chrchr-github 6e2cc450b8
Fix #11330 FN functionConst with access of smart pointer (#4720)
* Fix #11330 FNfunctionConst with access of smart pointer

* Simplify
2023-01-16 22:07:04 +01:00
Oliver Stöneberg 124668979c
replaced some `std::ostringstream` usage with `std::to_string()` (#4719) 2023-01-16 22:05:33 +01:00
chrchr-github a102ff3c2f
Fix #11485 FN unusedFunction / Fix #7739 FP unusedFunction (#4707) 2023-01-14 20:16:55 +01:00
chrchr-github a79dff15ab
Fix #11492 FP uninitvar with try/catch (#4711) 2023-01-14 20:14:38 +01:00
chrchr-github 7bbdc95f25
Fix #11473 FP constVariable / #11448 FP constParameter / #11188 FP danglingTempReference (#4680)
* Fix #11473 FP constVariable with range-based for / #11448 FP constParameter with unused non-const range loop variable

* Fix ValueType / #11188 FP danglingTempReference with auto

* Fix ValueType in range-based for

* Update symboldatabase.cpp
2023-01-11 22:04:06 +01:00
Armin Müller a77f0d9403
Typos found by running "codespell" (#4702) 2023-01-10 15:15:27 +01:00
chrchr-github 491721a6ff
Fix spurious variable declaration with unknown macro (#4694) 2023-01-09 16:11:26 +01:00
Oliver Stöneberg 8cc3e0b2ff
errortypes.h: use `enum class` instead of wrapping types into classes (#4693) 2023-01-08 19:31:54 +01:00
chrchr-github 911d610f2d
Fix #11486 FN unusedFunction when enum value with same name exists (#4690) 2023-01-08 14:30:42 +01:00
Paul Fultz II cefc105c5f
Fix 11468: false positive danglingTempReference warning (#4679) 2023-01-07 23:44:22 +01:00
chrchr-github 4ebdf5fae1
Fix #11478 FP identicalConditionAfterEarlyExit when passing *this (#4684) 2023-01-07 22:10:07 +01:00
Paul Fultz II 6020feb271
Fix 11461: arrayIndexOutOfBounds false positive (#4686) 2023-01-07 22:09:17 +01:00
Oliver Stöneberg a09667a6d9
removed unused error messages (#4689) 2023-01-07 10:35:39 +01:00
Paul Fultz II a338be4682
Add source traces when using LifetimeStore (#4678) 2023-01-03 22:02:48 +01:00
chrchr-github 4c1c506d21
#11472 FP returnTempReference with cast and scope operator (#4676) 2023-01-02 22:13:56 +01:00
chrchr-github 2007cd0a1d
Fix #11465 FP returnDanglingLifetime/returnTempreference with typeid (#4675) 2023-01-02 17:46:03 +01:00
chrchr-github f793b7dd35
Fix #11460 unintvar false positive (#4674)
* Fix #11460 unintvar false positive

* Format
2023-01-02 17:44:52 +01:00
chrchr-github 11f1a9d1f5
Fix crash on ternary with omitted operand (#4673)
* Fix MSVC compiler warning

* Fix crash on incomplete ternary operator

* Revert "Fix crash on incomplete ternary operator"

This reverts commit 28df0f0ab6ff794e733617447f847a97c1a7a609.

* Handle ternary with omitted operand
2023-01-02 17:44:17 +01:00
Oliver Stöneberg 0c95971c54
added .gitattributes and normalized files (#4668) 2022-12-30 21:33:45 +01:00
Oliver Stöneberg d3a2cdc26c
converted (undocumented) define `MAXTIME` into (undocumented) command-line options `--checks-max-time=`, `--template-max-time=` and `--typedef-max-time=` (#4661) 2022-12-30 21:21:05 +01:00
Oliver Stöneberg 71cdacdc97
fixed missing location for `valueFlowMaxIterations` debug warning / also added it to daca server overview (#4664) 2022-12-30 21:20:00 +01:00
Oliver Stöneberg 1cfe49e340
use `const_iterator` where possible (#4662) 2022-12-30 15:13:47 +01:00
Oliver Stöneberg b380fd2589
added command-line option `--valueflow-max-iterations` to control amount of valueflow iterations / also log debug warning when iterations are being exceeded (#4557) 2022-12-20 20:51:08 +01:00
Oliver Stöneberg 3c68b9b29f
use `cbegin()` and `cend()` with `const_ierator` loops (#4658) 2022-12-20 20:32:16 +01:00
Paul Fultz II f8132ea022
Fix 11381: FP derefInvalidIteratorRedundantCheck when updating iterator using std::tie (#4659) 2022-12-20 20:29:19 +01:00
chrchr-github 7506b4ab52
Fix #11441 FP variableScope when lambda is used (#4660) 2022-12-20 14:50:31 +01:00
chrchr-github ad858e92dc
Partial fix for #11444 cppcheckError: Analysis failed (function not recognized) (#4656) 2022-12-19 22:29:43 +01:00
Paul Fultz II da32c5aecd
Fix 11442: new "Reference to temporary returned." FPs (#4657) 2022-12-19 22:28:59 +01:00
Oliver Stöneberg 6fedbb4f77
add/preserve `const` in `dynamic_cast` (#4655) 2022-12-19 20:01:12 +01:00
Paul Fultz II 9da574f4a0
Fix 11227: ValueFlow: Known value not set in condition for ternary operator (#4653)
* Evaluate args before function call

* Fix tests

* Format

* Add test for 11227

* Format

* Fix known condition
2022-12-18 22:07:43 +01:00
Oliver Stöneberg dc5c5de10e
avoid some unnecessary copies (#4589) 2022-12-18 19:38:29 +01:00
chrchr-github 76c28073aa
Revert fix for #10831 (#4631) 2022-12-18 16:55:55 +01:00
chrchr-github 617cd29a41
Get type from auto (#4640) 2022-12-18 16:54:58 +01:00
chrchr-github b1abaf8809
Fix FP useStlAlgorithm (don't suggest std::accumulate when nothing is accumulated) (#4647) 2022-12-18 16:52:04 +01:00
gerboengels 63e30d1b8c
Fix syntaxError on lambda inside decltype (#4650)
Use case where it gave an issue:

using customComparator = decltype([] (const X& lhs, const X& rhs) { return lhs.CompareTo(rhs); });
std::map<X, int, costomComparator> m;

Co-authored-by: Gerbo Engels <gerbo.engels@ortec-finance.com>
2022-12-18 16:46:04 +01:00
Daniel Marjamäki 7799f820a3 Refactoring: Use static for local function getMinMaxValues 2022-12-17 21:21:18 +01:00
Daniel Marjamäki c736d60642 Fix Misra C++ warning 'Limited dependence should be placed on C++ operator precedence rules in expressions.' 2022-12-17 20:45:58 +01:00
chrchr-github 4c8aa56d8b
Partial fix for #11378 internalAstError regressions (iscpp11init) (#4629)
* Partial fix for #11378 internalAstError regressions (iscpp11init)

* Use %cop%

* Add test for #11229

* Format

* Format
2022-12-16 10:46:15 +01:00
Paul Fultz II 9c55b933c1
Partial fix for 11303: False negative: knownConditionTrueFalse using container .back() (#4633)
* Partial fix for 11303: False negative: knownConditionTrueFalse using container .back()

* Format

* Fix error message
2022-12-15 18:35:19 +01:00
Paul Fultz II 90898945c1
Fix 10532: False negative: dangling string_view when using ternary operator (#4638)
* Fix 10532: False negative: dangling string_view when using ternary operator

* Format

* Update
2022-12-15 18:34:43 +01:00
chrchr-github 553b579f8d
Fix #11434 FP knownConditionTrueFalse with loop over bool array (#4646)
* Fix #11434 FP knownConditionTrueFalse with loop over bool array

* Simplify
2022-12-15 14:31:02 +01:00
chrchr-github 0c1e2ceeb9
Fix #11289 FP wrongPrintfScanfArgNum - snprintf with parameter pack (#4644) 2022-12-15 08:52:13 +01:00
chrchr-github b7693ccc7a
Fix #11431 FP resourceLeak with goto (#4645) 2022-12-14 22:47:14 +01:00
Oliver Stöneberg 29e0133cb5
extracted `FwdAnalysis` from `astutils.{cpp|h}` (#4637)
* added missing filtering offiles in Visual Studio project

* extracted `FwdAnalysis` from `astutils.{cpp|h}`
2022-12-13 22:29:23 +01:00
Paul Fultz II e2f398f81a
Fix 11250: FN: bufferAccessOutOfBounds (comma operator: int x = (3,4) ) (#4636)
* Fix 11250: FN: bufferAccessOutOfBounds (comma operator: int x = (3,4) )

* Format
2022-12-13 07:52:58 +01:00
Oliver Stöneberg e01c463ff8
fixed #11428 - improved handling of suffixes in `MathLib::to{Double|ULong|Long}Number()` (#4635)
* fixed #11428 - improved handling of suffices in `MathLib::to{Double|ULong|Long}Number()`

* testmathlib.cpp: adjustments for `libc++`

* mathlib.cpp: added TODO
2022-12-13 07:52:45 +01:00
Paul Fultz II b4d455df48
Fix 11349: FP negativeIndex for clamped array index (#4627)
* Fix 11349: FP negativeIndex for clamped array index

* Format

* Use emplace_back

* Use default constructor
2022-12-13 07:50:01 +01:00
chrchr-github 5b687cb038
Fix #11423 Crash in valueFlowForwardConst() (#4634) 2022-12-12 22:58:48 +01:00
chrchr-github 3f5054035d
Fix #11432 FP passedByValue for overriden function (#4632) 2022-12-12 21:52:58 +01:00
Daniel Marjamäki 7aae78fed3 Refactoring: Remove unused parameter for AnalyzerInfo::reportErr 2022-12-11 21:27:16 +01:00