Commit Graph

1433 Commits

Author SHA1 Message Date
Pete Johns afe52fa9f2 Fixed MSVC++ compiler warning (pointers are not bools) 2010-10-13 21:19:18 +11:00
Pete Johns 52e16454fa Removed redundant code.
localClassDefinition is no longer required due to improved isIdentifierObjectType() in commit fbd3d92.
2010-10-13 20:48:37 +11: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
Robert Reif a58094e827 Fixed #2089 (False negative: Function can be const (calling const function)) 2010-10-13 07:26:41 +02:00
Daniel Marjamäki 2334192bff Fixed #2087 (False positive: Array 'str[1]' index 1 out of bounds) 2010-10-12 21:52:02 +02:00
Debrard Sebastien d0629803a9 warning de compilation 2010-10-12 19:57:17 +02:00
Debrard Sebastien 3273f964c8 comment 2010-10-12 19:56:35 +02:00
Debrard Sebastien 1a4e3dcc44 increment check 2010-10-12 19:54:39 +02:00
Daniel Marjamäki 9e15c4ef38 Fixed #2088 ([test.c:12]: (error) Buffer access out-of-bounds: l) 2010-10-12 19:35:20 +02:00
Robert Reif 907ed0ac6f Fixed #2085 (False negative: function can be const when member variable is compared) 2010-10-12 07:57:09 +02:00
Daniel Marjamäki 74bf1821e6 Array index: detect array index out of bounds when datatype is unknown. Ticket: #2086 2010-10-11 20:52:14 +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
Robert Reif a6e915f0cd Fixed #2081 (false negative: the function can be declared as const) 2010-10-11 17:43:36 +02:00
Zachary Blair d9967d4fd2 Fixed #2079 (detect side effects in assert) 2010-10-10 13:05:06 -07:00
Daniel Marjamäki 81aed3fbd7 Tokenize: Fixed bug in Tokenize::simplifyKnownVariables 2010-10-10 19:27:42 +02:00
Daniel Marjamäki ef4ce6f46b STL: fixed false positives in the new double-increment check when iterator shadows outer iterator 2010-10-10 14:28:14 +02:00
Daniel Marjamäki 5cc7c9dcf7 Parameter passed by value: updated error message so it mentions the reason. 2010-10-10 14:12:11 +02:00
Daniel Marjamäki ae0528ef59 STL: fixed false positives for the new double-increment check 2010-10-10 11:22:44 +02:00
Daniel Marjamäki 835b511bee STL: Added double-increment check. 2010-10-10 10:52:41 +02:00
Daniel Marjamäki a73ada54d5 Fixed #1705 (false negative: access past end of buffer) 2010-10-10 09:15:18 +02:00
Daniel Marjamäki 14f12e0647 Fixed #2078 (false negative: member variable not intialized) 2010-10-10 07:57:26 +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 068317bed1 STL: Fixed TODO test case TestStl::erase5 2010-10-09 07:15:34 +02:00
Daniel Marjamäki e0ba626351 ClassInfo: Removed unused functionality 2010-10-08 19:43:41 +02:00
Robert Reif 02027eb750 Fixed #2074 ('Internal error in Cppcheck' on complex function typedef (even 2 typedefs!)) 2010-10-06 05:43:07 +02:00
Daniel Marjamäki 7b4e08385d STL: refactoring CheckStl::erase so ExecutionPath is used 2010-10-05 20:54:13 +02:00
Pete Johns 4e11e71a21 Fixed 2072 (object destroyed immediately: add --doc info) 2010-10-04 08:54:19 +11: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 5bf2a300d9 1.45: updated version information 2010-10-03 17:05:36 +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
Daniel Marjamäki e4c3b390cc Fixed #2069 (cppcheck fails to scan OpenBSDs ftp source code) 2010-10-02 13:28:44 +02: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 9a9302cba1 Prevent Tokenizer::simplifyCalculations() from removing parantheses from calls to Functors. 2010-10-02 21:19:05 +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 6eeed00888 Fixed #2067 (Template methods do not 'use' private ones) 2010-09-30 21:22:49 +02: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 80069f016e Fixed #2065 (false positive: memory leak) 2010-09-27 17:53:10 +02:00
Pete Johns 6a52538a9a Fixed #1949: assert() hides memory leaks
Added separate unit-test (trac1949), initially broken to highlight the error and added "assert" to call_func_white_list.

