Daniel Marjamäki
67b495fc50
Fixed #9280 (False positive: unreadVariable on assignment to fixed address volatile struct member)
2020-02-15 17:31:47 +01:00
Daniel Marjamäki
8c0ad6a1b9
Fixed #9555 (False positive (unreadVariable): struct is assigned a value that is never used)
2020-02-15 16:43:06 +01:00
Daniel Marjamäki
569b2a4171
Fixed #9600 (false positive: compareBoolExpressionWithInt with --clang)
2020-02-15 14:45:12 +01:00
Paul Fultz II
61d847cac2
Fix issue 9637: false positive: Condition 'i<2U' is always true ( #2536 )
2020-02-15 07:57:43 +01:00
Daniel Marjamäki
332279326f
checkVirtualFunctionCallInConstructor; Check should be 'style' since there is no UB. Disabled the check temporarily, it should use CTU to determine if the class is a base class
2020-02-14 17:10:12 +01:00
Daniel Marjamäki
e31b2f8b73
SymbolDatabase; Set smart pointer type in Variable valueType
2020-02-14 09:40:27 +01:00
Paul Fultz II
7368a54629
Add generic valueflow forward analysis ( #2511 )
2020-02-13 16:27:06 +01:00
Daniel Marjamäki
3ec03b8915
Fixed #9571 (False positive: containerSize)
2020-02-12 18:53:36 +01:00
Dmitry-Me
25deb996e9
Improve test coverage for matching paths
2020-02-11 18:19:39 +03:00
Paul Fultz II
d858bfc338
Fix issue 9599: False positive: Using object that points to local variable that may be invalid ( #2530 )
...
* Fix issue 9599: False positive: Using object that points to local variable that may be invalid
* Improve tests
* Skip else
2020-02-11 11:45:10 +01:00
Paul Fultz II
e55ddacd18
Fix issue 9597: False positive: Reference to temporary returned if explicitly casted to base class ( #2531 )
2020-02-11 11:41:41 +01:00
Paul Fultz II
8fa7dd0fe0
Fix issue 9595: False positive: Using pointer to temporary doesn't account for const ref extended temporary lifetimes ( #2525 )
2020-02-10 18:01:11 +01:00
IOBYTE
4d58d9fc87
fix daca chromium crash ( #2527 )
2020-02-09 11:19:36 +01:00
Rikard Falkeborn
b1c6f2946a
Fix redundant FP assignment with unsigned zero ( #2521 )
...
* Refactor isNullOperand out of FwdAnalysis
* Improve isNullOperand
* Fix redundantAssignment FP with unsigned zero
* isNullValue check number
* Enhance isNullOperand to handle c++ casts
Also handle cast of NULL.
2020-02-09 11:16:08 +01:00
Daniel Marjamäki
ca3095746c
Fixed #9594 (False positive: Using argument that points at uninitialized variable when write only)
2020-02-04 18:56:18 +01:00
Dmitry-Me
84f65c40a7
Improve test coverage for templates with comparison in default value
2020-02-03 18:36:51 +03:00
Rikard Falkeborn
488bc9997c
Improve isSameExpression for same valued literals with followvar ( #2519 )
...
It allows (for example) cppcheck to detect that the lhs and the rhs are
the same in the following example:
double g()
{
double a = 1e1
return a & 10.0;
}
2020-02-03 09:35:24 +01:00
Rikard Falkeborn
bbfd10a69f
Bugfix Mathlib::isNullValue for hexadecimal numbers ( #2517 )
2020-02-02 16:40:36 +01:00
Rikard Falkeborn
ff9c04dc28
Improve isSameExpression for literals ( #2514 )
...
Improve isSameExpression() for literals with same value but different
representation, for example the following different ways of
representing 9 as double: 9.0, 0.9e1 and 0x1.2p3.
With this change, cppcheck can (for example) correctly detect that the
else if statements are always false in the following example:
void f(double x) {
if (x < 9.0) {}
else if (x < 0x1.2p3) {}
else if (x < 0.9e1) {}
}
2020-02-01 07:22:41 +01:00
Dmitry-Me
589b497ead
Improve test coverage for simplification of bitwise operations
2020-01-30 18:21:22 +03:00
Daniel Marjamäki
dcee189146
Tokenizer::setVarId: better handling of decltype()
2020-01-29 17:40:22 +01:00
Daniel Marjamäki
18124fe248
Fixed #9591 (SymbolDatabase: decltype)
2020-01-29 17:29:40 +01:00
Dmitry-Me
ee86aa7b40
Improve test coverage for simplification of arithmetic operations
2020-01-29 18:16:07 +03:00
Daniel Marjamäki
b1abcc06df
Clang import; distinguish static variable
2020-01-27 13:00:52 +01:00
Daniel Marjamäki
830f901206
Fixed #9586 (Valuetype: Wrong type for 'true << 1')
2020-01-27 11:46:59 +01:00
Rikard Falkeborn
8819e19dae
Fix #8489 (Fix FN printf argument with parenthesis) ( #2508 )
2020-01-27 06:55:01 +01:00
Daniel Marjamäki
b6833b525f
Clang import
2020-01-25 17:01:17 +01:00
Daniel Marjamäki
f911495db3
Clang import; Handle clang-9 while loop better
2020-01-25 16:10:13 +01:00
Daniel Marjamäki
0bab9ba6e3
Clang import; Handle clang-9 range for loop
2020-01-25 14:47:51 +01:00
Simon Martin
2840173a72
Ticket #9569 : Do not substitute type aliases within enum definitions. ( #2504 )
2020-01-25 10:18:37 +01:00
Simon Martin
224a41361d
Ticket #9572 : Properly detect designated initializers. ( #2496 )
2020-01-25 10:14:16 +01:00
Daniel Marjamäki
569523bbef
Clang import; Better handling of enums
2020-01-25 09:31:47 +01:00
Daniel Marjamäki
1cabba8755
Clang import; Improved enum handling
2020-01-24 21:34:29 +01:00
Aleksandr Serbin
11993ed999
Ticket 5607: Allow to exclude folders with glob pattern ( #2498 )
2020-01-24 07:06:09 +01:00
Daniel Marjamäki
fc813cef2a
Clang import: IfStmt
2020-01-23 16:18:39 +01:00
Daniel Marjamäki
ce77db2b1b
Clang import; EnumDecl
2020-01-23 16:06:25 +01:00
Daniel Marjamäki
4235a29501
ExprEngine: Handle variable annotations better
2020-01-21 18:55:07 +01:00
Daniel Marjamäki
b6db5116c3
Clang import; CXXStdInitializerListExpr
2020-01-21 18:29:04 +01:00
Daniel Marjamäki
a20b3a9e2e
Clang import; better handling of string literals
2020-01-21 17:47:57 +01:00
Daniel Marjamäki
6386f0e633
Clang import; CXXDeleteExpr
2020-01-21 17:47:57 +01:00
Dmitry-Me
51e775e21e
Improve test coverage for reading numbers represented as strings
2020-01-21 19:29:33 +03:00
Daniel Marjamäki
9f26e8a356
Clang import; CXXNewExpr
2020-01-21 12:16:39 +01:00
Daniel Marjamäki
7fecc17707
Clang import; CXXThrowExpr
2020-01-21 11:16:22 +01:00
Daniel Marjamäki
459e906ae1
Clang import; ConditionalExpr
2020-01-21 07:00:03 +01:00
Daniel Marjamäki
78fcf93342
Clang import; DoStmt
2020-01-20 20:46:33 +01:00
Daniel Marjamäki
cd3ad89777
Clang import; GotoStmt, LabelStmt
2020-01-20 19:07:10 +01:00
Daniel Marjamäki
6722ee9d3f
test/bug-hunting: add --clang option to the juliet testing
2020-01-20 18:53:40 +01:00
Daniel Marjamäki
3ccd369cf5
Clang import; CaseStmt
2020-01-20 17:38:54 +01:00
Daniel Marjamäki
d635ea4b7f
Clang import; SwitchStmt
2020-01-20 14:24:03 +01:00
Daniel Marjamäki
8d6891ac81
bug hunting; modified itc test script so you can pass --clang to it
2020-01-20 10:43:42 +01:00
Daniel Marjamäki
3d1cb87a11
Clang import; range for
2020-01-18 19:23:37 +01:00
Daniel Marjamäki
269d21e972
Clang import; Better array handling in sizeof()
2020-01-18 11:55:50 +01:00
Daniel Marjamäki
b905547c76
Clang import; Better sizeof/type handling
2020-01-18 11:07:36 +01:00
Daniel Marjamäki
f7a30fc99f
Rename Verification => Bughunting
2020-01-18 07:25:57 +01:00
Rikard Falkeborn
0bb98aeef9
Fix 9577 (endless recursion in Valueflow::bifurcate()) ( #2492 )
...
Ensure bifurcate() does not recurse endlessly where a variable is
initialized recursively, or a variable is initialized as x(0) or x{0}
followed by a recursive assignment (for example int x(0); x = x / 1;).
The first case is solved by bailing out if there initialization is done
using x(0) or x{0}, the second by adding a missing depth argument to a
recursive call.
2020-01-17 03:17:26 +01:00
Daniel Marjamäki
bc39cd73f0
Clang import; fix wrong 'sizeof' import
2020-01-17 03:15:08 +01:00
Daniel Marjamäki
fddc301f7b
Rename test cases, 'verification' was renamed to 'bug hunting'
2020-01-15 21:11:04 +01:00
Daniel Marjamäki
76a048a2c1
Bug hunting; 'hide' the uninitialized variables checking, I need to focus on division by zero and clang import
2020-01-15 21:06:00 +01:00
Daniel Marjamäki
c79ec9e956
ExprEngine: sizeof()
2020-01-15 15:24:36 +01:00
Daniel Marjamäki
7820b5dbcc
Rename 'Verification' to 'Bug hunting'
2020-01-14 21:17:07 +01:00
Daniel Marjamäki
434b506e58
testsuites/danmar-verify: fix syntax errors
2020-01-14 10:28:05 +01:00
Daniel Marjamäki
dfbf347912
Clang import; Better type
2020-01-13 17:56:30 +01:00
Daniel Marjamäki
066e43cce3
Clang import; InitListExpr
2020-01-13 12:44:35 +01:00
Daniel Marjamäki
bd41b3d713
Clang import; Fixed function arguments in SymbolDatabase
2020-01-13 05:52:46 +01:00
Daniel Marjamäki
9f3df5d630
Clang import; CompoundAssignOperator
2020-01-12 18:41:46 +01:00
Daniel Marjamäki
f4f4377fbf
Clang import; Constructor arguments, ExprWithCleanups
2020-01-12 16:49:02 +01:00
Daniel Marjamäki
d1f3ecec12
Verification; Tweak itc test script, avoid duplicate linenumbers
2020-01-12 10:53:44 +01:00
Daniel Marjamäki
7704f6578f
Verification; Fix struct member false negative
2020-01-12 10:29:03 +01:00
Steven Hoving
26e403893c
googletest.cfg; add MATCHER ( #2485 )
2020-01-12 08:11:58 +01:00
Rikard Falkeborn
c6e74f4c10
Mathlib: Fix value of suffixed binary integer literal ( #2487 )
2020-01-12 08:11:12 +01:00
Daniel Marjamäki
aa090a8b45
Clang import; addTypeTokens for function return type
2020-01-11 16:40:22 +01:00
Daniel Marjamäki
05a34142aa
Clang import; forward class declaration
2020-01-11 16:02:25 +01:00
Daniel Marjamäki
9c38a659a1
Clang import; Fixed CXXConstructExpr without child
2020-01-11 12:16:48 +01:00
Daniel Marjamäki
30bc67c691
Clang import; CXXNullPtrLiteralExpr
2020-01-10 19:01:33 +01:00
Daniel Marjamäki
7a3bedb583
Clang import; CXXConstructExpr
2020-01-10 18:54:28 +01:00
Daniel Marjamäki
4c778e0999
Clang import; Rename files/namespace
2020-01-10 16:29:06 +01:00
Daniel Marjamäki
8f1a50ffc0
Clang import; CStyleCastExpr
2020-01-10 16:19:01 +01:00
Daniel Marjamäki
e78775fac3
astyle formatting
...
[ci skip]
2020-01-10 11:31:12 +01:00
Daniel Marjamäki
a0a2eae1d2
Clang import; cxxStaticCastExpr2
2020-01-10 11:04:51 +01:00
Rikard Falkeborn
9afeef01c6
Improve duplicateExpressionTernary ( #2484 )
...
Test both the cases where sizeof(int) == sizeof(long) and when they are
different to improve testing.
2020-01-10 10:02:50 +01:00
fuzzelhjb
fcd5cda97f
Check selected files from project ( #2378 )
2020-01-10 08:57:37 +01:00
Daniel Marjamäki
b8aa71bc87
Clang import; CXXStaticCast
2020-01-09 20:53:06 +01:00
Daniel Marjamäki
bf62138237
Verification; Remove VERIFY_UNINIT define, the checking is always compiled from now on
2020-01-09 20:25:52 +01:00
Daniel Marjamäki
ae5dbe0575
Clang import; UnaryOperator
2020-01-09 19:07:14 +01:00
Daniel Marjamäki
2137f1ead9
Clang import; reference before declaration
2020-01-09 18:03:24 +01:00
Daniel Marjamäki
d842f00aef
Clang import; UnaryExprOrTypeTraitExpr
2020-01-09 17:31:46 +01:00
Daniel Marjamäki
7daa1bc11d
Clang import: CharacterLiteral
2020-01-09 16:54:45 +01:00
Daniel Marjamäki
fea981211e
Clang import; CXXBoolLiteralExpr
2020-01-09 16:19:38 +01:00
Dmitry-Me
9d8f67a6ca
Improve test coverage for MathLib::calculate()
2020-01-09 18:18:03 +03:00
Daniel Marjamäki
e6b873b7b9
Clang import; CXXOperatorCallExpr
2020-01-09 15:59:22 +01:00
Daniel Marjamäki
060c695f80
Clang import; CXXConstructorDecl, CXXThisExpr
2020-01-09 13:19:14 +01:00
Daniel Marjamäki
1589ac5352
Clang import; Set links properly
2020-01-09 12:42:29 +01:00
Daniel Marjamäki
0becff9d7f
testsuites/danmar-verify: Add divbyzero tests
2020-01-09 10:48:43 +01:00
Ken-Patrick Lehrmann
0b7649ca9b
Fix 9298 ( #2476 )
...
* Fix 9298
Tell cppcheck that strcpy returns its first argument, and use that
knowledge in checkTokenInsideExpression.
* Add missing unit tests in cmake
2020-01-09 08:47:36 +01:00
Maksim Derbasov
872d531568
Removing check hidingInheritedPublic ( #2482 )
2020-01-09 06:53:08 +01:00
Daniel Marjamäki
4e8a922e18
Clang import; CXXMemberCall
2020-01-08 21:49:23 +01:00
Daniel Marjamäki
3387ee3512
Clang import; ClassTemplateDecl
2020-01-08 21:31:06 +01:00
Daniel Marjamäki
eb3270959e
Clang import; FunctionTemplateDecl
2020-01-08 20:47:52 +01:00
Daniel Marjamäki
64953f36b3
Clang import: CXXRecordDecl, CXXMethodDecl
2020-01-08 19:32:04 +01:00
Daniel Marjamäki
54a9b61329
Clang import; NamespaceDecl, varDecl4, varDecl5
2020-01-08 18:23:40 +01:00
Daniel Marjamäki
b8ae957365
Clang import; fwrite FunctionDecl
2020-01-08 16:42:21 +01:00
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
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
6a4a59b783
Clang Import; Added test
2020-01-06 16:45:18 +01:00
amai2012
b621c35539
Astyle formatting [ci skip]
2020-01-05 17:00:34 +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
Maksim Derbasov
a3ed9116e5
Clarify error msg for hidingInheritedPublic ( #2474 )
2020-01-05 09:32:39 +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
ce0f7e201d
Formatted 'wxwidgets.cfg: Added support for more interfaces.'
2020-01-04 00:26:39 +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
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
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
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
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
7dcfd3400f
Verification; test
2019-12-31 06:08:04 +01:00
Daniel Marjamäki
e4b29c6f98
Verification; minor tweak of testcase
2019-12-30 21:18:32 +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
39a6eefef5
test/testsuites/danmar-verify: Added test cases
2019-12-30 09:44:49 +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
ad352838c0
Verification; Add some more testcases
2019-12-28 22:23:11 +01:00
Wolfgang Stöggl
ad8bedebd7
Update cmake_minimum_required VERSION ( #2457 )
...
When tests are built, the minimum required cmake version is 3.4.
The file test/CMakeLists.txt uses cmake_policy(SET CMP0064 NEW),
which requires cmake 3.4 [1].
[1] https://cmake.org/cmake/help/v3.4/policy/CMP0064.html
2019-12-28 10:46:13 +01:00
Daniel Marjamäki
4b4f7ea60b
Verification; Updated report
2019-12-27 19:05:22 +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