Commit Graph

991 Commits

Author SHA1 Message Date
Daniel Marjamäki 18f9e05f5a refactoring: Renamed checking classes 2009-07-13 16:00:15 +02:00
Kimmo Varis 2ee8be9f7f Merge branch 'master' of git@github.com:danmar/cppcheck 2009-07-13 16:52:06 +03:00
Kimmo Varis 6393498966 Astyle fixes. 2009-07-13 16:51:35 +03:00
Daniel Marjamäki 2a8fa6d19c astyle formatting 2009-07-13 15:50:54 +02:00
Daniel Marjamäki 913789605f refactoring: Refactoring of the leak-checking classes 2009-07-13 15:07:26 +02:00
Daniel Marjamäki f7cb7da560 doxygen: updated a few comments 2009-07-13 13:35:33 +02:00
Kimmo Varis 7491200d71 Merge branch 'master' of git@github.com:danmar/cppcheck 2009-07-13 11:40:40 +03:00
Kimmo Varis d88cf4d3e4 Pave a way for Windows Unicode builds.
Use UNICODE preprocessor define instead of QT_CORE_LIB when determining whether to use Ansi or Unicode data and functions. This only applies to Windows.
2009-07-13 11:39:46 +03:00
Daniel Marjamäki 7d35447d80 refactoring: renamed the severity "all" to "possible error" 2009-07-13 10:16:31 +02:00
Daniel Marjamäki 11bc5195b8 cleanup: continued with the removing of the security. Some more work is needed but now everything compiles and runs at least. 2009-07-12 22:21:49 +02:00
Daniel Marjamäki 2961f29b57 doc: add link 2009-07-12 21:51:57 +02:00
Daniel Marjamäki 03f3ee62a0 cleanup: removed deprecated files. security checking and errmsg 2009-07-12 19:18:38 +02:00
Daniel Marjamäki 112ffd81fd updated version to 1.34 2009-07-12 16:09:22 +02:00
Daniel Marjamäki b86b07827a unused private functions: don't check classes declared in header files unless it is known that their whole implementation is seen 2009-07-12 14:23:01 +02:00
Daniel Marjamäki 6a76243e9f doxygen: wrote a simple text for the mainpage 2009-07-11 16:44:04 +02:00
Daniel Marjamäki 36896e1ca0 better description for the message with id strncatUsage 2009-07-11 12:16:38 +02:00
Daniel Marjamäki 59372199e3 Revert "cppcheck: Now it's possible to change the output format, for example to a visual studio compliant format"
This reverts commit 91a8dbd7b9.
2009-07-10 22:38:26 +02:00
Daniel Marjamäki bd68837866 refactoring: minor refactorings and added some doxygen comments 2009-07-08 17:14:34 +02:00
Daniel Marjamäki 91a8dbd7b9 cppcheck: Now it's possible to change the output format, for example to a visual studio compliant format 2009-07-08 14:38:13 +02:00
Daniel Marjamäki 89115bd417 doc: added more information when '--verbose' is used for these error messages:
* dangerous usage of erase
 * overlapping data buffer
2009-07-08 12:57:36 +02:00
Daniel Marjamäki 2a02041fd8 memleak: fixed todo test case 2009-07-07 15:22:37 +02:00
Daniel Marjamäki ddc1ad7d4d Fixed #431 (Unused private function, wrong line when two functions with same name) 2009-07-07 08:55:14 +02:00
Daniel Marjamäki 9d1d7ebf8d Fixed #382 (False positive: public function flagged as 'Unused private function') 2009-07-07 08:30:23 +02:00
Daniel Marjamäki 9beb73824b Fixed #446 (memory leak false positive when variable is static) 2009-07-06 12:20:13 +02:00
Daniel Marjamäki a6ac747830 tokenizer: Don't simplify declarations of static variables 2009-07-06 11:45:14 +02:00
Reijo Tomperi 8b0e481d46 Refactoring: Rename member functions to follow naming guidelines. 2009-07-05 23:16:43 +03:00
Reijo Tomperi f676deb208 Test case improvement, unused function removed from tokenizer. 2009-07-05 22:37:53 +03:00
Reijo Tomperi e858ab2f0d Fix ticket #457 (False positive: Member variable not assigned a value in copy constructor)
http://sourceforge.net/apps/trac/cppcheck/ticket/457
Simplify "a = 0, b = 0;" into "a = 0; b = 0;"
2009-07-05 21:29:09 +03:00
Kimmo Varis 3132041de3 Move include paths list to Settings class so we can set include paths from GUI. 2009-07-04 01:23:37 +03:00
Reijo Tomperi 26358debcf Fix ticket #448 (false positive:: resource leak)
http://sourceforge.net/apps/trac/cppcheck/ticket/448
Tokenizer improved to simplify "if( (p)==-1 )"
2009-07-03 21:57:44 +03:00
Reijo Tomperi b2474fd980 Fix ticket #452 (Failure to detect "member var not initialized in constructor" if class inherits)
http://sourceforge.net/apps/trac/cppcheck/ticket/452
2009-07-03 21:22:14 +03:00
Reijo Tomperi ea0035ec3a Fix ticket #434 (Unused function gets reported dozens of times)
http://sourceforge.net/apps/trac/cppcheck/ticket/434
Using --unused-functions with -j will now print out error message:
"cppcheck: error: --unused-functions can't be used with -j option."
2009-07-02 23:29:52 +03:00
Reijo Tomperi 751a31ed91 Fix ticket #445 (simple to avoid false positive for buffer overflow)
http://sourceforge.net/apps/trac/cppcheck/ticket/445
Simple bailout in case "if" is found inside the for-loop.
2009-06-30 00:42:46 +03:00
Daniel Marjamäki 7ec8e2396f Fix ticket #267 (Glued define and define name in output text)
The handling of ifdef configurations where rewritten. Either a
configuration is handled properly or it is not handled at all.
2009-06-26 13:19:55 +02:00
Daniel Marjamäki 61f4a29758 minor fix of test case 2009-06-23 20:40:27 +02:00
Daniel Marjamäki 7f8b40d135 calling unknown function -> use 2009-06-23 20:37:34 +02:00
Reijo Tomperi bdf1987cc4 Fix ticket #435 (False positive: Invalid number of character when ({}) is used in code)
http://sourceforge.net/apps/trac/cppcheck/ticket/435
2009-06-22 23:54:11 +03:00
Kimmo Varis 4b1f300660 Merge branch 'master' of git@github.com:danmar/cppcheck 2009-06-22 11:58:15 +03:00
Kimmo Varis 1aafeebe7b GUI: Add support for project files.
GUI reads per-project settings (automatically deallocated classes) from XML project file. The project file format is described in projectfile.txt. Example project file is added for gui.

