Commit Graph

27284 Commits

Author SHA1 Message Date
Paul Fultz II da32c5aecd
Fix 11442: new "Reference to temporary returned." FPs () 2022-12-19 22:28:59 +01:00
Oliver Stöneberg 2cd8bb94e4
some small `CmdLineParser` cleanups and improvements () 2022-12-19 22:28:36 +01:00
Oliver Stöneberg 6fedbb4f77
add/preserve `const` in `dynamic_cast` () 2022-12-19 20:01:12 +01:00
Paul Fultz II 9da574f4a0
Fix 11227: ValueFlow: Known value not set in condition for ternary operator ()
* 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 d8451eda5f
donate-cpu: fixed interrupted `main` branch compilation () 2022-12-18 19:50:22 +01:00
Oliver Stöneberg dc5c5de10e
avoid some unnecessary copies () 2022-12-18 19:38:29 +01:00
Oliver Stöneberg 0ed98c8f29
removed unused test files () 2022-12-18 19:36:37 +01:00
chrchr-github 98b3d66684
Add test for () 2022-12-18 16:57:25 +01:00
chrchr-github 76c28073aa
Revert fix for () 2022-12-18 16:55:55 +01:00
chrchr-github 617cd29a41
Get type from auto () 2022-12-18 16:54:58 +01:00
chrchr-github b1abaf8809
Fix FP useStlAlgorithm (don't suggest std::accumulate when nothing is accumulated) () 2022-12-18 16:52:04 +01:00
gerboengels 63e30d1b8c
Fix syntaxError on lambda inside decltype ()
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
Oliver Stöneberg e5721030ca
greatly sped up `dmake` ()
* dmake.cpp: use `endsWith()` in `getCppFiles()`

* dmake.cpp: optimized string concatenation in `getDeps()`

* dmake.cpp: avoid duplicated `std::string::find()` in `getDeps()`

* dmake.cpp: no need to get dependencies of headers without `.h` extension in `getDeps()`

* dmake.cpp: do not try to look for file in `externals` folder which does not contain any headers in `getDeps()`
2022-12-17 09:13:31 +01:00
chrchr-github 4c8aa56d8b
Partial fix for internalAstError regressions (iscpp11init) ()
* Partial fix for  internalAstError regressions (iscpp11init)

* Use %cop%

* Add test for 

* Format

* Format
2022-12-16 10:46:15 +01:00
Paul Fultz II 9c55b933c1
Partial fix for 11303: False negative: knownConditionTrueFalse using container .back() ()
* 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 ()
* 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 FP knownConditionTrueFalse with loop over bool array ()
* Fix  FP knownConditionTrueFalse with loop over bool array

* Simplify
2022-12-15 14:31:02 +01:00
chrchr-github 0c1e2ceeb9
Fix FP wrongPrintfScanfArgNum - snprintf with parameter pack () 2022-12-15 08:52:13 +01:00
chrchr-github b7693ccc7a
Fix FP resourceLeak with goto () 2022-12-14 22:47:14 +01:00
Oliver Stöneberg 29e0133cb5
extracted `FwdAnalysis` from `astutils.{cpp|h}` ()
* 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) ) ()
* Fix 11250: FN: bufferAccessOutOfBounds (comma operator: int x = (3,4) )

* Format
2022-12-13 07:52:58 +01:00
Oliver Stöneberg e01c463ff8
fixed - improved handling of suffixes in `MathLib::to{Double|ULong|Long}Number()` ()
* fixed  - 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 ()
* 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 Crash in valueFlowForwardConst() () 2022-12-12 22:58:48 +01:00
chrchr-github 3f5054035d
Fix FP passedByValue for overriden function () 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
Rikard Falkeborn ac525531d9
test-my-pr, mark --c-only and --cpp-only mutually exclusive ()
It makes no sense to specify both arguments at the same time.
2022-12-11 19:41:21 +01:00
Paul Fultz II 3f88744851
Fix 11358: FP containerOutOfBounds for container passed by pointer () 2022-12-09 19:43:21 +01:00
Oliver Stöneberg 40a69e5afb
optimized deserializing of `ErrorMessage` and related main process code () 2022-12-09 19:34:51 +01:00
Oliver Stöneberg bdee2ffc32
bump simplecpp () 2022-12-09 07:18:13 +01:00
Paul Fultz II 6eccb2e36c
Throw internal error when tokens are not in order ()
* Throw internal error when tokens are not in order

* Add semicolon
2022-12-09 07:17:16 +01:00
Paul Fultz II 7acbb656f3
Fix 11412: False positive: uninitvar ()
* Dont remove modified variables from dead code

* Add test for 11412

* Format
2022-12-09 07:15:47 +01:00
Paul Fultz II c150317f02
Fix 11384: FP knownConditionTrueFalse when variable is modified in return statement ()
* Fix 11384: FP knownConditionTrueFalse when variable is modified in return statement

* Format
2022-12-09 07:15:15 +01:00
chrchr-github c779cefa61
Fix debug: Missing variable class for variable with varid () 2022-12-08 20:17:06 +01:00
Paul Fultz II 0cb742701d
Fix 11415: FP containerOutOfBounds for container initialized in virtual method () 2022-12-08 20:10:58 +01:00
chrchr-github 04b7c0c200
Fix FP knownConditionTrueFalse with iterator ()
* Fix wrong value set in valueFlowSameExpressions()

* Fix   FP knownConditionTrueFalse with iterator
2022-12-08 10:40:55 +01:00
Paul Fultz II 663a8411dd
Fix 11416: FP nullPointerRedundantCheck for check after loop with break () 2022-12-08 07:27:06 +01:00
Oliver Stöneberg 4103d05c7f
improved `ErrorMessage::deserialize()` error messages () 2022-12-07 18:00:45 +01:00
chrchr-github 8713dabe58
Get type from iterator () 2022-12-07 09:38:36 +01:00
Oliver Stöneberg 8bb5ac0efd
improved `MathLib::to{ULong|Long|Double}Number()` and increased test coverage / added CMake option `USE_LIBCXX` / fixed () 2022-12-07 09:20:09 +01:00
chrchr-github 89dba226dd
Fix FP uninitvar with unseen typedef () 2022-12-07 09:14:22 +01:00
chrchr-github 0e57c27dd3
Fix debug: CheckClass::checkConst found unlinked template argument list () 2022-12-07 09:12:46 +01:00
chrchr-github d5d7446433
Add cfg for std::scoped_lock, handle template arguments in checkMisusedScopedObject() () 2022-12-07 09:10:48 +01:00
Oliver Stöneberg 7d3ce62ee9
improved errorhandling related to deserializing `ErrorMessage` () 2022-12-03 15:44:33 +01:00
Rikard Falkeborn 9427fa3c66
Refactor runtests to allow to specify files on command line () 2022-12-03 15:41:11 +01:00
chrchr-github 0854fda28a
Get type from smartpointer ()
* Fix  checkLibraryFunction treats "auto" as type

* Use utility function

* Get type from 'auto p = new ...'

* Fix merge

* Add test for recent fix

* Format

* Get type from smartpointer
2022-12-03 07:50:21 +01:00
chrchr-github 7d6683fb78
Fix FP knownConditionTrueFalse with container and brace init ()
* Fix  FP knownConditionTrueFalse with container and brace init

* Format

* Format

* Move to getInitListSize()
2022-12-02 22:07:08 +01:00
chrchr-github e4ee7cd59c
Get type from 'auto p = new ...' ()
* Fix  checkLibraryFunction treats "auto" as type

* Use utility function

* Get type from 'auto p = new ...'

* Fix merge
2022-12-02 20:28:14 +01:00