Commit Graph

2664 Commits

Author SHA1 Message Date
Raphael Geissert 2b1ec9a07f Mention the name of the variable in the inconclusive leak msg 2011-01-03 20:40:31 -06:00
Markus Elfring e459ed1de3 Fixed #2389 (mistakable warning from 'CheckClass::uninitVarError') 2011-01-03 19:03:42 +01:00
Markus Elfring 3fc0317997 Bug #2390: Enclose the output of a variable name with quotes in "CheckOther::variableScopeError"
The variable name output was enclosed by quotation marks in the member
function "CheckOther::variableScopeError" and corresponding test functions.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
2011-01-03 05:15:20 +01:00
Raphael Geissert 3d9550b0bf Simplify "x = realloc (0, n);" to "x = malloc(n);" 2011-01-02 17:46:10 -06:00
Raphael Geissert e75a81669e Move simplification of realloc after simplification of math ops 2011-01-02 16:41:34 -06:00
Daniel Marjamäki d2714fefda typedef: Fixed testcase. ticket: #2375 2011-01-02 17:28:47 +01:00
Daniel Marjamäki 97f7a36e91 Buffer overruns: Added comments 2011-01-02 14:16:58 +01:00
Daniel Marjamäki 2e7e118cb8 Fixed #2392 (Preprocessor: Wrong simplification of __VA_ARGS__) 2011-01-02 11:19:37 +01:00
Daniel Marjamäki b5876f00ff Fixed #2391 (cstdlib file and memory function check misbehavior) 2011-01-02 08:32:51 +01:00
Daniel Marjamäki 4ec9d418ff Fixed #2215 (Improve check: Writing outside malloc bounds not detected) 2011-01-01 20:56:21 +01:00
Daniel Marjamäki 789d944912 typedef: don't simplify typedef after 'case'. it means that there is a typedef and constant with the same names. Ticket: #2386 2011-01-01 20:20:03 +01:00
Daniel Marjamäki 2a77dd3df1 Fixed #2246 (Improve check: Memory leak, function is not noreturn if return value is taken) 2011-01-01 20:14:01 +01:00
Daniel Marjamäki c8775344d6 uninitialized variables: Added some comments 2011-01-01 18:24:27 +01:00
Daniel Marjamäki 3c238882a2 Fixed TODO testcase. Use symbol database instead of token list. Ticket: #2375 2011-01-01 17:54:37 +01:00
Daniel Marjamäki 3eabb4ebe0 Added comments in the memory leaks checking 2011-01-01 13:28:34 +01:00
Daniel Marjamäki 0cc49188c0 Memory leaks: localized variables 2011-01-01 12:27:57 +01:00
Daniel Marjamäki 62145431a7 Tokenizer: Added more comments 2011-01-01 11:40:32 +01:00
Daniel Marjamäki e385323b65 Tokenizer: Added doxygen comments 2011-01-01 11:26:48 +01:00
Daniel Marjamäki 71acf78c64 Tokenizer: added doxygen comments 2011-01-01 09:26:24 +01:00
Zachary Blair 68700b3561 Fixed #2382 (Catching exceptions by value instead of reference) 2010-12-31 12:48:24 -08:00
Daniel Marjamäki 2da3fea1b8 Fixed #2386 (segmentation fault occurs in the checking when typedef has same name as an enum constant) 2010-12-31 20:55:28 +01:00
Daniel Marjamäki 3e5614a5a3 Null Pointer: Refactoring - broke out CheckNullPointer::isPointer 2010-12-31 18:30:04 +01:00
Daniel Marjamäki 04eb9cf305 Fixed #2378 (Refactoring: create utility function that skips redundant if/for/while) 2010-12-31 18:07:46 +01:00
Daniel Marjamäki ed6c76ce04 Fixed #2385 (False positive: array index out of bounds) 2010-12-31 17:43:38 +01:00
Daniel Marjamäki b04885cd4f astyle formatting 2010-12-31 15:57:08 +01:00
Daniel Marjamäki 4d8fae186b added more comments 2010-12-31 15:56:41 +01:00
Daniel Marjamäki b634242a58 Added comments for CheckNullPointer::nullPointerLinkedList 2010-12-31 14:37:34 +01:00
Daniel Marjamäki 377bcbe729 Remove redundant condition 2010-12-31 14:24:15 +01:00
Daniel Marjamäki 1a8c410c06 gcc: fixed compiler warning (suggest parantheses around assignment) 2010-12-31 14:18:24 +01:00
Daniel Marjamäki 3de9d9cb31 Refactoring and commenting CheckNullPointer::nullPointerAfterLoop 2010-12-31 14:17:10 +01:00
Daniel Marjamäki 59c86b5876 added doxygen comments 2010-12-31 14:16:22 +01:00
Daniel Marjamäki 1fa730d963 added some comments 2010-12-31 13:58:17 +01:00
Pete Johns 502cfe7243 Fixed #2384 ("The function 's::f' can be const" reported for pointer-to-pointer)
Moved check for pointer variables into isVariableDeclaration()

Can now handle multiple scopes and multiple levels of indirection. Simplified check for strucs and unions, too, reducing the size of getVarList().

skipScopeIdentifiers() and skipPointers() should probably be methods on class Token.
2010-12-31 22:12:32 +11:00
Zachary Blair d11b5163b7 Fixed #2382 (Catching exceptions by value instead of reference) 2010-12-31 03:01:38 -08:00
Daniel Marjamäki f1f1a21c23 Borland C++: Fixed compiler errors 2010-12-31 10:24:51 +01:00
Daniel Marjamäki d8f241e033 gcc: fixed -Wconversion errors 2010-12-31 09:51:27 +01:00
Daniel Marjamäki 68b9c6ec94 gcc: Fixed -Wconversion warnings in symbol database 2010-12-31 09:39:42 +01:00
Daniel Marjamäki cab338dffe gcc: fixed -Wconversion warnings in tokenizer 2010-12-31 09:38:03 +01:00
Daniel Marjamäki fa3853803b gcc: fixed -Wconversion warnings 2010-12-31 09:30:56 +01:00
Daniel Marjamäki f3ce02462e improved TODO comments 2010-12-30 22:41:22 +01:00
Daniel Marjamäki c7f2ddf63c CheckStl: Added comments 2010-12-30 22:36:25 +01:00
Daniel Marjamäki d005245188 fixed doxygen warnings 2010-12-30 22:13:31 +01:00
Daniel Marjamäki 742f5897b9 gcc: fixed compiler warning 2010-12-30 22:13:10 +01:00
Daniel Marjamäki 3d60d33280 Added comments 2010-12-30 22:07:27 +01:00
Daniel Marjamäki 8bdb05da6e Uninitialized variables: typeof doesn't dereference. Ticket: #2367 2010-12-30 21:30:46 +01:00
Daniel Marjamäki 307178d3c2 Tokenizer: Better handling of duplicate enums. Ticket: #2381 2010-12-30 20:55:23 +01:00
Daniel Marjamäki 7ec169f66a Fixed #2321 (false positive: (performance) Prefer prefix ++/-- operators for non-primitive types.) 2010-12-30 14:27:32 +01:00
Pete Johns 2e61736c73 Refactoring following #2377 (Technically the member function xxx can be const)
symboldatabase now recognises variables with arbitrarily many scopes.

Extracted method isVariableDeclaration()

Added unit tests for isVariableDeclaration in new file testsymboldatabase.cpp

Extracted givenACodeSampleToTokenize helper class into testutils.h to reduce duplication.
2010-12-30 19:46:44 +11:00
Pete Johns 5d0ace3a50 Fixed #2377 (Technically the member function xxx can be const)
TODO: Add unit test for getVarList() and refactor variable check.

