Commit Graph

303 Commits

Author SHA1 Message Date
Daniel Marjamäki 92a1e9e76e Severities: Added 'warning' and 'performance' severities. No changes to the command line options nor to the XML format. Ticket: #2106 2010-10-17 14:41:00 +02:00
Debrard Sebastien fb928b6778 Fixed #2018 (Postfix Operators) 2010-10-14 19:17:40 +02:00
Pete Johns fbd3d92aa9 Fixed #2084 (False positive: object destroyed immediately (struct and function with same name))
Tightened up class definition matching so as not to match C-style struct tags.
2010-10-13 20:37:53 +11:00
Debrard Sebastien 1a4e3dcc44 increment check 2010-10-12 19:54:39 +02:00
Daniel Marjamäki 3dfcbfc0e0 assignment in assert: modified the error message to better explain the reason why the warning is given. 2010-10-11 17:59:08 +02:00
Zachary Blair d9967d4fd2 Fixed #2079 (detect side effects in assert) 2010-10-10 13:05:06 -07:00
Daniel Marjamäki 3340010376 fix unit testing 2010-10-10 14:23:05 +02:00
Daniel Marjamäki a3367874d9 Fixed #1778 (false negative: nullpointer dereference (std::string pointer)) 2010-10-09 07:57:34 +02:00
Daniel Marjamäki 7b4e08385d STL: refactoring CheckStl::erase so ExecutionPath is used 2010-10-05 20:54:13 +02:00
Pete Johns 4bf9ff26ea Fixed 2071 (false positive: object destroyed immediately (when using '= { ... }'))
Simplified check within CheckOther::checkMisusedScopedObject() as a result.
2010-10-04 08:16:11 +11:00
Daniel Marjamäki cd8ef1cded Revert "temporarily disable the 'object destroyed immediately' message"
This reverts commit fa94312c9a.
2010-10-03 18:05:08 +02:00
Daniel Marjamäki fa94312c9a temporarily disable the 'object destroyed immediately' message 2010-10-03 16:59:13 +02:00
Pete Johns 78795dc3ac Fix false positive: Misused Scope Object does not pick constructors of local class declarations.
It does pick up if there is an unused construction within the function, though.
2010-10-02 22:59:04 +10:00
Pete Johns 365b1bed1a Fixed false positive: checkMisusedScopedObject no longer errors on calls to function objects. 2010-10-02 21:25:16 +10:00
Pete Johns b72b699b76 Fixed false-positive: Object is referenced on construction
struct Foo {
        void bar() {
        }
    };

    void fn() {
        Foo().bar(); // This caused a false-positive
    }
2010-10-02 20:26:29 +10:00
Pete Johns 3f72d3a877 Check misused scope object does not pick local class method.
Also fixed mistyped withinFuntion ->withinFunction.
2010-10-02 20:12:52 +10: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 415cbc63c3 Fixed #2066 (false positive: uninitialized variable when initializing through function pointer) 2010-09-27 19:26:09 +02:00
Daniel Marjamäki de3c761790 Fixed #2052 (False positive: possible null pointer dereference 'else continue') 2010-09-18 14:56:07 +02:00
Daniel Marjamäki fce70508f7 Fixed #2045 (False negative: Uninitialized variable (found with gcc)) 2010-09-17 20:38:37 +02:00
Daniel Marjamäki 1c3862bd35 Execution Paths: fixed TODO test cases 2010-09-17 19:31:45 +02: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 7e67bb53b8 Fixed #2049 (False negative: 'Uninitialized variable' error won't show) 2010-09-15 20:04:50 +02:00
Daniel Marjamäki 0418731473 Fixed #2030 (False positive: Uninitialized variable when function does not return) 2010-09-10 19:02:40 +02:00
Daniel Marjamäki 5688412f00 Fixed #2030 (False positive: Uninitialized variable when function does not return) 2010-09-07 20:25:29 +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 a2b4e5641f Fixed #2010 (missing continue in switch check ?) 2010-09-04 14:24:45 +02:00
Daniel Marjamäki fb4fce466e Fixed #2014 (False positive with longjmp) 2010-09-03 07:18:01 +02:00
Daniel Marjamäki 190a0040b7 Null pointer: Fixed false positive 2010-09-02 21:08:58 +02:00
Daniel Marjamäki df87ce9e04 Fixed #1945 (False positives when a for loop header is in a macro) 2010-08-26 21:57:48 +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 029613d4c4 Fixed #1923 (False positive: Possible null pointer derefence in else if) 2010-08-07 19:59:56 +02:00
Daniel Marjamäki e7e86ef333 calculation in sizeof: added two more ASSERT_EQUALS to guard against false positives 2010-08-07 10:12:39 +02:00
Daniel Marjamäki c395e51389 New check: look for calculation inside sizeof 2010-08-06 22:57:10 +02:00
Daniel Marjamäki 65f7bcbfa5 null pointers: fixed TODO assertion - dereference pointer in function call and then checking that it is not NULL 2010-08-05 08:19:36 +02:00
Daniel Marjamäki 6f228033d2 null pointers: fixed todo test case 2010-08-05 08:06:19 +02:00
Daniel Marjamäki 239d264432 uninitialized variables: fixed false negatives when uninitialized pointer data is read 2010-08-04 21:13:40 +02:00
Daniel Marjamäki 9c17114668 Fixed #1893 (false positive: dereferencing null pointer (try/catch)) 2010-07-24 14:27:18 +02:00
Daniel Marjamäki bbf2c6c6e6 Fixed #1880 (false positive: Uninitialized array (initialized in subfunction)) 2010-07-19 10:03:54 +02:00
Martin Ettl 6cc3f76668 #1880: added todo testcase (false positive: (error) Uninitialized variable: y) 2010-07-18 18:55:53 +02:00
Daniel Marjamäki 1fb4758583 Fixed #1855 (false positive: uninitialized variable (function call in switch condition)) 2010-07-18 13:19:37 +02:00
Daniel Marjamäki 11a72461f3 Fixed #1835 (false positive: uninitialized variable when using ?) 2010-07-08 11:16:49 +02:00
Daniel Marjamäki a1793edabe Fixed #1825 (*log(0) error) 2010-07-07 09:03:40 +02:00
Daniel Marjamäki 1b20f8d27d Fixed #1824 (false positive: unitialised variable) 2010-07-06 13:18:28 +02:00