Commit Graph

1030 Commits

Author SHA1 Message Date
Daniel Marjamäki aa58f41e6d Fixed #7152 (False positive for redundantAssignment after calling a lambda function) 2018-10-08 21:07:21 +02:00
Paul Fultz II e170a45230 Enable followVar for opposite expressions (#1404)
Enable followVar for opposite expressions
2018-10-04 21:17:47 +02:00
Paul Fultz II 4598995564 Enable followVar for duplicate ternary expressions (#1406) 2018-10-01 14:31:06 +02:00
Paul Fultz II f65cf220ba Fix false positives in unknownEvaluationOrder when using followVar (#1391)
Fix false positives in unknownEvaluationOrder when using followVar
2018-09-28 08:38:24 +02:00
Paul Fultz II 5bebeec224 Fix issue 8775: Dont follow aliased variables (#1390) 2018-09-24 06:37:47 +02:00
Daniel Marjamäki afe09f4d7a Temporarily comment out the followVariable() handling 2018-09-23 16:03:18 +02:00
Paul Fultz II 90a29d986b Fix issue 8730: Dont follow variables with unknown symbols (#1374) 2018-09-12 17:30:18 +02:00
Paul Fultz II f4f3f81e8f Fix issue 8741: Require pure when following variables in isSameExpression (#1373) 2018-09-09 07:08:32 +02:00
Paul Fultz II 5a2362b2a0 Fix issue 8738: Dont warn about multiconditions when value is known (#1369) 2018-09-07 15:02:34 +02:00
Paul Fultz II 2da958efb5 Fix issue 8722: Avoid duplicate messages due for followVar (#1367) 2018-09-06 06:55:36 +02:00
Paul Fultz II b46e25c18e Fix issue 8730: False positive: Opposite expression on both sides of && (#1366) 2018-09-05 18:07:01 +02:00
Paul Fultz II 08f301a0de Reenable followVar (#1363)
Reenable followVar
2018-09-05 05:53:33 +02:00
Paul Fultz II 93be440f92 Fix issue 8709: crash with switch statement with followVar (#1362)
* Fix crash with switch statement

* Update comment
2018-09-03 19:54:14 +02:00
Paul Fultz II 0e5fabf4dc Dont follow volatile variables (#1365) 2018-09-03 19:51:48 +02:00
Paul Fultz II 8353f94b93 Fix crashes in followVarExpression (#1358)
* Fix crashes in followVarExpression

* Add a regression test for issue 8717

* Skip reference declarations
2018-09-02 08:28:53 +02:00
Daniel Marjamäki a331206b44 Temporarily disable followVariableExpressions(), there are problems that should be fixed. 2018-09-01 08:32:06 +02:00
Daniel Marjamäki 7591616f43 Fixed #8710 (Update message duplicateExpression when operand is integer literal) 2018-08-30 18:28:34 +02:00
Paul Fultz II a5f4c5d0eb Improve message for same expressions (#1349)
* Improve message for same expressions

* Update message
2018-08-25 14:25:31 +02:00
Paul Fultz II c5154286da Fix issue 8687: false positive with same expression (#1336) 2018-08-13 12:55:41 +02:00
Paul Fultz II 80290a15e0 Fix FP with duplicate assign (#1330) 2018-08-08 08:31:31 +02:00
Daniel Marjamäki c3a44ce56b astyle formatting
[ci skip]
2018-08-07 18:06:51 +02:00
Paul Fultz II f603b529df Fix issue 8413: Condition is always false 'i=expr; if (i != expr) {}' (#1295)
* Follow variables when comparing same expression

* Remove assert include

* Dont follow function arguments

* Improve the checking to check more cases

* Add more tests

* Check if the variable is used inside a loop

* Follow both variables

* Only skip loops when variable is modified in scope

* Fix FP when followed variable is modified

* Dont follow arrays

* Skip pointer indirection

* Make recursive

* Improve checking more variables

* Fix test with sizeof

* Skip following operators

* Fix test when using sizeof

* Dont check every step

* Use early returns

* Update test to use a loop instead of conditional

* Add static

* Check variables are global

* Check local variables in another scope

* Fix issue with const pointers

* Distinguish between pointer indirection and multiply

* Use simple match

* Prevent crash with uniform initialization

* Use unary op and ast to detect pointer indirection

* Expand error message when expression do not match exactly

* Add errorpath to issameexpression

* Revert "Clarify warning message for 'Same expression on both sides of operator'"

This reverts commit 0e491b41a8.

* Check if the tokens are the same

* Report the operator and not the expressions
2018-08-07 09:32:16 +02:00
Daniel Marjamäki 0e491b41a8 Clarify warning message for 'Same expression on both sides of operator' 2018-08-05 10:48:02 +02:00
Daniel Marjamäki f9a5a114bb astyle formatting
[ci skip]
2018-07-25 07:44:06 +02:00
lordylike 12e58c8521 fix ticket 8570: passedByValue with member initializer list and std::move (#1316)
* fix ticket 8570

allow member initializer list variables that are moved to be non-const

* review feedback

* replace tabs with spaces in test code
2018-07-22 15:01:18 +02:00
Paul Fultz II 5d1fdf7958 Fix issue 7904: Handle double nots in isSameExpression (#1305)
* Fix issue 7904: Handle double nots in isSameExpression

* Skip checking double nots in assignments

* Use ast to check for double not
2018-07-15 11:30:02 +02:00
Daniel Marjamäki 03faa25d12 Conditions: Better handling of function calls 2018-07-08 15:58:04 +02:00
Daniel Marjamäki 24dd4c9c26 Restore code in checkVariableScope. Fixes false negative 2018-07-01 22:31:45 +02:00
Daniel Marjamäki 655a8b21b6 Fix false positive 'passedByValue' when address of argument is used 2018-06-23 23:25:06 +02:00
Daniel Marjamäki d0614b9b36 varScope: Fix false negatives for references 2018-06-22 22:51:03 +02:00
Daniel Marjamäki 593f7eee38 Fixed #8624 (Crash below CheckOther::checkDuplicateExpression) 2018-06-14 22:39:26 +02:00
Paul Fultz II daacf27c2e Fix false positive from issue 8612 (#1285) 2018-06-10 00:05:23 +02:00
Paul Fultz II 8d53bcfd63 Fix FP when using non-const members and also check return type of function (#1283) 2018-06-09 08:05:19 +02:00
Daniel Marjamäki 84f0a18053 passedByReference: avoid false positives for std::pair 2018-06-08 10:19:02 +02:00
Daniel Marjamäki 44c78d1770 passedByReference: avoid false positives for std::function 2018-06-08 08:40:14 +02:00
Daniel Marjamäki de09c117bf Fixed #8618 (False positive: shared_ptr is passed by reference by intention) 2018-06-07 22:39:21 +02:00
IOBYTE ce50df8047 Fix override warnings. (#1234) 2018-05-15 16:37:40 +02:00
Paul Fultz II 7ef714b0c6 Fix FP with duplicate assignments by checking if the expression is unique (#1223)
* Fix FP with duplicate assignments by checking if the expression is unique

* Use array of pointers

* Reorder scope condition
2018-05-13 20:20:55 +02:00
Paul Fultz II f5dbfce8ff Fix false positive with oppositeExpression when using binary op (#1211)
* Fix false positive with oppositeExpression when using binary op

* Simplify conditional
2018-05-08 20:43:57 +02:00
Paul Fultz II cac68c6b81 Fix FP when using - as a binary operator (#1201) 2018-05-04 07:58:30 +02:00
Paul Fultz II f191a3e753 Improve checking of opposite expressions (#1199)
* Improve checking of opposite expressions

* Fix some formatting
2018-05-02 06:32:33 +02:00
Daniel Marjamäki e1db4c0e2c astyle formatting
[ci skip]
2018-04-21 13:28:31 +02:00
Paul Fultz II d939c6015a Report opposite expressions (#1182)
* Report opposite expressions

* Skip assignment operator
2018-04-21 11:28:21 +02:00
Daniel Marjamäki d5fb529d4f Fixed #8492 (Improve message: parameter should be passed by reference) 2018-04-20 17:33:42 +02:00
PKEuS bbfcccf078 Refactorization: Replace several push_back-sequences by initializer lists 2018-04-09 09:41:24 +02:00
Paul Fultz II 95fc84a26b Find duplicate expressions assigned to the same variable (#1129)
* Check for duplicate assignments

* Improve checking of expression

* Add more tests

* Use simple match

* Improve robustness of check

* check for null

* Reduce side effects by checking for side effects

* Improve verbose message

* Reword the error message
2018-04-08 14:43:19 +02:00
amai b133d50ebe #6426 Regression now has platform dependent results 2018-04-04 16:07:07 +02:00
amai 7581231d9d #6426 FP duplicateExpressionTernary - (expr) ? ~0u : ~0ul. Add regression test 2018-04-04 14:31:48 +02:00
Daniel Marjamäki 7efc4dd26e astyle formatting
[ci skip]
2018-04-04 10:04:40 +02:00
Paul Fultz II bce5fe5cef Improve duplicate expressions in the ternary op by checking for equal values as well (#1134)
* Improve duplicate expressions in the ternary op by checking for equal values as well

* Use value instead of expression
2018-04-03 21:43:55 +02:00