10039 Commits

Author SHA1 Message Date
Daniel Marjamäki
6d796b434e Fixed #9731 (ValueFlow: does not handle many assignments well) 2020-06-08 21:17:12 +02:00
Simon Martin
1705d096f7
Simplify empty anonymous namespaces. (#2673) 2020-06-07 13:49:04 +02:00
Ken-Patrick Lehrmann
a45c7752a5
9185: Don't syntax error on nested lambdas (#2672) 2020-06-07 08:58:12 +02:00
Paul Fultz II
86ed860d26
Fix issue 9548: False negative: Mismatching iterators when inserting into a vector (#2595) 2020-06-06 17:54:56 +02:00
Ken-Patrick Lehrmann
99ff04f617
9757: skip template parameters when computing scope (#2670)
The template parameter is confusing simplifyUsing: it does not compute
properly the scope, and we end up replace "type" in "to_string" with
"void", then later "void" is removed and we have an internal error.
2020-06-06 17:51:15 +02:00
Daniel Marjamäki
44ff22f879 Fixed #9276 (FP literalWithCharPtrCompare) 2020-06-06 17:47:30 +02:00
Daniel Marjamäki
120c572252 Fixed #9750 (Chained stream operation gives uninitvar error) 2020-06-06 15:24:01 +02:00
Ken-Patrick Lehrmann
8c2c81dbcd
Fix some false positive in loop forward analysis (#2669)
* Fix some false positive in loop forward analysis

In cases like:
```
bool b();
void f()
{
    int val[50];
    int i, sum=0;
    for (i = 1; b() && i < 50; i++)
        sum += val[i];
    for (; i < 50; i++)
        sum -= val[i];
}
```
The forward analysis assumed the second loop was entered, and we ended
up with false positive in it:
 `Array 'val[50]' accessed at index 50, which is out of bounds`

* Fix style
2020-06-05 18:06:03 +02:00
Paul Fultz II
3109d16b42
Fix issue 9742: FP iterators3 for address of reference to vector in struct (#2668) 2020-06-01 08:53:08 +02:00
Paul Fultz II
eb4754b7d9
Fix issue 9587: False positive: parameter can be declared with const (#2667) 2020-05-31 10:10:10 +02:00
Sebastian
5cbed0464c
opencv2.cfg: Add types, macros, functions and memory (de)allocation (#2620)
* opencv2.cfg: Add types, macros, functions and memory (de)allocation

* cfg/cppcheck-cfg.rng: Allow alloc/realloc functions in classes
2020-05-30 17:41:44 +02:00
Paul Fultz II
eed2e829a7
Revert "Cleanup: Removed Tokenizer::simplifyTokenList2. As a side-effect, rules for "simple" token list are now executed on normal token list." (#2666)
This reverts commit 187cde183dfd7baea8cee270a0fccac18f6a945a.
2020-05-30 11:23:22 +02:00
PKEuS
187cde183d Cleanup: Removed Tokenizer::simplifyTokenList2. As a side-effect, rules for "simple" token list are now executed on normal token list. 2020-05-29 21:21:07 +02:00
PKEuS
bf69541369 Visual Studio: Use new files precompiled.h with several common includes for core and testrunner.
- CLI+Core: Reduces build time by 55% from 3:53 to 1:47
- Testrunner: Reduces build time by 27% from 1:40 to 1:13
2020-05-29 12:16:04 +02:00
Daniel Marjamäki
67115491ea Fixed #9739 (Tokenizer: simplifyTypedef: wrong simplification in using) 2020-05-29 11:16:49 +02:00
Daniel Marjamäki
7ff692341e Fixed #9730 (Regression: TEXT macro not handled in windows code) 2020-05-28 22:03:16 +02:00
miltolstoy
79c3af56e4
fix 9296: false negative uninit variable (#2663) 2020-05-28 21:28:18 +02:00
Daniel Marjamäki
d64631219b Fixed #9741 (Wrong value for sizeof) 2020-05-28 21:24:48 +02:00
Paul Fultz II
c9798590ba
Fix issue 9701: False positive. 3rd expression in for uses comma operator. (#2664) 2020-05-28 07:41:47 +02:00
Daniel Marjamäki
f482eb49cd ExprEngine; Fixed bug. Constraint expressions must be boolean 2020-05-27 19:37:07 +02:00
Oliver Stöneberg
3a90341961
some CMake cleanups and additions (#2639) 2020-05-27 05:15:46 +02:00
Oliver Stöneberg
4f68d85633
optimized non-matchcompiled Token::simpleMatch() a bit (#2640) 2020-05-26 20:13:56 +02:00
Daniel Marjamäki
9edca82138 Fix testrunner 2020-05-25 16:02:34 +02:00
Daniel Marjamäki
f7f26ffe90 Tokenizer: Better handling of c alternative tokens in const method 2020-05-25 15:07:23 +02:00
Paul Fultz II
bbe6157e16
Fix issue 9712: False positive: Returning pointer to local variable when return line implicitly cast to return type (#2662) 2020-05-23 23:12:00 +02:00
Ken-Patrick Lehrmann
084529575f
Skip ast validation inside template (#2661) 2020-05-23 21:11:08 +02:00
Daniel Marjamäki
5a4b309e6f Bug hunting: Add 'buffer overflow' check. Detect CVE-2019-19334 2020-05-23 17:50:24 +02:00
Oliver Stöneberg
c1f762b861
disabled some Visual Studio warnings (#2635) 2020-05-23 17:42:56 +02:00
orbitcowboy
5142c9e9ed wxwidgets.cfg: Fixed containerOutOfBounds-false negatives for wxArrayInt and wxArrayString. These containers have std::vector like implementation 2020-05-23 09:24:01 +02:00
Oliver Stöneberg
37bc0483a4
made check.h less heavy (#2633) 2020-05-23 07:16:49 +02:00
Paul Fultz II
0832830a95
Fix issue 9721: ValueFlow: Comparison is always false, but ValueFlow says it is always true (#2658) 2020-05-23 07:15:13 +02:00
Paul Fultz II
4270819728
Fix issue 9713: FP invalidContainerLoop when modifying container and immediately exiting the loop (#2659) 2020-05-23 07:14:45 +02:00
Paul Fultz II
6162ebd608
Fix issue 9714: FP invalidContainer related to auto and std::string::insert (#2660) 2020-05-23 07:13:55 +02:00
Paul Fultz II
526abd4b52
Fix issue 9738: ValueFlow: handle std::tie better (#2657) 2020-05-22 22:57:20 +02:00
Daniel Marjamäki
c86cfdaa50 Fixed #9736 (False positive: knownArgument in assert calls) 2020-05-22 11:49:28 +02:00
Daniel Marjamäki
43b58dbc9e Fixed #9729 (AST: lambda with noexcept) 2020-05-22 11:29:10 +02:00
Daniel Marjamäki
ac1ceb85b6 AST: improved AST when expression starts with %char% or %str% 2020-05-22 09:35:55 +02:00
Daniel Marjamäki
81d8686f99 Changed TODO_ASSERT_EQUALS, we have a false negative 2020-05-21 09:12:19 +02:00
Paul Fultz II
8301fa8244
Fix issue 8144: valueFlowBeforeCondition: struct (#2645) 2020-05-21 08:47:48 +02:00
orbitcowboy
9861a5291e Formatted the code, there are no functional changes [ci skip] 2020-05-20 23:45:00 +02:00
miltolstoy
a9d8b3495d
feat: add modulo of one check (#9528) (#2650) 2020-05-20 23:01:32 +02:00
PKEuS
fb1afe2345 Fixed test suite: Do no longer apply simplifyTokenList2 to token lists, except for those tests that test those simplifications, because checks are no longer run on that simplified token list
Changed failing unit test to TODO tests, as they indicate patterns we do no longer understand properly.
2020-05-20 18:54:16 +02:00
Daniel Marjamäki
f5f7cb7ff7 test: Removed AstStyle::Verbose 2020-05-19 18:27:44 +02:00
shaneasd
44a3501f1b
cleanup after #9700 (#2648) 2020-05-19 18:15:05 +02:00
Daniel Marjamäki
32e569704b executeCommand in CppCheckExecutor or QCheckThread 2020-05-19 16:04:40 +02:00
PKEuS
f6788c0472 Fixed Token::isKeyword: Actually set this flag to a reasonable value in all code paths 2020-05-19 13:47:25 +02:00
PKEuS
c9d8f607df Optimization: Reduced peak memory usage (30% in my test case) by immediately deleting simplecpp::TokenList while creating the cppcheck TokenList. 2020-05-19 12:08:17 +02:00
PKEuS
4948f85460 Visual Studio: Updated solution
- Enable several compiler warnings again
- Let __cplusplus have a reasonable value
2020-05-19 08:35:13 +02:00
PKEuS
d6390dbd14 Optimization: Improved performance of simplifyTypedef for code with lots of typedefs
20% performance gain when checking ExtremeTuxRacer sourcecode (with glext.h available)
2020-05-19 08:35:13 +02:00
PKEuS
793ed68029 Refactorization: Moved code from header to source
- from utils.h to new utils.cpp
- from token.h to token.cpp
- from valueflow.h to valueflow.cpp
- from errorlogger.h to errorlogger.cpp
2020-05-19 08:35:12 +02:00