Daniel Marjamäki
e36994f54b
astyle formatting
2009-07-22 18:48:42 +02:00
Daniel Marjamäki
6fecd858e3
Fixed #469 (Preprocessor should read open configurations that are defined within the file)
2009-07-22 18:47:50 +02:00
Daniel Marjamäki
1d514e1afe
Fixed #497 (Templates are not expanded correctly)
2009-07-22 13:29:42 +02:00
Daniel Marjamäki
3243933c90
Fixed #494 (False positives of checking leaks struct members)
...
Better handling of function calls
2009-07-22 08:30:51 +02:00
Daniel Marjamäki
ba36c9426b
null pointers: better checking when dereferencing pointer and then checking if it is null ( #485 )
2009-07-21 17:00:11 +02:00
Daniel Marjamäki
6f646246ee
dereferencing deallocated memory: it is ok to take the address to deallocated memory but it is not ok to dereference the address
2009-07-21 13:04:13 +02:00
Daniel Marjamäki
45f8560537
invalid pointer usage: broke out CheckOther::invalidPointer from the CheckOther::nullPointer ( #485 )
2009-07-21 12:09:58 +02:00
Daniel Marjamäki
ce595dd5c7
Merge branch 'master' of git@github.com:danmar/cppcheck
2009-07-21 07:41:43 +02:00
Reijo Tomperi
973bb164ea
Fix ticket #486 (C-style pointer casting misses const pointers)
...
http://sourceforge.net/apps/trac/cppcheck/ticket/486
2009-07-20 22:52:27 +03:00
Daniel Marjamäki
0e208eb52f
null pointer dereferencing: fixed another false positive ( #485 )
2009-07-20 19:59:55 +02:00
Daniel Marjamäki
05a1c50ff2
null pointer dereferencing: removed a few false positives in the new check that I added ( #485 )
2009-07-20 19:30:33 +02:00
Daniel Marjamäki
b7ba49114c
Fixed #485 (detect when code is checking for null after dereferencing)
2009-07-20 18:53:41 +02:00
Daniel Marjamäki
74699cab66
memory leak for struct member: made the checking more sensitive. Skip bail-out execution paths were the member is properly deallocated
2009-07-20 14:39:24 +02:00
Daniel Marjamäki
ddaea3244d
memleak: implemented simple checking for leaking struct members
2009-07-19 16:51:31 +02:00
Slava Semushin
d961e4b5c1
test/testrunner.cpp: fixed exit code when count of fails tests equals to 256.
...
When 256 tests fails return code was 0 and it was wrong. Now exit code
may be only 0 or 1 and not show how many tests fails.
Thanks to aggro80@ for pointing to this!
2009-07-19 03:12:55 +07:00
Daniel Marjamäki
ffac9281c4
astyle formatting
2009-07-18 20:35:22 +02:00
Slava Semushin
2ba0897ecb
src/checkmemoryleak.cpp: added fchmod() function to white list.
2009-07-18 23:48:48 +07:00
Slava Semushin
d3490abd64
Finally fixed ticket #284 (style check: redundant condition improvement)
...
http://sourceforge.net/apps/trac/cppcheck/ticket/284
2009-07-18 21:42:08 +07:00
Slava Semushin
d04eeb4fd4
Fixed ticket #481 (testrunner should exit with non-zero status if one of tests fails)
...
http://sourceforge.net/apps/trac/cppcheck/ticket/481
2009-07-18 19:08:10 +07:00
Slava Semushin
a0a526a205
Fixed ticket #464 (resource leak not detected when getc is used on the file handle)
...
http://sourceforge.net/apps/trac/cppcheck/ticket/464
2009-07-18 18:32:55 +07:00
Slava Semushin
53c120c701
Fixed ticket #479 (varId not assigned to reference to standart container)
...
http://sourceforge.net/apps/trac/cppcheck/ticket/479
2009-07-18 17:41:46 +07:00
Slava Semushin
aab06eaeab
Fixed ticket #477 (Bug in Token::Match() during process TestStl::pushback3)
...
http://sourceforge.net/apps/trac/cppcheck/ticket/477
2009-07-18 17:06:51 +07:00
Daniel Marjamäki
2ccc01f5ed
tokenizer: improved the Tokenizer::simplifyIfNot
2009-07-18 10:18:46 +02:00
Slava Semushin
5dea30519c
Fixed ticket #459 (false positive::Member variable not initialized in constructor)
...
http://sourceforge.net/apps/trac/cppcheck/ticket/459
2009-07-17 23:50:49 +07:00
Kimmo Varis
40ccd4d1ac
Add QMake project files for core and tests.
...
Ticket #472 (QMake project file to build cppcheck core).
2009-07-14 14:36:05 +03:00
Daniel Marjamäki
456c20b705
fixed todo test case - detect iterator usage after push_front|push_back
2009-07-14 12:40:47 +02:00
Daniel Marjamäki
69b1df3bb8
tokenizer: simplify the '?:' operator
2009-07-14 12:06:38 +02:00
Daniel Marjamäki
f4de77cefc
simplify tokens: simplify test cases
2009-07-14 11:37:26 +02:00
Daniel Marjamäki
17008879ac
minor refactoring: header cleanup. use forward declarations instead of includes
2009-07-13 19:11:31 +02:00
Daniel Marjamäki
18f9e05f5a
refactoring: Renamed checking classes
2009-07-13 16:00:15 +02:00
Kimmo Varis
6393498966
Astyle fixes.
2009-07-13 16:51:35 +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
03f3ee62a0
cleanup: removed deprecated files. security checking and errmsg
2009-07-12 19:18:38 +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
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
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
0ea09b1cb6
templates: simplified a todo test case by removing a redundant function from the code
2009-07-08 09:38:59 +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
7b2f6b6173
addon to previous commit - changed ASSERT_EQUALS to TODO_ASSERT_EQUALS for the todo test case
2009-07-06 12:38:04 +02:00
Daniel Marjamäki
5efb834f36
Memory leaks: Added a simple todo test case
2009-07-06 12:33:31 +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
Reijo Tomperi
290aefaa3d
TODO Test case TestSimplifyTokens::remove_comma added
2009-07-04 18:06:25 +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
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
13ca5f89be
added test case
2009-06-23 18:29:43 +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
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
453a5cdd47
Fixed ticket #411 (false positive: resource leak in while loop)
2009-06-20 13:58:30 +02:00
Daniel Marjamäki
13b8f10906
refactoring testcases for Tokenizer::simplifyAddBraces
2009-06-20 13:20:51 +02: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
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
Reijo Tomperi
c28cd3f82e
astyle fix
2009-06-18 21:05:42 +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
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
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
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
4dd3835617
Embed errout.str() into ASSERT_EQUALS() call.
...
Get rid of useless variables.
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
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
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
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
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