Commit Graph

665 Commits

Author SHA1 Message Date
Daniel Marjamäki be52e573f3 Fixed ticket #387 (Templates: template functions that return a pointer are not simplified correctly) 2009-06-14 11:28:25 +02:00
Slava Semushin 4286fdbabb Token: introduce str(const std::string &) method.
Get rid of useless std::string.c_str() calls.

No functional change.
2009-06-14 13:55:23 +07:00
Slava Semushin bc32d04efa Replace tok->previous()->previous() call to tok->tokAt(-2).
Done by command:
git grep -l 'previous()->previous()' | xargs sed -i 's|previous()->previous()|tokAt(-2)|'

No functional change.
2009-06-14 13:33:45 +07:00
Slava Semushin 57f1a6d2b7 Replace tok->previous()->previous()->previous() call to tok->tokAt(-3).
Done by command:
git grep -l 'previous()->previous()->previous()' |
xargs sed -i 's|previous()->previous()->previous()|tokAt(-3)|'

No functional change.
2009-06-14 13:33:45 +07:00
Slava Semushin 4245047674 Replace tok->next()->next() call to tok->tokAt(2).
Done by command:
git grep -l 'next()->next()' | xargs sed -i 's|next()->next()|tokAt(2)|'

No functional change.
2009-06-14 13:33:45 +07:00
Slava Semushin ab0a1973e8 Replace tok->next()->next()->next() call to tok->tokAt(3).
Done by command:
git grep -l 'next()->next()->next(),' | xargs sed -i 's|next()->next()->next()|tokAt(3)|'

No functional change.
2009-06-14 13:33:44 +07:00
Slava Semushin b3841dda96 Replace tok->next()->next()->next()->next() call to tok->tokAt(4).
Done by command:
git grep -l 'next()->next()->next()->next(),' | xargs sed -i 's|next()->next()->next()->next()|tokAt(4)|'

No functional change.
2009-06-14 13:33:44 +07:00
Daniel Marjamäki 2307395d6e Fixed ticket #373 (False unused functions)
Skip template functions when checking for unused functions
2009-06-14 07:58:36 +02:00
Slava Semushin 084b3c002f Fixed ticket #403 (false positive::Array index out of range)
http://sourceforge.net/apps/trac/cppcheck/ticket/403
2009-06-14 11:21:20 +07:00
Kimmo Varis 3e045dcf37 Fix the copyright text in Windows executable. 2009-06-14 00:24:35 +03:00
Reijo Tomperi a6d2dceeb3 Fixed ticket #398 (valgrind shows error when running testrunner)
http://172.29.29.21/apps/trac/cppcheck/ticket/398
2009-06-13 00:17:06 +03:00
Reijo Tomperi 9ea80b4d74 Fix ticket #397 (xml output doesn't encode " and & -characters as it should)
http://sourceforge.net/apps/trac/cppcheck/ticket/397
2009-06-12 22:02:01 +03:00
Daniel Marjamäki 777790ebc7 Fixed ticket #367 (Deallocating a deallocated pointer false positive when va_list used)
The overall matching of functions when calls are made were improved.
2009-06-12 17:31:29 +02:00
Reijo Tomperi 6362574c1a astyle fix 2009-06-12 18:24:43 +03:00
Daniel Marjamäki 35b6b2588e Fixed ticket #374 (False positive: The scope of variable can be limited)
A few refactorings and fixes were made
2009-06-12 16:17:51 +02:00
Slava Semushin cba0d9e130 Fixed ticket #392 (false positive and wrong allocation and deallocation not detected)
http://sourceforge.net/apps/trac/cppcheck/ticket/392
2009-06-12 21:14:01 +07:00
Slava Semushin 56a0660972 Tokenizer::createLinks(): correct comment.
No code change.
2009-06-12 20:49:49 +07:00
Daniel Marjamäki 169cfc1324 doc: minor update. The [BR] is not working as I thought 2009-06-12 15:30:29 +02:00
Daniel Marjamäki 9b2b14a608 doc: generating wiki documentation 2009-06-12 15:20:08 +02:00
Slava Semushin 7bee0cd2df Fixed ticket #390 (wrong allocation and deallocation not detected)
http://sourceforge.net/apps/trac/cppcheck/ticket/390
2009-06-12 20:04:58 +07:00
Daniel Marjamäki 0c01132698 added a classInfo function for each check class 2009-06-12 12:19:37 +02:00
Reijo Tomperi 092bd79ec4 Fix ticket #386 (False positive (memory leak) with comma)
http://apps.sourceforge.net/trac/cppcheck/ticket/386
2009-06-11 00:12:26 +03:00
Daniel Marjamäki d8f95f68c3 Fixed ticket #377 (False positive with "char a[]")
Updated the tokenizer so "char a[]" is tokenized into "char *a"
2009-06-10 19:36:00 +02:00
Reijo Tomperi db7b8fb3fd Partial fix for ticket #380 (Error reporting on unused functions)
Returning hard coded line number 1 and assumed that severity should be "style"
https://apps.sourceforge.net/trac/cppcheck/ticket/380
2009-06-09 23:45:31 +03:00
Slava Semushin 879174b06c src/checkunusedfunctions.h: assign default values in initializer list.
No functional change.
2009-06-10 03:12:57 +07:00
Slava Semushin c000fd581a Don't print message about missing source files when --errorlist used.
Also exit with zero status in this case.

