Commit Graph

13203 Commits

Author SHA1 Message Date
Daniel Marjamäki f3d9755e65 UninitVar: too many warnings (pointer dereference) 2021-10-03 18:12:29 +02:00
Daniel Marjamäki 9f2ddf1623 UninitVar: too many warnings (function/cast operand) 2021-10-03 14:47:57 +02:00
Paul Fultz II fc6a791a74
Fix 9766: False positive; suspicious operator is written in declaration (#3476) 2021-10-03 09:59:51 +02:00
chrchr-github 609e20d9d8
ValueFlow: string can be constructed from init list (#3459) 2021-10-02 23:09:49 +02:00
Daniel Marjamäki 7684d7b98a 2.6 dev: set version 2021-10-02 13:15:12 +02:00
chrchr-github 0c16e346f1
Minor: add endsWith() template, empy() check (#3472) 2021-09-28 20:34:21 +02:00
Daniel Marjamäki 08f9de95e2 Update copyright year 2021-09-26 11:34:56 +02:00
Paul Fultz II d1181ad8e2
Fix 10506: Hang: template alias (TemplateSimplfier) (#3466) 2021-09-25 11:56:39 +02:00
Paul Fultz II 5c3b69fe96
Fix 10496: crash: endless recursion (symbolDatabaseCreateExprId => isSameExpr => isSameExpr ...) (#3467) 2021-09-25 11:55:49 +02:00
Daniel Marjamäki 2ee920dc4e Fixed #10495 (False positive: unreadVariable when assigning to reference returned by method) 2021-09-24 07:30:17 +02:00
Paul Fultz II edd435d5f0
Fix 10491: Crash in unusedFunction on valid C++ code (#3465) 2021-09-22 13:03:46 +02:00
Paul Fultz II 255dc0484a
Fix 10331: wrong conditional value after assignment+return (#3461) 2021-09-21 19:25:41 +02:00
Paul Fultz II c76e6345c4
Fix FPs in bitwiseOnBoolean (#3455) 2021-09-19 15:20:57 +02:00
Paul Fultz II 9e9a982c6c
Fix 10468: False positive; uninitialized variable. Loop is always executed at least once (#3462) 2021-09-18 22:23:05 +02:00
Daniel Marjamäki 6234e9ddda Fixed #10483 (FP constParameter with array member and memcpy) 2021-09-15 21:25:16 +02:00
chrchr-github 05acc13582
Shadow variables, const, rename function (#3456) 2021-09-15 20:28:58 +02:00
Daniel Marjamäki a9a093e7cc Fixed #10367 (False positive; pointer out of bounds argv-1) 2021-09-15 08:29:10 +02:00
Daniel Marjamäki 29bbb4ce14 Fixed #9220 (False positive: Unused function check for template parameter) 2021-09-12 20:27:49 +02:00
Daniel Marjamäki 23d37e5e7b Fix crash in daca@home 2021-09-12 19:41:35 +02:00
Daniel Marjamäki b455f847ba Fixed #10448 (FN compareValueOutOfTypeRangeError with int32_t) 2021-09-12 15:08:14 +02:00
Daniel Marjamäki 6f4ce486a2 Fix FP in constVariable 2021-09-11 20:25:46 +02:00
Paul Fultz II 9ece849d80
Fix 10467: FP mismatchingContainers with array of vectors (#3453) 2021-09-09 20:43:46 +02:00
Paul Fultz II b0b3f7ec2d
Fix 10464: FP: knownConditionTrueFalse (#3452) 2021-09-09 07:49:56 +02:00
Daniel Marjamäki 47f5e5d145 Fixed #10461 (FP missingReturn with empty initializer list) 2021-09-06 21:20:19 +02:00
Paul Fultz II d4174a31ba
Fix 10414: FP 'The address of local variable 'single_value' might be accessed at non-zero index.' (regression) (#3447) 2021-09-06 07:15:46 +02:00
Paul Fultz II 98e22f6162
Fix 10413: FP arrayIndexOutOfBoundsCond after check (#3446) 2021-09-06 07:15:24 +02:00
Daniel Marjamäki 045f21ee48 Fixed #10142 (FP uninitMemberVar with std::map) 2021-09-05 16:35:24 +02:00
Paul Fultz II 0335671b35
Fix 10450: regression, FP : Iterator 'iter' from different container 'l' are used together (#3436) 2021-09-05 07:35:33 +02:00
FabianWolff cd5fa015c1
Fix incorrect warning with `%zi` in format string (#3437) 2021-09-05 07:34:22 +02:00
Paul Fultz II ccb31d8510
Fix 10460: FP knownConditionTrueFalse 'fabs(x)<1/(double)16' is always false (#3445) 2021-09-05 07:10:58 +02:00
Paul Fultz II 928efe77fc
Fix 9765: FP: knownConditionTrueFalse handling of template function with ternary operator (#3443) 2021-09-04 19:55:36 +02:00
Paul Fultz II 28bc717cbe
Fix 10163: false positive: lifetime for r is not same as for seq 'for (auto& r: seq)' (#3442) 2021-09-04 19:53:14 +02:00
Paul Fultz II 82b725e540
Fix FP when using deferred locks (#3441) 2021-09-04 19:06:48 +02:00
Paul Fultz II 9eb5eadd35
Fix 9777: False Positive: Condition is always true with reset/release on unique_ptr (#3440) 2021-09-04 19:06:13 +02:00
Paul Fultz II 8a708e556c
Fix 10456: FP identicalConditionAfterEarlyExit with variable captured by reference (#3439) 2021-09-04 19:05:41 +02:00
Ken-Patrick Lehrmann b3b3b6b2a1
Fix handling of namespace scope with several bodystarts (#3438)
Follow up to 0093452bed.
Give the proper end to getVariableList, since it might not be bodyEnd.

Before that, getVariableList would add the same variables in several
unrelated scopes, and all kind of false positive would follow.

For instance, with the case I added in the unit-tests, I had:
```
../code.cpp:15:18: warning: The struct 'is_A' defines member variable with name 'foo' also defined in its parent struct 'is_A_impl'. [duplInheritedMember]
static const int foo = 8;
                 ^
../code.cpp:15:18: note: Parent variable 'is_A_impl::foo'
static const int foo = 8;
                 ^
../code.cpp:15:18: note: Derived variable 'is_A::foo'
static const int foo = 8;
                 ^
../code.cpp:15:18: style: struct member 'has_A::foo' is never used. [unusedStructMember]
static const int foo = 8;
                 ^
../code.cpp:15:18: style: struct member 'is_A::foo' is never used. [unusedStructMember]
static const int foo = 8;
                 ^
```
2021-09-04 11:09:33 +02:00
Paul Fultz II b788e41191
Fix 10438: FP knownConditionTrueFalse after return in a catch clause (#3429) 2021-09-03 23:07:08 +02:00
Daniel Marjamäki dccebb98ea Removed missingReturn inconclusive warnings, that was too noisy 2021-09-01 19:50:17 +02:00
Ken-Patrick Lehrmann 4296859c1a
Remove usage of std::vector and getArguments from getTokenArgumentFunction (#3435)
getTokenArgumentFunction can be called many many times, and the vector
is not needed, but it can become quite costly.
This patch replaces getArguments with a function simply returning the
position of the token, if it is found in the arguments (thus saving the
cost of std::vector).
2021-09-01 10:51:44 +02:00
Paul Fultz II 7ce17f076a
Fix 10318: iterator converted to type, wrong scope check (#3433) 2021-08-31 09:48:23 +02:00
Daniel Marjamäki 15eb53b403 Tokenizer: Add 'enum struct' pattern 2021-08-30 20:18:06 +02:00
Paul Fultz II 49df3d811a
Validate asserts in the AST to fix crash in 10442 (#3428) 2021-08-29 20:45:31 +02:00
Daniel Marjamäki ccfd18b96d Simplify Typedef: Fixed typedef simplification in expanded tokens 2021-08-29 19:14:53 +02:00
Daniel Marjamäki 19fea629c6 Fix FP in checkCompareValueOutOfTypeRange when sign is unknown 2021-08-29 16:03:56 +02:00
Paul Fultz II 92eb59981d
Fix 10435: False positive: containerOutOfBounds (#3426) 2021-08-29 15:40:10 +02:00
Paul Fultz II 2ee880752f
Fix 10410: FP nullPointerRedundantCheck on if (a || b ) followed by if ( b ) (#3427) 2021-08-29 15:39:41 +02:00
Daniel Marjamäki 06249c08f3 argumentSize: Clarify error message 2021-08-29 15:38:58 +02:00
Daniel Marjamäki 0d31486264 Fixed #10403 (Wrong AST for destructor call) 2021-08-28 22:11:30 +02:00
Paul Fultz II c0765c451d
Fix 10139: AST broken; std::enable_if_t<> (#3424) 2021-08-28 09:28:56 +02:00
Paul Fultz II 4566e0e439
Fix 10148: False positive: knownConditionTrueFalse in for loop due to &= (#3425) 2021-08-28 09:28:29 +02:00
Daniel Marjamäki 6541efdb9a fix selfcheck warning 2021-08-27 22:33:03 +02:00
Daniel Marjamäki a55b0c332a Fixed #10095 (False positive: unreadVariable) 2021-08-27 17:37:42 +02:00
Paul Fultz II 740becbddf
Fix 10348: FP knownConditionTrueFalse with condition variable in do ... while loop (#3422) 2021-08-27 05:46:57 +02:00
Paul Fultz II 712ff1c073
Fix 10436: hang: valueFlowSubFunction 'ispunct(c)..' (#3423) 2021-08-27 05:46:33 +02:00
chrchr-github d9b6940070
Cleanup: unnecessary includes, fix include order, fix unreferenced va… (#3418) 2021-08-26 19:36:31 +02:00
Daniel Marjamäki f31fbba54a Token::typeDecl: Fix endless recursion for code:
void f()
{
  auto val = val;
}

I did not manage to pinpoint a good location to put a unit test. However this will be tested when daca@home runs the package gcc-avr.
2021-08-26 19:03:35 +02:00
Paul Fultz II 1cd9d0479d
Fix 10433: assertion failure in ValueFlow (Interval::fromValues) (#3419) 2021-08-26 07:46:40 +02:00
Paul Fultz II 8aa37218c2
Fix 10400: FP nullPointer - for loop condition (#3417) 2021-08-25 20:33:41 +02:00
Daniel Marjamäki 11916171fe Fix crash in programmemory, crash found in daca@home package system-root 2021-08-25 06:56:19 +02:00
Paul Fultz II f7ddd7a35d
Fix 10430: FP knownConditionTrueFalse with bool from unsigned char (#3416) 2021-08-25 04:51:54 +02:00
Paul Fultz II 8ddc5764f8
Fix 10425: False positive: returnDanglingLifetime when taking address of captured variable (#3415) 2021-08-25 04:06:03 +02:00
Daniel Marjamäki 37ef29889b Fix 10424: ExpressionAnalyzer assertion failure in librevisa 2021-08-24 16:06:51 +02:00
Paul Fultz II 524db1c756
Fix 10420: assertion error when analysing juce (#3413) 2021-08-23 11:12:42 +02:00
Paul Fultz II 865163b2ba
Add library configurations for free functions like std::size, std::empty, etc (#3410) 2021-08-23 09:03:48 +02:00
Daniel Marjamäki 165d48c846 fix gcc compiler warnings 2021-08-22 18:06:54 +02:00
Daniel Marjamäki db57efa486 CheckBufferOverrun: Reimplement CheckBufferOverrun::argumentSize check 2021-08-22 16:37:41 +02:00
chrchr-github ee4d90b4fa
Refactor: fix member shadowing, return by const ref (#3407) 2021-08-21 22:00:45 +02:00
Paul Fultz II a0c37ceba2
Fix FP: Set correct bounds for interval (#3411) 2021-08-21 21:17:05 +02:00
Paul Fultz II d30f42e0da
Fix FP when calling a function in a condition (#3412) 2021-08-21 18:52:11 +02:00
Daniel Marjamäki ca50dea97d Fix in Tokenizer::simplifyUsing for non-scopes 2021-08-21 10:10:40 +02:00
Daniel Marjamäki d73ab0ad96 Tokenizer::simplifyUsing; Fixed bug when enum class is used 2021-08-20 16:08:01 +02:00
Paul Fultz II e62cdbb664
Deduce symbolic values from conditions (#3406) 2021-08-19 22:01:55 +02:00
Paul Fultz II e0de48bb1d
Fix 7524: ValueFlow: false path for 'x<3' (#3393) 2021-08-16 09:19:07 +02:00
Daniel Marjamäki 6a565f9e2f cleanup unused function 2021-08-15 11:01:14 +02:00
Paul Fultz II be978b35cf
Add more ValueFlow info in the xml dumps (#3402) 2021-08-15 08:02:31 +02:00
Daniel Marjamäki 83270a6c52 Fixed #10376 (Cppcheck does not add some function arguments to the dump file) 2021-08-15 07:48:01 +02:00
Paul Fultz II f81ddd2daa
Fix 10408: FP nullPointer on 'return x.release()' (#3404) 2021-08-15 07:43:50 +02:00
Paul Fultz II 422e411b6c
Fix 9444: Syntax error on valid C++14 code (#3403) 2021-08-15 07:43:02 +02:00
Paul Fultz II 6d65f86871
Fix 9245: Synax error on valid C++14 code: AST broken, binary operator '=' doesn't have two operands. (#3400) 2021-08-14 22:50:58 +02:00
Paul Fultz II c92dab1329
Fix 10406: FP danglingLifetime with pointer-to-pointer (#3401) 2021-08-14 21:37:17 +02:00
Paul Fultz II 818fd248e1
Simplify template keyword bracket (#3399) 2021-08-14 21:16:27 +02:00
Paul Fultz II fdaeaacc40
Symboldatabase: Improve valuetypes for containers, iterators, and smart pointers (#3398) 2021-08-14 19:00:58 +02:00
Paul Fultz II f946bbc249
Only add exprids to expression and not variable declarations (#3397) 2021-08-14 06:49:12 +02:00
Paul Fultz II b9ac48c90a
Fix 10409: FP 'Condition 's.size()<3' is always false' (#3396) 2021-08-14 06:48:38 +02:00
Paul Fultz II 2a3657154b
Dont require __main__ for an addon (#3363) 2021-08-12 20:17:51 +02:00
Paul Fultz II 69eaa9dfd9
Refactor: ConditionHandler cleanup (#3394) 2021-08-11 08:37:37 +02:00
chrchr-github e626e3065d
Fix MSVC warning: member shadowing (#3392) 2021-08-10 22:34:13 +02:00
Daniel Marjamäki e95395e5f0 Fixed #10397 (FP constParameter - implementing an interface) 2021-08-10 15:37:59 +02:00
Daniel Marjamäki c2305b1da7 Fixed #10396 (FP missingReturn on void operator=()) 2021-08-10 09:55:16 +02:00
Daniel Marjamäki d0b6079a83 Fixed #10372 (Confusing message for compareValueOutOfTypeRangeError) 2021-08-10 09:38:28 +02:00
Daniel Marjamäki 0093452bed SymbolDatabase; Better handling of namespace that is defined in several scopes 2021-08-10 07:00:11 +02:00
Paul Fultz II 0f897acecd
Fix FP in solveExpr when using symbolic values (#3391) 2021-08-09 20:41:10 +02:00
Daniel Marjamäki d82df7cc55 Fix self-check warning, condition is always true 2021-08-09 13:17:48 +02:00
Daniel Marjamäki 0cb6603055 SymbolDatabase; Use range based for loops 2021-08-09 12:43:21 +02:00
Alfi Maulana aab5b39e2d
feat: add support for .ipp and .ixx extensions (#3383) 2021-08-09 10:46:56 +02:00
Daniel Marjamäki 94e8a69a9b Fix self-check warning 2021-08-09 09:55:24 +02:00
Paul Fultz II a218ea3b23
Fix 10404: FP knownConditionTrueFalse after subtraction (#3390) 2021-08-09 07:45:41 +02:00
Daniel Marjamäki 5f81b03df1 valueflow; Remove unused function, fixing gcc warning 2021-08-08 21:25:47 +02:00
Daniel Marjamäki fa398a6ba1 valueflow: remove not needed INDENT-OFF and INDENT-ON 2021-08-08 21:22:42 +02:00
Paul Fultz II 7f358b2bed
Format with uncrustify (#3388) 2021-08-07 20:51:18 +02:00