See also forum discussion at:
https://sourceforge.net/apps/phpbb/cppcheck/viewtopic.php?f=3&t=46
2009-06-22 11:57:17 +03:00
Daniel Marjamäki 5c36d33943 astyle formatting 2009-06-21 21:03:58 +02:00
Daniel Marjamäki 5b5352226c doc: simplified the documentation for autovariables a bit 2009-06-21 21:03:21 +02:00
Slava Semushin 13e805f332 Fixed ticket #399 (Add detection for resource leaks after open() usage)
http://sourceforge.net/apps/trac/cppcheck/ticket/399
2009-06-21 22:01:43 +07:00
Daniel Marjamäki 8715ba1458 CheckMemoryLeakInFunction: More sensitive checking when the code calls an unknown function 2009-06-21 14:12:59 +02:00
Daniel Marjamäki f28dec1f5a detect memory leak when all is given when calling an unknown function 2009-06-21 13:48:39 +02:00
Daniel Marjamäki a0ba52ccf1 Preprocessor: Replace "#if !defined(A)" with "#ifndef A" 2009-06-21 08:03:42 +02:00
Reijo Tomperi ac6e7b40e5 Fix ticket #426 (Problem with include)
http://sourceforge.net/apps/trac/cppcheck/ticket/426
2009-06-20 23:13:19 +03:00
Daniel Marjamäki 8a3ec4549b Fixed #425 (False positive: usage of char variable.. c = c & 0x03)
Using char variables in bit operations are ok if:
 * the result is stored in a char
 * the variable is and'ed with a number that is less than 0x100
2009-06-20 19:24:58 +02:00
Daniel Marjamäki d1d9c9a9c9 CheckMemoryLeakInClass: Only show the memory leak message when --all is used 2009-06-20 14:17:56 +02:00
Daniel Marjamäki 453a5cdd47 Fixed ticket #411 (false positive: resource leak in while loop) 2009-06-20 13:58:30 +02:00
Kimmo Varis af994d23e1 Doxygen fixes. Wrong parameter names etc. 2009-06-20 12:54:49 +03:00
Daniel Marjamäki 03944f1b96 Tokenizer: Fixed problem when simplifying casts 2009-06-19 19:25:56 +02:00
Reijo Tomperi 5f7d88b36c Fix ticket #416 (False positive: Redundant code)
http://sourceforge.net/apps/trac/cppcheck/ticket/416
2009-06-19 19:03:09 +03:00
Daniel Marjamäki 6e1281ec34 Preprocessor: Better handling of macros that has parantheses but not parameters such as "#define AAA( ) aaa" 2009-06-19 16:42:47 +02:00
Reijo Tomperi 73661dbd69 astyle fix 2009-06-19 16:47:40 +03:00
Daniel Marjamäki 58c7414ce0 Fixed ticket #417 (Crashes in windows because of invalid char value)
negative char values are allowed in strings and comments. but not in other code.
2009-06-19 15:43:46 +02:00
Daniel Marjamäki 12c9f09780 Fixed #420 (WarningOldStylePointerCast() needs a test case) 2009-06-19 12:01:27 +02:00
Kimmo Varis 3da3c74f6f Revert "Fix ticket #417 (Crashes in Windows because of invalid char value)"
This reverts commit 70db2562f4.

