Daniel Marjamäki
c4c929a6a7
Clang import: StringLiteral, funcdecl3, determine includes with clang -v
2020-01-08 16:36:51 +01:00
Daniel Marjamäki
f51048e03b
Clang Import; TypedefDecl
2020-01-08 14:25:09 +01:00
Daniel Marjamäki
e6ee29fd11
Clang import; BreakStmt, ContinueStmt
2020-01-08 12:29:54 +01:00
Daniel Marjamäki
ea414e46e1
Clang import; WhileStmt
2020-01-08 12:19:48 +01:00
Daniel Marjamäki
61039023b2
Clang import; ForStmt
2020-01-08 10:35:44 +01:00
Daniel Marjamäki
4b7e6c68b0
Clang import; MemberExpr
2020-01-08 09:51:35 +01:00
Daniel Marjamäki
d75d9c1866
Clang import; Refactoring
2020-01-07 19:51:44 +01:00
Daniel Marjamäki
e5b99d3299
Clang import; Refactoring
2020-01-07 19:47:06 +01:00
Daniel Marjamäki
a3abc75ca1
Clang import; RecordDecl
2020-01-07 18:33:24 +01:00
Daniel Marjamäki
c4131bbc5b
Clang import; else
2020-01-07 12:38:37 +01:00
Daniel Marjamäki
b829c4cebb
Clang import; Arrays
2020-01-07 12:19:06 +01:00
Daniel Marjamäki
2760d4400b
SymbolDatabase: Ensure parameter name is same
2020-01-06 18:56:01 +01:00
Daniel Marjamäki
6a4a59b783
Clang Import; Added test
2020-01-06 16:45:18 +01:00
Daniel Marjamäki
28688dcc09
Clang Import; set Token::function()
2020-01-06 15:26:21 +01:00
Daniel Marjamäki
8ea22edb4e
Clang Import; VarDecl
2020-01-06 13:47:19 +01:00
Daniel Marjamäki
00c05ce626
Clang import; CallExpr, setLocation
2020-01-06 09:05:39 +01:00
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
Daniel Marjamäki
4b4f7ea60b
Verification; Updated report
2019-12-27 19:05:22 +01:00
Dmitry-Me
147cf9319f
Restore compilation in gcc-4.6
2019-12-27 18:26:44 +03:00
Daniel Marjamäki
ec4668353d
Verification; Determine argument number properly
2019-12-26 18:32:59 +01:00
Daniel Marjamäki
31bddb6ae0
astyle formatting
...
[ci skip]
2019-12-26 15:48:29 +01:00
Paul Fultz II
ce1fc56e96
Fix issue 6890: ValueFlow: min/max value for variable, after condition ( #2460 )
...
* Set bounds when combining values
* Adust bounds when they are negated
* Try to infer conditional values
* Switch false and true
* Fix checking of conditions
* Fix compare
* Fix remaining tests
* Fix overflows
2019-12-26 15:47:53 +01:00
Daniel Marjamäki
8c652afd6e
Verification: Added IntRange::isLessThan and IntRange::isGreaterThan
2019-12-26 15:39:08 +01:00
Dmitry-Me
678560bf0d
Use "override" keyword in clang ( #2459 )
2019-12-25 18:19:00 +03:00
Paul Fultz II
42d44f02a2
Use lifetime analysis for checking mismatching containers ( #2456 )
...
* Use lifetimes to check for mismatching containers
* Fix error messages
* Format
* Remove unused variables
* Fix configuration and track iterators through algorithms
* Fix iterator value types in qt config
* Fix library issue with QStringList
* Remove unused functions
* Fix cppcheck errors
2019-12-25 09:32:50 +01:00
Daniel Marjamäki
0cd2935dc7
Verification; Verify that function call argument values meet annotations
2019-12-25 09:23:07 +01:00
Daniel Marjamäki
f0ac19514b
Verification: Handle Cppcheck annotations __cppcheck_low__ and __cppcheck_high__
2019-12-24 21:14:14 +01:00
Daniel Marjamäki
755e2d261c
Fixed #9402 (ExprEngine: && and || in condition)
2019-12-24 15:52:02 +01:00
Daniel Marjamäki
747a01f74d
Verification; Check function argument values
2019-12-23 22:10:43 +01:00
Daniel Marjamäki
eb551728a5
Verification; Avoid FP for known values
2019-12-22 21:24:39 +01:00
Daniel Marjamäki
93f10da981
Verification; Detect errors after bailout
2019-12-22 21:03:43 +01:00
PKEuS
8218120fd5
Moved function from .h to .cpp
2019-12-21 11:55:11 +01:00
Daniel Marjamäki
7f110f3ec3
Set version
2019-12-21 11:49:01 +01:00
Daniel Marjamäki
6890757986
Update Copyright year
2019-12-21 11:23:01 +01:00
Daniel Marjamäki
fe23d017f3
Fixed #8419 (False positive accessMoved on int)
2019-12-21 07:39:14 +01:00
Daniel Marjamäki
c2f8fb5603
Fixed #9405 (false positive: (style, inconclusive) Boolean expression 'dqOpen' is used in bitwise operation. Did you mean '&&')
2019-12-20 19:38:30 +01:00
Daniel Marjamäki
33ec78fe6e
Fixed #9036 (false positive: (style) Condition 's.x<127U' is always true)
2019-12-20 19:06:35 +01:00
Daniel Marjamäki
bd83630f2e
Fixed #8990 (False positive: struct member not used (union))
2019-12-20 18:31:55 +01:00
Daniel Marjamäki
252c3a17fa
Fixed #7107 (False positive iterators - using alias for container)
2019-12-20 12:13:26 +01:00
Daniel Marjamäki
9ffb657c1a
Fixed #8597 (False positive - Array index is used before limits check.)
2019-12-20 09:46:01 +01:00
Daniel Marjamäki
02eaf6fa93
Fixed #8998 (False positive uninitStructMember related to reference to member)
2019-12-19 20:18:32 +01:00
Daniel Marjamäki
c84ba10b37
Fixed #8774 (Wrong handling of function with name 'or')
2019-12-19 19:22:39 +01:00
Daniel Marjamäki
2a2fa49098
Thread safety: use std::atomic for global flags
2019-12-19 18:38:22 +01:00
Daniel Marjamäki
235ef0a01e
Fixed #9420 (False positive - redundantInitialization)
2019-12-18 19:39:23 +01:00
IOBYTE
ec4c979cd8
fix daca error: Internal Error: Invalid syntax ( #2452 )
...
* fix daca error: Internal Error: Invalid syntax
* fix cppcheck warnings
2019-12-18 11:48:36 +01:00
Daniel Marjamäki
caab1e61bb
Fixed #9542 (Better error handling for --addon)
2019-12-17 12:00:01 +01:00
Maksim Derbasov
68a67a910e
Remove .dump file after plugins execution ( #2451 )
2019-12-17 08:40:59 +01:00
Dmitry-Me
7d6582c7a5
Resolve C4800 Visual C++ warning
2019-12-16 18:11:12 +03:00
Paul Fultz II
ad352daa08
Fix issue 9535: Syntax Error: AST broken, 'if' doesn't have two operands. ( #2450 )
2019-12-16 12:17:01 +01:00
Daniel Marjamäki
a241be0ecc
Fixed #9434 (False positive: Out of bounds access when using const pointer)
2019-12-15 20:10:28 +01:00
Daniel Marjamäki
36f369473e
isPointerDeref: Return false for function declarations
2019-12-15 16:36:46 +01:00