Commit Graph

2212 Commits

Author SHA1 Message Date
Debrard Sebastien fb928b6778 Fixed #2018 (Postfix Operators) 2010-10-14 19:17:40 +02:00
Daniel Marjamäki b6c995ea47 Fixed #2096 (False positive: buffer overrun (extern array)) 2010-10-13 20:57:59 +02:00
Robert Reif 267d1f273e Fixed #2082 (Tokenizer::simplifyTypedef: wrong handling of array) 2010-10-13 20:02:37 +02:00
Daniel Marjamäki 229604b3e3 Fixed #2093 (False positive: buffer access out of bounds (unknown type)) 2010-10-13 18:06:50 +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
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 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
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 f427fdb856 STL: Added TODO test case for the new double-increment check 2010-10-10 17:55:14 +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 3340010376 fix unit testing 2010-10-10 14:23:05 +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 f2ba1c6171 Unit testing: Added TODO test case TestStl::erase5 2010-10-08 21:52:18 +02:00
Daniel Marjamäki 50603f44eb Unit testing: activated TODO test 2010-10-08 21:41:52 +02:00
Daniel Marjamäki e0ba626351 ClassInfo: Removed unused functionality 2010-10-08 19:43:41 +02:00
Robert Reif 24eba7ef02 Unit Testing: Added more typedef tests 2010-10-08 16:00:21 +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
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
Daniel Marjamäki a58ba811a6 Unit Testing: added missing TEST_CASE 2010-10-02 12:44:38 +02: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
Daniel Marjamäki 19d67757b1 Visual Studio: updated test/test.vcproj 2010-10-02 09:43:28 +02:00
Daniel Marjamäki bdb3c06c36 Visual Studio: Fixed compiler error. It seems visual studio 2008 doesn't like 'not'. 2010-10-02 09:42:31 +02: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
Pete Johns a801d3162e Added Doxygen commenting, per kimmov's request.
Of course test/ is not covered currently by the settings in doxyfile.
2010-09-26 19:15:14 +10:00
Pete Johns afc6d4507d Removed static std::string.
which_test() doesn't have to calculate anything, could be inlined.
2010-09-26 16:52:30 +10:00
Pete Johns 5dc4759598 Replaced TODO in numeric test with two passing tests.
Just getting to grips with how the tokenizer behaves.
2010-09-26 16:39:19 +10:00
Pete Johns acad87c3e3 Improved test coverage.
Refactored to extract givenACodeSampleToTokenize, reducing LOC.
2010-09-26 13:31:36 +10:00
Pete Johns 97a68bdcee Added `check` target.
Runs the test as per `make test`, but with less verbosity.

    -g GCC-style errors
    -q quiet tests