See the ticket - the fix was not correct fix.
2009-06-19 10:20:15 +03:00
Kimmo Varis 1619b6cb0f Merge branch 'master' of git@github.com:danmar/cppcheck 2009-06-19 00:11:17 +03:00
Daniel Marjamäki d5d96d2535 Merge branch 'master' of git@github.com:danmar/cppcheck 2009-06-18 23:10:16 +02:00
Kimmo Varis 48ac595ae0 Merge branch 'master' of git@github.com:danmar/cppcheck 2009-06-19 00:09:37 +03:00
Daniel Marjamäki 12f3ac5a2f Preprocessor: better handling of "..." and "__VA_ARGS__" in macros 2009-06-18 23:09:11 +02:00
Kimmo Varis 70db2562f4 Fix ticket #417 (Crashes in Windows because of invalid char value)
8-bit characters and UTF-8 characters are now converted to spaces. They can only appear in the code files in comments or string/char constants. So we cannot just ignore them as that would change length.
2009-06-19 00:09:05 +03:00
Reijo Tomperi e8d1905e6d Fix ticket #418 (delete a,b; not tokenized correctly)
http://sourceforge.net/apps/trac/cppcheck/ticket/418
2009-06-19 00:00:16 +03:00
Reijo Tomperi b7171c3cd2 Fix ticket #413 (false positive: C-style pointer casting for pure virtual function)
http://sourceforge.net/apps/trac/cppcheck/ticket/413
2009-06-18 23:26:21 +03:00
Slava Semushin fafc261611 Fixed ticket #278 (variable id: references are not handled correctly)
http://sourceforge.net/apps/trac/cppcheck/ticket/278
2009-06-18 23:30:04 +07:00
Daniel Marjamäki 5d0d21d668 Fixed a false positive (memory leak)
This false positive was first discovered in the VLC sourcecode. The TestMemoryLeakInFunction::simple11 test case is a simplified test code of that code.
2009-06-17 21:42:49 +02:00
Reijo Tomperi f8b3a57682 Fix ticket #309 (false positive::is not assigned a value in 'A::operator=')
http://sourceforge.net/apps/trac/cppcheck/ticket/309
2009-06-17 00:58:16 +03:00
Daniel Marjamäki b7c9a4ed8c Created a new class for detecting leaks (forgetting to free struct members) 2009-06-16 22:01:04 +02:00
Daniel Marjamäki ed98f1b367 Fixed #131 (Regression: leak reported by 1.27 is not reported by 1.29)
The leak will be reported as a definite bug again. Not just a possible bug.
cppcheck don't know if the execution path is possible, but it knows that if the execution path is taken the memory leak will be certain.
2009-06-16 19:05:05 +02:00
Daniel Marjamäki a81b6487bf Improved the "CheckMemoryLeak::functionReturnType" 2009-06-15 21:13:39 +02:00
Reijo Tomperi 0c059af3cb getXMLFooter() and getXMLHeader() functions added and taken into use 2009-06-15 21:36:39 +03:00
Daniel Marjamäki 433ff048a4 Fixed #264 (Memory Leak: alloc by assigning to a return value)
The fix was inspired by the previous patch submitted by hoangtuansu
2009-06-15 17:44:59 +02:00
Reijo Tomperi 7c4423889c Fixed ticket #405 (#ifdef A and #if defined A should be handled as same configuration)
http://sourceforge.net/apps/trac/cppcheck/ticket/405
2009-06-14 23:37:18 +03:00
Slava Semushin 8c327f82b3 Fixed ticket #346 (adding a "const" token prevents detection of memory leak)
http://sourceforge.net/apps/trac/cppcheck/ticket/346
2009-06-15 00:32:34 +07:00
Daniel Marjamäki af7c63155e Fixed #387 (Templates: template functions that return a pointer are not simplified correctly)
* Fixed so that the tokenizer handle variable declarations better when the variable is assigned the return value of a template function
 * Fixed so that the simplifyTemplates detect that a template function is used when its return value is taken
2009-06-14 14:57:47 +02:00
Daniel Marjamäki c56c913635 Merge branch 'master' of git@github.com:danmar/cppcheck 2009-06-14 11:30:22 +02:00
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
Slava Semushin 3a40c33d7b Updated wrong comments (looks like after copy&paste).
No code change.
2009-05-22 21:13:01 +07:00
Reijo Tomperi e6017ad54b Fix #299 (Memory leak not detected when parameters contain ::)
http://apps.sourceforge.net/trac/cppcheck/ticket/299
2009-05-21 22:51:19 +03:00
Daniel Marjamäki f182365bd2 Applied patch 0001-Use-Token-simpleMatch-instead-of-Token-Match-w
Author: php-coder

Ticket: http://apps.sourceforge.net/trac/cppcheck/ticket/323
2009-05-21 17:55:52 +02:00
Daniel Marjamäki 47e10b75e3 Applied patch 0003-GetAllocationType-mark-some-members-as-static-and-a.patch
Author: php-coder

