Daniel Marjamäki
dd9a1e890b
valueFlowRightShift: Do not perform analysis when rhs is negative
2018-11-04 17:13:23 +01:00
Daniel Marjamäki
efd92fd714
Refactoring: reuse utility function in SymbolDatabase
2018-11-04 13:29:29 +01:00
Daniel Marjamäki
6878de2c5e
ValueFlow: getExpressionRange, valueFlowRightShift
2018-11-03 23:25:46 +01:00
Daniel Marjamäki
8a05be34f8
Fix Cppcheck shadow variable warning
2018-11-03 19:41:25 +01:00
Daniel Marjamäki
f8b0584f6a
replace 'constexpr' with 'const'
2018-11-03 19:22:51 +01:00
Daniel Marjamäki
fb76ef1db1
Fixed testrunner
2018-11-03 18:59:55 +01:00
Daniel Marjamäki
66ca03fa0c
Fixed #8826 (false negative: Invalid memory address freed)
2018-11-03 18:55:20 +01:00
Daniel Marjamäki
ef35b86b4a
Multipass Valueflow
2018-11-03 15:53:24 +01:00
Daniel Marjamäki
6138294e3d
Fixed #8818 (AST broken: restrict)
2018-11-03 11:05:38 +01:00
Daniel Marjamäki
9741239b2f
Fixed #8824 (False positive: uninitialized variable (regression))
2018-11-03 10:31:55 +01:00
Armin Müller
acf2035a53
Typos found by running "codespell" ( #1461 )
2018-11-03 07:34:27 +01:00
Daniel Marjamäki
a4afcb5995
Revert "Fixed #8818 (AST broken: restrict)"
...
This reverts commit e7d61f399a
.
2018-11-02 21:07:37 +01:00
Daniel Marjamäki
0cc4555337
Revert "Tokenizer: Do not remove 'constexpr'"
...
This reverts commit 2f400b40ba
.
2018-11-02 21:07:24 +01:00
Daniel Marjamäki
2f400b40ba
Tokenizer: Do not remove 'constexpr'
2018-11-02 20:32:12 +01:00
Daniel Marjamäki
e7d61f399a
Fixed #8818 (AST broken: restrict)
2018-11-02 20:28:49 +01:00
Daniel Marjamäki
614a252704
Fix Match warning
2018-11-02 20:14:34 +01:00
Daniel Marjamäki
5de683ec49
Container size: Fix false positive
2018-11-02 20:10:40 +01:00
Daniel Marjamäki
16cc20a232
ValueFlow: Better handling of container size values
2018-11-02 18:28:32 +01:00
Daniel Marjamäki
3798feecad
TemplateSimplifier : Remove 'class|struct' in template arguments
2018-11-02 14:49:40 +01:00
rikardfalkeborn
869e4ba6ab
Add check for return value of boolean function ( #1451 )
...
* Add check for return value of boolean function
The rule for converting an integer to a boolean is that 0 is mapped to
false and everything else is mapped to true. There is nothing wrong with
the following code (according to the standards):
bool f()
{
return -1;
}
and neither gcc nor clang will warn about it. However, it's a bit
confusing. This commit adds a check that warns when a value other than 0
or 1 is returned from a boolean function (similar to the existing check
that functions with boolean arguments are only passed 0 or 1). Since the
code is perfectly legal, set the severity to "Style".
* Use early continue and remove some braces
* Add testcase with multiple returns
* Avoid null pointer dereference in case of return without operand
* Skip lambdas
Add TODO-test cases that shows FPs when the return type of lambdas are
specified explicitly (this is a problem with findLambdaEndToken).
* Enable testcases
2018-11-01 11:08:16 +01:00
rikardfalkeborn
88008fedb1
findLambdaEndToken handle explicit type ( #1458 )
...
* findLambdaEndToken: Add tests
* Add handling of explicit return in findLambdaEndToken()
* Use AST in findLambdaEndToken()
* Fix ast when lambda is mutable
2018-10-31 12:36:08 +01:00
Paul Fultz II
fafd0742d4
Fix FPs with return conditions ( #1455 )
...
* Fix 8815: FP with identical inner conditions
* Fix issue 8801: FP when not returning a bool
* Fix FP
* Add missing semicolon
* Move returnVar
2018-10-31 09:47:48 +01:00
Daniel Marjamäki
c03d32b429
ValueFlow: Improve containerSize handling of string like classes
2018-10-28 19:14:00 +01:00
Daniel Marjamäki
8beb42cc90
astyle formatting
...
[ci skip]
2018-10-28 17:37:19 +01:00
Paul Fultz II
2b6cc33dc6
Fix issue 8757: Throw syntax error on invalid code ( #1378 )
...
* Fix issue 8757: Throw syntax error on invalid code
* Fix FP with lambda returns
* Remove double percent
* Check more keywords
* Skip preprocessor directives
* Check for valid PP directive
* Fix preprocessor check
* Dont check for preprocessor directives
2018-10-28 17:17:53 +01:00
Paul Fultz II
f5811c6818
Fix issue 8732: Syntax error when using enable_if ( #1453 )
...
* Fix issue 8732: Syntax error when using enable_if
* Fix FPs
* Use simpleMatch
2018-10-28 17:16:31 +01:00
Daniel Marjamäki
06ede9c239
ValueFlow: handle x+=y for containers
2018-10-27 18:38:04 +02:00
IOBYTE
adbbadec7f
Fixed #8798 (template simplifier: wrong simpifications for namespaces) ( #1452 )
2018-10-26 14:20:13 +02:00
Kamil Dudka
d206047b84
Fixed #8794 - Memory leak false positive triggered by !(x != NULL) ( #1450 )
2018-10-26 06:21:45 +02:00
Daniel Marjamäki
86782af43c
Fix Cppcheck warning
2018-10-25 07:15:32 +02:00
Daniel Marjamäki
044c4b7fbb
Refactoring: Use range for loop
2018-10-25 06:14:27 +02:00
Daniel Marjamäki
b8e8b12783
Fixed #8797 (exprDependsOnThis handle method call in non-inline method)
2018-10-24 20:17:00 +02:00
Daniel Marjamäki
2348dcde6c
#8801 : Quick fix for false positives
2018-10-24 19:57:50 +02:00
IOBYTE
ea4e6a60f7
Fix template simplifier from deleting the same declaration multiple times ( #1449 )
...
Found by running valgrind on testrunner. May fix #8808 .
2018-10-24 19:32:37 +02:00
IOBYTE
0763fdbfad
Copy template default argument values from forward declaration to declaration. ( #1447 )
...
It is possible to define default template parameter values in forward
declarations and not define any in the actual declaration. Cppcheck
ignores forward declarations and only uses the default values in the
actual declaration so default values in forward declarations are copied
to the actual declaration when necessary.
2018-10-24 14:38:59 +02:00
Daniel Marjamäki
be1ff268c0
Refactoring: Use range for loops
2018-10-24 11:29:15 +02:00
Daniel Marjamäki
2e4f317c0b
Revert "Remove FIXME"
...
This reverts commit 749699c632
.
2018-10-22 21:03:30 +02:00
Daniel Marjamäki
15160f1691
Fixed #8788 (AST Broken error from assigning lambda to variable)
2018-10-22 17:25:01 +02:00
Daniel Marjamäki
749699c632
Remove FIXME
2018-10-22 12:45:34 +02:00
Daniel Marjamäki
dc38681a56
Remove FIXME in AST validation. Ticket #8749
2018-10-22 11:37:24 +02:00
Daniel Marjamäki
c483bcb12b
Fixed testrunner
2018-10-22 00:28:09 +02:00
Daniel Marjamäki
f9b132e831
Tokenizer::simplifyTypedef: Fix bug with arrays
2018-10-21 21:15:34 +02:00
Daniel Marjamäki
64fbffc90d
astyle formatting
...
[ci skip]
2018-10-21 20:28:46 +02:00
Paul Fultz II
edde0eedaa
Fix FP issue 8801: Condition 'a+b' is always true ( #1444 )
2018-10-21 08:04:00 +02:00
Paul Fultz II
2989c44f59
Enable checking duplicate expressions across associative operators ( #1445 )
...
* Enable checking duplicate expressions across associative operators
* Remove bitshift operators and check for streamRead
2018-10-21 07:09:20 +02:00
Daniel Marjamäki
14afc3fd3a
Fixed #8796 (Tokenizer::simplifyCompoundAssignment: Wrong simplification of return)
2018-10-20 21:33:43 +02:00
Daniel Marjamäki
277e0f1a8f
Fix Cppcheck error message
2018-10-20 15:28:34 +02:00
Daniel Marjamäki
29feaa5a51
Tokenizer: Avoid constant folding
2018-10-20 10:51:50 +02:00
Daniel Marjamäki
d265a0d6ab
Fixed #8798 (SymbolDatabase: Inner unnamed union)
2018-10-20 09:43:08 +02:00
Daniel Marjamäki
e2ea8bc2b0
astyle formatting
...
[ci skip]
2018-10-20 09:28:28 +02:00