2010-09-26 13:29:23 +10:00
Pete Johns 10396911ca Renamed RedirectInputOutput -> RedirectOutputError
This class does not redirect input.
2010-09-26 13:22:11 +10:00
Pete Johns 77089293c6 Extracted Error and Output redirection.
Making reuse possible.
2010-09-26 13:19:30 +10: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 3f79faac2a Fixed #2059 (cppcheck gives wrong path in error description) 2010-09-22 19:52:14 +02:00
Kimmo Varis d0acc16506 Update VS2010 solution/project files. 2010-09-20 18:09:17 +03: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 e2ef26cb2e STL: added TODO test case 2010-09-18 20:08:34 +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 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 334cbbcbf8 removed qmake files for the cli and unit tests 2010-09-18 12:44:52 +02:00
Daniel Marjamäki 554a7fd68e Visual Studio 2008: Updated the project/solution files 2010-09-18 08:20:02 +02:00
Daniel Marjamäki 75e307e968 updated test/test.pro 2010-09-18 08:09:30 +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 416f093fc3 Tokenizer: fixed variable declaration simplification 2010-09-15 19:53:47 +02:00
Daniel Marjamäki 42d0ad8262 Fixed #2048 (Preprocessor: ifndef incorrectly simplified) 2010-09-14 17:45:37 +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
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 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 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
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 c3762903a9 Symbol database: fixed false negative for uninitialized variable. ticket: #1895 2010-09-09 07:21:51 +02:00
Daniel Marjamäki 80be31de13 Fixed #2037 (memleak not detected in exit path when variable used) 2010-09-08 20:03:22 +02:00
Daniel Marjamäki 8e746ca53f CheckMemoryleaks: reduce 'use ; if return ; dealloc ;' to 'if return ; dealloc ;'. ticket: #2037 2010-09-08 19:22:03 +02:00
Daniel Marjamäki ad03c97a6e cmdlineparser: allow space between -D and define name. ticket: #2036 2010-09-08 17:42:28 +02:00
Kimmo Varis 3c8ffb90dd Add tests for userdefines and userincludes for CmdLineParser. 2010-09-08 18:02:22 +03:00
Robert Reif 2fc2859b68 Fixed #2035 (Enum 'qboolean' hides typedef with same name) 2010-09-08 06:45:57 +02:00
Daniel Marjamäki 86a08b9f0e unit testing: moved TestTokenizer::match tests to the TestToken 2010-09-07 20:42:29 +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 3a4cda0f0d Fixed #2034 (false positive: unused private function (Borland C++ __property)) 2010-09-07 18:37:43 +02:00
Reijo Tomperi 2ab78d819e One more encoding fix. 2010-09-07 00:12:24 +03:00
Kimmo Varis 1dfab9f02c Add more tests for CmdLineParser. 2010-09-06 23:16:52 +03:00
Daniel Marjamäki cfe694330f Fixed #2024 (Internal Error on multiple append calls on same string object) 2010-09-06 21:34:51 +02:00
Kimmo Varis f36666572a Add couple of basic tests for CmdLineParser. 2010-09-06 22:31:06 +03: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
Kimmo Varis 8fde754ad0 Disable command line tests after refactoring command line handling.
Disable the tests until I create tests that work with the new code.
2010-09-05 11:17:32 +03:00
Daniel Marjamäki 0f8bc429ad Fixed #2021 (false positive: syntax error with -std=gnu++0x code) 2010-09-05 08:16:19 +02:00
Daniel Marjamäki 7d3ccb064b Fixed #2020 (false positive: (error) Uninitialized variable, used in asm statement) 2010-09-05 08:06:37 +02:00
Daniel Marjamäki 51bc784537 Tokenizer: Fixed problem in Tokenizer::simplifyRedundantParanthesis when simplifying 'void delete(double num);' 2010-09-05 07:53:43 +02:00
Daniel Marjamäki a2b4e5641f Fixed #2010 (missing continue in switch check ?) 2010-09-04 14:24:45 +02:00
Daniel Marjamäki 75fb99cee7 Fixed #2015 (### Internal error in Cppcheck. Please report it.) 2010-09-04 11:49:56 +02:00
Daniel Marjamäki 9415423352 Fixed #2017 (false positive::struct or union member 'Base::m_ui' is never used) 2010-09-04 11:21:34 +02:00
Daniel Marjamäki f490ebcf88 Fixed #1872 (Confused -v switch) 2010-09-03 13:30:49 +02:00
Daniel Marjamäki 1938b8a423 Fixed #1976 (False Positives with unions) 2010-09-03 08:10:29 +02:00
Daniel Marjamäki fb4fce466e Fixed #2014 (False positive with longjmp) 2010-09-03 07:18:01 +02:00
Robert Reif b5276ce9e5 Symbol database: Added todo testcase for better namespace handling. Ticket: #1895 2010-09-03 06:17:34 +02:00
Daniel Marjamäki 427c0f4bfd Fixed #1975 (segmentation fault of cppcheck) 2010-09-02 23:01:12 +02:00
Daniel Marjamäki 190a0040b7 Null pointer: Fixed false positive 2010-09-02 21:08:58 +02:00
Daniel Marjamäki 01b05618e5 Tokenizer: Fixed Cppcheck warnings 2010-09-02 20:51:01 +02:00
Robert Reif 80fdf1ca51 Symbol database: Fixed false negatives for unused private functions. Ticket: #1895 2010-09-02 19:22:54 +02:00
Robert Reif fbffaade2e Fixed #2011 (Parser error in template function) 2010-09-02 19:09:06 +02:00
Daniel Marjamäki eb74bfc15a Fixed #2007 (False positive: member variable not initialized (Borland C++ property)) 2010-09-01 18:10:12 +02:00
Robert Reif 4153b7d24b refactoring namespace handling. ticket: #2001 2010-09-01 16:47:53 +02:00
Robert Reif 7a8190e188 Fixed #2002 (Wrong operator() parsing) 2010-09-01 06:32:46 +02:00
Robert Reif e39dda4eed const functions: Added unit test for ticket #2003 2010-09-01 06:18:09 +02:00
Kimmo Varis 63f1de509c Merge branch 'master' of github.com:danmar/cppcheck 2010-08-31 23:26:25 +03:00
Daniel Marjamäki 55e0e435bd Fixed #1959 (Do you support the oracle Pro*C ?) 2010-08-31 23:25:41 +03:00
Daniel Marjamäki 3a8e7b4bf0 Exception safety: Removed the noisy checks and keep the useful checks 2010-08-31 22:22:59 +02:00
Kimmo Varis d417256c98 Move timer code to own cpp/h files. 2010-08-31 23:18:07 +03:00
Daniel Marjamäki b2a775f3e0 Fixed #1959 (Do you support the oracle Pro*C ?) 2010-08-31 21:40:51 +02:00
Kimmo Varis 9a52b35144 Merge branch 'master' of github.com:danmar/cppcheck 2010-08-31 22:05:08 +03:00
Kimmo Varis ee7bc64197 Fix building CLI with VS2010. 2010-08-31 22:04:13 +03:00
Daniel Marjamäki 8ff1e71b22 Fixed #2004 (False positive in 'variable assigned a value but is never used' check) 2010-08-31 20:58:37 +02:00
Kimmo Varis e825fb1e70 Fix CLI build with VS2008. 2010-08-31 21:58:03 +03:00
Daniel Marjamäki 1d78b5072d Fixed #1996 (False positive for 'Variable foo is assigned a value that is never used') 2010-08-31 20:33:28 +02:00
Daniel Marjamäki 513826d8c2 Tokenizer::setVarId : don't give operator function variable id 'operator new []('. Ticket: #1997 2010-08-31 20:15:24 +02:00
Daniel Marjamäki fbe11b9bb9 Fixed #1999 (False positive: uninitialized variable (__published variables)) 2010-08-31 19:48:04 +02:00
Debrard Sébastien 071f7d5f34 Fixed #2005 (refactoring dangerous / obsolete functions checks) 2010-08-31 18:58:01 +02:00
Robert Reif 5aab602709 Fixed #2001 (No 'The function ... can be const' warnings when base class is in namespace.) 2010-08-31 17:57:42 +02:00
Robert Reif c56911ba6a Fixed #2000 (segmentation fault of cppcheck with bitfield) 2010-08-31 17:51:10 +02:00
Daniel Marjamäki 7ec3c72a19 Fixed #1997 (operator new [] simplified wrong) 2010-08-30 21:06:22 +02:00
Daniel Marjamäki 9c499db17b Revert "Visual Studio: Added /MP switch"
This reverts commit 2450a80556.
2010-08-30 17:51:08 +02:00
Robert Reif 96d73c189c Symbol database: better handling of operator functions. Ticket: #1895 2010-08-30 17:14:20 +02:00
Robert Reif 0d530711f6 Fixed #1988 (segmentation fault of cppcheck with wrong syntax of -std=c++0x) 2010-08-30 07:25:17 +02:00
Robert Reif a862e982ff Fixed #1993 (False negatives: uninitialised variables in constructor) 2010-08-29 16:36:10 +02:00
Daniel Marjamäki 54e313efdc Tokenizer: Added testcase that asserts that there are not internal errors when using typedefs. Ticket: #1887 2010-08-29 13:54:26 +02:00
Daniel Marjamäki 02939c78f8 Fixed #1994 (False 'Found obsolete function' positive) 2010-08-29 12:01:32 +02:00
Daniel Marjamäki 71453871d4 Fixed #1989 (false positive: Variable 'Aux13' is assigned a value that is never used) 2010-08-28 13:32:43 +02:00
Daniel Marjamäki 83a8879f11 Tokenizer::simplifyInitVar : Refactorings and fixes related to ticket #1989 2010-08-27 22:58:21 +02:00
Daniel Marjamäki d45186d645 Added --debug-warnings that we can use to enable various debug warnings 2010-08-27 20:28:00 +02:00
Daniel Marjamäki 8eee4cf2e8 Fixed #1984 (false positive: syntax error in for loop (< -operator)) 2010-08-26 23:24:01 +02:00
Daniel Marjamäki 57523574ef Fixed #1985 (false positive: syntax error in try catch-block with for()-loop inside) 2010-08-26 23:19:18 +02:00
Daniel Marjamäki 0597c50a47 Fixed #1966 (False positive: Unused private function (virtual function in base class)) 2010-08-26 22:05:45 +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 1d9e484053 Fixed #1951 (Preprocessor: Compound macro statements not handled correctly) 2010-08-26 21:33:45 +02:00
Robert Reif 499a12c896 Tokenizer::simplifyTypedef: Report about unhandled typedefs. Ticket: #1821 2010-08-26 20:44:13 +02:00
Daniel Marjamäki 8b18aaff25 Fixed #1981 (false positive: syntax error on template operator <) 2010-08-26 07:43:00 +02:00
Daniel Marjamäki ca9cdf5bf5 Tokenizer: If syntax errors are found then don't return a token list. Ticket: #1961 2010-08-25 22:10:21 +02:00
Daniel Marjamäki 6c8287913c Tokenizer: Detect some syntax errors when trying to use templates. Ticket: #1961 2010-08-25 21:57:57 +02:00
Robert Reif 4a6070d2af fix 2 problems related to ticket 1976:
1. nested unnamed anonymous structures and unions were not supported.
 2. declaration split up in class had bug if proceeded by access specifier.
2010-08-25 20:17:31 +02:00
Daniel Marjamäki e7f7c77eab Fixed #1948 (C++ class scoping not followed) 2010-08-24 22:04:14 +02:00
Daniel Marjamäki ca407110dc Fixed #1936 (Internal error. Token::Match called with varid 0.) 2010-08-24 20:58:22 +02:00
Robert Reif d961a6ec9e Tokenizer: Fixed cppcheck and compiler warnings 2010-08-24 07:28:56 +02:00
Daniel Marjamäki 39a69b0871 Fixed #1970 (Internal error. CheckClass::SpaceInfo::getVarList found variable '_root' with varid 0.) 2010-08-23 21:22:11 +02:00
Daniel Marjamäki f7063bed7c Fixed #1967 (Tokenizer::setVarid doesn't set variable value (list of function pointers)) 2010-08-23 20:15:02 +02:00
Daniel Marjamäki 3b716dfcc9 Tokenizer: Simplified the bitfields handling. This patch just looks for the bitfield signature but doesn't care about the type. I don't think any other code would have this same signature so it should be OK. We could add code to only look in structures and classes but I don't think that is necessary. Ticket: #1956 2010-08-23 07:29:05 +02:00
Robert Reif cb7b508f77 Tokenizer::simplifyBitfields: fixed more issues. Ticket #1956 2010-08-22 13:25:47 +02:00
Robert Reif 3fcca23b53 Tokenizer: better handling of bitfields. Ticket: #1956 2010-08-22 09:41:22 +02:00
Robert Reif 77d634127c Tokenizer: simplify DECLARE_DYNAMIC and DECLARE_DYNCREATE 2010-08-22 09:38:05 +02:00
Robert Reif ac9078857e Tokenizer: simplify bitfields. Ticket: #1956 2010-08-21 16:34:41 +02:00
Robert Reif 9c594684db Tokenizer: handle DECLARE_DYNAMIC. Ticket: #1956 2010-08-21 07:55:14 +02:00
Robert Reif 7173e01926 Fixed #1965 (tokenizer::simplifyEnum add support for C++0x enums) 2010-08-21 07:44:56 +02:00
Robert Reif 7b2b844b8e Fixed #1964 (False positive: function can be const (get this)) 2010-08-20 19:47:41 +02:00
Daniel Marjamäki 741ce40e3d Tokenizer::setVarId : fixed problem for class members 2010-08-20 19:28:10 +02:00
Daniel Marjamäki 3dd504bcb2 updates of Visual Studio files 2010-08-20 17:59:09 +02:00
Robert Reif 66de0d8f72 Fixed #1954 (False positive: function can be const (derived class)) 2010-08-20 07:28:31 +02:00
Robert Reif f123e951ec Fixed #1963 (typedef array incorrectly simplified) 2010-08-20 07:11:02 +02:00
Daniel Marjamäki cfa7b4906e Symbol database: bug fixes. Ticket: #1895 2010-08-18 22:42:04 +02:00
Daniel Marjamäki 0934035fcf Fixed #1955 (cppcheck hangs with 100% cpu load) 2010-08-18 22:22:14 +02:00
Daniel Marjamäki 1fd773b245 Fixed #1944 (segfault in Tokenizer::simplifyLogicalOperator) 2010-08-17 20:06:20 +02:00
Daniel Marjamäki aa00587fed #1943 (segmentation fault of cppcheck (= default)) 2010-08-17 19:50:21 +02:00
Daniel Marjamäki 1faaa5471c Fixed #1946 ('Dereferenced iterator erased' false positive) 2010-08-17 18:56:11 +02:00
Daniel Marjamäki 64cdee62ef Fixed #1942 (false positive: uninitialized variable in __asm__ statement) 2010-08-16 19:38:47 +02:00
Robert Reif cc079462dd Symbol database: fixed problems with namespaces. Ticket: #1895 2010-08-16 18:55:39 +02:00
Daniel Marjamäki 85acb005a2 Fixed #1941 (Internal error::Space Info::getVarList found variable with varid 0) 2010-08-16 18:51:25 +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
Daniel Marjamäki fe482785aa Variable Id: Fixed various bugs related to templates and bitfields. Ticket: #1928 2010-08-15 11:54:28 +02:00
Daniel Marjamäki e1d6320a55 quick fix for #1905 (false positive: the function '...' can be declared as const (member array is assigned)) 2010-08-15 08:30:21 +02:00
Erik Lax 54b7f972c9 Fixed #1932 (false positive: unused private function) 2010-08-15 07:44:08 +02:00
Zachary Blair c8087d3389 Fixed #162 (Initialisation of a variable by itself) 2010-08-14 21:34:04 -07:00
Daniel Marjamäki 4ff9a1ac94 Fixed #1928 (missing varId for template class variable) 2010-08-14 20:50:49 +02:00
Erik Lax 248bb3b6e8 Fixed #1935 (false negative: detect buffer overrun from network functions (recv, recvfrom..)) 2010-08-14 20:19:23 +02:00
Sbastien Debrard a55a06cea5 Fixed #1933 (Add checks for obsolete functions) 2010-08-14 20:13:46 +02:00
Daniel Marjamäki 5846630fa9 Added scanf check. Modified patch submitted by Eric Sesterhenn 2010-08-14 15:15:12 +02:00
Ettl Martin 0d8b74e538 fixed unit test of dangerous functions 2010-08-14 11:31:36 +02:00
Robert Reif 7c18ece65d Symbol database: Fixed bug when end of namespace wasn't found. Ticket: #1895 2010-08-14 08:16:53 +02:00
Robert Reif db78c3acdf Symbol database: fixed linenr problem in virtual destructors check 2010-08-13 23:57:53 +02:00
Erik Lax 032d2678aa Fixed #1930 (false negative: bad iterators checks fails to detect bugs with preincrement) 2010-08-13 20:54:31 +02:00
Robert Reif ab7bb876f9 Symbol database: Refactoring virtual destructors check. Ticket: #1895 2010-08-13 18:34:02 +02:00
Robert Reif 47c776247a Symbol database: fix a small bug and add more tests. ticket: #1895 2010-08-12 07:38:27 +02:00
Daniel Marjamäki a1f288d088 Tokenizer::setVarId : Fixed a problem when using static class members 2010-08-10 18:22:58 +02:00
Robert Reif 988b43d419 const function check: Added more unit tests 2010-08-10 07:48:09 +02:00
Robert Reif 0b41d822cb Virtual destructors: extended and fixed the testing 2010-08-09 21:22:46 +02:00
Robert Reif bf1352c573 Fixed typo in testcase. Ticket: #1311 2010-08-09 17:57:07 +02:00
Robert Reif 217b9425b5 Fixed #1922 (False positive: function can be const when both const and non-const functions are provided.) 2010-08-09 17:54:16 +02:00
Robert Reif 12523bc745 Symbol database: Enhancements and fixes. Ticket: #1895 2010-08-09 17:50:26 +02:00
Daniel Marjamäki eab69a686b Visual Studio: Fixed unit tests. Ticket: #640 2010-08-07 21:05:14 +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 262885f3e0 Fixed #1921 (false positive: the function '...' can be declared as const (inline friend)) 2010-08-07 16:08:44 +02:00
Daniel Marjamäki ed4f1164a1 Fixed #1894 (unreadVariable false positive with const references) 2010-08-07 15:53:51 +02:00
Daniel Marjamäki 050011d287 Fixed #1881 (false positive: The function '...' can be const (nonconst code is hidden inside #if)) 2010-08-07 13:08:36 +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 adc47f1820 Fixed #1487 (fix gcc compiler warnings) 2010-08-06 21:02:43 +02:00
Daniel Marjamäki eedb5e383e Memory leaks: better handling of 'return strcmp(..' etc 2010-08-05 21:23:32 +02:00
Daniel Marjamäki 2450a80556 Visual Studio: Added /MP switch 2010-08-05 19:02:05 +02:00
Daniel Marjamäki e5a2c6426b Memory leaks: Added ASSERT_EQUALS near the TODO_ASSERT_EQUALS 2010-08-05 13:30:07 +02:00
Daniel Marjamäki 1b2f16f443 Buffer overflow: Fixed two TODO test cases 2010-08-05 11:01:47 +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 9d24c9ceaa Memory leaks: refactoring return handling 2010-08-04 23:01:32 +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 6d94c4f15e Memory leaks: don't translate 'return p[10];' to 'return use ;' 2010-08-04 20:48:20 +02:00
Daniel Marjamäki 33bf8bf730 Fixed #1670 (False negative: Array index out of bounds in return statement) 2010-08-04 20:38:52 +02:00
Daniel Marjamäki 08e2d91372 Fixed #1919 (option '--suppressions file' can not work when filename includes colon) 2010-08-03 17:52:03 +02:00
Daniel Marjamäki 6700351ede Fixed #1833 (memory leak detected in version 1.37 not detected in 1.43) 2010-08-02 23:04:23 +02:00
Daniel Marjamäki ff9d3d0965 memory leaks: better handling of 'loop { dealloc ; alloc ; }' 2010-08-02 22:17:09 +02:00
Daniel Marjamäki ae0252dc91 memory leaks: simplify 'callfunc ; ;' 2010-08-02 21:59:47 +02:00
Daniel Marjamäki df44703ee9 memory leaks: better checking of function calls. If there are statements after the function call it is unlikely the function call is noreturn 2010-08-02 21:56:50 +02:00
Kimmo Varis 2fa4378338 Astyle cleanup with new Astyle options. 2010-07-31 15:44:08 +03:00
Daniel Marjamäki 694325d51f Fixed #1912 (False positive: memory leak (calling noreturn function)) 2010-07-30 08:50:10 +02:00
Daniel Marjamäki 2e2baa23a6 Fixed #1909 (### Internal error in Cppcheck. Please report it) 2010-07-28 21:03:15 +02:00
Kimmo Varis 45a6742e3f Windows: Add _CRT_SECURE_NO_WARNINGS define.
The _CRT_SECURE_NO_WARNINGS define suppresses some Windows-specific
compile warnings. Windows has "secure" versions of some functions
and compiler outputs warnings that those "secure" versions should
be used instead. Since other platforms don't have those functions
we just suppress this warning for now on.
2010-07-27 17:34:13 +03:00
Zachary Blair 9f44d9eb62 Fixed #1889 (false positive: Common realloc mistake) 2010-07-26 23:17:27 -07:00
Daniel Marjamäki 7c5219324e Refactoring: Cleanup include that checkheaders reported as not needed 2010-07-26 22:05:51 +02:00
Kimmo Varis 60cf37d1ef Update VS 2010 project files. 2010-07-26 22:06:33 +03:00
Robert Reif 0bb07e6947 Create a symbol database 2010-07-26 16:46:37 +02:00
Daniel Marjamäki 29b2be19ab Fixed #1383 (Preprocessor: define - ifndef problem) 2010-07-25 15:19:25 +02:00
Daniel Marjamäki 0c65796984 Refactoring: Cleanup headers using checkheaders 2010-07-24 22:12:56 +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 3ad8f98c61 Refactoring: Settings::addSuppression return error message and callers make sure it's reported properly. Ticket: #1839 2010-07-23 23:12:56 +02:00
Daniel Marjamäki 5e0a4a173a Refactoring: The preprocessor will report errors instead of throwing exceptions. Ticket: #1866 2010-07-23 13:54:52 +02:00
Daniel Marjamäki e1612bc175 Fixed #1891 (Internal error when enum assigned to sizeof without brackets) 2010-07-22 22:21:12 +02:00
Daniel Marjamäki f69109fbf6 Fixed #1828 (### Internal error in Cppcheck. Please report it.) 2010-07-22 19:57:48 +02:00
Kimmo Varis 618076a65f Better fix for #1371.
Now handles also system includes. And have couple of tests.
2010-07-21 14:16:42 +03:00
Kimmo Varis 9d29ee6edd Use enum for header file types 2010-07-21 12:58:30 +03:00
Robert Reif f2f5b3ebf0 Fixed #1883 (false positive: (style) The function 'A::SetPos' can be const) 2010-07-20 09:43:27 +02:00
Daniel Marjamäki 9debcb84cd filelocation-refactoring: Fixed unit tests in windows 2010-07-19 22:02:51 +02:00
Daniel Marjamäki 3c376047ba pulled changes from kimmov (filelocation-refactor) 2010-07-19 18:06:49 +02:00