Left TestMemleakInFunction::call_func() as is, as this wouldn't highlight the actual problem.
2010-09-27 20:25:34 +10:00
Daniel Marjamäki cdecbe29d0 Optimisation: Made Tokenizer::simplifyInitVar faster 2010-09-26 15:54:41 +02:00
Daniel Marjamäki ff7a99ad37 Revert "Optimisation: small speedups in the Tokenizer::simplifyTokenList handling"
This reverts commit 056037feed.
2010-09-24 22:18:51 +02:00
Daniel Marjamäki 056037feed Optimisation: small speedups in the Tokenizer::simplifyTokenList handling 2010-09-24 22:14:18 +02:00
Daniel Marjamäki 86e517c5d3 Fixed #1951 (Preprocessor: Compound macro statements not handled correctly) 2010-09-24 21:38:11 +02:00
Daniel Marjamäki 4c98a7e67b Optimisation: Removed unused and slow code. The code was added to fix #1225 but it is now redundant. 2010-09-24 20:56:21 +02:00
Daniel Marjamäki 8950beac37 Optimisation to make the CheckUninitVar::parse slightly faster 2010-09-23 21:40:08 +02:00
Daniel Marjamäki 3f79faac2a Fixed #2059 (cppcheck gives wrong path in error description) 2010-09-22 19:52:14 +02:00
Daniel Marjamäki 7e954ebb57 Optimisation: optimised Token::Match 2010-09-20 20:15:07 +02:00
Kimmo Varis bc4c8e6e94 Delete unused VS lib-projects.
Those projects are just remainder from tries to create a real library
from the lib code.
2010-09-20 21:09:10 +03:00
Daniel Marjamäki 21bf58f1ec Optimisation: small optimisation of CheckClass::privateFunctions 2010-09-20 19:43:03 +02:00
Kimmo Varis d0acc16506 Update VS2010 solution/project files. 2010-09-20 18:09:17 +03:00
Daniel Marjamäki 78e13f098e Refactorings: Optimised the Token::multiCompare function 2010-09-19 15:14:13 +02:00
Daniel Marjamäki 78bd66cd5c Fixed #2056 (False positive: Resource leak) 2010-09-19 12:16:29 +02:00
Daniel Marjamäki a6ff3681bb Fixed #1802 (Preprocessor: macros are expanded wrong) 2010-09-18 22:20:01 +02:00
Daniel Marjamäki a7cf68b9ef Check Class: Removed the 'operator= should not return a const reference' 2010-09-18 20:05:34 +02:00
Daniel Marjamäki 6ba5385878 CheckClass: the 'virtual destructor' checking is currently inactive 2010-09-18 19:03:15 +02:00
Daniel Marjamäki 395f10aa6d Fixed #2053 (false positive on list erase) 2010-09-18 16:46:38 +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
Ettl Martin f6e75b5542 fixed clang++ warning: lib/path.cpp:80:2: warning: no newline at end of file [-pedantic] 2010-09-16 21:39:17 +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
Ettl Martin a56f6d276a fixed warning from cppcheck: [lib/checkbufferoverrun.h:129]: (style) 'operator=' should not return a const reference 2010-09-15 22:25:12 +02:00
Daniel Marjamäki ebf13acfbd Fixed #2032 (inline suppressions fail with comment on the same line as function) 2010-09-15 21:10:54 +02:00
Daniel Marjamäki de3b9f610a Fixed #2033 (all inline suppressions fail with relative paths) 2010-09-15 21:03:21 +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 416f093fc3 Tokenizer: fixed variable declaration simplification 2010-09-15 19:53:47 +02:00
Daniel Marjamäki 38b35feaa8 Tokenizer: the 'failed to parse typedef' messages should not be shown unless --debug-warnings are given 2010-09-14 20:59:09 +02:00
Daniel Marjamäki 42d0ad8262 Fixed #2048 (Preprocessor: ifndef incorrectly simplified) 2010-09-14 17:45:37 +02:00
Robert Reif f2a3267ac7 Preprocessor: Report #error configuration when -D is used. Ticket: #2042 2010-09-14 07:21:19 +02:00
Robert Reif 0153dccb66 Symbol database: Skip bail out in constructors if a virtual function might be called because that would be undefined behaviour. Ticket: #1895 2010-09-14 07:16:53 +02:00
Daniel Marjamäki b0bb71ee20 Preprocessor: Handle C++0x rawstrings by replacing them with normal strings. Ticket: #2022 2010-09-13 19:36:40 +02:00
Daniel Marjamäki b1d74ed6b8 Revert "Preprocessor: Report #error configuration when -D is used. Ticket: #2042"
This reverts commit 674644cb29.
2010-09-13 16:59:43 +02:00
Robert Reif 674644cb29 Preprocessor: Report #error configuration when -D is used. Ticket: #2042 2010-09-13 16:55:40 +02:00
Robert Reif 6de1711515 Symbol database: reduce false negatives for 'uninitialized variable' when calling base class function. ticket: #1895 2010-09-12 22:40:51 +02:00
Daniel Marjamäki 84d9282da2 Memory leaks: remove redundant 'if return ; else|' 2010-09-12 21:41:13 +02:00
Robert Reif aae2986361 Fixed #2042 (#error messages should be displayed when user defines are used) 2010-09-12 21:30:47 +02:00
Daniel Marjamäki 5a95303405 Memory leaks: reduce 'loop { if continue ;' to 'loop {' 2010-09-12 21:15:19 +02:00
Daniel Marjamäki 0a30aba2e6 Memory leaks: insert ';' in the simplifycode to split up the commands 2010-09-12 21:04:05 +02:00
Daniel Marjamäki 9c4a05a3bd Memory leaks: simplify 'loop { use ; callfunc ; }' to 'use ;' 2010-09-12 20:45:30 +02:00
Daniel Marjamäki ceeef847ef Memory leaks: simplify 'if break ; break ;' 2010-09-11 21:48:40 +02:00
Daniel Marjamäki 7aa0504692 Memory leaks: simplify 'use use' 2010-09-11 21:32:21 +02:00
Daniel Marjamäki 424fe064cb Memory leaks: don't write debug warning for '; alloc ; dealloc ; return ; }' 2010-09-11 21:14:20 +02:00
Daniel Marjamäki d4e045cee5 Memory leaks: fixed try/catch and nested loops simplifications 2010-09-11 21:07:35 +02:00
Daniel Marjamäki 4064712baa Memory leaks: improved simplification for 'callfunc' 2010-09-11 20:49:24 +02:00
Daniel Marjamäki 73122c3e8a Memory leaks: Improved the simplifycode for 'use ; if| use ;' 2010-09-11 20:18:16 +02:00
Daniel Marjamäki ecd863700e Fixed #2023 (false positive with realloc()) 2010-09-11 11:15:04 +02:00
Robert Reif 69afc0a0db Symbol database: fixed false positive. ticket: #1895 2010-09-11 08:23:30 +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
Robert Reif 5a6eff90d1 Symbol database: Refactoring. ticket: #1895 2010-09-10 07:02:49 +02:00
Daniel Marjamäki 0afd19c59b Fixed #2039 (unions not handled properly, false positive about initialization) 2010-09-09 20:15:00 +02:00
Daniel Marjamäki 929a54e1b0 Fixed #2038 (memleak false positive with assignment expression in arguments) 2010-09-09 19:40:36 +02:00
Daniel Marjamäki 5af0d65aef Fixed #2025 (iso646 c++ operators are not handled correctly) 2010-09-09 17:43:09 +02:00
Robert Reif 6d35396720 Symbol database: refactoring - differentiate between member data initialization and assignment and save the order of variable declarations. makes it possible to create some additional checks. ticket: #1895 2010-09-09 07:26:40 +02:00
Robert Reif c3762903a9 Symbol database: fixed false negative for uninitialized variable. ticket: #1895 2010-09-09 07:21:51 +02:00