Commit Graph

1984 Commits

Author SHA1 Message Date
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
Zachary Blair df1c911d84 Merge branch 'master' of github.com:danmar/cppcheck 2010-07-19 07:49:44 -07:00
Robert Reif 4cf92992a8 Fixed #1883 (false positive: (style) The function 'A::SetPos' can be const) 2010-07-19 13:16:11 +02:00
Daniel Marjamäki d4d0bc050a Fixed #1865 (Tokenizer::simplifyRedundantParantheses: wrong handling of 'operator delete') 2010-07-19 12:06:20 +02:00
Daniel Marjamäki bbf2c6c6e6 Fixed #1880 (false positive: Uninitialized array (initialized in subfunction)) 2010-07-19 10:03:54 +02:00
Zachary Blair 9ffd06ff5e Fixed #1856 (false positive: "pData" nulled but not freed upon failure) 2010-07-18 23:55:39 -07:00
Robert Reif 37b37218cf Fixed #1882 (false negative: function can be declared const) 2010-07-19 08:40:46 +02:00
Robert Reif 689de10abf uninitialized class members: better handling of nested classes 2010-07-18 20:43:51 +02:00
Martin Ettl 6cc3f76668 #1880: added todo testcase (false positive: (error) Uninitialized variable: y) 2010-07-18 18:55:53 +02:00
Martin Ettl 5ab36d8a6d added a testcase for ticket #1879 2010-07-18 15:13:48 +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 c16b5d6f3a Fixed #1857 (XML tag no more included for unusedFunction error (1.44 regression)) 2010-07-18 11:22:26 +02:00
Robert Reif 81a053aa90 Fixed #1311 (false negative: missing const not found in derived classes) 2010-07-18 10:18:41 +02:00
Kimmo Varis 6903f61f69 Update Visual Studio projects. 2010-07-17 17:59:47 +03:00
Kimmo Varis 5d1a10b0a3 Astyle cleanup. 2010-07-17 17:42:17 +03:00
Robert Reif 9c4bbd4c65 Fixed #1730 (False negative in 'variable not initialized in ctor') 2010-07-17 12:26:05 +02:00
Kimmo Varis 6db365e6f7 Improve path name handling in ErrorLogger.
This commit adds setfile() method to FileLocation class. The setfile
method converts in Windows path separators to internally used Unix
separators. And getfile() converts path separators back to Windows
separators. This fixes bugs that error reports had mixed path
separators in paths.
2010-07-17 01:27:40 +03:00
Robert Reif d72365ab00 Fixed #1375 (false negative: uninitialized member variables not found in nested class constructors) 2010-07-15 10:16:16 +02:00
Kimmo Varis d811970531 Merge remote branch 'remotes/kimmo/severity-refactor' 2010-07-14 22:29:02 +03:00
Kimmo Varis fcfa292205 Fix tests after severity-refactor.
Now previously used testSeverity is not valid severity.
2010-07-14 21:12:54 +03:00
Robert Reif fd352865ca CheckClass: Improvements and refactorings for constructors and variables checking 2010-07-14 19:00:52 +02:00
Daniel Marjamäki a6b6022497 Fixed #1851 (false positive: Member variable not initialized int ctor) 2010-07-14 18:50:29 +02:00
Kimmo Varis fa0f6edacf Rename ErrorMessage::toText() to ErrorMessage::toString(). 2010-07-14 18:31:05 +03:00
Daniel Marjamäki bea714445a Fixed #1850 (An access to a nested std::map via a negative integer key is reported as 'Array index out of bounds') 2010-07-14 12:24:07 +02:00
Daniel Marjamäki a1ce80806e Fixed #1844 (False positive: invalid iterator when erase() is used in if-else (with continue)) 2010-07-14 09:42:10 +02:00
Robert Reif c572e6af87 Fixed #1846 (False positive with -s: Variable hides typedef with same name) 2010-07-13 08:08:12 +02:00
Robert Reif ab088bcec9 Fixed #1847 (False positive: Method using std::swap<>() can be declared const) 2010-07-13 08:04:48 +02:00
Daniel Marjamäki 61150498c4 Variable Id: fixed issue with function call. Ticket: #1848 2010-07-12 20:18:03 +02:00
Robert Reif e86e8449f8 Variable usage: better handling of pointer aliasing. Ticket: #1729 2010-07-12 09:50:18 +02:00