Fix for 5193a36a6a commit.
2009-06-10 02:05:21 +07:00
Daniel Marjamäki a71d260308 Refactoring: Moved CheckOther::returnPointerToLocalVariable to CheckAutoVariables 2009-06-09 19:45:58 +02:00
Daniel Marjamäki a3bf635249 Doxygen: Added a few simple doxygen comments for the leaks checking 2009-06-08 20:54:49 +02:00
Daniel Marjamäki 2c07c22d9e Refactoring: Split up the CheckMemoryLeak into CheckMemoryLeakInFunction and CheckMemoryLeakInClass 2009-06-08 20:20:43 +02:00
Daniel Marjamäki 15dbf9c085 Refactoring: Renaming the CheckMemoryLeakClass to CheckMemoryLeak. Deleted testmemleakmp 2009-06-08 18:51:17 +02:00
Daniel Marjamäki d7fa3e6dda Refactoring: Renamed CheckFunctionUsage to CheckUnusedFunctions 2009-06-07 22:12:20 +02:00
Daniel Marjamäki 6356db82a9 Added headers to the "--errorlist" output 2009-06-07 18:53:47 +02:00
Daniel Marjamäki 548f45899f Updated version to 1.33 2009-06-07 12:57:39 +02:00
Reijo Tomperi 9bac4aca75 Fix ticket #371 (Resource leak when exit() and if() uses together)
http://apps.sourceforge.net/trac/cppcheck/ticket/371
2009-06-07 09:55:20 +03:00
Daniel Marjamäki 5747133fa8 Fix #370 (Assign auto variable to parameter false positive) 2009-06-06 21:25:41 +02:00
Daniel Marjamäki a8c5526c84 Fix #368 (Leak detected when allocated memory assigned to member of structure which returned from function)
The return value of strcpy wasn't handled very well
2009-06-06 20:55:16 +02:00
Daniel Marjamäki dd473b074a Fix #153 (Unsigned divide)
The "unsigned i" variable declaration wasn't handled well. So I added an "int" token.
2009-06-06 10:40:48 +02:00
Reijo Tomperi 9cd5558f5e Fix ticket #364 (false positive:: division by zero)
http://apps.sourceforge.net/trac/cppcheck/ticket/364
2009-06-06 00:33:13 +03:00
Reijo Tomperi 90b786b09c Fix ticket #353 (No pair for character (').)
http://apps.sourceforge.net/trac/cppcheck/ticket/353
2009-06-05 23:45:31 +03:00
Daniel Marjamäki 5193a36a6a Created an undocumented command line flag "--errorlist" that prints all messages 2009-06-05 18:34:55 +02:00
Daniel Marjamäki cfb4e91986 Fix #359 (Incorrect unused function) 2009-06-05 15:02:26 +02:00
Daniel Marjamäki d0f3dccc6d Fixed #354 (false positive: memory leak) 2009-06-05 08:56:46 +02:00
Slava Semushin 21e0639443 Fixed ticket #360 (Teach about new(std::nothrow) form)
http://apps.sourceforge.net/trac/cppcheck/ticket/360
2009-06-05 11:03:48 +07:00
Slava Semushin 58781c761c Fixed ticket #329 (snprintf size is out of bounds when two variables in one scope with similar names)
FIXME:
Because it's fix for simplifyTokenList() test should be moved to
test/testsimplifytokens.cpp file.

