Commit Graph

83 Commits

Author SHA1 Message Date
Daniel Marjamäki 3e1df1b463 Clarify condition: re-enabled check 2011-03-13 12:16:55 +01:00
Daniel Marjamäki e94ebd829d suspicious condition: commented out the check temporarily - there are some false positives I'll need to fix 2011-03-09 22:29:50 +01:00
Daniel Marjamäki db48158b28 Suspicious condition: Added new check for conditions that contains assignment+comparison 2011-03-09 22:20:14 +01:00
Greg Hewgill a532a9690e full implementation of switch case fall through 2011-03-05 00:45:57 +13:00
Greg Hewgill 93ea774484 initial simplistic implementation of switchCaseFallThrough 2011-03-05 00:45:57 +13:00
Zachary Blair e1b2569b81 Fixed #432 (New check: wrong usage of ! operator in conditions) 2011-02-27 12:30:22 -08:00
Sébastien Debrard f5ed52b84b fix #2569 check postfix increment on boolean 2011-02-11 23:38:23 +01:00
Erik Lax aeae5a867d Fixed #2550 (Bad substr/strncmp comparison) 2011-02-08 19:49:29 +01:00
Daniel Marjamäki d06fde77ff Fixed #2531 (False positive: Redudant assignment to itself) 2011-02-04 20:55:38 +01:00
Greg Hewgill be195a72c9 initialise Check::_name in constructor rather than relying on virtual Check::name() 2011-02-02 22:58:25 +13:00
Daniel Marjamäki a596a7a8fe Fixed #2494 (New check: clarify calculation when using ?: operator) 2011-01-24 21:40:49 +01:00
Debrard Sébastien 27dce075e0 Fixed #155 (check size of a variable whose type is a sized array) 2011-01-22 19:21:56 +01:00
Daniel Marjamäki 94ebb24d3d Optimising: about 5% improvement with Visual Studio executable 2011-01-15 20:55:51 +01:00
Reijo Tomperi 226b605774 Change year 2010 -> 2011 in license texts. 2011-01-09 21:33:36 +02:00
Raphael Geissert 6ec4497919 [PATCH] Check for calls to memset() where 0 bytes are to be filled
Inspired by Silvio Cesare's work
2011-01-06 11:31:58 +01:00
Zachary Blair d11b5163b7 Fixed #2382 (Catching exceptions by value instead of reference) 2010-12-31 03:01:38 -08:00
Daniel Marjamäki 38e7209d26 Fixed #2373 (Using XML2 in --errorlist output) 2010-12-29 12:43:29 +01:00
Zachary Blair 215cb5ac8d Fixed #2162 (false positive: Mutual exclusion over ||) 2010-11-21 00:06:43 -08:00
Daniel Marjamäki fd64a7e683 Mutual exclusion: Disable this check until #2162 is fixed. 2010-11-20 07:43:07 +01:00
Zachary Blair 36d80d6eaa Fixed #2058 (Warn for unused variable when only doing malloc/free) 2010-11-14 17:37:36 -08:00
Daniel Marjamäki 14803643ca empty string test: Removed this check 2010-11-03 17:56:14 +01:00
Daniel Marjamäki bc283d8b99 Uninitialized variables: Broke out the checking into separate file 2010-10-31 12:31:11 +01:00
Daniel Marjamäki df8a93bf97 Null pointers: Broke out the checking into separate file 2010-10-31 11:51:25 +01:00
Daniel Marjamäki 1ef09147f3 CheckOther: updated CheckOther::getErrorMessages 2010-10-31 10:07:35 +01:00
Daniel Marjamäki 995e39200b Fixed #2130 (Invalid possible NULL pointer dereference, etc.) 2010-10-27 20:20:10 +02:00
Daniel Marjamäki bdd6d6d53d null pointer: use simplified token list in the 'check and deref' checking 2010-10-25 21:05:43 +02:00
Daniel Marjamäki 026514db1a Fixed #2127 (null pointer dereference after condition (SRD nr 522)) 2010-10-25 19:43:54 +02:00
Zachary Blair 26afb04dc5 Fixed #2105 (Incorrect operator: mutual exclusion over ||) 2010-10-24 18:14:21 -07:00
Debrard Sebastien 1a4e3dcc44 increment check 2010-10-12 19:54:39 +02:00
Zachary Blair d9967d4fd2 Fixed #2079 (detect side effects in assert) 2010-10-10 13:05:06 -07:00
Pete Johns 4e11e71a21 Fixed 2072 (object destroyed immediately: add --doc info) 2010-10-04 08:54:19 +11:00
Pete Johns 0017655f55 Added test for functor false-positive [passing]
Also removed typedef's following danmar's review and renamed isClassresults -> isClassResults to make more clear.
2010-10-02 18:45:24 +10:00
Pete Johns 6e0ef3eda2 Fixed #1132 (Detection of misused scope objects in functions)
Emits error in the form:

    [useless_lock.cpp:18]: (error) instance of "Lock" object destroyed immediately

    ...if an instance of a class or struct is unnamed and therefore destroyed
    straight after creation.

    Only checks for misused scope objects within functions.

    Optimised isIdentifierObjectType() by memoizing.