Ticket: http://apps.sourceforge.net/trac/cppcheck/ticket/321
2009-05-21 12:26:44 +02:00
Daniel Marjamäki eafb1f823c Applied patch 0002-CheckMemoryLeak-renamed-enum-members.patch
Author: php-coder
2009-05-21 12:16:42 +02:00
Daniel Marjamäki 167ab7ee15 Applied patch 0001-src-checkmemoryleak.h-replaced-assignment-in-contru.patch
Author: php-coder
2009-05-21 12:11:35 +02:00
Reijo Tomperi bb2b2e000b Fix ticket #316 (\n is tokenized into \\ in a string when macro is used)
http://apps.sourceforge.net/trac/cppcheck/ticket/316
2009-05-20 21:36:59 +03:00
Reijo Tomperi 9c60391375 Apply patch #320 from php-coderrr ([PATCH] Determine memory leaks after strndup() usage)
http://apps.sourceforge.net/trac/cppcheck/ticket/320
2009-05-19 23:29:10 +03:00
Reijo Tomperi a3f469d339 Fix ticket #315 (Segmentation fault when checking Linux kernel) (previous fix was only partial fix)
http://apps.sourceforge.net/trac/cppcheck/ticket/315
2009-05-19 22:19:15 +03:00
Reijo Tomperi d6d55c2db4 Fix ticket #315 (Segmentation fault when checking Linux kernel)
http://apps.sourceforge.net/trac/cppcheck/ticket/315
2009-05-18 23:32:04 +03:00
Reijo Tomperi 927918f9b0 astyle fix 2009-05-18 23:30:43 +03:00
Daniel Marjamäki bad464ae9b Classes: Static variables don't need to be initialized or assigned in constructors etc
http://apps.sourceforge.net/trac/cppcheck/ticket/307
2009-05-17 19:27:16 +02:00
Daniel Marjamäki 2e61201c18 STL: It is ok to compare vector iterators with <
https://apps.sourceforge.net/trac/cppcheck/ticket/313
2009-05-17 18:58:32 +02:00
Daniel Marjamäki 2bd80a7335 Fix for ticket 291 - preprocessor: better handling of defines
http://apps.sourceforge.net/trac/cppcheck/ticket/291
2009-05-17 18:51:29 +02:00
Reijo Tomperi 36cdac1b96 Fix ticket #312 (division by pointer value causes wrong tokenizing)
http://apps.sourceforge.net/trac/cppcheck/ticket/312
2009-05-14 22:53:49 +03:00
Reijo Tomperi e5e82274dc Fix ticket #306 (Invalid multi-line comment produces cryptic internal error)
http://apps.sourceforge.net/trac/cppcheck/ticket/306
2009-05-13 22:18:02 +03:00
Reijo Tomperi 997a784bb6 Added TODO test case TestPreprocessor::multiline_comment
Made tokenizer to printout token list in case of syntax error, if debug is used
2009-05-13 00:01:53 +03:00
Reijo Tomperi e83db8ac7b Fix ticket #288 (Tokenizer::syntaxError should use error logger instead of std::cout)
http://apps.sourceforge.net/trac/cppcheck/ticket/288
2009-05-11 22:52:04 +03:00
Reijo Tomperi fede702bf5 Fix ticket #302 (White space between "\" and newline not handled correctly)
http://apps.sourceforge.net/trac/cppcheck/ticket/302
2009-05-11 21:12:29 +03:00
Daniel Marjamäki 15bbd4613e Updated version to 1.32 2009-05-10 12:31:47 +02:00
Daniel Marjamäki 1ae24066fe null pointer dereferencing: check that its a pointer that is dereferenced to avoid false positives when using classes that behave almost like pointers (#295) 2009-05-10 08:43:16 +02:00
Daniel Marjamäki daea0547fa memory leaks: Handling exit (#297) 2009-05-10 08:01:38 +02:00
Reijo Tomperi f2a5527e60 Fix #289 (if() is not properly tokenized)
http://apps.sourceforge.net/trac/cppcheck/ticket/289
2009-05-09 23:12:14 +03:00
Reijo Tomperi e7cff4bc43 Apply #296 ([PATCH] cppcheck leak memory when -j option uses)
http://apps.sourceforge.net/trac/cppcheck/ticket/296
2009-05-09 22:40:22 +03:00
Reijo Tomperi 63da926ed2 Fix ticket #294 (### Error: Invalid number of character ()
http://apps.sourceforge.net/trac/cppcheck/ticket/294
2009-05-09 22:32:29 +03:00
Daniel Marjamäki e9eba16053 templates: fixed problem when for example calling static member function in a template class (#293) 2009-05-09 08:02:59 +02:00
Daniel Marjamäki dae530d8de template: no usage -> no expansion (#292) 2009-05-08 16:19:22 +02:00
Reijo Tomperi dd8b738f7f Initial fix for ticket #283 (segmentation fault when checking xterm sources)
http://apps.sourceforge.net/trac/cppcheck/ticket/283
It should print out error message now instead of crashing. Cleanup is needed.
2009-05-07 23:17:29 +03:00
Daniel Marjamäki 917a48cd65 templates: don't expand forward declarations for templates 2009-05-07 16:05:07 +02:00
Reijo Tomperi a12fd4ff5e Fix ticket #282 (protected destructor - false positive)
http://apps.sourceforge.net/trac/cppcheck/ticket/282
2009-05-06 23:22:26 +03:00
Daniel Marjamäki 80fe293c19 stl: removed false positives for STL buffer overruns. Bailing out when it can't be checked if the index is ok or not. (#285) 2009-05-06 21:55:04 +02:00
Daniel Marjamäki a32114b15c memleak: removed false positives for pclose (#286) 2009-05-06 21:31:31 +02:00
Daniel Marjamäki 51beadd81c templates: instantiations in a template class (#280) 2009-05-06 21:03:11 +02:00
Daniel Marjamäki feba87187a templates: speedup by breaking out inner loops (#257) 2009-05-05 20:16:57 +02:00
Daniel Marjamäki fd0e592767 Preprocessor: Handling newlines when using # to stringify parameters (#281) 2009-05-05 17:19:06 +02:00
Daniel Marjamäki 96ebf343f1 speedup: made the token simplifications a little faster 2009-05-03 21:32:22 +02:00
Daniel Marjamäki 7a8b980627 templates: extracted the template simplification into a separate function 2009-05-03 21:23:47 +02:00
Reijo Tomperi 0f59ef9064 Fix #276 (simplification: Variable value)
http://apps.sourceforge.net/trac/cppcheck/ticket/276
2009-05-03 21:57:27 +03:00
Reijo Tomperi cb209bbd41 Fix #279 (Refactoring: replace and remove Token::aaaa , Token::aaaa0 and Token::aaaa1)
http://apps.sourceforge.net/trac/cppcheck/ticket/279
2009-05-03 21:10:59 +03:00
Daniel Marjamäki c9eab77683 varid: speedup of the algorithm for setting variable ids 2009-05-03 14:31:54 +02:00
Daniel Marjamäki f6d6a3855e varid: updated handling of variable id for class variables (#26) 2009-05-03 13:50:26 +02:00
Reijo Tomperi e825de1450 Fix possible bug caused by previous commit. 2009-05-03 14:17:31 +03:00
Reijo Tomperi b29673f4a2 Fix slowlyness, caused by one of the previous commits. 2009-05-03 14:07:32 +03:00
Daniel Marjamäki 3819c66f36 stl: Fixed ticket #277 - dereferencing an iterator that has been erased 2009-05-03 07:37:39 +02:00
Daniel Marjamäki 6a009f7084 tokenizer: give class member variables varId (#26) 2009-05-02 22:57:18 +02:00
Daniel Marjamäki e26c999020 Refactoring: Using MathLib for converting string to number
commit beacd5793f9e9987432a20ac39a76ae6c2c8babd
Author: Daniel Marjamäki <hyd_danmar@users.sourceforge.net>
Date:   Sat May 2 10:44:18 2009 +0200

    memleak: using mathlib

commit 4d28172a5d88cc2cbe5ed94a4e4fdbd0dd4bb5e1
Author: Daniel Marjamäki <hyd_danmar@users.sourceforge.net>
Date:   Sat May 2 10:35:06 2009 +0200

    tokenizer: using the MathLib for converting string to number

commit 4e4b95b3554c9c6d121efeb39741204b1621b1a3
Author: Daniel Marjamäki <hyd_danmar@users.sourceforge.net>
Date:   Sat May 2 10:28:39 2009 +0200

    CheckOther: Using mathlib
2009-05-02 10:45:15 +02:00
Daniel Marjamäki 6f4c5ab71c refactoring: Replaced 'aaaa' 2009-05-01 22:41:55 +02:00
Reijo Tomperi 26c193f9bc Fix ticket #204 (false positive::memory leak with --all when free is guarded by simple if)
http://apps.sourceforge.net/trac/cppcheck/ticket/204
2009-05-01 21:31:07 +03:00
Reijo Tomperi bc4fb21325 tokenizer: simplify assembler (#270), fix _asm also.
http://apps.sourceforge.net/trac/cppcheck/ticket/270
2009-05-01 20:53:08 +03:00
Reijo Tomperi a46de47158 Fix ticket #196 (False positive: Resource leak)
http://apps.sourceforge.net/trac/cppcheck/ticket/196
2009-05-01 14:39:57 +03:00
Daniel Marjamäki e37da13c26 tokenizer: simplify assembler (#270) 2009-05-01 12:39:14 +02:00
Reijo Tomperi 67832d89f7 Astyle fix 2009-05-01 13:08:19 +03:00
Reijo Tomperi 241ad528a9 Fix ticket #275 Simplify if( a == 0 ), if( 0 == a ) into if( !a )
http://apps.sourceforge.net/trac/cppcheck/ticket/275
2009-05-01 13:07:10 +03:00
Reijo Tomperi 34540fee04 Fix partially ticket #196 False positive: Resource leak
And add few test cases related to it. Move one failing test behind TODO
http://apps.sourceforge.net/trac/cppcheck/ticket/196
2009-05-01 12:28:33 +03:00
Daniel Marjamäki 6d53343d32 class checking: only check class assignments if the --all has been given 2009-05-01 07:36:35 +02:00
Daniel Marjamäki 534d0e9939 class checking: Checking that vectors/lists/strings etc are modified in the assignment function 2009-05-01 07:28:58 +02:00
Reijo Tomperi 7e5c32b7f4 Fix ticket #269 (Incorrect variable id, when delete is used.)
http://apps.sourceforge.net/trac/cppcheck/ticket/269
2009-04-29 22:45:57 +03:00
Daniel Marjamäki ad4c7993d1 stl: checking that iterator is used against a single container 2009-04-29 20:16:04 +02:00
Daniel Marjamäki f9795988eb checkstl: Check for invalid pointer to vector element 2009-04-28 21:18:02 +02:00
Daniel Marjamäki bb154da394 memory leaks: handling std::auto_ptr (#266) 2009-04-28 20:01:35 +02:00
Daniel Marjamäki 67eb54c4c0 Merge branch 'abc' 2009-04-27 21:29:29 +02:00
Daniel Marjamäki b49997e69d bail out instead of crash when parsing unicode code (#207) 2009-04-27 21:29:03 +02:00
Reijo Tomperi d8f6636673 Improve fix to ticket #261: Allow macro definition to have uncoupled double quote.
http://apps.sourceforge.net/trac/cppcheck/ticket/261
2009-04-26 22:19:08 +03:00
Daniel Marjamäki 7b58e09a07 Preprocessor: Report correct file and line in message 'No pair for character..' (#261) 2009-04-26 11:05:32 +02:00
Daniel Marjamäki ebd15cec0f push_back: updated the checking of push_back (#263) 2009-04-25 17:14:02 +02:00
Daniel Marjamäki 49430afabe varid: Set variable id for stl containers and iterators 2009-04-25 16:55:00 +02:00
Reijo Tomperi 347b8a2de8 astyle fix 2009-04-23 23:53:01 +03:00
Daniel Marjamäki 8e15a9e79d xml generator: handle '<' and '>' (#263) 2009-04-23 21:59:26 +02:00
Reijo Tomperi 14eff64194 Fix ticket #258 (segmentation fault)
http://apps.sourceforge.net/trac/cppcheck/ticket/258
2009-04-20 21:38:05 +03:00
Daniel Marjamäki ca8f25fced return pointer to local array: fixed false positive when return value is converted to for instance a std::string (#255) 2009-04-19 16:47:54 +02:00
Daniel Marjamäki 7cddc52d8f mathlib: Fixed todo 3/2=1 2009-04-16 22:06:17 +02:00
Reijo Tomperi 23f00e64cb Fix ticket #257 (Improve speed of template tokenizing)
http://apps.sourceforge.net/trac/cppcheck/ticket/257
2009-04-14 23:21:52 +03:00
Daniel Marjamäki 3c3a56bfca private functions: don't report false positives when using initialization lists (#254) 2009-04-14 21:46:13 +02:00
Daniel Marjamäki 7750f327ff STL boundries: added new check written by Bill Eggert (#247) 2009-04-13 17:48:13 +02:00
Reijo Tomperi 9c9e920829 Fix ticket #252 (Fix --style warnings in cppcheck)
http://apps.sourceforge.net/trac/cppcheck/ticket/252
2009-04-13 12:02:21 +03:00
Daniel Marjamäki 8533e112fe updated version to 1.31 2009-04-12 19:54:15 +02:00
Reijo Tomperi 1f53fb7149 Fix ticket #248 (STL erase check broken?)
http://apps.sourceforge.net/trac/cppcheck/ticket/248
2009-04-10 14:27:36 +03:00
Daniel Marjamäki e72a38aaa8 mathlib: Added licence text 2009-04-09 16:17:59 +02:00
Daniel Marjamäki 6fb18b3ddc simplify calculations: Don't simplify division with 0 2009-04-06 19:43:54 +02:00
Daniel Marjamäki 638d18cfc8 tokenize: use mathlib when simplifying calculations (ticket: 236) 2009-04-06 19:23:30 +02:00
Daniel Marjamäki 97f5380a2c added testing for mathlib 2009-04-06 19:08:13 +02:00
Daniel Marjamäki f0d870c52d Added math library that was created by hoangtuansu 2009-04-06 18:27:14 +02:00
Reijo Tomperi 51d97fa831 Fix ticket #212 (Tokenizer: Handle L "text")
http://apps.sourceforge.net/trac/cppcheck/ticket/212
2009-04-05 22:21:38 +03:00
Reijo Tomperi 051f2929b5 Fix ticket #244 (Headers from included file are searched from wrong path)
http://apps.sourceforge.net/trac/cppcheck/ticket/244
2009-04-05 21:14:02 +03:00
Reijo Tomperi 11858129d0 Fix ticket #243 (boundary checking)
http://apps.sourceforge.net/trac/cppcheck/ticket/243
2009-04-04 21:05:48 +03:00
Reijo Tomperi 7a11f0e61f Fix ticket #242 (Preprocessor: Bail out on failure instead of terminating the program)
http://apps.sourceforge.net/trac/cppcheck/ticket/242
2009-04-03 22:09:12 +03:00
Reijo Tomperi 3b0643a000 Fix some potential null pointer crashes 2009-04-03 14:55:36 +03:00
Daniel Marjamäki ebee7928e2 operator=: changed error message when variable is not assigned 2009-03-31 19:00:56 +02:00
Reijo Tomperi 14bdf1ee62 Fix ticket #239 (missing function implementation in namespace causes crash)
http://apps.sourceforge.net/trac/cppcheck/ticket/239
2009-03-31 00:59:33 +03:00
Daniel Marjamäki 263c5b9e5a division with zero => division by zero 2009-03-29 20:27:10 +02:00
Daniel Marjamäki d7aee72fcd zero division: it's an error 2009-03-29 18:47:05 +02:00
Daniel Marjamäki e45bb20f92 tokenizer: don't replace sizeof when size can't be determined (#233) 2009-03-29 16:36:34 +02:00
Reijo Tomperi bd66f12e60 astyle fix 2009-03-28 23:11:03 +02:00
Gianluca Scacco c88a362893 Fixed ticket #228: false positive with usage of an auto-variable 2009-03-28 21:47:38 +01:00
Daniel Marjamäki 6f7f8c4b4f Tokenizer: Don't treat typedefs as variable declarations (#234) 2009-03-28 21:07:33 +01:00
Daniel Marjamäki 447c830e8f performance enhancement (patch submitted by davidmiller in ticket 231) 2009-03-28 20:33:55 +01:00
Daniel Marjamäki 4059a2ad05 added check for zero division. The code was written by Nguyen Duong Tuan 2009-03-28 07:49:47 +01:00
Daniel Marjamäki c0b608059a possible null pointer dereference after a while-loop 2009-03-27 17:19:34 +01:00
Daniel Marjamäki 063f59c86c moved checks back to style (where they used to be) 2009-03-27 15:55:14 +01:00
Daniel Marjamäki 4eeac1f364 tokenizer: fix segmentation fault if end of token list is reached 2009-03-27 15:12:49 +01:00
Daniel Marjamäki c74da7bab9 variable id: give std::string variables an id 2009-03-25 18:10:03 +01:00
Daniel Marjamäki 8db1ac8c5d astyle formatting 2009-03-25 07:25:33 +01:00
Daniel Marjamäki b9f4a773b8 Buffer overrun: Added check to detect when size argument to memset is a char constant (#213) 2009-03-25 07:25:10 +01:00
Daniel Marjamäki 9f3634412e simplify tokens (known variable values in conditions) 2009-03-25 07:10:17 +01:00
Gianluca Scacco a66cf8b20f Fixed Ticket #202: Return of the address of an auto-variable 2009-03-24 21:53:46 +01:00
Daniel Marjamäki afcaa30b51 Fixed ticket 216 (False positive: variable scope) 2009-03-24 20:59:56 +01:00
Daniel Marjamäki 6c1af7e5e6 register CheckClass 2009-03-24 20:47:43 +01:00
Daniel Marjamäki 586037ed11 fixed testcase 2009-03-24 20:28:44 +01:00
Daniel Marjamäki da0b571aee Fixed ticket 197 (false positive: condition is always true/false) 2009-03-24 19:49:01 +01:00
Daniel Marjamäki 6580e0eb21 fixed snprintf false positive (#210) 2009-03-24 18:43:39 +01:00
Daniel Marjamäki 65070cc067 Simplify if conditions more.. simplifyIfAssign + simplifyIfNot 2009-03-24 18:23:21 +01:00
Daniel Marjamäki 44c952873e Fixed ticket 205 (False positive: char variable used in bit operation) 2009-03-23 19:04:51 +01:00
Daniel Marjamäki 06776c6ac7 Fixed the testcase TestMemleak::realloc3 2009-03-23 18:34:59 +01:00
Daniel Marjamäki 7905cbc5e7 simplify tokens: move assignment out from condition (Ticket #201) 2009-03-23 18:20:56 +01:00
Daniel Marjamäki a87419f59b Fixed Ticket 199 (The error messages generated by 'unused functions' are wrong) 2009-03-22 18:57:53 +01:00
Daniel Marjamäki 09457194d9 astyle code formatting 2009-03-22 08:23:20 +01:00
Daniel Marjamäki 276c0a7b2f Merge branch 'master' of git@github.com:danmar/cppcheck 2009-03-22 08:20:41 +01:00
Daniel Marjamäki e017d5a079 refactoring - added 'getErrorMessages' to all check classes 2009-03-22 08:20:15 +01:00
Gianluca Scacco abda874944 Refactoring of CheckAutoVariables 2009-03-22 08:01:48 +01:00
Daniel Marjamäki 0a71771c6a improved the Tokenizer::setVarId to handle function parameters better 2009-03-21 21:58:39 +01:00
Daniel Marjamäki 6fc66d3e2c refactoring error messages 2009-03-21 21:33:27 +01:00
Daniel Marjamäki 729b2c1706 Fixed 188 (Return of auto variable address), applied patched submitted by gscacco 2009-03-21 18:36:41 +01:00
Daniel Marjamäki da06c12925 refactoring error messages 2009-03-21 18:31:28 +01:00
Daniel Marjamäki 468ed653e2 refactoring error messages 2009-03-21 17:58:13 +01:00
Daniel Marjamäki aee39ae929 refactoring - handling the stlOutOfBounds error message the new way 2009-03-21 14:20:10 +01:00
Daniel Marjamäki 001cb0a7ec refactoring - added a function getErrorMessages that will be used to get a list of error messages 2009-03-21 14:07:51 +01:00
Daniel Marjamäki bcad5afb26 refactoring - fixed the unit tests 2009-03-21 14:02:58 +01:00
Daniel Marjamäki 170f817a19 refactoring: there are now 2 functions for running checks. 'runChecks' and 'runSimplifiedChecks' 2009-03-21 07:53:23 +01:00
Daniel Marjamäki 0ed425d105 refactoring 2009-03-20 20:21:54 +01:00
Daniel Marjamäki 272d455e2d refactoring: generate error message in the class 2009-03-20 20:09:44 +01:00
Daniel Marjamäki 8e4af409e7 refactoring: Added a function to the Check base class that allows easier error reporting 2009-03-20 19:52:18 +01:00
Daniel Marjamäki ccfdbfca58 improved Token::tokAt to handle negative argument too 2009-03-20 18:50:11 +01:00
Daniel Marjamäki 9f1c3cc535 refactoring the rest of the classes 2009-03-20 18:16:21 +01:00
Daniel Marjamäki 21dff96e7b refactoring checkbufferoverrun 2009-03-20 17:35:53 +01:00
Daniel Marjamäki 5914af4481 refactoring CheckClass 2009-03-20 17:30:24 +01:00
Daniel Marjamäki e6e778e45f refactoring 2009-03-20 17:15:51 +01:00
Daniel Marjamäki 5565be0c74 refactoring: minor cleanup 2009-03-19 21:20:08 +01:00
Daniel Marjamäki d4fdfc0f5a astyle formatting 2009-03-19 20:53:23 +01:00
Daniel Marjamäki dfe867fded added checkautovariables and integrated it into cppcheck 2009-03-19 20:52:18 +01:00
Daniel Marjamäki 16b6a7a605 refactoring: loop through all Check instances and execute the runChecks function 2009-03-19 19:24:13 +01:00
Daniel Marjamäki 47d7ff983f refactoring: removed the changes to the error handling 2009-03-19 18:39:20 +01:00
Daniel Marjamäki a573c62cd5 refactoring: first step - started with checkstl 2009-03-18 22:40:38 +01:00
Daniel Marjamäki f37dd4f143 Fixed ticket 184 (Tokenizer - Simplification: Split up variable declarations) 2009-03-18 20:32:05 +01:00
Reijo Tomperi 2fb4c52728 Fixed tokenizer: "return - 2 ;" --> "return -2 ;" 2009-03-18 20:48:06 +02:00
Reijo Tomperi ca055dc830 Fix ticket #191 (semicolon after #endif stop tokenizing of function)
http://apps.sourceforge.net/trac/cppcheck/ticket/191
2009-03-18 01:10:26 +02:00
Reijo Tomperi 819953006c Astyle fix 2009-03-17 22:00:27 +02:00
Daniel Marjamäki 9c057c707b tokenize negative numbers into a single token 2009-03-17 20:50:06 +01:00
Reijo Tomperi 2a3535c04f Fix ticket #186 (runtime error when checking code that has a namespace)
http://apps.sourceforge.net/trac/cppcheck/ticket/186
2009-03-17 20:16:15 +02:00
Daniel Marjamäki 9fe8ae452a Refactoring the code for the templates handling 2009-03-17 18:55:28 +01:00
Reijo Tomperi b3dd9e699b --debug flag can be used to printout token list (for development purposes) 2009-03-16 23:31:52 +02:00
Reijo Tomperi c413c8d4b3 Fix ticket #179 (preprocessor issues)
http://apps.sourceforge.net/trac/cppcheck/ticket/179
2009-03-16 23:20:55 +02:00
Daniel Marjamäki 0cc7672673 Fixed Ticket #82 (detect buffer overrun; dynamic memory) 2009-03-16 18:11:09 +01:00
Reijo Tomperi 21b687b301 Improved tokenizer to handle '#' better. Previously everything after # was combined into a single token,
now # is considered more like an alphabet, with few exceptions, e.g. "##" tokens.
2009-03-15 23:09:27 +02:00
Daniel Marjamäki a6ad972aad Fix Ticket 180 (Templates: Expanding member functions that are not implemented inline) 2009-03-15 20:03:29 +01:00
Daniel Marjamäki 9b06b22053 templates: replace constructor/destructor names when expanding template classes 2009-03-15 17:07:05 +01:00
Reijo Tomperi ca7870af33 Fix ticket #177 (Tokenizer doesn't add braces around if-scope)
http://apps.sourceforge.net/trac/cppcheck/ticket/177
2009-03-15 14:44:57 +02:00
Reijo Tomperi bb3316a45b Fix ticket #181 (#pragma causes wrong line numbers)
http://apps.sourceforge.net/trac/cppcheck/ticket/181
2009-03-15 14:23:12 +02:00
Reijo Tomperi c385b3e045 Improve creation of link() for Token class. Tokenizer::simplifyTokenList() should now return
code where Token::link() actually works.
2009-03-15 01:39:45 +02:00
Daniel Marjamäki 6eadbaae04 templates: better handling of templates with multiple type arguments 2009-03-14 21:26:32 +01:00
Daniel Marjamäki 75d0e8687b Memory leak: handle allocation in deallocation list 2009-03-14 20:19:36 +01:00
Daniel Marjamäki 02df14ec37 Memory leaks: Refactoring to use Tokenizer::FindClassFunction. Enabled test case, the memory leak is now detected 2009-03-14 18:21:37 +01:00
Daniel Marjamäki 01c39daa13 Merge branch 'ref' 2009-03-13 22:39:47 +01:00
Daniel Marjamäki daa911daeb refactoring: moved 'FindClassFunction' from CheckClass to Tokenizer 2009-03-13 22:28:44 +01:00
Reijo Tomperi 116e940214 Fixed ticket #169 (Add Token::link())
http://apps.sourceforge.net/trac/cppcheck/ticket/169
2009-03-13 23:25:56 +02:00
Reijo Tomperi 3c4704a00c Fix ticket #151 (Handling of namespaces)
http://apps.sourceforge.net/trac/cppcheck/ticket/151
2009-03-13 01:07:05 +02:00
Daniel Marjamäki 4c28882a12 expanding template classes 2009-03-12 22:17:42 +01:00
Daniel Marjamäki f96e2deb1a uninitialized const pointer member variables 2009-03-12 21:33:10 +01:00
Daniel Marjamäki 1514e65464 astyle style fixes 2009-03-11 19:14:45 +01:00
Daniel Marjamäki 77cf2213fe templates: simplify template functions with 1 type argument 2009-03-11 18:50:24 +01:00
Daniel Marjamäki eac29d151c made the Tokenizer::simplifyCasts more generic 2009-03-10 21:26:08 +01:00
Daniel Marjamäki c7c13ce3c1 Fixed ticket 134 (memory leak not detected) caused by wrong checking if code is inside class function or not 2009-03-10 20:44:24 +01:00
Daniel Marjamäki cd54a0ed3b Fixed ticket 147 (Invalid line number for error message) 2009-03-09 20:29:25 +01:00
Daniel Marjamäki f39e117921 removed unused private function CheckSecurity::eraseCheckLoop 2009-03-09 20:09:06 +01:00
Daniel Marjamäki f8cd34198b simplify casts 2009-03-09 19:47:21 +01:00