[Removed my testcase for #2377 and removed two TODOs.]
2010-12-30 17:56:28 +11:00
Daniel Marjamäki 3d3593e6e7 Fixed #2374 (False 'memory leak' report (assigning to map in subfunction)) 2010-12-29 22:18:23 +01:00
Robert Reif 3900ac731e simplifyTypedef: Better handling of 'typedef int RexxFunctionHandler();'. Ticket: #2348 2010-12-29 20:25:47 +01:00
Robert Reif 3f1f50e970 simplifyTypedef: operator typedef. Ticket: #2375 2010-12-29 20:22:06 +01:00
Daniel Marjamäki 38e7209d26 Fixed #2373 (Using XML2 in --errorlist output) 2010-12-29 12:43:29 +01:00
Daniel Marjamäki fd27be2440 Fixed #2372 (internal error in logicaloperator check (varid=0)) 2010-12-29 10:07:28 +01:00
Robert Reif 137d0e2ba7 typedef: fixed problem with 'typedef int pread_f(int);'. ticket: #2348 2010-12-29 09:18:41 +01:00
Robert Reif e82b1f8946 typedef: fix typedef simplification. ticket: #2348 2010-12-28 21:21:13 +01:00
Daniel Marjamäki bdf0cb7115 Fixed #2370 (false negative: Buffer access out-of-bounds (for with if, no break)) 2010-12-28 20:46:31 +01:00
Daniel Marjamäki 0667fcf53c Fixed #2355 (simplifyTypedef: wrong simplification of 'typedef FMAC1 void (*a)();') 2010-12-28 14:04:44 +01:00
Robert Reif 1b92eeae1e Fixed #2354 (simplifyTypedef: function pointers are not simplified into valid code) 2010-12-28 08:01:32 +01:00
Daniel Marjamäki d4e3e7e201 Fixed #2367 (false positive: (error) Uninitialized variable: s) 2010-12-27 21:19:10 +01:00
Daniel Marjamäki 448c03c6e6 Fixed #2367 (false positive: (error) Uninitialized variable: s) 2010-12-27 21:05:33 +01:00
Daniel Marjamäki 92acca3d0c Fixed #2368 (assigned a value that is never used) 2010-12-27 20:49:07 +01:00
Kimmo Varis e8b81f909d Change 'Scope of variable'-message to information message. 2010-12-27 16:48:03 +02:00
Daniel Marjamäki 660de98c0c Fixed #2365 (Internal error: Token::Match called with varid 0) 2010-12-27 14:06:32 +01:00
Daniel Marjamäki 2367cfcf1e Fixed #2361 (false positive on t[0X10]) 2010-12-27 08:09:05 +01:00
Kimmo Varis 12f2850777 Improve the message about const function.
See discussion thread:
https://sourceforge.net/apps/phpbb/cppcheck/viewtopic.php?f=3&t=192
2010-12-26 23:44:03 +02:00
Kimmo Varis f5f2a2ce2a Improve message for container type range check.
See thread:
https://sourceforge.net/apps/phpbb/cppcheck/viewtopic.php?f=3&t=192&start=0
2010-12-26 23:44:02 +02:00
Kimmo Varis ad89a84796 Improve error message about overlapping buffers for s[n]printf().
See forum thread:
https://sourceforge.net/apps/phpbb/cppcheck/viewtopic.php?f=3&t=192&start=0
2010-12-26 23:44:01 +02:00
Daniel Marjamäki 6aa400fd80 Buffer overrun: UB when pointer arithmetic result points out of bounds. Ticket #1774 2010-12-26 21:23:28 +01:00
Daniel Marjamäki 6178459c15 Fixed #2304 (Tokenizer::simplifyKnownVariables: known strcpy parameter) 2010-12-26 20:34:07 +01:00
Daniel Marjamäki 5f3d2a7e35 Fixed #2090 (False negative: null pointer dereference 's=0; strcpy(s,p);') 2010-12-26 19:29:58 +01:00
Daniel Marjamäki f4581d833d Tokenizer: Bailout if @ is encountered in the code 2010-12-26 15:07:14 +01:00
Daniel Marjamäki 243a524909 Fixed #2350 (false positive: possible null pointer dereference) 2010-12-26 13:38:16 +01:00
Pete Johns 59acbb3da0 Fixed Linux build.
OSX built without limits.h
2010-12-26 23:08:51 +11:00
Pete Johns 64e2c8668c Fixed #2358 (Compilation fail on Mac)
Added test case to prove it works. Not a true unit-test as it accesses the file-system.
2010-12-26 23:04:07 +11:00
Daniel Marjamäki 4fd8d2e056 Fixed #2326 (Preprocessor: inline-suppr does not work for id=missingInclude) 2010-12-26 11:14:57 +01:00
Pete Johns 7943d8ce53 canonicalize_file_name() is a GNU-extension.
Replaced with call to realpath() to build on non-Linux systems, such as Mac OSX.
2010-12-26 14:15:42 +11:00
Daniel Marjamäki ecad249ae2 Fixed #2346 (False positive: pointer is assigned value that is never used. used here: 'pCol = pCol->GetNext()') 2010-12-25 19:17:53 +01:00
Daniel Marjamäki 10ee43790d Fixed #2339 (Tokenizer::setVarId : Wrong handling of 'int gr = id - (TLFPressProperties::OIL_FLUID * nb);') 2010-12-25 12:40:44 +01:00
Daniel Marjamäki 6f8f0e1aa1 Fixed #2353 (Tokenizer::simplifyKnownVariables: wrong simplification after return) 2010-12-25 10:07:57 +01:00
Daniel Marjamäki 81c5576eb4 Misused scope objects: Don't use this check if the checked file is a pure C file. Ticket: #2352 2010-12-25 08:43:52 +01:00
Daniel Marjamäki 65041cf0ff Fixed #2349 (Empty 'msg' in output when using '-j') 2010-12-24 11:13:57 +01:00
Daniel Marjamäki 335d164cdf Fixed #2356 (False positive reported with iterator deletion) 2010-12-24 10:33:48 +01:00
Daniel Marjamäki 18fd12006a Tokenizer::simplifyGoto: Don't simplify 'goto' inside unhandled macro calls. Ticket: #2348 2010-12-23 22:03:58 +01:00
Daniel Marjamäki 472ecd8805 Tokenizer: Fixed calculation simplification of '0*(*p)'. Ticket: #2348 2010-12-23 18:59:18 +01:00
Daniel Marjamäki aff3623fec Fixed #2345 (False positive: uninitialized variable (in sub-condition in if inside a loop)) 2010-12-23 09:16:29 +01:00
Daniel Marjamäki b89f486d0d Fixed #2344 (FileLister Unix: Don't convert to absolute paths) 2010-12-22 21:01:51 +01:00
Daniel Marjamäki be46d453c4 Information: Added new severity 2010-12-22 19:53:17 +01:00
Daniel Marjamäki 22a1f3332f xml2: changed the format of the cppcheck-version info 2010-12-22 18:45:09 +01:00
Robert Reif fc7e2d1ac1 Fixed #2341 (false positive for function pointer returning typedef) 2010-12-22 18:37:23 +01:00
Daniel Marjamäki 00e9822cb3 Fixed #2337 (False Positive: memory leak) 2010-12-22 18:32:00 +01:00
Daniel Marjamäki 3a612d7cd8 xml2: Added cppcheck-version 2010-12-22 10:29:23 +01:00
Daniel Marjamäki f392dbef95 Fixed #2338 (False positive: Deallocating a deallocated pointer) 2010-12-22 08:24:50 +01:00
Daniel Marjamäki 6951c32683 Fixed #2336 (False positive: memory leak (passing pointer to subfunction)) 2010-12-21 21:12:45 +01:00
Daniel Marjamäki 0f9415a5fb Fixed #2330 (unreadVariable error for a fstream object when only extraction operator (>>) is used) 2010-12-21 19:02:00 +01:00
Robert Reif 244974a61a unused variables: fixed false negatives with the help of the symbol database. ticket: #2317 2010-12-21 08:13:40 +01:00
Daniel Marjamäki f73cce9eca Fixed #2317 ((style) Variable is allocated memory that is never used) 2010-12-20 18:31:16 +01:00
Daniel Marjamäki cdc8801be0 Fixed #2334 (Internal class index function (no need to 'strchr')) 2010-12-20 18:13:26 +01:00
Daniel Marjamäki c0bedb5036 Fixed #2331 (Token::Match is called with varid 0) 2010-12-19 21:27:28 +01:00
Daniel Marjamäki 02892499d2 Fixed #2286 (Variable 'ownKilled' is assigned a value that is never used) 2010-12-19 18:27:31 +01:00
Daniel Marjamäki 1cd6f16ecf Fixed #2322 (cppcheck follows recursive symlinks) 2010-12-19 11:22:27 +01:00
Daniel Marjamäki 8247270f35 Fixed #2328 (false positive: buffer overrun (for loop with a break => the end value is not reached)) 2010-12-19 10:39:43 +01:00
Daniel Marjamäki 41ac2c252f Fixed #2325 (Tokenizer: Remove for-loop if condition is false) 2010-12-18 21:43:12 +01:00
Robert Reif a2aa601899 CheckOther: Use SymbolDatabase. Ticket: #2318 2010-12-18 20:35:40 +01:00
Kimmo Varis 062eabf246 Don't use relative paths in lib.pri.
Using relative path in included file binds it to be usable only
included from one directory. Instead use variable for giving the
base path for files.
2010-12-18 17:03:46 +02:00
Daniel Marjamäki 79ea453913 Preprocessor: Report 'missing system include' with debug severity. temporary solution until the handling of system includes is better. 2010-12-18 14:45:53 +01:00
Daniel Marjamäki 8ffc2b0ac6 Tokenizer: better handling for switch/break in the simplifyKnownVariables. Ticket: #2324 2010-12-18 11:14:31 +01:00
Daniel Marjamäki f6c00fc478 Fixed #2323 (false positive: Buffer access out of bounds) 2010-12-18 10:54:36 +01:00
Daniel Marjamäki fc9c450eed Fixed #2320 (false positive: Uninitialized variable: kbuf) 2010-12-18 10:06:21 +01:00
Daniel Marjamäki 7eb9855104 Tokenizer: Remove redundant parantheses in rhs. Ticket: #2320 2010-12-18 09:44:58 +01:00
Daniel Marjamäki 18933ea0e6 QMake: auto-generate the visual studio project files with qmake 2010-12-17 21:43:47 +01:00
Daniel Marjamäki 814efb2512 Fixed #2313 (False Positive: memory leak) 2010-12-17 21:34:22 +01:00
Daniel Marjamäki c2335f845e Fixed #2306 (False positive: array of std::string is reported as uninitialized) 2010-12-17 21:20:04 +01:00
Daniel Marjamäki 696550abd3 Fixed #2299 (false positive: possible nullpointer dereference) 2010-12-17 21:09:12 +01:00
Daniel Marjamäki 845d1491f9 Fixed #2307 (No constructor defined false positive when class is enclosed in namespace) 2010-12-17 20:56:46 +01:00
Daniel Marjamäki e0a0ed6fac removed the NOLONGLONG handling. it seems unlikely it is needed 2010-12-16 21:53:18 +01:00
Daniel Marjamäki 0cebcc8fa9 Fixed #2300 (false positive: possible nullpointer dereference) 2010-12-16 21:41:50 +01:00
Daniel Marjamäki 49ee1533d9 Fixed #2301 (false positive: The given size 3 is mismatching) 2010-12-16 21:27:33 +01:00
Daniel Marjamäki 2d97189486 Fixed #2311 (False positive: Index out of bounds) 2010-12-16 20:16:59 +01:00
Robert Reif f2d69acbfd Symbol database: reuse in CheckOther. Ticket: #2318 2010-12-16 19:04:47 +01:00
Robert Reif bf136f0123 Fixed #2314 (False positive: (style) Template instantiation 'Foo' hides typedef with same name) 2010-12-16 07:48:46 +01:00
Kimmo Varis ac8eb30d68 Fixed #2309 (cppcheck-suppress issue because of path slash/backslash)
Internally we are using forward-slash and only convert to backslash
for Windows output. For suppressing we must use internal
forward-slash format of paths.
2010-12-15 22:39:46 +02:00
vBm 46a11183a5 Fixed some spelling mistakes 2010-12-15 18:45:53 +01:00
Daniel Marjamäki 5ce63a1df0 Fixed #2292 (segmentation fault with cppcheck 1.46 with --errorlist) 2010-12-13 18:17:33 +01:00
Daniel Marjamäki 48241c81f8 dmake: add include path '../externals' to lib.pri in case the pcre.h is placed there. 2010-12-12 17:26:13 +01:00
Daniel Marjamäki 2d3865a671 Add support for user defined rules 2010-12-12 11:56:22 +01:00
Daniel Marjamäki b90e514b32 1.46: updated version information 2010-12-12 08:33:05 +01:00
Daniel Marjamäki 1cfd3309bc XML2: Added severity 'portability' for future use. Ticket: #2106 2010-12-11 21:54:06 +01:00
Daniel Marjamäki 9de016b96d Obsolete functions: added better verbose messages 2010-12-09 19:49:33 +01:00
Daniel Marjamäki 69bacde479 Tokenizer: Cleanup redundant statement '; x = x + 0;'. Ticket: #2283 2010-12-09 19:35:52 +01:00
Daniel Marjamäki ee083cd7a0 Fixed #2284 (False positive: Possible null pointer reference) 2010-12-09 18:17:56 +01:00
Robert Reif 4d2c210f2a Symbol database: use in checkmemoryleaks.cpp. ticket: #2219 2010-12-09 06:15:01 +01:00
Daniel Marjamäki cad9c5f232 Fixed #2285 (False Positive: memory leak) 2010-12-08 21:02:02 +01:00
Robert Reif c6e67d4aad Symbol database: use symbol database in the memory leaks function checking. Ticket: #2219 2010-12-08 07:49:01 +01:00
Robert Reif 980a90071c Fixed #2282 (Improve check: Function can be const) 2010-12-07 19:42:30 +01:00
Robert Reif b6acfa809b Symbol database: creates a single symbol database within Tokenizer on demand and changes all checks to use it 2010-12-07 07:08:49 +01:00
Robert Reif 271d8988aa Symbol database: fixed a TODO test where class variables were qualified with the class name 2010-12-07 07:07:36 +01:00
Robert Reif 6c719c5806 Symbol database: removed unnecessary null pointer checks 2010-12-07 07:07:07 +01:00
Daniel Marjamäki 26864dd011 Memory leaks: Removed the experimental checking using ExecutionPath. 2010-12-06 21:46:18 +01:00
Daniel Marjamäki 0b696b7079 Fixed #2280 (Tokenizer::setVarId : variable id not set for inner iterator) 2010-12-06 17:52:44 +01:00
Robert Reif 626a814241 Symbol database: better handling of inline functions. Ticket: #2219 2010-12-05 20:26:52 +01:00
Daniel Marjamäki b25e6ff24c Fixed #2279 ((style) struct of union member is never used) 2010-12-05 18:33:53 +01:00
Robert Reif c20b8831ee Fixed #2275 (False Positive: Member variable not initialized in the constructor) 2010-12-04 20:24:13 +01:00
Robert Reif 04b811b74f Fixed #2273 (False Positive: Member variable not initialized in the constructor) 2010-12-04 17:47:00 +01:00
Daniel Marjamäki ab336b9088 Tokenizer: Added a few comments 2010-12-04 15:49:25 +01:00
Daniel Marjamäki 11a0ac4e07 xml2: rename '--xmlver' to '--xml-version'. bugfix in settings, change the type of _xml_version from bool to int. 2010-12-04 14:20:51 +01:00
Daniel Marjamäki 1f1df0645b Merge branch 'xml2' of github.com:danmar/cppcheck 2010-12-04 14:06:57 +01:00
Kimmo Varis d14b5039ce Improve 'Use x.empty() instead of x.size() for emptiness' warning.
Improve the performance warning message as discussed at dev-forum:
https://sourceforge.net/apps/phpbb/cppcheck/viewtopic.php?f=3&t=192#p926
2010-12-04 10:15:48 +02:00
Kimmo Varis 8369d0ddd6 Improving 'Wrong assignment of auto variable' error message.
Improving the error message as discussed at dev-forum:
https://sourceforge.net/apps/phpbb/cppcheck/viewtopic.php?f=3&t=192&start=0
2010-12-04 09:55:20 +02:00
Robert Reif 758fc85a12 Memory leaks: Determine that some classes are not auto-deallocated. Reduce false negatives. Ticket: #2219 and #1618 2010-12-04 07:29:12 +01:00
Daniel Marjamäki 93ebdca313 Fixed #2264 (False positive: variable assigned value that is never used) 2010-12-03 18:45:49 +01:00
Robert Reif b29568c81d Fixed #2271 (Tokenizer: simplify Qt signals and slots) 2010-12-03 08:14:09 +01:00
Robert Reif 2cd8bc74cc Symbol database: The symbol database has a bug where it can find an out of line constructor when looking for a destructor. Ticket: #2272 2010-12-03 07:35:06 +01:00
Daniel Marjamäki 8118e4755a Fixed #2263 (False positive: variable assigned value that is never used) 2010-12-02 20:08:05 +01:00
Daniel Marjamäki 66f0948395 Preprocessor: Don't include system headers twice. 2010-12-02 18:07:32 +01:00
Robert Reif eda4bcae29 Fixed #2271 (Tokenizer: simplify Qt signals and slots) 2010-12-02 17:41:49 +01:00
Daniel Marjamäki af80384ae7 xml2: replace --xml2 with --xmlver=2. Ticket: #2106 2010-12-02 17:32:51 +01:00
Robert Reif 1bc8a2b6ba Fixed #2172 (False positive: struct is not initialized in constructor) 2010-12-02 07:35:01 +01:00
Daniel Marjamäki 12c8eeff2c xml2: Added experimental --xml2 result format. Ticket: #2106 2010-12-01 21:24:17 +01:00
Daniel Marjamäki b4be71aa4e checkuninitvar: fixed possible null-pointer dereference. thanks orbitcowboy for spotting it. 2010-12-01 18:05:57 +01:00
Robert Reif f12c0c7ada Tokenizer: add assert(_settings) to Tokenizer to insure the tokenizer always has settings. Ticket: #2219 2010-12-01 18:00:55 +01:00
Kimmo Varis 1a3175741f Fixed #2268 ([GUI] Generic class name is shown for 'Message' while correct one for 'Summary') 2010-12-01 17:55:22 +02:00
Robert Reif 43dcc51752 Fixed #2252 (segmentation fault with enable=all) 2010-11-30 19:52:42 +01:00
Robert Reif f90236a183 Fixed #2252 (segmentation fault with enable=all) 2010-11-30 19:40:32 +01:00
Daniel Marjamäki 0081800a20 Fixed #2261 (False positive: memory leak) 2010-11-30 19:36:04 +01:00
Daniel Marjamäki 6761765a70 Fixed #2262 (False positive: Resource leak: fd) 2010-11-30 19:14:31 +01:00
Daniel Marjamäki 234b1e0098 Fixed #2265 (False positive: Uninitialized variable: path) 2010-11-30 18:40:36 +01:00
Daniel Marjamäki 065af5c444 Fixed #2251 (False positive: Possible null pointer reference) 2010-11-29 20:30:23 +01:00
Daniel Marjamäki cdb685c83c Fixed #2245 (False positive: Possible null pointer dereference) 2010-11-29 20:19:31 +01:00
Daniel Marjamäki 4de64209fb Fixed #2248 (memory leak : pointer inserted in an object) 2010-11-29 19:53:34 +01:00
Kimmo Varis 6bf0e7eb08 Remove extra space char from begin of verbose message. 2010-11-29 20:27:31 +02:00
Kimmo Varis f467e3120e Improve redundant STL container condition -message.
Have separate summary and verbose messages. Se discusion at forum:
https://sourceforge.net/apps/phpbb/cppcheck/viewtopic.php?f=3&t=192
2010-11-29 20:24:08 +02:00
Kimmo Varis 8d8945ac57 Improve "Assert statement 'varname' -message.
Modifying the message so that we have short message and verbose
message. As discussed in dev-forum:
https://sourceforge.net/apps/phpbb/cppcheck/viewtopic.php?f=3&t=192
2010-11-29 20:12:21 +02:00
Daniel Marjamäki add8584612 Fixed #2232 (segmentation fault of cppcheck) 2010-11-29 17:46:10 +01:00
Kimmo Varis 564d896715 Run astyle. 2010-11-28 23:29:06 +02:00
Kimmo Varis 85735e382f Improve the 'suspicious code sizeof sizeof' -message.
As discussed at dev-forum:
https://sourceforge.net/apps/phpbb/cppcheck/viewtopic.php?f=3&t=192
2010-11-28 14:20:46 +02:00
Daniel Marjamäki 3068dbf22e Preprocessor: Temporarily skip 'missing include' warnings for system headers in release mode. When the handling works better these messages should not be skipped. Ticket: #1937 2010-11-28 12:38:06 +01:00
Daniel Marjamäki 00da0adf25 Fixed #2236 (False positive: Assignment to itself) 2010-11-28 11:48:06 +01:00
Daniel Marjamäki ea405d95c6 Fixed #2241 (Segfault checking a file) 2010-11-28 07:35:42 +01:00
Kimmo Varis c9c6de24a6 Remove extra space from error message. 2010-11-27 20:54:02 +02:00
Kimmo Varis 2c3f9a9dce Small fix to error message.
Start with capital letter and no space in beginning.
2010-11-27 20:41:08 +02:00
Daniel Marjamäki 095f725b3c Fixed #2218 (False positive: Data is allocated but not initialized) 2010-11-27 17:34:54 +01:00
Daniel Marjamäki 03a92582ca Fixed #2235 (false Resource leak) 2010-11-27 11:09:42 +01:00
Kimmo Varis 2ed14431fe Ticket #2237 (Too long "short" message about iterator increment)
Improve the message for suspicious iterator increment in loop.
2010-11-27 10:57:26 +02:00
Kimmo Varis 837605b05b Ticket #2239 (Too long "short" message about function parameter passing)
Have a proper short message for the parameter passing warning and
improve the message.
2010-11-27 10:46:34 +02:00
Kimmo Varis 9b4b8b2abe Ticket #2238 (Improve postincrement warning message)
Have a proper short message for post ++/-- operators.
Pre ++/-- operators are usually more efficient for non-primitive types.
2010-11-27 10:30:57 +02:00
Kimmo Varis 87b69a10fa Ticket #2240 (Improve no constructor-message).
Improve the message about missing constructor but having class
attributes. Have proper short and long messages.
2010-11-27 10:17:03 +02:00
Robert Reif 88a1448a07 Symbol database: refactor CheckMemoryLeakInClass::checkPublicFunctions to use the symbol database. Ticket: #2219 2010-11-25 21:04:49 +01:00
Daniel Marjamäki 0a744c0c6e Fixed #2234 (Variable is assigned a value that is never used) 2010-11-25 18:16:11 +01:00
Robert Reif ad91f414db Symbol database: Avoid possible null pointer dereference if _settings is null. Ticket: #2219 2010-11-25 17:55:44 +01:00
Robert Reif 03b12c5494 Fixed #2230 (segmentation fault of cppcheck) 2010-11-25 07:43:39 +01:00
Robert Reif 08b86e0b7e Fixed #2228 (False positive: Claims function can be const when it can not be (shared_ptr)) 2010-11-25 07:15:33 +01:00
Daniel Marjamäki fc57e06cdd Fixed #2226 (segmentation fault of cppcheck) 2010-11-24 18:08:21 +01:00
Daniel Marjamäki 22a4dd2cc3 Fixed #2225 (false positive: variable is assigned a value that is never used '*(stack[0])+=arg') 2010-11-23 20:35:08 +01:00
Robert Reif 1842a122da reuse symbol database in checkmemoryleak.cpp. ticket: #2219 2010-11-23 18:41:07 +01:00
Robert Reif f1eef49fcb Fixed #2221 (segmentation fault of cppcheck) 2010-11-23 07:31:15 +01:00
Daniel Marjamäki bb745da5f9 Tokenizer::simplifyKnownVariables: suppress debug warnings about pointer aliases. Temporary solution that limits the amount of debug warnings somewhat. 2010-11-21 13:50:57 +01:00
Daniel Marjamäki 9d88e17c39 Tokenizer::simplifyKnownVariables: Reduce debug-warnings for conditional increment 2010-11-21 13:40:42 +01:00
Daniel Marjamäki 9d9a5b0623 VS: Fixed compiler warnings. Ticket: #2200 2010-11-21 11:48:27 +01:00
Daniel Marjamäki ee333598fc gcc: fixed compiler warnings 2010-11-21 11:06:28 +01:00
Zachary Blair 215cb5ac8d Fixed #2162 (false positive: Mutual exclusion over ||) 2010-11-21 00:06:43 -08:00
Daniel Marjamäki 0fe4249cfc Fixed #2216 (wrong warning when C++0x keyword delete is used) 2010-11-20 17:20:25 +01:00
Ettl Martin f10e433593 mathlib: toString() parameter changed to const reference 2010-11-20 14:21:18 +01:00
Daniel Marjamäki cda44e0c39 VS: Fixed compiler warnings 2010-11-20 11:48:03 +01:00
Daniel Marjamäki d021cd9074 VS: fixed compiler warning. Ticket: #2200 2010-11-20 11:28:47 +01:00
Daniel Marjamäki e8ca76e02e Fixed #2200 (MathLib: Calculation overflow) 2010-11-20 10:05:33 +01:00
Daniel Marjamäki 9ccc57a455 Fixed #2214 (Improve check: Memory leak not detected when pointer is incremented) 2010-11-20 08:35:23 +01:00
Daniel Marjamäki fd64a7e683 Mutual exclusion: Disable this check until #2162 is fixed. 2010-11-20 07:43:07 +01:00
Robert Reif 27cae2f0d7 Symbol database: add global space and add all global functions and variables to it. Ticket: #2198 2010-11-20 07:26:50 +01:00
Daniel Marjamäki 66c2825b23 Fixed #2210 (False positive: buffer overrun (snprintf, unknown type)) 2010-11-18 19:26:46 +01:00
Daniel Marjamäki aa653fe42b Uninitialized variables: Fixed simple undetected case for '= %var% |' and '| %var% ;' 2010-11-16 20:16:44 +01:00
Daniel Marjamäki eb54be2b2a Uninitialized variables: Cleanup '+=' handling. This is simplified in the Tokenizer now. 2010-11-16 20:09:23 +01:00
Daniel Marjamäki 35c72db251 Uninitialized variables: Fixed simple undetected case for '= %var% -' 2010-11-16 20:07:41 +01:00
Daniel Marjamäki cbdae275ed Uninitialized variables: Fixed false negative. Ticket: #2207 2010-11-16 20:01:57 +01:00
Robert Reif 77a5d4e399 Fixed #2204 (False positive when using const class members) 2010-11-16 07:30:55 +01:00
Daniel Marjamäki 29bb553782 Fixed #2207 (False positive: uninitialized variable (return if uninitialized)) 2010-11-15 20:35:01 +01:00
Daniel Marjamäki d250cb5aa2 Fixed #2206 (False positive: variable is assigned a value that is never used (array initializers)) 2010-11-15 17:53:55 +01:00
Daniel Marjamäki 7b3e7f6467 Fixed #2205 (False positive: variable is assigned a value that is never used (assigning to dereferenced casted pointers)) 2010-11-15 17:30:07 +01:00
Daniel Marjamäki 6d1c0687c9 Fixed #2202 (false postive: Data is allocated but not initialized: rbdc) 2010-11-15 17:11:08 +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 378e83e73d Fixed #2201 (false positive: Uninitialized variable: __v0) 2010-11-14 17:35:22 +01:00
Daniel Marjamäki 71ea6213d0 Fixed #2131 (Preprocessor: incorrect include file loading) 2010-11-14 08:35:32 +01:00
Robert Reif 6a06970e1b CheckClass: Refactoring - organize each check so the check function comes first, any helper functions come second, and the message functions come last. Ticket: #2198 2010-11-14 06:50:33 +01:00
Daniel Marjamäki 71c1ce71ce Tokenizer::simplifyKnownVariables: Simplify known variables for struct members 2010-11-13 18:45:35 +01:00
Daniel Marjamäki 667cc8f6e5 Tokenizer: Skip debug warnings in Tokenizer::simplifyKnownVariables for loop variable 2010-11-13 16:40:04 +01:00
Daniel Marjamäki 3d195f2326 Auto variables: improved the check for 'return retval.c_str()'. Ticket: #2191 2010-11-13 15:38:21 +01:00
Daniel Marjamäki 47d37e7a05 Uninitialized variables: Fixed false negatives when calling unknown function with uninitialized variable by value: 'f(a+1)' 2010-11-13 15:10:17 +01:00
Daniel Marjamäki 6836198a5c system headers: merged the systemheaders branch into master. it works pretty well. Ticket: #1937 2010-11-13 13:06:58 +01:00
Daniel Marjamäki bf15236b9e Fixed #2196 (False positive: Invalid data is allocated but not initialized (initialization in loop)) 2010-11-13 10:33:35 +01:00
Daniel Marjamäki a06a1a6574 Symbol database: Added files 2010-11-13 08:08:45 +01:00
Daniel Marjamäki 3303c40879 uninitialized variables: fixed problem when parsing loop bodies 2010-11-13 08:03:59 +01:00
Robert Reif 894586f4dd Fixed #2198 (SymbolDatabase: separate SymbolDatabase from CheckClass) 2010-11-13 07:31:56 +01:00
Daniel Marjamäki f7ca4f09ef Fixed #2151 (false negative: memory leak when calling subfunction that doesn't deallocate the memory) 2010-11-12 21:09:34 +01:00
Daniel Marjamäki a8d7ac0f0d Fixed #2193 (false negative: nullpointer dereference) 2010-11-12 19:42:02 +01:00
Robert Reif 0fffa1f651 This patch fixes a bug I introduced in the previous patch. It also speeds up nested class parsing by skipping the entire class implementation using { link to jump to } rather than parsing for }. Ticket: #2172 2010-11-12 19:29:20 +01:00
Daniel Marjamäki 9d7a623985 Uninitialized variables: Passing uninitialized array as parameter to function. Ticket: #2188 2010-11-12 17:38:25 +01:00
Daniel Marjamäki e523d5a3a3 Fixed #914 (improve check: usage of uninitialized variable) 2010-11-12 17:14:37 +01:00
Daniel Marjamäki 1204043556 Fixed #2148 (uninitialized variable: false negative, function parameter that is passed by value) 2010-11-12 17:06:14 +01:00
Daniel Marjamäki 6b489230e8 Fixed #2188 (Does not detect initialization) 2010-11-12 16:11:44 +01:00
Daniel Marjamäki a605bdc8a2 Fixed #2195 (unit tests failing) 2010-11-12 15:43:16 +01:00
Daniel Marjamäki ba7a3b376e Fixed #2167 (Drop linefeeds from error messages) 2010-11-11 19:54:43 +01:00
Daniel Marjamäki 0328d26fcb Fixed #2192 (false positive: resource leak) 2010-11-11 17:40:20 +01:00
Robert Reif 07f4067fa8 typedef: better handling of __typeof__ 2010-11-11 17:02:04 +01:00
Robert Reif a09c221014 typedefs: handle __typeof__ 2010-11-11 06:40:49 +01:00
Daniel Marjamäki 624ce205b9 Fixed #2185 (False negative: when constant is undefined a 'dangerous usage of strncpy' is not found) 2010-11-10 20:20:05 +01:00
Daniel Marjamäki 41bbe5d0cf Fixed #2182 (Context sensitive false positive) 2010-11-10 18:24:40 +01:00
Daniel Marjamäki 28c53cabea Fixed #2184 (False Positive: memory leak) 2010-11-10 17:46:40 +01:00
Robert Reif 4ddf6f3b44 Symbol database: code cleanups 2010-11-10 16:52:52 +01:00
Daniel Marjamäki 2102b9598e FileLister: fixed compiler errors in win32. accept all files given by user. 2010-11-09 19:32:11 +01:00
Daniel Marjamäki 14bf9fbbdb Fixed #2181 (How can I select the extension of the files to check?) 2010-11-09 19:20:31 +01:00
Daniel Marjamäki 81cac166d6 FileLister: minor cleanup 2010-11-09 19:11:43 +01:00
Daniel Marjamäki 508c171945 Symbol database: add support for class inline functions with classes 2010-11-09 17:06:07 +01:00
Robert Reif 36b03bdd3e Fixed #2179 (Segmentation fault in assignment operator) 2010-11-09 06:58:19 +01:00
Daniel Marjamäki c2bf3647a4 Fixed #2178 (segmentation fault of cppcheck) 2010-11-08 19:47:19 +01:00
Daniel Marjamäki 6a4f70e496 Fixed #2169 (Inline suppression does not work unless filename is given) 2010-11-08 18:53:48 +01:00
Daniel Marjamäki 21ec772e31 Tokenizer: Only show 'failed to instantiate template' debug messages if the --debug-warnings has been given 2010-11-08 18:01:28 +01:00
Daniel Marjamäki 27b7638901 Visual Studio: Fixed compiler warnings about assignment in condition 2010-11-08 17:29:08 +01:00
Robert Reif 23b50a3d81 Symbol database: delay finding class variables until after all classes have been found. 2010-11-08 17:12:25 +01:00
Daniel Marjamäki 586f4992d8 Tokenizer::simplifyKnownVariables: Fixed TODO test cases in TestBufferOverrun 2010-11-07 17:42:32 +01:00
Daniel Marjamäki 47e9fcb5a8 Revert "Tokenizer: More specific bailout in simplifyKnownVariables for loop variable"
This reverts commit 7e9bb62dff.
2010-11-07 17:40:27 +01:00
Daniel Marjamäki 7e9bb62dff Tokenizer: More specific bailout in simplifyKnownVariables for loop variable 2010-11-07 17:20:03 +01:00
Daniel Marjamäki cd94fa89e0 Tokenizer: More specific bail outs in simplifyKnownVariables 2010-11-07 11:07:56 +01:00
Daniel Marjamäki b881718d9f Tokenizer: better bailout in simplifyKnownVariables when there is loop 2010-11-07 10:42:08 +01:00
Daniel Marjamäki fb068a4e71 Fixed #2170 (false positive: After a strncpy() the buffer should be zero-terminated) 2010-11-07 09:37:45 +01:00
Daniel Marjamäki bd2b1b2914 Tokenizer: better handling of const variables 2010-11-07 08:43:30 +01:00
Daniel Marjamäki 25391cb562 Tokenizer: Bailout simplifyKnownVariables for loop variables 2010-11-07 08:10:09 +01:00
Robert Reif 662cd27f87 Symbol database: fixed problem 2010-11-06 20:27:12 +01:00
Daniel Marjamäki 2833a5ebb5 Tokenizer: Refactoring the simplifyKnownVariable 2010-11-06 20:23:49 +01:00
Daniel Marjamäki 5be12a1d27 Tokenizer: improved simplifyKnownVariables 2010-11-06 19:43:32 +01:00
Daniel Marjamäki 53fc0ca5e6 Tokenizer: Refactoring. Merged two patterns into one pattern. 2010-11-06 15:55:37 +01:00
Daniel Marjamäki afcc28e9ee Tokenizer: Added debug warning that is shown when bailing out in simplifyKnownVariables 2010-11-06 15:42:41 +01:00
Robert Reif 8a379d4826 Fixed #2176 (Tokenizer::simplifyTypedef function pointer bug) 2010-11-06 15:15:50 +01:00
Robert Reif 0205498a12 Symbol database: improved handling of out of line functions returning function pointers 2010-11-06 13:31:56 +01:00
Robert Reif c49a8a99a3 Fixed #2175 (Tokenizer::simplifyTypedef : wrong simplification of 'typedef float vec_t[3];') 2010-11-06 13:28:44 +01:00
Daniel Marjamäki c39fbb86db Tokenizer::simplifyKnownVariables : Fixed TODO test case when simplifying pointer alias in function call 2010-11-06 13:24:33 +01:00
Daniel Marjamäki 13c2a73d3f Tokenizer::simplifyKnownVariables: Fixed TODO test case. 2010-11-06 11:38:58 +01:00
Daniel Marjamäki dd41c74d7f Fixed #2136 (false negative: array bounds) 2010-11-06 09:10:10 +01:00
Daniel Marjamäki 314e5b838b Tokenizer: removed redundant assignments such as 'x+=0;'. Ticket: #2173 2010-11-06 07:23:35 +01:00
Robert Reif 431201dd67 Fixed #2174 (Tokenizer::simplifyFunctionReturn bug) 2010-11-06 06:53:09 +01:00
Daniel Marjamäki 52faadda89 Tokenizer: simplify calculations with zero better 2010-11-05 20:35:31 +01:00
Daniel Marjamäki 4fdb420454 Tokenizer: simplifyknownvariables, improved handling of string constant 2010-11-05 20:05:57 +01:00
Daniel Marjamäki 65c7b6eb8b Uninitialized variables: better handling of for example 'a[1] = 1+a[2];' 2010-11-05 19:24:14 +01:00
Daniel Marjamäki a90a7202cb Uninitialized variables: detect usage of dead pointer: '*p += 10' 2010-11-05 17:04:41 +01:00
Daniel Marjamäki 95bfa50d7e Null pointers: Fixed false negatives in the CheckAndDeRef checking 2010-11-04 21:22:29 +01:00
Daniel Marjamäki f3bf14ba13 Fixed #2171 (false positive: possible nullpointer dereference) 2010-11-04 21:09:32 +01:00
Daniel Marjamäki 06ec4d9a84 GCC: Fixed compiler warnings about sign-conversion 2010-11-04 20:52:20 +01:00
Daniel Marjamäki d21974777c Fixed #2161 (false positive: assigned a value that is never used) 2010-11-04 20:16:17 +01:00
Daniel Marjamäki 0984a0be47 Tokenizer: Fixed 'a[b-1]+=1' 2010-11-04 19:38:19 +01:00
Daniel Marjamäki fce6f11ed8 Tokenizer: simplify 'a[b-1]+=1' better 2010-11-04 19:02:54 +01:00
Daniel Marjamäki c29940b114 Fixed #2166 (false positive: possible null pointer dereference) 2010-11-04 18:18:19 +01:00
Robert Reif bc8ecf2aa7 Fixed #2168 (Segmentation fault of cppcheck) 2010-11-04 17:54:04 +01:00
Zachary Blair 10a4dde105 Fixed #2137 (Invalid mutual exclusion report) 2010-11-04 00:10:25 -07:00
Robert Reif 003f99da82 Symbol database: Fixed bug. Ticket: #2149 2010-11-04 06:58:37 +01:00
Robert Reif cf0403434d Symbol database: Bug fix 2010-11-03 20:33:07 +01:00
Daniel Marjamäki 1323cbdb6d Fixed #2160 (#2160 (Invalid unused variable report (style))) 2010-11-03 19:30:00 +01:00
Daniel Marjamäki 14803643ca empty string test: Removed this check 2010-11-03 17:56:14 +01:00
Daniel Marjamäki 19f809c9b4 Unused variables: better handling of '= %var% ++'. Ticket: #2160 2010-11-02 20:01:12 +01:00
Daniel Marjamäki dd4b2b8b46 Tokenizer: simplify 'x[0] += 1;' 2010-11-02 19:22:48 +01:00
Robert Reif 0fe72839d8 Symbol Database: Better handling of namespaces. Ticket: #2149 2010-11-02 18:30:57 +01:00
Daniel Marjamäki c4452effa3 Tokenizer: simplify 'x.y += 1;' 2010-11-01 20:33:55 +01:00
Daniel Marjamäki 1b9de20f9b Tokenizer: simplify 'case 0: x += y;' 2010-11-01 19:31:30 +01:00
Daniel Marjamäki 94fc13f0c4 Fixed #2159 (False positive: Null pointer dereference 'if (!x) return *y;') 2010-11-01 19:21:08 +01:00
Daniel Marjamäki 3fb17baa12 Fixed #2158 (False positive: value is not unused when using +=) 2010-11-01 17:36:54 +01:00
Daniel Marjamäki 285d76a413 Null pointers: Fixed false positive for 'x && x->y' 2010-10-31 19:48:58 +01:00
Daniel Marjamäki 69c6358198 CheckNullPointer: Reuse CheckNullPointer::isPointerDeRef in CheckNullPointer::nullPointerByDeRefAndChec 2010-10-31 16:07:50 +01:00
Daniel Marjamäki 32def3a3f0 CheckNullPointer: Reuse the CheckNullPointer::isPointerDeRef function 2010-10-31 15:46:08 +01:00
Daniel Marjamäki 33d3fd4716 CheckNullPointer: Reduced false negatives by making pattern more generic 2010-10-31 15:40:34 +01:00
Daniel Marjamäki 6faa4b79d3 CheckNullPointer: Refactoring. Created the function CheckNullPointer::isPointerDeRef that can be used to detect if a pointer is dereferenced 2010-10-31 15:32:19 +01:00
Daniel Marjamäki 1e866c3235 Visual Studio: Fixed compiler error 2010-10-31 11:42:45 +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 6c19ea7b53 Tokenizer: Added a few comments 2010-10-31 09:58:44 +01:00
Daniel Marjamäki 558899dc74 Variable usage: Fixed false negative that I introduced when simplifying compound assignments 2010-10-31 09:34:25 +01:00
Daniel Marjamäki 23d3fd3a5a Fixed #2147 (uninitialized variable: false negative for 'x += y;') 2010-10-31 08:47:13 +01:00
Daniel Marjamäki 8d96697623 GCC: Fixed compiler warnings 2010-10-30 14:53:25 +02:00
Daniel Marjamäki b55f6458a2 Fixed #2120 (False positive: array index out of bounds (unknown type in struct, sub function)) 2010-10-30 12:32:43 +02:00
Daniel Marjamäki 7b630cc581 Fixed #2154 (false positive: The loop might unintentionally skip an element in the container) 2010-10-30 11:22:30 +02:00
Kimmo Varis 9627b667a1 Move simplifyPath method from FileLister to Path class.
simplifyPath() "fits" better to Path class conceptually. It handles
paths, not lists them. Also this way we get rid of few unneeded
dependencies to FileLister class.
2010-10-29 22:21:27 +03:00
Daniel Marjamäki 9435fde551 Tokenizer: Added function for checking if code is Java/C# 2010-10-28 18:51:55 +02:00
Daniel Marjamäki fee20bafa0 Java: Removed bailout added in 120073f000 2010-10-28 18:01:51 +02:00
Daniel Marjamäki 995e39200b Fixed #2130 (Invalid possible NULL pointer dereference, etc.) 2010-10-27 20:20:10 +02:00
Daniel Marjamäki fc98bcdcb2 Fixed #2141 (false positive: possible null pointer dereference) 2010-10-27 19:42:47 +02:00
Daniel Marjamäki fd153eac02 Fixed #2142 (false positive: null pointer dereference (throw)) 2010-10-27 19:38:42 +02:00
Robert Reif b6aca47e11 Fixed #1195 (Uninitialized member variable not detected 'std::vector<int> *ints;') 2010-10-27 19:28:15 +02:00
Robert Reif 5a8f490f07 Fixed #2135 (False positive 'Can be const') 2010-10-27 19:25:34 +02:00
Pete Johns 8022baec2a Removed unnecessary code duplication. 2010-10-27 19:34:06 +11:00
Cary R 59139b17cb Fixed #2138 (Add support for comments in suppression file) 2010-10-26 21:22:11 +02:00
Daniel Marjamäki a38b14d582 Tokenizer: Remove redundant semi colons 2010-10-26 21:05:20 +02:00
Daniel Marjamäki 79583ee45d #2133 (cppcheck: floating point exception) 2010-10-26 20:05:34 +02:00
Daniel Marjamäki 6200d4505a Fixed #2118 (Invalid syntax error report.) 2010-10-26 19:39:48 +02:00
Daniel Marjamäki 9370f552ac Fixed #2134 (sizeof(*list) complains of null pointer dereference) 2010-10-26 18:26:02 +02:00
Daniel Marjamäki b6106ddf72 Fixed #2132 (Internal error. Token::Match called with varid 0.) 2010-10-26 18:10:03 +02:00
Daniel Marjamäki 27235f27ae Fixed #2129 (Invalid dereference after release report) 2010-10-26 17:49:48 +02:00
Daniel Marjamäki 893f7fa347 Fixed #2130 (Invalid possible NULL pointer dereference, etc.) 2010-10-26 17:40:30 +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 132aa8d0c4 uninitialized variables: fixed fp when analysing loops 2010-10-25 20:56:15 +02:00
Daniel Marjamäki 026514db1a Fixed #2127 (null pointer dereference after condition (SRD nr 522)) 2010-10-25 19:43:54 +02:00
Daniel Marjamäki 41a06a21d9 using deallocated pointer: detect first problem reported in ticket #2090 2010-10-25 17:36:46 +02:00
Zachary Blair 26afb04dc5 Fixed #2105 (Incorrect operator: mutual exclusion over ||) 2010-10-24 18:14:21 -07:00
Daniel Marjamäki 24a2def3ad Execution Path: Fixed FP in improved handling of loop bodies 2010-10-24 19:14:40 +02:00
Daniel Marjamäki 8f707e5e46 Null pointers: Better handling of loops 2010-10-24 18:51:14 +02:00
Daniel Marjamäki 40aeb17738 uninitialized variables: handling loop bodies. end upon '}' 2010-10-24 18:28:25 +02:00
Daniel Marjamäki 6601de7681 uninitialized variables: refactoring handling of loop bodies 2010-10-24 18:26:59 +02:00
Daniel Marjamäki b66d3c8858 Fixed #2125 (uninitialized variable: better handling of for loops) 2010-10-24 18:12:48 +02:00
Daniel Marjamäki cf86e11d05 Fixed #2111 (Class methods writing to a union are detected as 'can be const') 2010-10-24 16:43:10 +02:00
Daniel Marjamäki 13b8544436 Visual Studio: Fixed compiler warning. Ticket: #2123 2010-10-24 11:52:28 +02:00
Daniel Marjamäki 306587b1d0 Buffer overruns: Fixed TODO test case 2010-10-24 11:32:27 +02:00
Daniel Marjamäki f3c6c64e9a Fixed #2121 (False positive: Buffer access out-of-bounds when using uint32_t) 2010-10-23 13:12:17 +02:00
Daniel Marjamäki 120073f000 Java: fixed false positives about uninitialized variable 2010-10-23 10:56:30 +02:00
Daniel Marjamäki 5deb046ac5 Fixed #2120 (False positive: array index out of bounds (unknown type in struct, sub function)) 2010-10-23 08:49:03 +02:00
Daniel Marjamäki c907acf767 Fixed #1819 (False positive: auto variable assignment (unseen typedef)) 2010-10-22 21:12:56 +02:00
Daniel Marjamäki 9fdc03fc1d Fixed #2117 (false positive: buffer access out of bounds) 2010-10-22 20:15:51 +02:00
Daniel Marjamäki 9ae4a758b8 Fixed #2116 (Internal error. Token::Match called with varid 0) 2010-10-21 21:28:32 +02:00
Daniel Marjamäki eba827bc4b Fixed #2112 (Crash scanning qtcreator sources) 2010-10-21 19:42:09 +02:00
Daniel Marjamäki 6a66d32871 JAVA: better handling of java code 2010-10-20 22:15:35 +02:00
Daniel Marjamäki 4ff52b5883 Objective C: activate checking of .m and .mm files. The normal checking is used. 2010-10-20 21:09:07 +02:00
Daniel Marjamäki 8b866178ff Fixed #2103 (false positive when variable is checked to NULL and not freed) 2010-10-20 20:38:37 +02:00
Daniel Marjamäki 68dd2f8378 Fixed #2113 (False positive: Memory leak where a pointer is passed in a struct to another function to be freed) 2010-10-20 18:39:40 +02:00
Daniel Marjamäki 02ba2b202e Fixed #2110 (Tokenizer::simplifyTypedef: regression - wrong simplification of 'typedef char TString[256];') 2010-10-20 06:09:29 +02:00
Daniel Marjamäki f8c02718a5 Activated checking of .java and .cs files 2010-10-19 21:54:15 +02:00
Daniel Marjamäki 20674e08d0 Stl: improved check for dangerous usage of c_str 2010-10-19 20:21:58 +02:00
Daniel Marjamäki 2ca7dbc004 Fixed #2109 (false positive: buffer overrun) 2010-10-19 18:23:44 +02:00
Daniel Marjamäki 0864a0700a Fixed #2108 (False positive: the loop might unintentionally skip an element in the container.) 2010-10-18 20:05:54 +02:00
Daniel Marjamäki e54129fa8d STL: check for dangerous usage of string::c_str(). Ticket: #1116 2010-10-17 19:18:46 +02:00
Ettl Martin 7d1995dfaa Merge branch 'master' of github.com:danmar/cppcheck 2010-10-17 21:56:05 +08:00
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
Ettl Martin f25f3c64b4 fixed style waring (You should use ++ and -- as prefix whenever possible as these are more efficient than postfix operators) in lib/checkclass.cpp 2010-10-17 20:15:29 +08:00
Kimmo Varis ddfc7b2d5a Run dmake to update Makefile and lib/lib.pri. 2010-10-17 00:57:25 +03:00
Kimmo Varis 7a84e7dcca Add comment that qmake doesn't add _UNICODE define for project files. 2010-10-17 00:32:31 +03:00
Daniel Marjamäki 28e40cb9b0 unicode: updates to the handling of unicode filenames. Ticket: #2100 2010-10-16 21:39:58 +02:00
Daniel Marjamäki 88a98a2ef0 unicode: use short filenames when long filename doesn't work. Temporary solution for #2100 2010-10-16 12:40:21 +02:00
Daniel Marjamäki 4e121c94ab some more comments 2010-10-15 18:37:48 +02:00
Daniel Marjamäki d182079c5e added comments in CheckStl 2010-10-15 18:21:53 +02:00
Daniel Marjamäki 0b6948a805 Fixed #2101 (list in vector iterator usage) 2010-10-15 18:11:41 +02:00
Daniel Marjamäki ba2b986ece Fixed #2097 (false positive: buffer access out of bounds) 2010-10-14 20:00:32 +02:00
Daniel Marjamäki e11d9f1628 astyle formatting 2010-10-14 19:59:10 +02:00
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 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
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
Robert Reif 2fc2859b68 Fixed #2035 (Enum 'qboolean' hides typedef with same name) 2010-09-08 06:45:57 +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 d0423ff8ac Set encoding to UTF-8 for some files. 2010-09-06 22:39:02 +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 e800490b50 Add back <stdexcept> as GCC requires it.
I removed <stdexcept> after checking it builds with VS 2008. But Dan
pointed out GCC needs that header.
2010-09-06 22:00:56 +03:00
Kimmo Varis 3551ce8b58 Remove unneeded includes. 2010-09-06 21:08:50 +03:00
Robert Reif 28c5893ee0 const functions: fixed false negatives for the type P. ticket: #1884 2010-09-06 19:04:14 +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
Kimmo Varis 120b6b9133 Remove unused function.
I forgot to remove the function that was used in command line
parsing code.
2010-09-05 11:24:01 +03:00
Kimmo Varis 45eaebe423 Move CLI command line parsing to own class. 2010-09-05 11:17:31 +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 beb4dddb2e Refactoring CheckMemoryLeaks 2010-09-04 10:06: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
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
Sbastien Debrard 2049f70754 Fixed #1972 (file extensions) 2010-09-02 19:17:47 +02:00
Robert Reif fbffaade2e Fixed #2011 (Parser error in template function) 2010-09-02 19:09:06 +02:00
Robert Reif cb318c21e3 Symbol database: adds support for inline functions returning function pointers and starts to convert privateFunctions over to the symbol database. Ticket: #1895 2010-09-02 07:40:20 +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
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 42dfd255e3 Fix Linux makefile after moving timer code to own files. 2010-08-31 23:22:48 +03: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
Daniel Marjamäki 688b2aefe9 Tokenizer: Fixed warnings about unsigned / signed conversion 2010-08-31 21:04:17 +02: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 4463f650d0 Fixed #2003 (false positive in set functions) 2010-08-31 17:59:17 +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
Robert Reif 16efc9be26 Fixed #1887 (internal error in GLee) 2010-08-31 17:48:19 +02:00
Daniel Marjamäki dcc02166c6 Fixed #1998 (VS compiler warning with current HEAD) 2010-08-30 21:45:26 +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
Daniel Marjamäki 527354b4be Fixed #1886 (Associate header file with code file including it) 2010-08-30 17:44:46 +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 edec43c913 mention the manual in the --help output 2010-08-29 13:21:35 +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
Robert Reif b1bf201a8a Symbol database: Refactorings. Ticket: #1895 2010-08-28 11:23:23 +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 02088443f9 quick fix for #1969 (False positive: Uninitialized variable when exit() is called before variable is used.) 2010-08-26 23:11:04 +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
Robert Reif 5c3ecc31da Code cleanup 2010-08-26 07:32:48 +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
Robert Reif ff4ebbede3 Fixed gcc compiler warning about uninitialized variable tok1. Ticket: #1965 2010-08-25 07:38:53 +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
Daniel Marjamäki 225114df1c Fixed #1960 (cppcheck hangs with 100% cpu load) 2010-08-24 20:50:04 +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 807269b5e9 Refactoring handling of microsoft types. Ticket: #1956 2010-08-22 21:53:45 +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
Robert Reif 86f1718b1c Symbol database: Fixed the error reporting so errors are shown in the gui. Ticket: #1895 2010-08-17 17:20:54 +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
Sbastien Debrard 296289d190 Refactoring of obsolete functions checks. Ticket: #1940 2010-08-15 21:26:13 +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 4949869f5f removed unused variable 'dot' 2010-08-15 09:03:16 +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
Robert Reif 556ef9afcf Symbol database: report error when it is detected that a variable id is missing. Ticket: #1928 2010-08-15 08:03:27 +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 00dc3adc18 ErrorLogger: Added better \n handling to the XML output 2010-08-14 18:36:36 +02:00
Daniel Marjamäki 2e249670b3 dangerous scanf usage: Added verbose information 2010-08-14 18:35:48 +02:00
Daniel Marjamäki 5846630fa9 Added scanf check. Modified patch submitted by Eric Sesterhenn 2010-08-14 15:15:12 +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
Daniel Marjamäki 6efad92647 dangerous functions: removed 'scanf' because it can be used in a safe way 2010-08-14 07:50:35 +02:00
Robert Reif db78c3acdf Symbol database: fixed linenr problem in virtual destructors check 2010-08-13 23:57:53 +02:00
Daniel Marjamäki e9a3d03372 Dangerous functions: Improved error messages 2010-08-13 22:27:45 +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 a994f235c5 Symbol database: move finding base classes until after all classes are found because of template instantiation. Ticket: #1895 2010-08-13 07:35:30 +02:00
Robert Reif b92644a30c Symbol database: refactoring variable handling. Ticket: #1895 2010-08-13 07:34:34 +02:00
Daniel Marjamäki 6cb7fefdbf Added command line option --report-progress. ticket: #1926 2010-08-12 21:03:33 +02:00
Ettl Martin a6be941006 actived Wconversion flag in Makefile and fixed almost all Warnings from gcc-4.4 2010-08-12 19:39:19 +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
Robert Reif c88aa242e8 Symbol database: better handling of 'friend'. ticket: #1895 2010-08-11 22:36:04 +02:00
Daniel Marjamäki cb72f21994 Optimisation in Tokenizer::tokenize 2010-08-11 17:29:33 +02:00
Daniel Marjamäki 0ea9e98680 Optimisation: Made inner loop in Tokenizer::setVarId faster 2010-08-10 19:06:45 +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 03c436a735 Symbol database: Refactoring 2010-08-10 18:01:33 +02:00
Robert Reif 483a3ddfe1 Fixed #1925 (fix some cppcheck warnings in cppcheck) 2010-08-10 07:26:59 +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 6a3befa720 Optimising: Tokenizer::setVarId when setting variable ids for struct/class members 2010-08-08 19:14:23 +02:00
Daniel Marjamäki 195b48e81f astyle formatting 2010-08-08 18:55:15 +02:00
Daniel Marjamäki 1d79c164c4 Optimisation: Optimised firstWordEquals 2010-08-08 18:54:49 +02:00
Daniel Marjamäki 5a8181d425 Tokenizer: 'simplifyCalculations();' should have the same results as 'while (simplifyCalculations());' 2010-08-08 09:25:09 +02:00
Daniel Marjamäki 11ef2c0a06 Refactoring: Cppcheck::reportProgress needs to call _errorLogger::reportProgress. Ticket: #1625 2010-08-08 08:46:47 +02:00
Daniel Marjamäki 1555901077 Refactoring: Made Tokenizer::simplifyCalculations a little faster 2010-08-08 08:28:28 +02:00
Daniel Marjamäki 764ce99c6f Performance: Refactoring CheckOther::nullPointerStructByDeRefAndChec to make it faster 2010-08-07 21:00:17 +02:00
Daniel Marjamäki dcf54621d4 visual studio: fixed a few compiler warnings (when saving istream::get result in a char) 2010-08-07 20:33:24 +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 54121a74ff Symbol Database: Don't use it when it is not needed 2010-08-07 12:41:11 +02:00
Daniel Marjamäki 9e7b087832 Refactoring: Made CheckClass members private 2010-08-07 12:26:42 +02:00
Daniel Marjamäki c395e51389 New check: look for calculation inside sizeof 2010-08-06 22:57:10 +02:00
Daniel Marjamäki 7911626aed gcc: fixed some more -Wsign-conversion warnings 2010-08-06 22:43:06 +02:00
Daniel Marjamäki 12217461a2 gcc: fixed some more -Wsign-conversion warnings 2010-08-06 22:37:48 +02:00
Daniel Marjamäki adc47f1820 Fixed #1487 (fix gcc compiler warnings) 2010-08-06 21:02:43 +02:00
Daniel Marjamäki 271a74a16c gcc: Fixed some compiler warnings when using -Wsign-conversion. Ticket: #1487 2010-08-06 19:42:31 +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
Daniel Marjamäki 290d02780f gcc: Fixed some compiler warnings when using -Wsign-conversion. Ticket: #1487 2010-08-06 19:38:21 +02:00
Daniel Marjamäki 3adfc61eca gcc: Fixed some compiler warnings when using -Wsign-conversion. Ticket: #1487 2010-08-06 19:15:44 +02:00
Daniel Marjamäki 146465a6ad gcc: Fixed some compiler warnings when using -Wsign-conversion. Ticket: #1487 2010-08-06 18:42:55 +02:00
Daniel Marjamäki 7fb44d1995 gcc: fixed some compiler warnings when using -Wsign-conversion 2010-08-06 18:32:31 +02:00
Daniel Marjamäki 6346e1aa90 Borland C++: Fixed compiler errors 2010-08-06 17:44:26 +02:00
Daniel Marjamäki f5823f7747 Visual Studio: Fixed warnings 2010-08-06 17:32:16 +02:00
Daniel Marjamäki 567f1da4b4 Preprocessor: Compiler dependent parsing of '<backspace><space><newline>'. Maybe it should be possible to control it from the commandline instead. Ticket: #640 2010-08-06 08:50:31 +02:00
Daniel Marjamäki 32d98969fb suppress visual studio warnings about loosing data when calculating Token::progressValue 2010-08-05 21:40:04 +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 81c058f2be Merge branch 'master' of github.com:danmar/cppcheck 2010-08-05 19:02:21 +02:00
Daniel Marjamäki 2450a80556 Visual Studio: Added /MP switch 2010-08-05 19:02:05 +02:00
Ettl Martin d16944398a fixed compiler Warning in lib/checkbufferoverrun about comparison of signed and unsigned variable 2010-08-05 18:58:58 +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 c9b1804954 astyle formatting 2010-08-04 20:28:41 +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 9edecd4a3f Added ErrorLogger::reportProgress and removed ErrorLogger::ReportProgress. This will make it easier for GUI and other clients to display progress information. 2010-08-03 16:36:21 +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 a274cb1015 cleanup headers 2010-07-31 08:52:28 +02: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
Ettl Martin 9fa6b20b9d checkheaders: removed redundant include (token.h) from errorlogger.cpp 2010-07-27 21:40:38 +02:00
Daniel Marjamäki 81d7a37b68 Fixed #1864 (Relative Path of #include-File doesn't work) 2010-07-27 18:07:30 +02:00
Daniel Marjamäki 2fd2ab1712 Fixed a vs compiler warning. Ticket: #1901 2010-07-27 17:48:22 +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
Daniel Marjamäki 94acebc3d0 Cleanup redundant include 2010-07-27 09:32:20 +02: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 17395b310d Remove unneeded path separator conversion. 2010-07-26 22:49:47 +03:00
Kimmo Varis 2f8d43984f Fix path separators for couple of messages. 2010-07-26 22:43:49 +03:00
Kimmo Varis 7b8cb17a44 Windows: convert to internal separators when finding files. 2010-07-26 22:16:19 +03: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 bb7484945a Fixed #1887 (internal error in GLee) 2010-07-25 18:20:30 +02:00
Daniel Marjamäki e358af9018 Refactoring: Report progress when checking takes a long time. Ticket: #1868 2010-07-25 18:19:37 +02:00
Daniel Marjamäki 786ca037ec Refactoring: changed 'bool varid=0' to 'bool varid=false' 2010-07-25 18:17:44 +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 19e26c3b80 CheckBufferOverrun: report progress. Ticket: #1868 2010-07-24 20:54:42 +02:00
Daniel Marjamäki b8146271a2 Report progress when checking a file takes a long time. Ticket: #1868 2010-07-24 18:58:52 +02:00
Daniel Marjamäki 05c4138b2f Refactoring: Removed unused variable _xmllist 2010-07-24 18:57:38 +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 dfbdd8f9c4 Refactoring Token::Match: Report errors through ErrorLogger. Ticket: #1839 2010-07-24 10:51:17 +02:00
Daniel Marjamäki 9b49202da8 Refactoring Tokenizer::syntaxError 2010-07-24 10:39:01 +02:00
Daniel Marjamäki dd07d82c34 Refactoring MathLib: Report errors through the tokenizer. Ticket: #1839 2010-07-24 10:25:03 +02:00
Daniel Marjamäki 84e576de04 Refactoring: use MathLib add/sub instead of calculate 2010-07-24 10:13:45 +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 5c771adece Refactoring: Use Check::reportError instead of writing to std::cout. Ticket: #1839 2010-07-23 22:53:29 +02:00
Daniel Marjamäki 8a0d989190 Refactoring: Don't throw exceptions in the tokenizer upon errors. Ticket: #1866 2010-07-23 14:02:29 +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 37c959023a Refactoring: The Settings::addEnabled will return error message instead of throwing it. Ticket: #1866 2010-07-23 13:29:16 +02:00
Daniel Marjamäki 1b7796791b Variable scope: Improved verbose information (see also 7ef0296) 2010-07-23 12:29:21 +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 b4d55d8e65 Fix path separators for missing include files-message. 2010-07-21 17:00:12 +03:00
Kimmo Varis 9b0851ed25 Fixed #1892 (Verbosity setting set to false and not set back to original value)
Verbosity was set to false to temporarily reduce printing messages.
But it was not set back to its original value so rest of the
messages that should have been printed for verbose setting
enabled were not printed.
2010-07-21 16:26:59 +03: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
Kimmo Varis c25930581c Formatting and improving comments. 2010-07-19 20:06:42 +03: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
Kimmo Varis 342632a618 Remove './' from begin of paths when printing progress. 2010-07-19 15:05:44 +03:00
Kimmo Varis dc77bc69a0 Move path simplifying code to Path class. 2010-07-19 14:27:05 +03: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
Kimmo Varis 0485976c54 Use std::replace() to replace chars in paths. 2010-07-19 13:02:04 +03:00
Daniel Marjamäki 7ef0296f97 --verbose: added more information for the variableScope error message. 2010-07-19 11:30:01 +02:00
Kimmo Varis c8d866b906 Merge remote branch 'remotes/kimmo/master' 2010-07-19 11:10:04 +03:00
Kimmo Varis 9f78177914 Remove unused methods from ErrorLogger. 2010-07-19 11:04:30 +03:00
Daniel Marjamäki bbf2c6c6e6 Fixed #1880 (false positive: Uninitialized array (initialized in subfunction)) 2010-07-19 10:03:54 +02:00
Kimmo Varis 95fa267c0e Remove misleading comment. 2010-07-19 10:54:53 +03: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 7842658cb4 Refactoring CheckClass::initializeVarList. Ticket #1811 2010-07-18 20:58:16 +02:00
Daniel Marjamäki e7690836fd fixed the mistake I made when applying patch 2010-07-18 20:56:19 +02:00
Robert Reif 689de10abf uninitialized class members: better handling of nested classes 2010-07-18 20:43:51 +02:00
Kimmo Varis b384aabc52 Fixed #1371 (#include "foo\file.h" -> #include "foo/file.h" should be handled automatically on linux)
Linux can't open file paths with / separator. So we'll need to fix
such include file paths (in source files) first.
2010-07-18 20:02:18 +03: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 020a8a965c use cppcheckError to report Tokenizer/Preprocessor error instead of std::cerr 2010-07-18 12:57:29 +02:00
Daniel Marjamäki a4b887f21a Fixed #1843 (Tokenizer::createTokens() calls std::exit(0)) 2010-07-18 12:44:55 +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
Kimmo Varis 006c9f17d4 GUI: Avoid unnecessary path separator conversion. 2010-07-18 11:20:10 +03: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
Kimmo Varis 3c12d23fd9 Add Path class for path handling routines.
In this initial commit the Path class contains two methods for
converting path separators. I want to move cppcheck path handling
to direction that we internally have paths with / separator. And
convert from/to native separators when needed.
2010-07-17 17:38:36 +03:00
Robert Reif 9c4bbd4c65 Fixed #1730 (False negative in 'variable not initialized in ctor') 2010-07-17 12:26:05 +02:00
Robert Reif ad9d1375aa Fixed #1875 (CheckClass::getVarList: simplify function use) 2010-07-17 12:25:14 +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
Kimmo Varis 6362e50e73 Fix comment. 2010-07-16 22:47:46 +03:00
Kimmo Varis 3fa4e8a1d5 Remove unused ErrorLogger::_writemsg() methods. 2010-07-16 21:40:02 +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 ad0394939a Refactor ErrorMessage constructor to take Severity::SeverityType.
This removes lots of unneeded casting as everybody now uses the
Severity::SeverityType.
2010-07-14 23:11:32 +03:00
Kimmo Varis d811970531 Merge remote branch 'remotes/kimmo/severity-refactor' 2010-07-14 22:29:02 +03:00
Kimmo Varis ba5017cf05 Add debug-severity to Severity::SeverityType. 2010-07-14 21:12:54 +03:00
Kimmo Varis f54f28530b Make Severity::none to match and output empty string. 2010-07-14 21:12:54 +03:00
Kimmo Varis 5f8af2e1e8 Refactor ErrorMessage's severity to Severity::SeverityType. 2010-07-14 21:12:39 +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
Kimmo Varis 05adb285c5 Rename Severity::stringify() to Severity::toString(). 2010-07-14 17:40:18 +03:00
Kimmo Varis 3716b3f9d8 Rename Severity::e to Severity::SeverityType. 2010-07-14 17:30:03 +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 233432a888 gcc: fixed compiler warning (suggest parantheses) 2010-07-14 09:46:08 +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
Kimmo Varis c9215e9e44 Change the "information" error to "debug" error.
There was one debugging error sent with "information" severity. That
confused the GUI that didn't know such severity. Change the severity
to "debug" so the meaning of the error is more clear.
2010-07-12 00:56:52 +03:00
Daniel Marjamäki 94a8eba989 1.44: updated version information 2010-07-10 11:29:07 +02:00
Daniel Marjamäki 4b0e3edfa4 Unit Testing: Test that suppressions work 2010-07-09 13:27:15 +02:00
Daniel Marjamäki abbd557761 Fixed #1836 (--suppresions file.txt fails due to wrong line edings) 2010-07-09 12:42:08 +02:00
Daniel Marjamäki 2531bb73d7 Fixed #1834 (False positive: invalid iterator when erase() is used in if-else) 2010-07-09 10:50:24 +02:00
Daniel Marjamäki a60047227d Settings: added '#include <cctype>' 2010-07-09 10:18:35 +02:00
Daniel Marjamäki c34c3ee742 Unused functions: Refactoring 2010-07-08 13:01:53 +02:00
Daniel Marjamäki 1876cd482b Suppressions: Validate given id 2010-07-08 12:06:27 +02:00
Daniel Marjamäki 11a72461f3 Fixed #1835 (false positive: uninitialized variable when using ?) 2010-07-08 11:16:49 +02:00
Robert Reif 566b4b4beb Variable usage: fixed false positive reported in #1729 2010-07-08 08:42:34 +02:00
Robert Reif 2d6dfa57e1 Variable usage: Better aliasing support (Ticket #1729) 2010-07-08 08:00:50 +02:00
Daniel Marjamäki 49626e427e Realloc: changed the error message. I think it's better to mention realloc in the message. 2010-07-07 20:28:15 +02:00
Daniel Marjamäki a1793edabe Fixed #1825 (*log(0) error) 2010-07-07 09:03:40 +02:00
Daniel Marjamäki 4ebf4caf66 Variable usage: only warn about variables that have variable id > 0 2010-07-07 08:50:34 +02:00
Daniel Marjamäki 2bb07a55bd Fixed #1803 (False positive: unused variable: this) 2010-07-07 08:39:18 +02:00
Daniel Marjamäki a107cd1b59 Fixed #1729 (False positive: variable is assigned a value that is never used (pointer aliasing)) 2010-07-07 08:26:24 +02:00
Robert Reif b0f1d5669b Fixed #1829 (### Internal error in Cppcheck. Please report it.) 2010-07-07 07:40:11 +02:00
Daniel Marjamäki dc2a0a6468 Fixed #1789 (false positive: memory leak (reallocation in subfunction through parameter)) 2010-07-06 21:36:50 +02:00
Daniel Marjamäki 1b20f8d27d Fixed #1824 (false positive: unitialised variable) 2010-07-06 13:18:28 +02:00
Robert Reif 1799e4a575 Fixed #1827 (### Internal error in Cppcheck. Please report it.) 2010-07-06 08:26:30 +02:00
Robert Reif c949a29d1e Fixed #1821 (simplifyTypedef: better typedef support) 2010-07-05 23:03:54 +02:00
Daniel Marjamäki 18a75edd20 Fixed #1823 (tokenize && wrong) 2010-07-05 22:41:02 +02:00
Daniel Marjamäki b02fc037ed Buffer Overrun: Fixed false positive when variable is reassigned in called function 2010-07-05 22:19:27 +02:00
Daniel Marjamäki ae3557fa92 Fixed #1820 (False positive: memory leak (auto deallocated class)) 2010-07-05 14:01:25 +02:00
Daniel Marjamäki b173d5f117 Fixed #1817 (False positive: Resource leak (casting)) 2010-07-05 13:16:33 +02:00
Daniel Marjamäki c811acaa50 Fixed #1818 (False positive: Dangerous usage of strncpy (copying a constant string)) 2010-07-05 12:45:39 +02:00
Robert Reif 28c265b20c Fixed #1821 (simplifyTypedef: better typedef support) 2010-07-02 15:22:29 +02:00
Daniel Marjamäki 3205775eb9 Fixed #1790 (mismatching allocation/deallocation false positive) 2010-06-30 09:21:15 +02:00
Zachary Blair 5ea28ccbba Fixed #157 (Forgetting to put a break in a switch statement) 2010-06-30 00:10:30 -07:00
Daniel Marjamäki c6888845a0 Fixed #1815 (False positive: uninitialized variable when using ? operator) 2010-06-30 08:28:34 +02:00
Robert Reif b33fb48618 Fixed #1816 (Tokenizer: remove restrict keyword) 2010-06-30 08:10:39 +02:00
Daniel Marjamäki 76133e0234 Class checking: Fixed FP for static arrays (not initialized in constructor) 2010-06-29 12:51:18 +02:00
Robert Reif 4668359b51 Fixed #1808 (false positive: uninitialized variable with multiple assignment) 2010-06-29 08:38:24 +02:00
Daniel Marjamäki 46e2f1e64b --author=Robert Reif <reif@earthlink.net>
Fixed #1814 (false positive: Variable hides typedef with same name)
2010-06-28 15:33:27 +02:00
Daniel Marjamäki f82895c1f2 Fixed #1809 (false positive: uninitialized variable with nested if) 2010-06-26 17:15:44 +02:00
Robert Reif 539804369a Fixed #1811 (false positive: Uninitialized variable) 2010-06-26 07:50:53 +02:00
Daniel Marjamäki ad0908cb3f Fixed #1808 (false positive: uninitialized variable with multiple assignment) 2010-06-25 19:39:30 +02:00
Robert Reif 38f90dae09 Fixed #1813 (false negative: Member variable not assigned a value in operator=) 2010-06-25 07:52:12 +02:00
Daniel Marjamäki 9fd89d3bdc Fixed #1495 (False -s positive: Member variable not assigned a value in operator=) 2010-06-24 20:09:26 +02:00
Robert Reif 2a1edff77f Fixed #1812 (false negative: functionVariableUsage doesn't support static variables) 2010-06-24 17:00:32 +02:00
firewave 6fd4ba6e4f Avoid Visual Studio warnings about constant expressions 2010-06-24 04:24:25 +02:00
Robert Reif 74e48d4bb1 Fixed #1732 (False positive: Variable not assigned a value (pointer to pointer)) 2010-06-23 06:54:14 +02:00
Robert Reif fac9f66cc0 Fixed #1810 (False positive: Variable 'separator' is assigned a value that is never used) 2010-06-22 17:07:41 +02:00
Robert Reif a5b45a7f83 Fixed #1807 (false positive: Variable is not assigned a value (casting function parameters)) 2010-06-22 17:04:11 +02:00
Daniel Marjamäki d22da6088c Fixed #1800 (false positive: memory leak when ptr used as map key) 2010-06-21 18:43:28 +02:00
Robert Reif bdd28b47aa Fixed #1799 (false positive: Variable is assigned a value that is never used) 2010-06-21 18:12:01 +02:00
Daniel Marjamäki 26e167fd5b Refactoring: Removed redundant checks 2010-06-20 20:51:36 +02:00
Daniel Marjamäki 4cd3e8fdc0 Refactoring: Reduced copy/pasted code 2010-06-20 19:03:59 +02:00
Daniel Marjamäki 54b8e79cae Preprocessor: Reduce copy/pasted code 2010-06-20 18:41:45 +02:00
Nicolás Alvarez c76a9525c1 Change size-t to std::string::size_type. 2010-06-19 17:24:10 -03:00
Nicolás Alvarez 12d6947334 Fix build error on 64-bit systems. 2010-06-19 17:16:14 -03:00
Nicolás Alvarez df3d98a7c2 Fix typos in sizeofsizeof error message. 2010-06-19 17:16:14 -03:00
Daniel Marjamäki 85bf4b2be6 Fixed #1795 (false positive: nullpointer dereference (needs to improve Tokenizer::simplifyKnownVariables)) 2010-06-19 17:54:38 +02:00
Daniel Marjamäki 82b63dd736 Fixed #1633 (tokenizer: simplifyKnownVariable: improved handling of arithmetic) 2010-06-19 14:00:45 +02:00
Daniel Marjamäki a402b6bb98 Fixed #1802 (Preprocessor: macros are expanded wrong) 2010-06-19 12:03:39 +02:00
Daniel Marjamäki 38c3de7343 Preprocessor: Refactoring. Broke out code that parses out the parameters from code. 2010-06-19 09:09:47 +02:00
Daniel Marjamäki dcdbe117e6 Borland C++: Fixed compiler errors. When using 'a?b:c', Borland requires that b and c are the same type 2010-06-19 08:52:14 +02:00
Robert Reif ec61c6fa26 Fixed #1801 (simplifyTypedef: duplicate typedefs not handled properly) 2010-06-18 07:16:05 +02:00
firewave d6d4b99b85 Removed obsolete checkheaders from Visual Studio projects 2010-06-17 15:00:58 +02:00
Robert Reif f116e74f6e Fixed #1801 (Segmentation fault while scanning Qt's qcups.cpp) 2010-06-17 06:59:01 +02:00
Leandro Lisboa Penz 58a872e6a0 Fixed #1789 (false positive: memory leak (reallocation in subfunction through parameter))
Detecting reallocations in the other function.
2010-06-16 22:29:55 -03:00
Daniel Marjamäki 8a6f4254e0 Fixed #853 (False positive: memory leak for member variable with unknown function) 2010-06-16 19:28:47 +02:00
Robert Reif ee7ad272d6 variable usage: fix false positives when __attribute__ is used. Ticket: #1792 2010-06-16 18:04:31 +02:00
Robert Reif 7dba21858a simplify the alias handling in the checking of variable usage. Ticket: #1729 2010-06-16 18:00:21 +02:00
Robert Reif 61e7e759f0 Fixed #1798 (structure templates) 2010-06-16 07:13:52 +02:00
Zachary Blair ae2a02ad93 Applied review suggestions for Ticket #920 2010-06-15 22:03:38 -07:00
Daniel Marjamäki dc12a9b3b5 Fixed #1545 (new check: usage of iterator pointing to invalid memory after reserve) 2010-06-15 19:53:09 +02:00
Daniel Marjamäki a42273da63 Fixed #887 (Tokenizer: Simplify variable value after loop) 2010-06-15 17:56:14 +02:00
Daniel Marjamäki 5c00c1a539 removed the deprecated checkheaders 2010-06-15 16:56:04 +02:00
Zachary Blair efefceabae Fixed #920 (new style check: find empty catch blocks) 2010-06-14 23:45:46 -07:00
Robert Reif 98ae660260 Fixed #1792 (false positive: Variable 'test' is assigned a value that is never used) 2010-06-14 15:46:57 +02:00
Daniel Marjamäki cb7e9fbec1 Fixed #1776 (False Negative: Unitialized array) 2010-06-14 08:36:34 +02:00
Daniel Marjamäki b5d0955d11 doxygen: fixed error messages given by doxygen 2010-06-14 07:54:41 +02:00
Daniel Marjamäki e987d2e05b Memory leaks: more specific bailouts to reduce false negatives 2010-06-13 19:00:11 +02:00
Daniel Marjamäki 5de124280a Fixed #1783 (false positive: uninitalized variable in constructor/operator=, when calling overloaded functions) 2010-06-13 10:23:59 +02:00
Daniel Marjamäki 70bfa890a8 Fixed #1718 (Tokenizer add close braces to for loop at wrong place when if-else presents inside) 2010-06-13 08:00:46 +02:00
Robert Reif 18bb7488b9 Fixed #1787 (false negative: out of bounds in derived class) 2010-06-13 07:17:50 +02:00
Daniel Marjamäki 76221c0916 Fixed #1510 (false positive '(possible error) Memory leak' when 'a = b = new ...; delete a' (but not b)) 2010-06-12 13:37:44 +02:00
Daniel Marjamäki f3fbdc96e1 Fixed #1788 (Tokenizer: template destructor is lost) 2010-06-12 08:32:05 +02:00
Robert Reif 3d2c28a524 Fixed #1784 (false positive: Variable is not assigned a value) 2010-06-10 07:21:47 +02:00
Robert Reif 6b65b77acf Fixed #1782 ((error) ### Internal error in Cppcheck. Please report it.) 2010-06-10 07:18:55 +02:00
Daniel Marjamäki e64ce2e812 Fixed #1781 (false positive: uninitialized variable when using asm statement in macro) 2010-06-09 21:28:15 +02:00
Robert Reif 00dcec47ac Variable usage: read variable when using syntax '..=*(p);' 2010-06-08 18:26:14 +02:00
Daniel Marjamäki 472bd9dabe Fixed #1726 (False negative: null pointer dereference in switch block) 2010-06-06 12:15:31 +02:00
Daniel Marjamäki e140ff6e84 Memory leaks: skipping function call inside allocation 2010-06-06 11:22:59 +02:00
Daniel Marjamäki a9196e8710 Memory leaks: Added allocation function 'g_strdup_printf' 2010-06-06 11:09:19 +02:00
Daniel Marjamäki 68ad8219ed Fixed #1722 (Member variable initialized in call to base class constructor) 2010-06-06 08:29:35 +02:00
Martin Ettl f75ca79849 applied patch from php-coder from ticket 1724; removed TODO_TESTCASES; 2010-06-05 19:49:49 +02:00
Daniel Marjamäki 1de6e94947 Code coverage: Removed unused code 2010-06-05 11:25:47 +02:00
Daniel Marjamäki 07e00d57d9 Fixed #1725 (segfault in ExecutionPath::bailOutVar (probably caused by #1721 fix)) 2010-06-05 09:45:35 +02:00
Leandro Lisboa Penz 4ac7da7d51 Fixed #73 (memory leaks not found when calling a function that returns allocated memory through a parameter) 2010-06-04 20:58:50 -03:00
Zachary Blair 2645e96783 Applied review suggestions for Ticket #568 2010-06-03 22:42:54 -07:00
Daniel Marjamäki b11e23eb08 Fixed #1721 (False negative: uninitialized variable in switch block) 2010-06-03 20:02:58 +02:00
Robert Reif 4c4844b722 Fixed #1723 (Variable assigned value which is never used but is thrown) 2010-06-03 07:05:57 +02:00
Daniel Marjamäki 09e02b9f9f updated --help output. The --enable is used to enable additional checks. 2010-06-02 21:34:03 +02:00
Daniel Marjamäki cb43168d81 Fixed #1720 (segmentation fault of cppcheck) 2010-06-02 18:10:32 +02:00
Daniel Marjamäki 5789eb116d astyle formatting 2010-06-02 18:09:25 +02:00
Daniel Marjamäki 8ead23fc91 CheckOther::nullConstantDereference: Fixed cppcheck warning message - tok may become null 2010-06-02 18:06:37 +02:00
Daniel Marjamäki 28ad69e4b3 Refactoring of CheckOther::nullConstantDereference 2010-06-02 17:53:45 +02:00
Zachary Blair 33b4254d33 Fixed #568 (string functions with command line arguments may overflow buffer) 2010-06-01 22:41:07 -07:00
Daniel Marjamäki 45821b3871 Fixed #1719 (False negative: memory leak (fgets in condition)) 2010-05-31 18:20:34 +02:00
Daniel Marjamäki 9b1ed1112b Memory leaks: Fixed bug in CheckMemoryLeak::functionReturnType 2010-05-30 20:30:08 +02:00
Daniel Marjamäki 08b6e6ee09 Fixed #1717 (False positive: Resource leak with while) 2010-05-30 13:15:15 +02:00
Daniel Marjamäki 83c62eca9c Tokenizer: simplify loops that continue while errno is EINTR 2010-05-30 12:49:39 +02:00
firewave 62093d764d Fixed Visual Studio 2010 warning 2010-05-30 10:44:03 +02:00
Daniel Marjamäki 37ae4692bb Uninitialized variables: fixed false negative when using uninitialized variable inside malloc call 2010-05-30 10:30:51 +02:00
Daniel Marjamäki 1ec49430e3 Uninitialized variables: better handling when uninitialized variables are used in function calls 2010-05-30 09:31:10 +02:00
Daniel Marjamäki ab41879246 ExecutionPath: Better handling of 'FOREACH (..) {}' 2010-05-30 09:00:18 +02:00
Daniel Marjamäki f41334e58a ExecutionPath: better handling of 'FOREACH(..){..}' 2010-05-30 08:26:44 +02:00
Daniel Marjamäki d3ed1c8960 Refactoring uninitialized variables (checking variable declarations) 2010-05-30 08:02:39 +02:00
Daniel Marjamäki 406cbda563 Uninitialized variables: better handling of struct variables 2010-05-30 07:55:11 +02:00
Daniel Marjamäki 46b5e4e79a Fixed #1716 (Wrong reporting of leak with close() in a while loop condition) 2010-05-29 22:20:10 +02:00
Daniel Marjamäki 0c6352a826 Memory leaks: small fixes. add checking of 'g_fopen'. don't let 'fclose' calls be interpreted as 'callfunc' 2010-05-29 21:56:18 +02:00
Daniel Marjamäki 495dfde32c Fixed #1716 (Wrong reporting of leak with close() in a while loop condition) 2010-05-29 21:11:59 +02:00
Daniel Marjamäki 24703418bd Fixed #1715 (switch with fallthrough and 'return' confuses cppcheck) 2010-05-29 20:55:09 +02:00
Daniel Marjamäki d09e1df0d7 Fixed #1714 (Wrong precedence for shift operators when simplifying calculations?) 2010-05-29 20:27:08 +02:00
Daniel Marjamäki b702b8542d Memory leaks: enabled the leaks checking when members are not deallocated in the destructor. This checking was previously an --all check so there could be false positives. 2010-05-29 19:29:59 +02:00
Daniel Marjamäki 7601089bee astyle formatting 2010-05-29 11:19:56 +02:00
Daniel Marjamäki 82f030df2c the virtual destructor error message needs to be restricted. marked the checking as inconclusive for now. 2010-05-29 11:19:28 +02:00
Zachary Blair fe1fa4022d Merge branch 'master' of github.com:danmar/cppcheck 2010-05-28 22:53:54 -07:00
Robert Reif 1a25183e8f Fixed #1671 (simplifyTypedef: support for more typedefs) 2010-05-29 07:52:06 +02:00
Zachary Blair 59086fa599 Fixed #818 (Detect sprintf buffer overrun with struct members) 2010-05-28 22:51:28 -07:00
Robert Reif 3fb0260ef1 Fixed #1713 (remove Microsoft variants of inline) 2010-05-29 07:43:58 +02:00
Robert Reif 26a7d29760 Fixed #1671 (simplifyTypedef: support for more typedefs) 2010-05-28 06:55:54 +02:00
Daniel Marjamäki d3c20cac81 Fixed #1712 (False negative: dereferencing uninitialized pointer) 2010-05-27 19:00:52 +02:00
Robert Reif dc34a1b3ff Fixed #1711 (Wrong typedef name shown when struct declared with __attribute__) 2010-05-27 18:15:42 +02:00
Robert Reif 8881a0c361 Fixed #1671 (simplifyTypedef: support for more typedefs) 2010-05-27 07:00:33 +02:00
Robert Reif 176b41caa5 Fixed #1709 (char buffer that is only accessed with pointers is marker not assigned) 2010-05-26 19:22:35 +02:00
Daniel Marjamäki d23f63c805 astyle formatting 2010-05-26 19:21:34 +02:00
Daniel Marjamäki 88e9a4ade6 Fixed #1704 (false negative: null pointer dereference) 2010-05-26 19:16:42 +02:00
Zachary Blair 619cfbc56f Fixed #168 (buffer overflow: not enough room for the null terminator) 2010-05-26 01:56:34 -07:00
Robert Reif 019e1f9dfe Fixed #1671 (simplifyTypedef: support for more typedefs) 2010-05-25 20:43:44 +02:00
Robert Reif 4306082fcf Fixed #1708 (False positive for const) 2010-05-25 06:55:49 +02:00
Daniel Marjamäki 5692e7a6f6 Fixed #1707 (false positive: Memory leak) 2010-05-24 19:28:27 +02:00
Daniel Marjamäki c465d824b7 Removed TODO 2010-05-24 07:32:33 +02:00
Daniel Marjamäki 78255fdfc5 Tokenizer: Removed the Tokenizer::simplifyNamespaces. Ticket: #1700 2010-05-23 13:51:41 +02:00
Robert Reif b20cf06b66 Fixed #1671 (simplifyTypedef: support for more typedefs) 2010-05-23 10:46:39 +02:00
Robert Reif 048733a15e false positive: Variable is assigned a value that is never used 2010-05-23 10:41:05 +02:00
Daniel Marjamäki 8f76aea6ed 2 pass checking: broke out Cppcheck::analyseFile. To be used for tests 2010-05-21 21:06:11 +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 4633979ff7 fixed gcc compiler warnings (comparing float values) 2010-05-21 12:28:13 +02:00
Daniel Marjamäki 89ec49508d Fixed gcc compiler warning 2010-05-21 12:13:05 +02:00
Robert Reif a8921afcd7 Fixed #1698 (Add define support to GUI) 2010-05-21 09:49:57 +02:00
Daniel Marjamäki 8d2e4bc553 Tokenizer: give dead pointer a value 2010-05-21 08:26:53 +02:00
Robert Reif 78614b8dc1 Fixed #1699 (False positive: The function '...' can be const) 2010-05-20 17:45:10 +02:00
Robert Reif 5dfbb38dc9 #1697 (false positive: The function can be const) 2010-05-20 06:52:59 +02:00
Daniel Marjamäki c31accc52a Fixed #1695 (Ticket #1614 is broken using latest from git) 2010-05-19 19:23:09 +02:00
Daniel Marjamäki 6815f4e941 printchecks: better explanation of its purpose. I call it from gdb when I debug ExecutionPaths. 2010-05-18 20:58:11 +02:00
Daniel Marjamäki 1792395654 astyle formatting 2010-05-18 20:08:27 +02:00
Daniel Marjamäki f87eb774eb Fixed #1646 (False positive: array access after return cannot have default loop value) 2010-05-18 19:55:23 +02:00
firewave 2bced1d90c Avoid some Visual Studio warnings 2010-05-18 19:19:15 +02:00
Robert Reif 41c43c1790 Fixed #1691 (False positive: Function parameter 'x' is passed by value. It could be passed by reference instead.) 2010-05-18 18:20:11 +02:00
Zachary Blair 1539c0b3d2 Fixed #1649 (add a warning for potential memory leaks when using realloc) 2010-05-17 22:46:48 -07:00
Robert Reif 0d7474042a Fixed #1685 (segmentation fault of cppcheck) 2010-05-18 07:11:23 +02:00
Robert Reif 9dfbd3946a Fixed #1673 (Tokenizer::simplifyTypedef causes segfault for boost library) 2010-05-17 19:58:27 +02:00
Daniel Marjamäki f8442391af astyle formatting 2010-05-17 19:51:35 +02:00
Daniel Marjamäki 453adb4ea4 Tokenizer: it is bad to do: 'tok->previous()->deleteThis()' 2010-05-17 19:50:36 +02:00
Monika Lukow 71e5c56bf9 Fixed #1418 (false negative: buffer access out of bounds) 2010-05-16 23:53:42 +02:00
Erik Lax 20289b1f5b Fixed #1683 (false positive: The function can be const) 2010-05-16 20:26:32 +02:00
Daniel Marjamäki 56d176e1ce Fixed #1684 (false positive: buffer access out of bounds when using extern variable declaration) 2010-05-16 20:21:22 +02:00
Daniel Marjamäki 4c6858fa9c Refactoring: Removed 'possibleError' 2010-05-16 19:57:41 +02:00
Daniel Marjamäki d0e122079f Refactoring: Removed possibleError messages from CheckMemoryLeaks 2010-05-16 19:55:16 +02:00
Erik Lax 19aaa32a99 Fixed #1688 (Tokenizer::simplifyKnownVariables and pointer assignments) 2010-05-16 19:38:44 +02:00
Daniel Marjamäki 01034cd48d Refactoring: Removed 'possible error' message about cin 2010-05-16 19:09:36 +02:00
Daniel Marjamäki 26fab24de4 Refactoring: Removed some inconclusive checking in CheckBufferOverrun 2010-05-16 15:30:39 +02:00
Daniel Marjamäki 6edb2e77b4 Refactoring: Removed Severity::possibleStyle 2010-05-16 14:43:42 +02:00
Daniel Marjamki 5fe2a56b41 doc: updated docs about -D command line flag 2010-05-16 08:48:03 +02:00
Daniel Marjamki 14b27f97fa Fixed #1212 (Allow giving used defines in command line) 2010-05-16 07:38:29 +02:00
Daniel Marjamki d7b117402c Code cleanup: Removed autodealloc handling 2010-05-16 07:15:31 +02:00
Daniel Marjamki 8e3c39ae5b Fixed #1678 (false positive: Member variable not initialized in the constructor, for arrays of undefined type) 2010-05-15 20:24:11 +02:00
Erik Lax c0149d3cd1 Fixed #1679 (Bad iterators checks fails to detect bugs with indent levels) 2010-05-15 20:00:41 +02:00
Erik Lax 0510d9a2b0 Fixed #1680 (Bad iterators checks fail to detect invalidation of iterator for deletion by value) 2010-05-15 19:46:42 +02:00
Daniel Marjamki 70d20ac544 Fixed #1681 (false negative: memory leak in operator =) 2010-05-15 19:40:32 +02:00
Daniel Marjamki 972046c4bd Added test CheckOther::sizeofsizeof. Inspired by #1682 2010-05-15 14:06:45 +02:00
Daniel Marjamki 85afa86da3 astyle formatting 2010-05-14 18:40:37 +02:00
Daniel Marjamki 8b1ffefd74 Fixed #1682 (Internal error) 2010-05-14 18:40:15 +02:00
Konrad Windszus c39f80d361 Ticket #1318: Make sure error ids are unique 2010-05-13 22:14:29 +02:00
Robert Reif f8cceface5 Fixed #1677 (False positive: (style) Variable 'xxx' is assigned a value that is never used) 2010-05-13 13:59:41 +02:00
Martin Ettl 1382832bd0 mathlib:isInt() now handles calles of 'u' and 'l' correctly; testcases added 2010-05-12 23:49:09 +02:00
Robert Reif 963108d957 Fixed #1671 (simplifyTypedef: support for more typedefs) 2010-05-11 21:41:33 +02:00
Daniel Marjamäki 84c3ec9c4c Fixed #1669 (Still seeing 'possible style' warnings in 1.43) 2010-05-10 21:22:59 +02:00
Daniel Marjamäki 5d01047ae4 Fixed #1665 ('If you see this, there is a bug': Token::Match('%var% ( %varid% [,)]', 0)) 2010-05-10 18:11:02 +02:00
Robert Reif a390f3c8f4 Better handling of function pointer typedef 2010-05-10 17:50:40 +02:00
Robert Reif ac7515cdcc Fixed #1666 (simplifyTypedef: add support for typedefs of functions) 2010-05-10 07:12:06 +02:00
Daniel Marjamäki d7118c4d36 Fixed #1648 (mismatch allocate and deallocate calls.) 2010-05-09 13:46:13 +02:00
Daniel Marjamäki 7c52c8683d Fixed #1662 (false positive: Data is allocated but not initialized, when using sprintf) 2010-05-09 07:48:52 +02:00
Robert Reif be35b72c7e Fixed #1660 (false positive: Variable is assigned a value that is never used, when using cast) 2010-05-09 07:15:40 +02:00
Daniel Marjamäki 8971d697b2 Fixed #1656 (dangerous usage of erase not detected: for (; it != it2; ++it) ints.erase(it);) 2010-05-08 20:11:15 +02:00
Daniel Marjamäki 2901434773 Fixed #1658 (false negative: uninitialized pointer usage) 2010-05-08 19:23:46 +02:00
Daniel Marjamäki cdb6915a5b cli help: show the flags in alphabetical order 2010-05-08 12:45:38 +02:00