2010-10-02 14:22:26 +10:00
Pete Johns 50c2fa9ab0 Revert "Fixed #1132 (Detection of misused scope objects)"
This reverts commit c6acdccfa0.
2010-10-01 20:52:16 +10:00
Pete Johns c6acdccfa0 Fixed #1132 (Detection of misused scope objects)
Emits error in the form:

    [useless_lock.cpp:18]: (error) instance of "Lock" object destroyed immediately

...if an instance of a class or struct is unnamed and therefore destroyed
straight after creation.

Removed "internal error" from token.cpp, since in this case varid would be NULL.
2010-10-01 20:30:21 +10:00
Daniel Marjamäki f843678a07 Redundant conditions: some refactorings
* removed the 'redundant null pointer' check. sometimes it's unsafe to delete NULL pointer. and this check doesn't point out errors anyway.
 * moved the 'redundant condition' check for set::remove. Moved it to CheckStl.
2010-09-16 18:49:23 +02:00
Daniel Marjamäki cfbc06c8b6 removed 'empty catch block' check. to avoid false positives we'll need to check if it is bad with an empty catch block (dead pointer/undefined behaviour/etc) 2010-09-05 13:27:58 +02:00
Daniel Marjamäki 72916caee6 Reverted 7398453cb0 2010-08-15 21:25:14 +02:00
Sbastien Debrard 7398453cb0 Refactoring of obsolete functions checks. Ticket: #1940 2010-08-15 21:22:33 +02:00
Zachary Blair c8087d3389 Fixed #162 (Initialisation of a variable by itself) 2010-08-14 21:34:04 -07:00
Daniel Marjamäki 5846630fa9 Added scanf check. Modified patch submitted by Eric Sesterhenn 2010-08-14 15:15:12 +02:00
Daniel Marjamäki c395e51389 New check: look for calculation inside sizeof 2010-08-06 22:57:10 +02:00
Daniel Marjamäki faa713e7b5 gcc: Fixed some compiler warnings when using -Wsign-conversion. Ticket: #1487 2010-08-06 19:40:54 +02:00
Zachary Blair 5ea28ccbba Fixed #157 (Forgetting to put a break in a switch statement) 2010-06-30 00:10:30 -07:00
Zachary Blair efefceabae Fixed #920 (new style check: find empty catch blocks) 2010-06-14 23:45:46 -07:00
Daniel Marjamäki b5d0955d11 doxygen: fixed error messages given by doxygen 2010-06-14 07:54:41 +02:00
firewave 62093d764d Fixed Visual Studio 2010 warning 2010-05-30 10:44:03 +02:00
Daniel Marjamäki 88e9a4ade6 Fixed #1704 (false negative: null pointer dereference) 2010-05-26 19:16:42 +02:00
Daniel Marjamäki 75c9355e9a Added some multipass checking for the uninitialized variables. It is still experimental. You can activate it with the '--test-2-pass' switch. Some more refactorings are needed to make it truly usable, the main thing is to make it thread safe. 2010-05-21 19:35:18 +02:00
Daniel Marjamäki 6edb2e77b4 Refactoring: Removed Severity::possibleStyle 2010-05-16 14:43:42 +02:00