Commit Graph

11426 Commits

Author SHA1 Message Date
Ken-Patrick Lehrmann b6d2c1b238 Fix github CI (#2477)
* Fix github CI

```
Checking lib/check.cpp: __CPPCHECK__=1...
lib/symboldatabase.h:719:5: warning: Class 'Function' has a constructor with 1 argument that is not explicit. [noExplicitConstructor]
    Function(const Token *tokenDef);
    ^

Checking lib/templatesimplifier.cpp: __CPPCHECK__=1...
lib/symboldatabase.cpp:1754:33: warning: Condition 'settings' is always true [knownConditionTrueFalse]
    const Library * const lib = settings ? &settings->library : nullptr;
                                ^
lib/symboldatabase.cpp:1751:9: note: Assuming that condition '!settings' is not redundant
    if (!settings)
        ^
lib/symboldatabase.cpp:1754:33: note: Condition 'settings' is always true
    const Library * const lib = settings ? &settings->library : nullptr;
```

* Compile parseClangAstDump
2020-01-05 21:10:48 +01:00
Daniel Marjamäki 07cc3e47c4 cppcheck.vcxproj: Try to make appveyor happy 2020-01-05 19:34:25 +01:00
Daniel Marjamäki 0b765cd253 Clang importing; Use ValueFlow 2020-01-05 19:21:13 +01:00
Daniel Marjamäki fa727185e5 Clang import; IfStmt 2020-01-05 19:18:32 +01:00
amai2012 b621c35539 Astyle formatting [ci skip] 2020-01-05 17:00:34 +01:00
Daniel Marjamäki 211af1d4fe Clang import: debug output 2020-01-05 16:58:13 +01:00
Paul Fultz II 90f82d0374 Fix issue 9541: false negative: knownConditionTrueFalse (#2473)
* Fix issue 9541: false negative: knownConditionTrueFalse

* Add another test case

* Add another test

* Fix FPs

* Format

* Fix compile error

* Remove double conditions

* Fix compile error
2020-01-05 16:25:33 +01:00
Ken-Patrick Lehrmann 5f73e1cb32 Fix 9546: properly check that the bound is the size (#2475)
Previously, as the check was done on the token and not on the ast,
`i <= v.size()` and `i <= v.size() - 2` would both raise the same
warning.

This patch fixes this, but this mean the check is only done when the
condition if `i <= v.size()`. Any other (more complex) condition is
ignore, and so we have false negative for instance with
 `i <= v.size() + 1`.
2020-01-05 16:24:25 +01:00
Daniel Marjamäki bc17b9a1be Importing Clang ast dump: Run ValueFlow analysis 2020-01-05 16:23:02 +01:00
Daniel Marjamäki b03bdfaf72 Import Clang ast dump (experimental) 2020-01-05 15:12:53 +01:00
Maksim Derbasov a3ed9116e5 Clarify error msg for hidingInheritedPublic (#2474) 2020-01-05 09:32:39 +01:00
Daniel Marjamäki 4f1e8bc5e7 astyle formatting
[ci skip]
2020-01-04 18:47:05 +01:00
Paul Fultz II e1a97c524d Fix issue 9554: False positive: The address of local variable 'x' is accessed at non-zero index. (#2470)
* Fix issue 9554: False positive: The address of local variable 'x' is accessed at non-zero index.

* Format

* Remove unnecesary condition check
2020-01-04 11:39:52 +01:00
Ken-Patrick Lehrmann a9d423eef2 Fix #8938: FP identicalInnerCondition (#2471) 2020-01-04 11:38:56 +01:00
Ken-Patrick Lehrmann eca7ee9260 9356: Prevent false positive when passing non-const reference to member constructor (#2370)
* Add cases for 9356

* 9356: Prevent false positive when passing non-const reference to member constructor

This workarounds false positives 'Parameter  can be declared with const [constParameter]'
when said parameter is used in constructor call. It assume the
constructor call might change the parameter (without any checks.
The drawback is that we have false negative, in cases where we could
check the constructor actually takes a const reference, or a copied by
value parameter.

* Add todo comment in isVariableMutableInInitializer
2020-01-04 11:36:45 +01:00
Paul Fultz II e07801a891 Fix issue 9563: new daca crash: findLambdaEndToken not finding end token (#2472) 2020-01-04 10:45:24 +01:00
orbitcowboy 1e0f8ae9b4 Running astyle [ci skip]. 2020-01-04 00:06:27 +01:00
Paul Fultz II dd05839a7e Fix false positives in knownConditionTrueFalse when using expressions with const variables (#2469) 2020-01-03 19:35:28 +01:00
Daniel Marjamäki 0e369edd8c Verification; Only warn about uninitialized function arguments if VERIFY_UNINIT is defined 2020-01-02 06:16:36 +01:00
Daniel Marjamäki e32c01b13c Verification; printing debug output on std::cout 2020-01-01 19:57:49 +01:00
Maksim Derbasov fc5fd3c40c Check that virtual function non-narrow access modifier in derived class (#2229)
* Check that virtual function has not narrowed access in derived class

* motivation info added

* error reporting moved to func

* added suppression for CI
2020-01-01 16:09:43 +01:00
Rikard Falkeborn 7514544d94 Fix #8758 (add syntax error for invalid code) (#2466) 2020-01-01 15:46:09 +01:00
Daniel Marjamäki f23d880a7e Verification; use <uninit> configuration 2020-01-01 14:37:20 +01:00
Paul Fultz II 30b9455e89 Fix issue 9556: FP mismatchingContainers: raw pointer comparison (#2465)
* Fix issue 9556: FP mismatchingContainers: raw pointer comparison

* Formatting
2020-01-01 12:02:21 +01:00
Daniel Marjamäki b44029cdaa Refactoring; CWEs should be clarified 2020-01-01 09:09:10 +01:00
Daniel Marjamäki 28c37bb63f Verification; Clarify error message 2020-01-01 08:36:40 +01:00
Daniel Marjamäki 443e8cfbcf Verification; avoid false positive for known float value 2020-01-01 08:33:27 +01:00
Daniel Marjamäki d4ec8075a4 Verification; Fix false positive in while loops 2019-12-31 22:32:16 +01:00
Daniel Marjamäki 043634be27 Verification; Better handling of assignment in while 2019-12-31 20:31:31 +01:00
Daniel Marjamäki 446256a503 Verification; assume non-const pointer argument might point at uninitialized data 2019-12-31 17:51:58 +01:00
Daniel Marjamäki 10010eba95 Verification; Avoid fp for array declaration 2019-12-31 16:50:20 +01:00
Dmitry-Me 1a2b770bfd Break the loop once a match is found 2019-12-31 18:32:45 +03:00
Dmitry-Me 895910b769 Fixed #7159 (wrong handling of function parameters) 2019-12-31 18:26:12 +03:00
Daniel Marjamäki f55d72e821 Verification; uninitialized local variable 2019-12-31 14:57:42 +01:00
Daniel Marjamäki 48be067dd1 Verification; Added --verify-diff option 2019-12-31 12:05:08 +01:00
Daniel Marjamäki 3af3219076 Verification; Juliet *_float_* division by zero tests 2019-12-31 09:02:06 +01:00
Paul Fultz II 82c91f9484 Fix issue 9550: False positive: Same iterator is used with containers 'x' that are defined in different scopes (#2463) 2019-12-31 08:09:04 +01:00
Daniel Marjamäki fde86b696d Verification; Use ValueFlow for improved accuracy 2019-12-31 05:59:06 +01:00
Daniel Marjamäki 3ff31b799c Verification: Use separate id for floating point division by zero 2019-12-30 19:50:22 +01:00
Daniel Marjamäki 4b5585e75b Verification; floating point division by zero 2019-12-30 19:47:18 +01:00
Daniel Marjamäki a60efa6774 Verification; Experimental checking for uninit 2019-12-30 18:55:16 +01:00
Daniel Marjamäki 6ea1875a84 Verification; Ensure assertions for variable type limits are added 2019-12-30 12:53:59 +01:00
Daniel Marjamäki d247ffb13a Fix compiler warning 2019-12-29 21:22:20 +01:00
Daniel Marjamäki 29b599b0e5 Verification; callbacks in executeCast 2019-12-29 19:17:36 +01:00
Daniel Marjamäki 9723b28385 Verification; struct pointer member 2019-12-29 18:42:35 +01:00
Daniel Marjamäki 2710a94b4b Verification; Merged handling of pointers and arrays 2019-12-29 16:26:11 +01:00
Paul Fultz II 75de485c4d Fix issue 9551: Out-of-bounds in getLifetimeTokens() (#2461) 2019-12-29 08:23:58 +01:00
Daniel Marjamäki d16ea3293e Verification; Fix testing 2019-12-28 22:09:16 +01:00
Daniel Marjamäki ab2e87191f Verification; Avoid crash 2019-12-27 20:27:21 +01:00
Daniel Marjamäki 49ed1a82b4 Verification; save report in custom file 2019-12-27 19:25:06 +01:00