http://apps.sourceforge.net/trac/cppcheck/ticket/329
2009-06-05 09:53:34 +07:00
Slava Semushin 6745d9b8ef Fixed ticket #358 (Local typedef flagged as uninitialized member)
http://apps.sourceforge.net/trac/cppcheck/ticket/358
2009-06-05 07:34:12 +07:00
Reijo Tomperi 1bb7b01a06 Fix ticket #352 (Memory leaks: Missed memory leak when "--all" is not given)
http://apps.sourceforge.net/trac/cppcheck/ticket/352
Detect memory leaks without --all when there is "alloc ; assign callfunc ;
2009-06-03 23:20:33 +03:00
Reijo Tomperi 3428584925 Fix ticket #351 (false positive::resource leak)
http://apps.sourceforge.net/trac/cppcheck/ticket/351
2009-06-03 22:02:16 +03:00
Reijo Tomperi 2a7470e986 Changed EOL character to LF in a few files. 2009-06-02 23:32:58 +03:00
Daniel Marjamäki b4c637c58b Fixed #350 (False positive: Array index out of bounds) 2009-06-02 18:56:53 +02:00
Daniel Marjamäki 6ef87e8eab Fixed #339 (Buffer overrun not detected with pointer arrays)
http://apps.sourceforge.net/trac/cppcheck/ticket/339
2009-06-01 19:21:08 +02:00
Slava Semushin 37a485f4f0 Fixed ticket #349 (Add detection for resource leaks after tmpfile() usage)
https://apps.sourceforge.net/trac/cppcheck/ticket/349
2009-06-01 17:40:24 +07:00
Slava Semushin 09fce76e30 Fixed ticket #348 (Simplify sizeof for pointers)
https://apps.sourceforge.net/trac/cppcheck/ticket/348
2009-06-01 17:01:45 +07:00
Slava Semushin 3d0926936f Tokenizer::simplifyTokenList: use SizeOfType().
No functional change.
2009-06-01 16:59:35 +07:00
Slava Semushin fa5cdcb128 Tokenizer::simplifyTokenList: reduce indent.
No functional change.
2009-06-01 16:27:04 +07:00
Slava Semushin dc6168b9d7 Tokenizer::simplifyTokenList: some improvements.
Corrections for 2de4c516e9 commit:
- declare variable near their usage
- set right position of next token
2009-06-01 03:01:10 +07:00
Reijo Tomperi 2de4c516e9 Fixed ticket #338 (Simplify sizeof for pointer arrays) by patch submitted by php-coderrr
http://apps.sourceforge.net/trac/cppcheck/ticket/338
2009-05-31 22:33:44 +03:00
Slava Semushin 8822cbb713 src/tokenize.cpp(unwantedWords): propagate const modifier.
No functional change.
2009-06-01 02:04:29 +07:00
Daniel Marjamäki 2120edb89b Variable Id: structs must not have variable id 2009-05-31 18:46:32 +02:00
Slava Semushin 5f57e4ac2d Merge branch 'master' of git@github.com:danmar/cppcheck 2009-05-31 20:50:55 +07:00
Slava Semushin fb0c217c3e src/tokenize.cpp(combineWithNext): propagate const modifier.
No functional change.
2009-05-31 20:48:40 +07:00
Reijo Tomperi 3fe1b50e60 Fix ticket #344 (Tokenizer crash in Windows)
http://apps.sourceforge.net/trac/cppcheck/ticket/344
2009-05-31 15:55:06 +03:00
Daniel Marjamäki aba7518aeb Fixed ticket #345 ('!' and 'not' tokens interpreted differently even though they mean the same) 2009-05-31 10:42:27 +02:00
Daniel Marjamäki 8b76301ee2 Fix ticket #318 ('..' in include will cause conflicting slashes in messages) 2009-05-31 10:12:19 +02:00
Daniel Marjamäki 375dfeab06 Fix for #341 (Functions passed as pointer not detected as used) 2009-05-31 08:01:16 +02:00
Daniel Marjamäki 2cbbc65691 cppcheck: removed the 'this may take several minutes' when checking unused functions. The check is much faster nowadays 2009-05-31 07:48:35 +02:00
Daniel Marjamäki bf98ff85e5 Memory leaks: calling function that deallocates the memory and allocates new memory
https://apps.sourceforge.net/trac/cppcheck/ticket/336
2009-05-30 20:30:44 +02:00
Kimmo Varis 997872f624 GUI: Fix building with MinGW.
Add shlwapi library to qmake project file. Use WCHAR instead of wchar_t.
2009-05-30 20:45:51 +03:00
Kimmo Varis 55acefa206 Make GUI work in Windows compiled with VS.
Since GUI is QT project it is also Unicode project. And other cppcheck code is ANSI code. So we must convert data between Unicode and ANSI when calling WinAPI functions. WinAPI functions want Unicode strings but e.g. std::string contains ANSI strings.
2009-05-30 19:46:04 +03:00
Daniel Marjamäki e987b23509 Merge branch 'aa' 2009-05-30 14:26:07 +02:00
Daniel Marjamäki d33139b2c7 Preprocessor: Added todos for better handling of UTF / extended ASCII
http://apps.sourceforge.net/trac/cppcheck/ticket/343
2009-05-30 14:24:55 +02:00
Kimmo Varis 0a9f6bc631 Windows: Fix FileLister to send full paths instead of only filenames. 2009-05-30 13:22:08 +03:00
Reijo Tomperi 58eda6e978 Fix ticket #325 (Replace developer names in source files with AUTHORS file)
http://apps.sourceforge.net/trac/cppcheck/ticket/325
2009-05-30 08:48:12 +03:00
Reijo Tomperi 8876f0ee57 Fix ticket #342 (Simplify "if( (true) == true )")
http://apps.sourceforge.net/trac/cppcheck/ticket/342
2009-05-30 00:04:01 +03:00
Reijo Tomperi a3be307c03 Fix bug related to ticket #330, cppcheck hanged with some files containing "(("
http://apps.sourceforge.net/trac/cppcheck/ticket/330
2009-05-28 23:03:36 +03:00
Daniel Marjamäki a3990648a9 Tokenizer: Simplifying redundant parantheses
http://apps.sourceforge.net/trac/cppcheck/ticket/330
2009-05-28 19:37:39 +02:00
Kimmo Varis 3f3b1279da Fix building GUI with Visual Studio. 2009-05-28 10:22:30 +03:00
Reijo Tomperi adb1ed4947 Fix ticket #319 (Function names are tagged as variables)
http://apps.sourceforge.net/trac/cppcheck/ticket/319
2009-05-27 23:34:08 +03:00
Daniel Marjamäki ca6d927dfa Fix ticket 330 (found memory leak when __builtin_expect uses) 2009-05-27 20:49:29 +02:00
Daniel Marjamäki e89c03da92 Fix ticket 308 (cppcheck msg:: invalid number of ((). Cant process file) 2009-05-27 20:07:18 +02:00
Daniel Marjamäki 650d58e3de Fix for ticket 337 ('scope can be limited' false positive with variables referenced by pointers) 2009-05-27 19:38:26 +02:00
Reijo Tomperi ea4232fb06 Fix ticket #334 (segmentation fault on boost 1.39.0)
http://apps.sourceforge.net/trac/cppcheck/ticket/334
2009-05-26 23:22:00 +03:00
Daniel Marjamäki b9b542d05b Fixed ticket #333 (tokenizer: incorrect removal of decrement/increment) 2009-05-25 14:21:58 +02:00
Daniel Marjamäki 2d2c0e42cc Fix ticket #317 (pre-increment causes style false positive) 2009-05-25 08:31:20 +02:00
Daniel Marjamäki 7fdd497c44 Fix ticket #317 (pre-increment causes style false positive) 2009-05-25 08:26:11 +02:00
Reijo Tomperi 977e31786d Fix ticket #332 (White space between macro name and '(' causes macro simplification to fail)
http://apps.sourceforge.net/trac/cppcheck/ticket/332
2009-05-24 23:57:12 +03:00
Slava Semushin 9ae9ffa9be src/checkmemoryleak.cpp(GetAllocationType): simplify condition a bit.
Replace two Token::simpleMatch() calls to one Token::Match().

Correction for my previous (2654a4aa54)
commit.

No functional change.
2009-05-24 03:46:50 +07:00
Slava Semushin 2654a4aa54 Added support to search resource leaks after opendir()/fdopendir() usage. 2009-05-24 02:53:02 +07:00
Slava Semushin f5300ae56c Part of fix for ticket #284 (style check: redundant condition improvement)
Fixed case "if (p) delete [] p;" and also added test case for it.

http://apps.sourceforge.net/trac/cppcheck/ticket/284
2009-05-24 00:32:53 +07:00
Slava Semushin bc62472a18 Part of fix for ticket #284 (style check: redundant condition improvement)
Fixed case "if (p != NULL) delete p;" and also added test case for it.

http://apps.sourceforge.net/trac/cppcheck/ticket/284
2009-05-24 00:30:27 +07:00
Slava Semushin 1e2545439e src/checkmemoryleak.cpp(GetDeallocationType): removed brackets.
No functional change.
2009-05-24 00:26:34 +07:00
Slava Semushin bfd49e21e7 Added 17 functions which work with FILE structure to white list.
Inspired by previous commit.
2009-05-23 18:01:18 +07:00
Slava Semushin b5c7316666 Fixed ticket #327 (File descriptor leak not detected when feof() used)
Thanks to aggro80@ for help.

http://apps.sourceforge.net/trac/cppcheck/ticket/327
2009-05-23 17:20:26 +07:00
Reijo Tomperi bbf63b7970 Fix ticket #304 (#include <file.h> should be searched from paths given with -I parameter.)
http://apps.sourceforge.net/trac/cppcheck/ticket/304
Note that the ticket is same as with previous commit, but task description was changed a little.
2009-05-23 00:18:48 +03:00
Reijo Tomperi 93d9400f63 Fix ticket #304 (#include <file.h> should be parsed like #include "file.h" is being parsed)
http://apps.sourceforge.net/trac/cppcheck/ticket/304
2009-05-22 23:59:07 +03:00
Reijo Tomperi 0f9b2efa43 Fix ticket #326 (Reported memory leak when pointer returned by assign to function's parameter)
http://apps.sourceforge.net/trac/cppcheck/ticket/326
2009-05-22 23:36:03 +03:00
Slava Semushin 0f20ce738d Replaced two Token::simpleMatch() calls to one Token::Match().
Suggested by hyd_danmar in ticket
http://apps.sourceforge.net/trac/cppcheck/ticket/323

No functional change.
2009-05-22 22:03:42 +07:00
Slava Semushin a2a6eebb01 Fixed ticket #324 (Teach about fcloseall() function)
http://apps.sourceforge.net/trac/cppcheck/ticket/324
2009-05-22 21:47:40 +07:00
Slava Semushin b2aaf5d4c7 Fixed ticket #300 (wrong level given)
Enable checks of dangerous functions only when --style option used.

http://apps.sourceforge.net/trac/cppcheck/ticket/300
2009-05-22 21:35:00 +07:00
Slava Semushin 4bd1c3fb00 Propagate static and const modifiers.
No functional change.
2009-05-22 21:20:32 +07:00
Slava Semushin e72583b663 Removed unused or superfluous headers.
No functional change.
2009-05-22 21:17:59 +07:00