Reijo Tomperi
b6999d010f
Fix #812 (False positive: sprintf with "%.4s" with --all)
...
http://sourceforge.net/apps/trac/cppcheck/ticket/812
2009-10-11 22:07:18 +03:00
Reijo Tomperi
59aad35137
Fix #694 (False (possible error) Buffer overrun with %-1s)
...
ashim2009 did most of the work
http://sourceforge.net/apps/trac/cppcheck/ticket/694
2009-10-11 21:36:22 +03:00
Reijo Tomperi
1401e3f668
Fix #810 (false positive: Division with signed and unsigned operators)
...
http://sourceforge.net/apps/trac/cppcheck/ticket/810
2009-10-11 17:52:35 +03:00
Reijo Tomperi
ea36632ca3
Fix #808 (Segfault in Preprocessor)
...
http://sourceforge.net/apps/trac/cppcheck/ticket/808
2009-10-10 23:23:48 +03:00
Slava Semushin
237dcb9533
Fixed #809 (Tokenizer: don't replace sizeof() of unknown type to zero)
...
http://sourceforge.net/apps/trac/cppcheck/ticket/809
2009-10-10 19:26:03 +07:00
Daniel Marjamäki
b67fe861b8
Added testcase for #807 (cppcheck crashes scanning ruby 1.9.1)
2009-10-10 10:13:56 +02:00
Daniel Marjamäki
67f53661a9
Fixed #806 (cppcheck crashes scanning openssl)
2009-10-09 21:11:29 +02:00
Reijo Tomperi
a078c9353d
More test cases for sprintf counter
2009-10-08 17:36:00 +03:00
Reijo Tomperi
5eee9af974
sprintf counter improvements
2009-10-08 16:27:46 +03:00
Reijo Tomperi
ad5d87ee14
Fix #802 (possible null pointer dereference reported for reference)
...
http://sourceforge.net/apps/trac/cppcheck/ticket/802
2009-10-08 11:55:37 +03:00
Reijo Tomperi
014ad937cf
Optimize speed and fix one false positive with stl checks.
2009-10-07 23:38:21 +03:00
Reijo Tomperi
52ca36a6ed
Added more test cases for sprintf counter
2009-10-07 21:33:44 +03:00
Daniel Marjamäki
13e43b8710
Ashim Kapoor: updated the counter ( #694 )
2009-10-07 18:21:44 +02:00
Reijo Tomperi
fcd269dbf7
Refactoring: Moved some code into a new function.
...
Renamed count->countSprintfLength.
Added code to collect sprintf parameters.
Added a few TODO test cases.
2009-10-07 15:37:20 +03:00
Reijo Tomperi
8fc21dda27
Fix #801 (Tokenizer: Simplify sizeof for function parameters)
...
http://sourceforge.net/apps/trac/cppcheck/ticket/801
2009-10-07 12:05:44 +03:00
Reijo Tomperi
06dd66bff4
Fix #487 (Tokenizer: Simplify sizeof for string array and string pointer)
...
http://sourceforge.net/apps/trac/cppcheck/ticket/487
2009-10-07 11:08:53 +03:00
Reijo Tomperi
8472e58413
Refactored sizeof simplification and fixed one TODO assert.
2009-10-07 10:54:34 +03:00
Reijo Tomperi
d9ae2c171e
Detect referenced by value errors for std::map also.
2009-10-07 00:04:54 +03:00
Reijo Tomperi
ab762b1a00
Fix #388 (resource leak not detected, allocation through function call)
...
http://sourceforge.net/apps/trac/cppcheck/ticket/388
2009-10-06 23:14:32 +03:00
Reijo Tomperi
2e69d50458
Fix #796 (segmentation fault while scanning)
...
http://sourceforge.net/apps/trac/cppcheck/ticket/796
2009-10-06 21:03:15 +03:00
Daniel Marjamäki
36fb24b1a5
memory leaks: don't write errors for static member variables
2009-10-06 18:25:00 +02:00
Daniel Marjamäki
c3d56c1d13
Fix #797 (false positive: variable scope when using function call)
2009-10-06 17:45:28 +02:00
Reijo Tomperi
d598bed1c6
Fix #575 (Array index out of bounds check: get address of one-past-the-end array is legal)
...
http://sourceforge.net/apps/trac/cppcheck/ticket/575
2009-10-06 14:50:27 +03:00
Reijo Tomperi
c55140d4cd
Fix #580 (double free not found)
...
http://sourceforge.net/apps/trac/cppcheck/ticket/580
2009-10-06 12:44:53 +03:00
Reijo Tomperi
13fbd616da
Moved some test cases from testtokenize into testsimplifytokens and added one TODO case.
2009-10-06 12:40:50 +03:00
Reijo Tomperi
272f0d3be5
Fix #795 (Preprocessor: Incorrect handling of #if (A) || (B))
...
http://sourceforge.net/apps/trac/cppcheck/ticket/795
2009-10-06 11:47:36 +03:00
Reijo Tomperi
0a7da96cb6
Fix #765 (divsion by zero not detected in std::cout stream)
...
http://sourceforge.net/apps/trac/cppcheck/ticket/765
2009-10-06 09:14:59 +03:00
Reijo Tomperi
1eba4b374f
Fix #794 (Floating point exception on CheckBufferOverrun)
...
http://sourceforge.net/apps/trac/cppcheck/ticket/794
2009-10-05 23:19:44 +03:00
Reijo Tomperi
edb28d2856
Fix #365 (Improve simplifyQuestionMark() in tokenize.cpp)
...
http://sourceforge.net/apps/trac/cppcheck/ticket/365
2009-10-05 17:34:38 +03:00
Reijo Tomperi
6901bcae79
Fix #771 (False positive. Null pointer dereference in a switch case)
...
http://sourceforge.net/apps/trac/cppcheck/ticket/771
2009-10-05 14:46:38 +03:00
Reijo Tomperi
036f3894f1
Fix simplifyRedundantParanthesis() to work after '}'
2009-10-05 14:30:05 +03:00
Reijo Tomperi
5a0a5422c3
Fix #776 (Tokenizer: remove useless brackets around variable assignment)
...
http://sourceforge.net/apps/trac/cppcheck/ticket/776
2009-10-05 14:22:35 +03:00
Reijo Tomperi
fc684d7b5a
Fix #778 (Tokenizer: impove simplification inside if())
...
http://sourceforge.net/apps/trac/cppcheck/ticket/778
2009-10-05 14:10:09 +03:00
Reijo Tomperi
1df8f38423
Fix #793 (Improve passedByValue check)
...
http://sourceforge.net/apps/trac/cppcheck/ticket/793
2009-10-05 11:59:28 +03:00
Reijo Tomperi
8bb812548c
Fix #777 (Tokenizer: double casting simplified incorrectly)
...
http://sourceforge.net/apps/trac/cppcheck/ticket/777
2009-10-05 00:12:12 +03:00
Reijo Tomperi
498beb7d9a
Fix #784 (Tokenizer: Simplify 2[a] -> a[2])
...
http://sourceforge.net/apps/trac/cppcheck/ticket/784
2009-10-04 23:33:41 +03:00
Daniel Marjamäki
23d8937661
Fixed #789 (false positive: resource leak reported when using for loop)
2009-10-04 19:58:41 +02:00
Daniel Marjamäki
ab18f1bd3c
Preprocessor: Minor fixes ( #772 )
2009-10-04 15:41:50 +02:00
Daniel Marjamäki
6b1fae75e5
Fixed #785 (False positive: resource leak of extern FILE*)
2009-10-04 14:24:41 +02:00
Daniel Marjamäki
af5a695f82
Fixed #727 (False positive: Resource leak when release is done inside function call)
2009-10-04 13:10:08 +02:00
Slava Semushin
6b0d364f57
Fixed #782 (Checks are missing test cases)
...
http://sourceforge.net/apps/trac/cppcheck/ticket/782
2009-10-04 15:05:58 +07:00
Daniel Marjamäki
ee1bcb728c
use '<' comparisons instead of '>' ( #610 )
2009-10-04 07:51:12 +02:00
Daniel Marjamäki
1a48f869c8
Fixed #772 (Preprocessor: #if(A) is not seen equal to #if A)
2009-10-04 07:25:30 +02:00
Daniel Marjamäki
4387071eb1
Fixed #733 (New check: locking & unlocking mutex and semaphore variables)
2009-10-03 21:46:22 +02:00
Slava Semushin
b0d8b6ca8b
Fixed #780 (Tokenizer: replace typedef for pointers to struct)
...
http://sourceforge.net/apps/trac/cppcheck/ticket/780
2009-10-03 22:02:23 +07:00
Slava Semushin
9983066f62
Fixed #770 (Tokenizer: Var id not set for static variables in some cases)
...
http://sourceforge.net/apps/trac/cppcheck/ticket/770
2009-10-03 17:05:07 +07:00
Reijo Tomperi
107895e8cc
TODO test cases TestTokenizer::vardec_static added
2009-10-02 17:28:30 +03:00
Daniel Marjamäki
57067f6627
memory leaks: refactoring unit tests
2009-10-01 22:25:59 +02:00
Daniel Marjamäki
e894e37131
Fixed #679 (False positive: Unused private function produced by exception specification)
2009-10-01 19:45:48 +02:00
Reijo Tomperi
b3ad712b61
Fix #421 (Memory leak not found when typeid() is used.)
...
http://sourceforge.net/apps/trac/cppcheck/ticket/421
2009-10-01 11:56:59 +03:00
Reijo Tomperi
4650e513e1
Fix #741 (False positive: Buffer overrun with -a when index increased in multiple locations)
...
http://sourceforge.net/apps/trac/cppcheck/ticket/741
2009-10-01 11:33:53 +03:00
Reijo Tomperi
d4a97eb2b4
Fix #419 (missleading buffer overrun)
...
http://sourceforge.net/apps/trac/cppcheck/ticket/419
2009-10-01 10:59:27 +03:00
Reijo Tomperi
39092150e2
Fix #763 (Tokenizer: Goto incorrectly simplified)
...
http://sourceforge.net/apps/trac/cppcheck/ticket/763
2009-10-01 10:25:32 +03:00
Daniel Marjamäki
e3e8224b4e
memory leaks: fixed TODO_ASSERT_EQUALS
2009-09-30 22:27:00 +02:00
Reijo Tomperi
f9871c2d54
Fix #745 (false positive: possible null pointer dereference , while)
...
http://sourceforge.net/apps/trac/cppcheck/ticket/745
2009-09-30 21:42:14 +03:00
Reijo Tomperi
ec44f8f6c7
Fix #744 (False positive: (possible error) Array index out of bounds)
...
http://sourceforge.net/apps/trac/cppcheck/ticket/744
2009-09-30 15:51:33 +03:00
Reijo Tomperi
6ed727564c
Fix #759 (Tokenizer: Incorrect var id when two variables with same name)
...
http://sourceforge.net/apps/trac/cppcheck/ticket/759
2009-09-30 14:40:10 +03:00
Reijo Tomperi
7852d38f54
Fix #761 (Tokenizer: typedef inside class is incorrectly simplified)
...
http://sourceforge.net/apps/trac/cppcheck/ticket/761
2009-09-30 14:35:00 +03:00
Reijo Tomperi
bb1a9a07e4
Fix #760 (Tokenizer: Goto not simplified)
...
http://sourceforge.net/apps/trac/cppcheck/ticket/760
2009-09-30 14:30:53 +03:00
Reijo Tomperi
500dedb8a3
Added TODO test cases: simplifyTypedef, simplifyTypedef2, simplifyTypedef3
2009-09-30 10:11:09 +03:00
Reijo Tomperi
724c78fb4d
Fix #750 (cppcheck wants variable outside do-loop to be only inside loop)
...
http://sourceforge.net/apps/trac/cppcheck/ticket/750
Fix #758 (False positive on variable scope with boost foreach)
http://sourceforge.net/apps/trac/cppcheck/ticket/758
2009-09-30 00:56:43 +03:00
Daniel Marjamäki
e5bc4a02ae
added a TODO_ASSERT_EQUALS for the counter
2009-09-29 20:50:22 +02:00
Reijo Tomperi
1b1047a5e4
Fix #757 (Change message: (style) The class 'KClass' has no constructor)
...
http://sourceforge.net/apps/trac/cppcheck/ticket/757
2009-09-29 21:27:17 +03:00
Reijo Tomperi
77d677dd59
TODO test case for count() added
2009-09-29 18:51:29 +03:00
Daniel Marjamäki
12b29e35ad
Ashim Kapoor: deal with backspace better ( #694 )
2009-09-29 17:02:19 +02:00
Reijo Tomperi
ededbfb10e
Fix comment in test case
2009-09-29 17:19:56 +03:00
Reijo Tomperi
63523316a2
Check nullpointer check is now executed without --style flag
...
Added TODO test case for nullpointer check
2009-09-29 16:38:05 +03:00
Reijo Tomperi
64f0f3b308
Fix #751 (if-condition considered redundant even with else-branch)
...
http://sourceforge.net/apps/trac/cppcheck/ticket/751
Fix also other issue with if(a.b) delete c.b;
Fix also other issue with if(a.b.c) delete a.b.c;
2009-09-29 00:18:40 +03:00
Daniel Marjamäki
311f6dc92e
Fixed #746 (False positive, Memory leak when goto is used)
2009-09-28 22:58:06 +02:00
Daniel Marjamäki
1427f0a2c7
memory leaks: fixed a TODO_ASSERT_EQUALS for a false positive
2009-09-28 22:41:45 +02:00
Reijo Tomperi
2d4404f030
Fix #754 (Tokenizer: transform modifier "signed" to "int")
...
http://sourceforge.net/apps/trac/cppcheck/ticket/754
Also fix int unsigned -> unsigned int
2009-09-28 21:25:05 +03:00
Slava Semushin
b9237db9a3
Fixed #753 (Tokenizer: don't simplify variables inside do {} while loop)
...
http://sourceforge.net/apps/trac/cppcheck/ticket/753
2009-09-28 22:15:31 +07:00
Daniel Marjamäki
a1e20290cd
Refactoring the unit testing of format strings
2009-09-27 22:13:15 +02:00
Daniel Marjamäki
a61abcbbc8
Fixed #728 (False positive, resource leak, when released in a loop)
2009-09-27 21:49:07 +02:00
Slava Semushin
e8c83613e4
Fixed #740 (False positive, buffer overrun with --all)
...
Regression since 07f41f4563
commit.
http://sourceforge.net/apps/trac/cppcheck/ticket/740
2009-09-27 22:50:59 +07:00
Slava Semushin
661ce78b69
Fixed #738 (False Buffer overrun with -a when i is increased by more than 1 inside loop body)
...
http://sourceforge.net/apps/trac/cppcheck/ticket/738
2009-09-27 22:14:51 +07:00
Reijo Tomperi
fdde2182b9
Fix GPL comments in all files. ">." was missing from the end.
2009-09-27 18:08:31 +03:00
Slava Semushin
07f41f4563
Fixed #714 (False Buffer overrun with -a when i is increased by more than 1 in a loop)
...
http://sourceforge.net/apps/trac/cppcheck/ticket/714
2009-09-27 21:12:46 +07:00
Reijo Tomperi
d1f3953cce
Fix #720 (String length for strings like this "\x61" is calculated wrong)
...
http://sourceforge.net/apps/trac/cppcheck/ticket/720
2009-09-27 17:04:10 +03:00
Slava Semushin
7e2208b5cc
Detects invalid iterator inside for() when postfix form of increment used.
2009-09-27 15:10:21 +07:00
Slava Semushin
5285635354
Fixed #735 (Detects invalid iterator after push_back() when iterator declared inside for())
...
http://sourceforge.net/apps/trac/cppcheck/ticket/735
2009-09-27 14:59:19 +07:00
Slava Semushin
acdbb20c99
Detect buffer overruns when ?: use as sprintf() argument.
2009-09-27 00:40:58 +07:00
Slava Semushin
19ed8e9311
Fixed #729 (False positive: Buffer overrun when ? is used to select parameter)
...
http://sourceforge.net/apps/trac/cppcheck/ticket/729
2009-09-27 00:06:54 +07:00
Slava Semushin
50a34b8a37
Fixed #731 (False positive, strcpy copying a buffer with a null character)
...
http://sourceforge.net/apps/trac/cppcheck/ticket/731
2009-09-26 22:58:14 +07:00
Daniel Marjamäki
3da779725d
Ashim Kapoor: handle %i,%f,%d,%x,%X better ( #694 )
2009-09-26 16:19:18 +02:00
Slava Semushin
a919f4541a
Fixed #732 (Tokenizer: Incorrect simplification)
...
Regression since 58a9e05697
commit.
http://sourceforge.net/apps/trac/cppcheck/ticket/732
2009-09-26 17:02:13 +07:00
Daniel Marjamäki
0b3a139b3b
Fixed #710 (False positive: invalid vector iterator after push_back)
2009-09-26 11:49:09 +02:00
Daniel Marjamäki
482a2f9d95
Fixed #718 (False positive, resource leak when break in a loop before exit)
2009-09-26 07:19:22 +02:00
Reijo Tomperi
6a63742dde
Fix #730 (False positive, buffer overrun with strncpy)
...
http://sourceforge.net/apps/trac/cppcheck/ticket/730
2009-09-25 23:32:18 +03:00
Daniel Marjamäki
6db95cd01c
Memory leaks: Added a TODO assertion for a false positive
2009-09-25 22:01:54 +02:00
Daniel Marjamäki
fd311e3c72
Fixed #678 (False positive: Unused private function produced by inner class)
2009-09-25 20:42:22 +02:00
Daniel Marjamäki
fe3c8cab9f
Ashim Kapoor: Added function that returns minimum size of format strings ( #694 )
2009-09-25 18:23:44 +02:00
Reijo Tomperi
2594f9b63f
Merge branch 'master' of git@github.com:danmar/cppcheck
2009-09-24 23:47:28 +03:00
Reijo Tomperi
16e55f4f89
Improve C style pointer cast detection
...
http://sourceforge.net/apps/trac/cppcheck/ticket/724
2009-09-24 23:46:08 +03:00
Daniel Marjamäki
cd94d50526
Memory leaks: fixed a TODO_ASSERT_EQUALS
2009-09-24 22:40:18 +02:00
Daniel Marjamäki
fa4e0a617e
Fixed #700 (False positive: Memory leak)
2009-09-23 22:42:07 +02:00
Reijo Tomperi
62ccda5677
Fix #713 (Tokenizer: Simplify 0L)
...
http://sourceforge.net/apps/trac/cppcheck/ticket/713
Use MathLib to handle other variations of 0.
2009-09-23 22:44:52 +03:00
Slava Semushin
313479cf8d
Tokenizer::simplifySizeof(): use Token::getStrLength().
...
Fixed wrong result when string contains escaped quotes.
Correction for 0e729fedc0
commit.
2009-09-23 23:02:53 +07:00
Reijo Tomperi
ef09f3475c
Fix #713 (Tokenizer: Simplify 0L)
...
http://sourceforge.net/apps/trac/cppcheck/ticket/713
2009-09-23 00:23:11 +03:00
Daniel Marjamäki
0e729fedc0
Fixed #716 (segmentation fault: sizeof string)
2009-09-22 20:50:00 +02:00
Slava Semushin
9d65a1ebe8
test/testdivision.cpp: fixed syntax errors in TestDivision::division8
...
Before testrunner complains:
### Unlogged error at Tokenizer::syntaxError: Invalid number of character ({)
### Unlogged error at Tokenizer::syntaxError: Invalid number of character ({)
### Unlogged error at Tokenizer::syntaxError: Invalid number of character ({)
Broken since 36c7108a28
commit where
test case was added.
2009-09-22 23:53:26 +07:00
Daniel Marjamäki
ad92aa4c20
Fixed #715 (False positive: Resource leak when exit() after if loop)
2009-09-22 18:09:29 +02:00
Daniel Marjamäki
faac5bccd6
Fixed #702 (If you see this, there is a bug - varid was 0)
2009-09-22 17:49:13 +02:00
Reijo Tomperi
4d2a8608a8
Fix #706 (false positive: invalid number of character ((), can't process file)
...
http://sourceforge.net/apps/trac/cppcheck/ticket/706
2009-09-21 23:27:06 +03:00
Reijo Tomperi
0fff5a23bf
Fix #701 (false positive: Invalid deallocation)
...
http://sourceforge.net/apps/trac/cppcheck/ticket/701
2009-09-20 23:38:32 +03:00
Reijo Tomperi
1c01dd64f3
Fix #703 (Tokenizer: Create links for [])
...
http://sourceforge.net/apps/trac/cppcheck/ticket/703
2009-09-20 23:13:06 +03:00
Slava Semushin
7236230228
Additional fix for better simplifying array declaration.
...
Pointed out by hyd_danmar@ in IRC.
Addressed to #696
2009-09-20 18:28:56 +07:00
Slava Semushin
5dee65048f
Fixed #690 (False positive: (possible error) Buffer overrun)
...
http://sourceforge.net/apps/trac/cppcheck/ticket/690
2009-09-20 17:54:19 +07:00
Slava Semushin
58a9e05697
Fixed #696 (Tokenizer: Simplify array declaration)
...
http://sourceforge.net/apps/trac/cppcheck/ticket/696
2009-09-20 17:28:15 +07:00
Reijo Tomperi
003e27c10e
Fix #667 (Preprocessor does not handle macro inside macro correctly)
...
http://sourceforge.net/apps/trac/cppcheck/ticket/667
2009-09-20 00:09:05 +03:00
Reijo Tomperi
661e4504cb
astyle fix
2009-09-19 14:21:50 +03:00
Daniel Marjamäki
7f2ca357b0
Fixed #673 (False positive: null pointer dereference when dynamic cast is used)
2009-09-19 10:54:10 +02:00
Slava Semushin
7a07f9343f
test/testtokenize.cpp: refactoring code.
...
- introduce and use simplifyKnownVariables() function
- don't append leading space to result string with tokens
No functional change.
2009-09-19 13:55:41 +07:00
Daniel Marjamäki
8f96c1992a
Fixed #688 (False positive in error category when --all is used)
2009-09-19 08:23:10 +02:00
Daniel Marjamäki
e4291a5966
Fixed #676 (The scope of variable can actually not be limited)
2009-09-17 21:05:12 +02:00
Daniel Marjamäki
1dc738b1ae
Fixed #677 (False positive: Unused private function produced by class member initialization)
2009-09-16 23:04:13 +02:00
Daniel Marjamäki
c5368581d9
Fixed by #675 (false positive: when operator is overloaded)
2009-09-16 20:07:03 +02:00
Reijo Tomperi
55fc473a00
Fix #684 (Tokenizer: (65536*72/100) incorrectly simplified to zero)
...
http://sourceforge.net/apps/trac/cppcheck/ticket/684
2009-09-15 23:38:54 +03:00
Daniel Marjamäki
5efedf85d6
Fixed #671 (False positive. Leak when loop is before exit)
2009-09-15 22:26:38 +02:00
Daniel Marjamäki
36c7108a28
Fixed #669 (possible style without --all + false positives)
2009-09-15 20:46:47 +02:00
Reijo Tomperi
92b8593f59
TODO test case for preprocessor macro handling
2009-09-14 22:53:57 +03:00
Daniel Marjamäki
020321769c
Fixed #658 (Assertion 'begin != __null' failed)
2009-09-14 21:49:41 +02:00
Reijo Tomperi
2b6955dde5
Fix #670 (Tokenizer: Simplify '\0' into 0)
...
http://sourceforge.net/apps/trac/cppcheck/ticket/670
2009-09-14 21:42:56 +03:00
Slava Semushin
d16a0b7a80
TestSimplifyTokens::sizeof_(): don't append leading space.
...
No functional change.
2009-09-13 17:59:59 +07:00
Slava Semushin
0fb89f8afa
Fixed #645 (Tokenizer::simplifyCasts() breaks link() if casts function)
...
http://sourceforge.net/apps/trac/cppcheck/ticket/645
2009-09-13 17:31:32 +07:00
Slava Semushin
dade31b6d7
TestTOKEN::getStrLength(): allocate tok variable in stack (instead of in heap)
...
No functional change.
2009-09-13 15:08:43 +07:00
Daniel Marjamäki
1d974f7c05
memory leaks: added test assertion. simplify ';alloc;exit;' to ';exit;'
2009-09-13 07:20:42 +02:00
Reijo Tomperi
241f585d34
Fix #594 (division by zero not detected when using atol or atof)
...
http://sourceforge.net/apps/trac/cppcheck/ticket/594
Simplify atol("0") into 0 (and other atol() calls also)
2009-09-12 23:54:47 +03:00
Daniel Marjamäki
5df28c51c6
memory leaks: minor refactorings
2009-09-12 21:13:47 +02:00
Daniel Marjamäki
f4b6c822d3
Fixed #375 (new check: Detect when using 'this-x')
2009-09-12 15:25:02 +02:00
Daniel Marjamäki
ab4a7fdef2
Fixed #518 (False positive for leaks when function from err()-family used)
2009-09-12 14:11:17 +02:00
Daniel Marjamäki
7479b943cc
Fixed #644 (Tokenizer::simplifyComma: Wrong simplification in cast)
2009-09-12 08:12:00 +02:00
Daniel Marjamäki
37dae83e06
More Fixing of #635 (Preprocessor: remove 'asm(...)')
2009-09-11 23:34:24 +02:00
Reijo Tomperi
ed1c9bed49
Fix ticket #632 (Mathlib isInt() identifies "330L" as not int)
...
http://sourceforge.net/apps/trac/cppcheck/ticket/632
2009-09-11 23:46:59 +03:00
Daniel Marjamäki
8837e0dcff
Simple fix for #635 (preprocessor: remove 'asm(...)')
2009-09-11 21:22:41 +02:00
Reijo Tomperi
908aaff1fa
New test case in TestSimplifyTokens::template_default_parameter
2009-09-09 23:57:28 +03:00
Reijo Tomperi
ed425158d9
astyle fix
2009-09-06 15:12:38 +03:00
Slava Semushin
c1958054af
Added test cases for #487 .
2009-09-06 18:29:39 +07:00
Daniel Marjamäki
535fe17ffd
Templates: Scaled up the handling of default values for template parameters ( #638 )
2009-09-06 08:22:45 +02:00
Reijo Tomperi
75a65a02a8
Fix another issue related to #647 (Crash during tokenizing (wrong) K&R function declaration)
...
http://sourceforge.net/apps/trac/cppcheck/ticket/647
2009-09-05 23:41:39 +03:00
Reijo Tomperi
a3d9863725
Fix #647 (Crash during tokenizing (wrong) K&R function declaration)
...
http://sourceforge.net/apps/trac/cppcheck/ticket/647
Thanks to undingen for providing a patch
2009-09-05 22:21:25 +03:00
Reijo Tomperi
7af4ac4282
New command line argument added --template
...
Fix ticket #462 (Allow using template to customize output format)
http://sourceforge.net/apps/trac/cppcheck/ticket/462
2009-09-05 22:01:49 +03:00
Slava Semushin
a9273c9d39
Fixed #629 (Tokenizer: expand nested strcat() calls)
...
http://sourceforge.net/apps/trac/cppcheck/ticket/629
2009-09-05 23:46:27 +07:00
Daniel Marjamäki
d86a2505f3
Merge branch 'master' of git://github.com/AlekSi/cppcheck into aleksi
2009-09-05 11:03:53 +02:00
Aleksey Palazhchenko
d9d2f53df6
Added top-level 'check' target.
...
Also refactored all. pro files by the way. :)
2009-09-04 22:59:25 +04:00
Daniel Marjamäki
333c6d9e0a
memory leaks: Added a todo test case for the getcode function
2009-09-04 19:11:19 +02:00
Aleksey Palazhchenko
e48664a3c9
Fixes in test.pro
2009-09-04 11:05:06 +04:00
Reijo Tomperi
23c07dd2b8
Merge branch 'master' of git@github.com:danmar/cppcheck
2009-09-03 23:36:42 +03:00
Reijo Tomperi
7408674017
Fix #601 (Poor var initialization assumption when can't find function definition)
...
http://sourceforge.net/apps/trac/cppcheck/ticket/601
Fix #641 ((style) Member variable not initialized in the constructor: False Positive)
http://sourceforge.net/apps/trac/cppcheck/ticket/641
This fix will also cause us not to detect several potential issues, but as there are so many
false positives, any unknown function call should stop the error for now. New
ticket is created to handle regression caused by this:
http://sourceforge.net/apps/trac/cppcheck/ticket/643
2009-09-03 23:28:00 +03:00
Daniel Marjamäki
7a9e4a7bd4
templates: remove typename tokens
2009-09-03 22:19:44 +02:00
Daniel Marjamäki
2719724a97
templates: Quick fix for the problem with default value for a template argument
2009-09-03 21:46:07 +02:00
Daniel Marjamäki
401f8aaa96
Templates: Added todo testcase for handling default values for template arguments. Related with ticket #638
2009-09-02 22:54:50 +02:00
Reijo Tomperi
686ff425f9
Fix ticket #637 (False positive, Using 'memset' on struct that contains a 'std::string')
...
http://sourceforge.net/apps/trac/cppcheck/ticket/637
2009-09-02 23:51:07 +03:00
Reijo Tomperi
7569bda227
Added few memset test cases
2009-09-02 23:32:15 +03:00
Reijo Tomperi
8ab26e85cf
Don't warn about division by zero if zero if floating point number.
...
Fix bug from mathlib isInt() and add test case from which few are false positives
2009-09-01 22:06:46 +03:00
Daniel Marjamäki
93659bbe08
memory leaks: fixed a todo testcase to find more leaks
2009-09-01 20:12:53 +02:00
Daniel Marjamäki
9a47b7110e
memory leaks: fixed todo testcases to find more memory leaks
2009-09-01 20:02:28 +02:00
Slava Semushin
0ec848b1fa
test/testmemleak.cpp(dofindleak): provide settings object with debug enabled.
...
This allows to print tokens when syntax error found in one of tests.
2009-09-02 00:38:35 +07:00
Daniel Marjamäki
7ba244cf45
Memory leaks: fixed a todo testcase
2009-09-01 19:33:17 +02:00
Daniel Marjamäki
59a4a36fe1
memory leaks: minor fix for testcase
2009-09-01 19:06:34 +02:00
Slava Semushin
eebe7457c9
Fixed #631 (False positive matching iterator which is dereferenced)
...
http://sourceforge.net/apps/trac/cppcheck/ticket/631
2009-09-01 23:49:17 +07:00
Reijo Tomperi
0d468d97c7
Fix #630 (Division by zero check only looks at first character of divisor)
...
http://sourceforge.net/apps/trac/cppcheck/ticket/630
Thanks to liam_routt for finding this and providing fix for it.
2009-09-01 17:00:26 +03:00
Daniel Marjamäki
c9449f9bd0
Preprocessor: Added a todo testcase
2009-08-31 20:36:25 +02:00
Daniel Marjamäki
03d7573208
Borland C++: Don't warn about uninitialized variables that are declared in the __published section. These are auto-initialized
2009-08-31 19:40:49 +02:00
Reijo Tomperi
67a8a3225c
astyle fix
2009-08-30 23:07:37 +03:00
Daniel Marjamäki
960fb861da
Refactoring: Refactoring of the unit testing for the CheckMemoryLeakInFunction
2009-08-30 21:11:15 +02:00
Reijo Tomperi
6fb44e733b
Fix ticket #612 (Division by zero not detected when zero has type suffix)
...
http://sourceforge.net/apps/trac/cppcheck/ticket/612
2009-08-30 22:02:09 +03:00
Slava Semushin
c50f7787f9
Fixed #569 (Buffer overrun not detected when strcat() called few times)
...
http://sourceforge.net/apps/trac/cppcheck/ticket/569
2009-08-30 18:44:23 +07:00
Slava Semushin
843ede94f3
Token::getStrLength(): introduce new static method.
...
No functional change.
2009-08-30 18:07:10 +07:00
Reijo Tomperi
e1cdbf3c5a
Fix ticket #611 (Preprocessor: the configurations "A;B" and "B;A" are the same)
...
http://sourceforge.net/apps/trac/cppcheck/ticket/611
2009-08-30 00:00:54 +03:00
Reijo Tomperi
fc343b3e9e
astyle fix
2009-08-29 23:33:12 +03:00
Daniel Marjamäki
9d7defad22
Fixed #615 (Memleak was detected in 1.32 but not in 1.33 and later)
2009-08-29 17:33:57 +02:00
Daniel Marjamäki
1dd2ec4757
Fixed #414 (memory leak in if-else construct not detected)
2009-08-29 16:55:43 +02:00
Daniel Marjamäki
270d2b2d4f
memory leaks: improved the simplification of 'if* ;'
2009-08-29 16:27:16 +02:00
Daniel Marjamäki
8f1f89ae2b
memory leaks: fixed todo test case. reduce exit better
2009-08-29 16:03:23 +02:00
Slava Semushin
085187b445
Tokenizer: enhance simplifyNot() and rename to simplifyLogicalOperators().
...
Don't replace "and" everything becuse it may be used as variable name.
Better fix for #620
Corrections for commit eb05cf904d
2009-08-29 20:42:14 +07:00
Slava Semushin
eb05cf904d
Fixed #620 (Tokenizer: replace "and" by "&&")
...
http://sourceforge.net/apps/trac/cppcheck/ticket/620
2009-08-29 19:26:01 +07:00
Slava Semushin
ae413a1ef0
Fixed #618 (Tokenizer: Wrong handling of enum)
...
http://sourceforge.net/apps/trac/cppcheck/ticket/618
2009-08-29 16:42:42 +07:00
Daniel Marjamäki
6347d0e976
memory leaks: better handling of open/close
2009-08-29 09:18:21 +02:00
Daniel Marjamäki
88d0bd3908
astyle
2009-08-29 08:20:18 +02:00
Daniel Marjamäki
ee5b2a43c7
Fixed #627 (False positive with --all, Resource leak with open())
2009-08-29 07:43:44 +02:00
Daniel Marjamäki
de9e62e90a
Memory leaks: handling asprintf better
2009-08-29 07:26:32 +02:00
Daniel Marjamäki
406fdd3219
Memory leaks: Fixed two todo testcases (getcode handling of asprintf)
2009-08-29 07:02:36 +02:00
Daniel Marjamäki
ab047c680c
memory leaks: fixed a todo testcase
2009-08-29 06:42:24 +02:00
Daniel Marjamäki
74fd052fc0
Memory leaks: Testing that asprintf is handled correctly
2009-08-28 23:26:40 +02:00
Daniel Marjamki
cbc237c37b
fixed failed assertions when running the testrunner
2009-08-28 17:05:25 +02:00
danmar
4f6b79b761
Fixed #625 (cppcheck dumps core on valid code)
2009-08-28 12:57:29 +02:00
danmar
bb2bda0be4
Fixed #622 (Tokenizer: Calculations are wrong)
2009-08-28 12:13:46 +02:00
Daniel Marjamäki
5d2c409e46
Fixed #623 (False positive: possible null pointer dereference when using the ?: operator)
2009-08-28 08:48:37 +02:00
Reijo Tomperi
929dbe92e4
Fix the last test case from ticket #613 (array members variables are not checked in constructor)
...
http://sourceforge.net/apps/trac/cppcheck/ticket/613
2009-08-26 23:33:23 +03:00
Daniel Marjamäki
ff9ed1d7aa
Preprocessor: better handling of pragma asm and pragma endasm
2009-08-26 21:54:43 +02:00
Slava Semushin
7c86a10a9d
Fixed #617 (False positive "buffer overrun" when sprintf() doesn't have optional parameters)
...
http://sourceforge.net/apps/trac/cppcheck/ticket/617
2009-08-27 00:21:32 +07:00
Daniel Marjamäki
9bdd1def58
added testcase for the Tokenizer::simplifyGoto
2009-08-26 18:54:28 +02:00
Daniel Marjamäki
f94aab35e7
Fixed #498 (Tokenizer: simplify 'goto')
2009-08-26 18:46:56 +02:00
Reijo Tomperi
d778f67265
Fix sytax error in uninitVarArray(). This also causes the test to fail, so changing it as TODO.
...
See http://sourceforge.net/apps/trac/cppcheck/ticket/613
2009-08-26 00:42:07 +03:00
Reijo Tomperi
e3c1e14bb0
astyle fix
2009-08-26 00:41:03 +03:00
Daniel Marjamäki
d67e3fcc49
Refactoring the unit tests of TestMemleakInFunction
2009-08-25 22:18:22 +02:00
Daniel Marjamäki
c25e1963b1
Fixed #498 (Tokenizer: simplify 'goto')
2009-08-24 23:10:12 +02:00
Daniel Marjamäki
0c479b8c9f
TestClass: Added a testcase where a array member variable is initialized through strcpy
2009-08-24 17:15:29 +02:00
Reijo Tomperi
c581753040
Fix ticket #613 (array members variables are not checked in constructor)
...
http://sourceforge.net/apps/trac/cppcheck/ticket/613
Patch from micres
2009-08-23 22:54:41 +03:00
Daniel Marjamäki
9da2ecf4f4
Refactoring the unit testing. Wrote special tests for CheckMemoryLeakInFunction::findleak
2009-08-23 15:48:25 +02:00
Daniel Marjamäki
0da25081d5
refactoring: began refactoring the unit testing for CheckMemoryLeakInFunction. More specific testing of the functions getcode, simplifycode, call_func, etc
2009-08-23 11:26:17 +02:00
Slava Semushin
8cafaf2960
Fixed #603 (Tokenizer: Incorrect simplification of < >)
...
http://sourceforge.net/apps/trac/cppcheck/ticket/603
2009-08-23 13:26:16 +07:00
Slava Semushin
e6120a5725
Fixed #581 (Wrong usage of div-function)
...
http://sourceforge.net/apps/trac/cppcheck/ticket/581
2009-08-23 10:37:09 +07:00
Slava Semushin
ec050d2563
TestOther::varScope5: fixed syntax error in test case.
...
Testrunner complains about "Unlogged error at Tokenizer::syntaxError"
since 74bbe945f6
commit.
2009-08-22 21:29:09 +07:00
Daniel Marjamäki
724d6bf53a
Fixed #507 (Preprocessor: Incorrect expanding of inner macros)
2009-08-22 13:03:52 +02:00
Slava Semushin
acc38a8bbf
Fixed #592 (Tokenizer: improve the tokenization of do .. while)
...
http://sourceforge.net/apps/trac/cppcheck/ticket/592
2009-08-22 17:49:42 +07:00
Daniel Marjamäki
94c49bc34e
Fixed #608 (Tokenizer: simplifyKnownVariables doesn't handle 'while (--i)' correctly)
2009-08-22 10:23:55 +02:00
Slava Semushin
cbeb45566b
Fixed #609 (Tokenizer: don't add {} after do-while();)
...
http://sourceforge.net/apps/trac/cppcheck/ticket/609
2009-08-22 14:49:45 +07:00
Daniel Marjamäki
439ff8b144
Fixed #599 (False positive: null pointer dereference)
2009-08-21 12:42:40 +02:00
Reijo Tomperi
9d1907be66
Fix ticket #600 (Tokenizer: if(!(fclose(fd) == 0)) is simplified incorrectly)
...
http://sourceforge.net/apps/trac/cppcheck/ticket/600
2009-08-20 22:37:05 +03:00
Reijo Tomperi
7d44ce7736
Fix ticket #598 (Preprocessor: Multiline comments add line change to wrong location)
...
http://sourceforge.net/apps/trac/cppcheck/ticket/598
2009-08-20 00:27:47 +03:00
Daniel Marjamäki
8b46172bcf
Memory leaks: Use varid instead of varname
2009-08-19 19:42:07 +02:00
Daniel Marjamäki
85682ed429
Fixed #591 (False positive: Deallocating a deallocated pointer)
2009-08-18 20:49:08 +02:00
Slava Semushin
74bbe945f6
Fixed #272 ("The scope of the variable XXX can be limited" not detected when variable is initilialized during declaration)
...
http://sourceforge.net/apps/trac/cppcheck/ticket/272
2009-08-17 02:12:57 +07:00
Daniel Marjamäki
52856fcbeb
ettlmartin: improved the MathLib::IsInt
2009-08-16 18:45:26 +02:00
Slava Semushin
be89be8c30
Fixed #590 (False positive: Invalid deallocation when variables have same name)
...
http://sourceforge.net/apps/trac/cppcheck/ticket/590
2009-08-16 15:27:40 +07:00
Reijo Tomperi
c8da301f83
fix ticket #586 (Preprocessor: Lines like "#error don't" can cause "no pair for character" errors)
...
http://sourceforge.net/apps/trac/cppcheck/ticket/586
2009-08-14 00:22:51 +03:00
danmar
3de825c290
Borland C++ Builder: Fixed compilation and testrunner problems
2009-08-13 22:13:52 +02:00
Reijo Tomperi
4f8a06ed0d
Initial work for class and member function/variable list in tokenizer.
2009-08-12 23:50:03 +03:00
Daniel Marjamäki
bcab694a74
preprocessor: added todo testcase for detecting redundant preprocessor conditions
2009-08-12 20:28:43 +02:00
Daniel Marjamäki
ad4ea01750
Fixed #583 (False positive: the nullpointer check doesn't handle goto properly)
2009-08-12 18:54:52 +02:00
Slava Semushin
4c32057180
Fixed ticket #541 (Wrong testcases produce unlogged error at Tokenizer::syntaxError)
...
http://sourceforge.net/apps/trac/cppcheck/ticket/541
2009-08-12 02:06:41 +07:00
Slava Semushin
6a7624054e
Fixed ticket #584 (Tokenizer: don't set varId for class declaration)
...
http://sourceforge.net/apps/trac/cppcheck/ticket/584
2009-08-12 01:58:49 +07:00
Daniel Marjamäki
e7feac506c
Refactoring: updated the nullPointer message so it contains the name of the pointer
2009-08-11 17:18:01 +02:00
Daniel Marjamäki
ecdbcbce3d
Fixed #566 (False positive when assigning the return value of realloc(NULL,..) to a pointer variable holding a freed memory address)
2009-08-10 22:04:28 +02:00
Daniel Marjamäki
045b73c7ec
Fixed #582 (Preprocessor: Remove assembler code inside pragmas)
2009-08-10 20:07:55 +02:00
Reijo Tomperi
93604dd344
Fixed ticket #578 (missing virtual destructor not detected)
...
http://sourceforge.net/apps/trac/cppcheck/ticket/578
2009-08-10 17:58:13 +03:00
Daniel Marjamäki
3331cb834f
Hoangtuansu: Fixed #537 (false positive::operator= should return something)
2009-08-09 19:57:48 +02:00
Gianluca Scacco
ba4754a784
Added new test for invalid deallocation
2009-08-09 15:43:00 +02:00
Slava Semushin
c66103f7bc
Fixed ticket #574 (Tokenizer: not assign varId when variable first afer keyword and has long type)
...
http://sourceforge.net/apps/trac/cppcheck/ticket/574
2009-08-09 15:41:31 +07:00
Slava Semushin
1fd2c0ff28
Fixed ticket #572 (Tokenizer: improve detection of arrays)
...
http://sourceforge.net/apps/trac/cppcheck/ticket/572
2009-08-09 15:16:37 +07:00
Slava Semushin
5f3baba178
Fixed ticket #573 (False positive of set range check when we dereferencing iterator)
...
http://sourceforge.net/apps/trac/cppcheck/ticket/573
2009-08-09 02:07:33 +07:00
Slava Semushin
0f96299d87
Fixed ticket #570 (Buffer overrun not detected when sprintf() format string greater then buffer size)
...
http://sourceforge.net/apps/trac/cppcheck/ticket/570
2009-08-08 21:52:35 +07:00
Slava Semushin
92d4c086ce
Fixed ticket #571 (Buffer overrun for sprintf() not detected after first ')' symbol)
...
http://sourceforge.net/apps/trac/cppcheck/ticket/571
2009-08-08 21:03:10 +07:00
Slava Semushin
50f7fa5828
Fixed ticket #565 (Tokenizer: simplify variable declaraion like 'int z = x >> 16')
...
http://sourceforge.net/apps/trac/cppcheck/ticket/565
2009-08-08 17:33:07 +07:00
Daniel Marjamäki
a0a4008e17
Fixed #525 (false positive: vector range checking with <)
2009-08-07 16:23:28 +02:00
Reijo Tomperi
d719606201
Fixed ticket #564 (set variable id for "struct ABC **p")
...
http://sourceforge.net/apps/trac/cppcheck/ticket/564
2009-08-07 00:31:39 +03:00
Reijo Tomperi
80953633ee
Fix ticket #563 (set variable id for **p)
...
http://sourceforge.net/apps/trac/cppcheck/ticket/563
2009-08-06 23:11:29 +03:00
Daniel Marjamäki
ce8c5b0236
Fixed #555 (False positive: [CuTest.c:25]: (error) Memory leak: len)
2009-08-05 21:18:16 +02:00
Daniel Marjamäki
e1beb70f80
Fixed #558 (Tokenizer: Bad simplification of 'for(unsigned i = 0; i < 100; ++i)')
2009-08-05 20:15:48 +02:00
Daniel Marjamäki
1c59e4a51b
Fixed #528 (Tokenizer: Simplify: 'if(!(a->x=b()))')
2009-08-05 19:45:05 +02:00
Daniel Marjamäki
9e348ca739
Fixed #554 (resource leak false positive)
2009-08-04 21:34:14 +02:00
Daniel Marjamäki
706ba34a6d
Refactoring the unit testing
2009-08-04 21:32:14 +02:00
Reijo Tomperi
975e7778ab
Fix ticket #531 (false positive about missing virtual destructor)
...
http://sourceforge.net/apps/trac/cppcheck/ticket/531
2009-08-04 22:23:22 +03:00
Reijo Tomperi
769119c725
Fix ticket #552 (False positive with --all when realloc is used with two variables.)
...
http://sourceforge.net/apps/trac/cppcheck/ticket/552
2009-08-02 23:30:43 +03:00
Reijo Tomperi
10f6678cf9
TODO test case realloc5 added and "Checkmemoryleak: simplifycode result for" debug info added.
2009-08-02 22:23:47 +03:00
Slava Semushin
822fb93cda
Improved "index out of bounds" check.
...
Corrected 342acaaaf2
commit.
2009-08-02 19:29:45 +07:00
Slava Semushin
f38530fb31
test/testbufferoverrun.cpp: improve test cases.
2009-08-02 19:29:37 +07:00
Slava Semushin
ed86eda07d
Fixed ticket #549 (Tokenizer: improve calculation simplification)
...
http://sourceforge.net/apps/trac/cppcheck/ticket/549
2009-08-02 15:45:33 +07:00
Slava Semushin
342acaaaf2
Fixed #547 (index out of bounds not detected when addition used as array index)
...
http://sourceforge.net/apps/trac/cppcheck/ticket/547
2009-08-02 14:59:02 +07:00
Slava Semushin
0445edf6fe
Fixed #542 (Tokenizer: allow numbers in templates parameters)
...
http://sourceforge.net/apps/trac/cppcheck/ticket/542
2009-08-01 23:17:35 +07:00
Slava Semushin
0e2273833e
Fixed ticket #539 (Tokenizer: don't replace constants variables with varid 0)
...
http://sourceforge.net/apps/trac/cppcheck/ticket/539
2009-08-01 20:57:54 +07:00
Daniel Marjamäki
b5d172b6e9
preprocessor: fixed problem in Preprocessor::expandMacros when macro argument is for example 'unsigned long'
2009-08-01 14:55:45 +02:00
Daniel Marjamäki
e6713e9774
null pointers: fixed a false positive
2009-08-01 11:30:37 +02:00
Daniel Marjamäki
b7ffcf53ba
Fixed #511 (false positive, memory leak when using 'var = ({});')
2009-07-31 23:42:21 +02:00
Slava Semushin
8588012df7
Fixed #521 (Tokenizer: improve static variable detection)
...
Also change cppcheck default behavior to don't show "If you see this,
there is a bug" message for each variable without varId. This feature
was very helpful for developers but may annoying users.
http://sourceforge.net/apps/trac/cppcheck/ticket/521
2009-08-01 00:40:36 +07:00
Daniel Marjamäki
2b26a320f0
astyle formatting
2009-07-31 14:01:50 +02:00
Daniel Marjamäki
2d9e4e1a73
null pointers: detect when there are possible null pointer dereferencing when looping through a linked list both in inner and outer loops at the same time
2009-07-31 10:49:43 +02:00
Daniel Marjamäki
228e926654
null pointers: Added a todo testcase
2009-07-30 21:57:23 +02:00
Slava Semushin
347802f819
Fixed ticket #503 (Dereferencing after erase() not work if we try to get access to member)
...
http://sourceforge.net/apps/trac/cppcheck/ticket/503
2009-07-31 00:49:38 +07:00
Slava Semushin
5db677bc30
Fixed ticket #523 (Tokenizer: set varId for types with long namespaces)
...
FIXME: skip namespaces by the best way.
http://sourceforge.net/apps/trac/cppcheck/ticket/533
2009-07-31 00:40:41 +07:00
Slava Semushin
681b836389
Fixed ticket #532 (Tokenizer: set varId for types which have comma in template parameter)
...
http://sourceforge.net/apps/trac/cppcheck/ticket/532
2009-07-31 00:25:26 +07:00
Daniel Marjamäki
d06e669017
Preprocessor: Speedup of the match_cfg_def function
2009-07-30 10:10:34 +02:00
Reijo Tomperi
2fa3b4ce60
Added more tests to test case TestSimplifyTokens::ifassign1
2009-07-30 01:39:28 +03:00
Reijo Tomperi
b56fdb83da
Fixed ticket #529 (Tokenizer: simplify if((x==0)))
...
http://sourceforge.net/apps/trac/cppcheck/ticket/529
2009-07-30 00:37:01 +03:00
Daniel Marjamäki
050b85c5eb
memory leak for struct member: fixed false positive when the struct pointer is stored away
2009-07-29 11:38:20 +02:00
Daniel Marjamäki
4e66dc105e
null pointers: Fixed false positive when 'do' are used
2009-07-29 11:17:22 +02:00
Slava Semushin
367efe31ea
Fixed ticket #524 (Containers range check shouldn't stop at first founded error)
...
http://sourceforge.net/apps/trac/cppcheck/ticket/524
2009-07-29 03:55:23 +07:00
Slava Semushin
8b0c1daf98
Fixed ticket #522 (Tokenizer: recognize comma in container with STL type declaration)
...
http://sourceforge.net/apps/trac/cppcheck/ticket/522
2009-07-29 02:46:33 +07:00
Slava Semushin
f50aa1e188
Fixed ticket #520 (Tokenizer: properly set varId for containers with STL types)
...
http://sourceforge.net/apps/trac/cppcheck/ticket/520
2009-07-29 00:54:13 +07:00
Slava Semushin
c8caefa94c
Fixed ticket #519 (Tokenizer converts commas in for-loops)
...
http://sourceforge.net/apps/trac/cppcheck/ticket/519
2009-07-28 23:40:15 +07:00
Slava Semushin
600f3a834d
Fixed ticket #514 (false positive:: memory leak when using comma near delete[])
...
http://sourceforge.net/apps/trac/cppcheck/ticket/514
2009-07-28 02:13:08 +07:00
Slava Semushin
37fe631639
test/testautovariables.cpp: renamed some testcases.
...
Make it readable.
No functional change.
2009-07-28 00:36:56 +07:00
Slava Semushin
82ae0e305b
checkautovariables: added newlines to make code more readable.
...
No code change.
2009-07-28 00:34:17 +07:00
Slava Semushin
bb4b2b707c
Fixed ticket #517 (False positive for extern variables: return of the address of an auto-variable)
...
http://sourceforge.net/apps/trac/cppcheck/ticket/517
2009-07-28 00:32:01 +07:00
Reijo Tomperi
358aa5be8d
Improve test case TestSimplifyTokens::comma_keyword
2009-07-27 00:08:18 +03:00
Daniel Marjamäki
b4a6d74e42
astyle formatting
2009-07-26 22:13:08 +02:00
Slava Semushin
6c022798ea
Fixed ticket #499 (buffer overflow not detected when using macros)
...
sprintf() buffer overrun detection works wrong due to typo (since time
when it was added in commit a604f56f19
).
Also reports buffer overrun when sprintf() writes bytes equal to
buffer size -- in this case off-by-one error appears.
http://sourceforge.net/apps/trac/cppcheck/ticket/499
2009-07-26 19:29:46 +07:00
Slava Semushin
a73346e889
Fixed ticket #496 (Tokenizer: simplify statements with "," better)
...
https://sourceforge.net/apps/trac/cppcheck/ticket/496
2009-07-26 18:03:11 +07:00
Reijo Tomperi
a07b7635c0
Fix ticket #265 (Log a warning when an include file is not found)
...
http://sourceforge.net/apps/trac/cppcheck/ticket/265
2009-07-25 22:10:30 +03:00
Daniel Marjamäki
a6d696bf40
Fixed #504 (false positive: null pointer dereference)
2009-07-25 20:36:02 +02:00
Daniel Marjamäki
b172d62cae
Added more tests to the TestPreprocessor::match_cfg_def ( #505 )
2009-07-25 17:04:13 +02:00
Daniel Marjamäki
f877cd2db1
Preprocessor: Added todo test case for better evaluation of #if conditions
2009-07-25 16:22:42 +02:00
Daniel Marjamäki
dacaff824c
Fixed #501 (Preprocessor should read open configurations that are defined within the file)
2009-07-25 13:58:34 +02:00
Slava Semushin
8643936e0c
Fixed ticket #500 (Tokenizer: simplify the "(p != NULL)" conditions)
...
Also teach simplifyIfNot() to handle variables like Foo::var.
https://sourceforge.net/apps/trac/cppcheck/ticket/500
2009-07-25 18:23:03 +07:00
Slava Semushin
88d7c598e3
test/testtokenize.cpp: use tokenizeAndStringify() function.
...
Instead of self-written code.
No functional change.
2009-07-25 16:41:16 +07:00
booga
9fa8c0ee9c
astyle FTW (should have read about that sooner)
2009-07-24 19:23:30 -04:00
booga
52e2e775b2
Fix #476 STL Container checks.
...
Fix #473 Add post increment check for STL objects and Classes.
2009-07-24 18:36:15 -04:00
Daniel Marjamäki
9136d8cf80
Tokenizer: simplify return statements - remove redundant parantheses
2009-07-24 21:55:35 +02:00
Daniel Marjamäki
6bb85703f6
memory leaks: fixed false positive for struct members - better handling of if/else
2009-07-24 09:05:40 +02:00
Daniel Marjamäki
73c028bdb7
memory leaks: added a todo test case for struct members when using if-else
2009-07-23 22:29:31 +02:00
Daniel Marjamäki
5b81c92a14
null pointers: fixed false positives when checking if pointer is null at many locations ( #485 )
2009-07-23 19:59:29 +02:00
Daniel Marjamäki
06c8ff9d0d
null pointers: fixed false positives ( #49 )
2009-07-23 19:02:14 +02:00
Daniel Marjamäki
565ac2fca6
Fixed #493 (Memory leak: False positive when using the exit(0))
2009-07-23 16:30:30 +02:00
Daniel Marjamäki
d0f1d885ed
null pointers: dereferencing a pointer and then checking if it's null ( #49 )
2009-07-23 14:13:46 +02:00
Daniel Marjamäki
024778d6eb
tokenizer: simplify '?:' better when the condition is always true
2009-07-23 10:12:02 +02:00
Daniel Marjamäki
9b2dd8c7eb
Preprocessor: Better evaluation of conditions such as '#if defined A || defined B' ( #469 )
2009-07-22 20:11:27 +02:00
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
Slava Semushin
fe5d0c56ba
Merge branch 'master' of git@github.com:danmar/cppcheck
2009-06-10 01:56:26 +07:00
Slava Semushin
d9f2dd385b
test/testrunner.cpp: removed unused headers.
...
No functional change.
2009-06-10 01:52:42 +07:00
Daniel Marjamäki
a71d260308
Refactoring: Moved CheckOther::returnPointerToLocalVariable to CheckAutoVariables
2009-06-09 19:45:58 +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
51736bae8b
deleted the testmemleakmp file
2009-06-08 18:36:54 +02:00
Daniel Marjamäki
d7fa3e6dda
Refactoring: Renamed CheckFunctionUsage to CheckUnusedFunctions
2009-06-07 22:12:20 +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
acaa22ff6c
Refactoring: Simple code cleanup
2009-06-06 14:48:48 +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
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
52a8368b02
Strip redundant std::string usage from tests.
...
Second round: handle empty strings.
Done by command:
git grep -l ASSERT_EQUALS | xargs sed -i 's|ASSERT_EQUALS(std::string(\(".*"\)),|ASSERT_EQUALS(\1,|'
Should be no functional change.
2009-06-05 07:43:55 +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
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
e5c0383594
Strip redundant std::string usage from tests.
...
Done by command:
git grep -l ASSERT_EQUALS | xargs sed -i 's|ASSERT_EQUALS(std::string(\(".\+"\)),|ASSERT_EQUALS(\1,|'
Should be no functional change.
2009-06-01 02:50:25 +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
Daniel Marjamäki
2120edb89b
Variable Id: structs must not have variable id
2009-05-31 18:46:32 +02: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
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
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
a015704591
Changed expected result for test case TestTokenizer::removeParantheses3 to simplify it more
2009-05-28 23:13:15 +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
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
Reijo Tomperi
d6a34dafb2
Added test case TestMemleak::dealloc_and_alloc_in_func
2009-05-27 22:16:54 +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
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
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
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
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
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
Daniel Marjamäki
2508f3c721
Preprocessor: Added test case for #291 . One of the assertions is a TODO and it should be fixed.
...
http://apps.sourceforge.net/trac/cppcheck/ticket/291
2009-05-13 21:38:57 +02: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
31f315d2ec
Added TODO test case TestMemleak::stdstring
2009-05-12 22:04:49 +03:00
Reijo Tomperi
24d96b188e
Fix ticket #305 (Negative value passed to ASSERT_EQUALS)
...
http://apps.sourceforge.net/trac/cppcheck/ticket/305
Moved also test case from testtokenizer to testtoken.
2009-05-12 21:28:02 +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
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
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
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
Reijo Tomperi
177aeba0cf
Added TODO test case TestMemleak::assign_pclose
2009-05-06 21:20:25 +03:00
Reijo Tomperi
e098bffd28
Added test case TestSimplifyTokens::template7
2009-05-05 23:09:15 +03: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
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
f6d6a3855e
varid: updated handling of variable id for class variables ( #26 )
2009-05-03 13:50:26 +02: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
0dacb4b1ca
stl: added a ticket for the todo test case TestStl::eraseDereference
2009-05-02 21:35:35 +02:00
Daniel Marjamäki
50567c164f
stl: added todo test case, invalid iterator after insert
2009-05-02 20:49:58 +02:00
Daniel Marjamäki
b46777235d
stl: added todo test case, erasing invalid iterator
2009-05-02 20:39:51 +02:00
Daniel Marjamäki
e11449bd58
stl: added test case, dereferencing an iterator that has been erased
2009-05-02 19:58:57 +02:00
Daniel Marjamäki
7803466079
testing mathlib: Test that conversion to numbers work
2009-05-02 11:12:49 +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
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
Daniel Marjamäki
1ad5cf1ec5
astyle formatting
2009-05-01 12:03:25 +02:00
Daniel Marjamäki
8dba34d580
class checking: enabled test case. The --all setting must be provided
2009-05-01 12:01:55 +02:00
Reijo Tomperi
7002af6c9a
astyle fix
2009-05-01 12:29:49 +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
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
Reijo Tomperi
d4a7256686
Added test case TestTokenizer::varid_delete for ticket #269
...
http://apps.sourceforge.net/trac/cppcheck/ticket/269
2009-04-29 22:22:56 +03:00
Reijo Tomperi
a8f296bb6e
Added test case TestMemleak::free_member_in_sub_func for ticket #253
...
http://apps.sourceforge.net/trac/cppcheck/ticket/253
2009-04-29 21:40:21 +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
2a200cff00
stl: added todo test case about using same iterator with different containers
2009-04-29 17:32:38 +02:00
Daniel Marjamäki
b90fdfed1d
changed todo comment to TODO_ASSERT_EQUALS
2009-04-28 21:44:31 +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
8075cd8b9d
added todo test case for detecting unmodified containers in the operator= function
2009-04-28 20:50:10 +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
Daniel Marjamäki
ef54e446db
push_back: added a few todo test cases for the checking of push_back
2009-04-25 16:32:37 +02: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
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
Daniel Marjamäki
9a086c118f
math lib: 3/2 should result in 1
2009-04-12 18:45:42 +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
97f5380a2c
added testing for mathlib
2009-04-06 19:08:13 +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
Leandro Lisboa Penz
82cb229871
checkmemoryleak: fixed and reactivated forwhile9 and forwhile10 tests.
2009-04-04 20:55:45 -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
07af9cf7c8
astyle fix
2009-04-03 22:10:27 +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
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
Gianluca Scacco
f5104d6d0a
Added new test to autovariable
2009-03-28 21:54:12 +01: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
4c4f138639
Memory leaks: refactoring the TODO test cases
2009-03-28 20:50:09 +01:00
Nicolas Le Cam
ad7df1cbe0
Add TestMemleak::realloc4 that currently fail.
...
Change TestMemleak::if10, TestMemleak::forwhile8 and TestMemleak::realloc2 as they are currently leaking memory, mark them as TODO.
Comment out TestMemleak::forwhile9 and TestMemleak::forwhile10 as they are wrong (infinite loops).
2009-03-28 16:21:55 +01:00
Daniel Marjamäki
022dbc651e
removed TestOther::zeroDiv3 - it is not valid
2009-03-28 08:02:15 +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
7afccc395a
testing: new handling of todo test cases. If they use TODO_ASSERT_EQUALS instead we can detect when they are fixed
2009-03-25 18:31:40 +01:00
Daniel Marjamäki
0cfa241abb
variable id: enabled test case for function parameters
2009-03-25 18:15: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
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
Daniel Marjamäki
afcaa30b51
Fixed ticket 216 (False positive: variable scope)
2009-03-24 20:59:56 +01:00
Daniel Marjamäki
c0039a2551
added testcase
2009-03-24 20:24:03 +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
c9d02273b8
added todo test case for ticket 200
2009-03-22 21:42:01 +01:00
Vesa Pikki
f04bdccee4
Astyle formatting.
2009-03-22 15:15:16 +02:00
Gianluca Scacco
416115e38f
Fixed error compiling testautovariables
2009-03-22 12:00:21 +01:00
Daniel Marjamäki
da06c12925
refactoring error messages
2009-03-21 18:31:28 +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
bcad5afb26
refactoring - fixed the unit tests
2009-03-21 14:02:58 +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
3fab99a5cb
astyle formatting
2009-03-19 19:35:47 +01:00
Daniel Marjamäki
75171cae08
refactoring: fixed the teststl so it is runnable again
2009-03-19 19:35:08 +01:00
Daniel Marjamäki
09ff4fa35f
Merge branch 'master' of git@github.com:danmar/cppcheck
2009-03-18 22:41:01 +01:00
Daniel Marjamäki
a573c62cd5
refactoring: first step - started with checkstl
2009-03-18 22:40:38 +01:00
Nicolas Le Cam
2b199ffb9b
Fix compilation on 64bit systems
2009-03-18 22:13:27 +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
896abcb569
Fixed some memory leaks in test cases
2009-03-17 21:59:40 +02:00
Daniel Marjamäki
9c057c707b
tokenize negative numbers into a single token
2009-03-17 20:50:06 +01:00
Daniel Marjamäki
128215d692
Added test case for detecting false positive in the STL size handling
2009-03-17 18:54:50 +01: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
f9b481ae3a
Ticket #184 (Tokenizer - Simplification: Split up variable declarations), added testcases
2009-03-16 19:03:23 +01:00
Daniel Marjamäki
0cc7672673
Fixed Ticket #82 (detect buffer overrun; dynamic memory)
2009-03-16 18:11:09 +01:00
Reijo Tomperi
1c74978a92
test case stringify3 added
2009-03-15 23:39:58 +02: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
b26955b9f8
Test case stringify2() added.
2009-03-15 16:05:23 +02: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
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
3b29125d65
added testcase for 'Tokenizer::FindClassFunction'
2009-03-13 22:38:42 +01:00
Daniel Marjamäki
0a6a0ae46e
TestMemleak: added two testcases for checking for leaks in classes
2009-03-13 19:52:01 +01: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
Reijo Tomperi
657495b825
astyle fix
2009-03-11 00:49:16 +02:00
Daniel Marjamäki
eac29d151c
made the Tokenizer::simplifyCasts more generic
2009-03-10 21:26:08 +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
f8cd34198b
simplify casts
2009-03-09 19:47:21 +01:00
Reijo Tomperi
1c626c53c2
Added test case for #147 (Invalid line number for error message)
...
http://apps.sourceforge.net/trac/cppcheck/ticket/147
macro_linenumbers() in test/testpreprocessor.cpp
2009-03-08 22:28:12 +02:00
Reijo Tomperi
765da17132
Astyle fix
2009-03-08 09:49:04 +02:00
Reijo Tomperi
5be85d71a0
Fix ticket #145 (Line numbers are invalid if file is included inside #ifdef)
...
http://apps.sourceforge.net/trac/cppcheck/ticket/145
2009-03-08 09:45:53 +02:00
Daniel Marjamäki
cc8a6168e7
astyle formatting
2009-03-06 18:13:41 +01:00
Daniel Marjamäki
d7cd09cb6e
added internal support for handling list of classes that are automaticly deallocated
2009-03-06 07:22:07 +01:00
Reijo Tomperi
6fcb89f136
Fix segmentation fault that happens with invalid code.
2009-03-05 23:22:00 +02:00
Reijo Tomperi
42a9eb9e53
Fix ticket #133 (Segmentation fault when static_cast is in for loop)
2009-03-05 21:32:02 +02:00
Daniel Marjamäki
547f120ee9
known variables: better handling of ++ and --
2009-03-04 06:03:51 +00:00
Reijo Tomperi
832275bc37
Fix #132 (False positive returning memcpy())
2009-03-03 20:39:17 +00:00
Reijo Tomperi
69c23301db
Fix ticket Add/Change #125 (the printout of the token list is wrong)
2009-03-03 20:17:23 +00:00
Daniel Marjamäki
37c889ab30
unused private function: better handling of initialization lists in constructors
2009-03-02 20:40:24 +00:00
Daniel Marjamäki
86050cccdb
unused private function: fixed false positive (ticket: 129)
2009-03-02 17:16:02 +00:00
Daniel Marjamäki
87b0314e72
memory leak: fixed issue with reporting wrong location
2009-03-01 20:34:04 +00:00
Reijo Tomperi
fc8f47145a
Copyrights updated
2009-03-01 19:52:33 +00:00
Daniel Marjamäki
c7b068c174
variable id: fixed so that the variable ids are assigned correctly (ticket:126)
2009-03-01 16:37:02 +00:00
Daniel Marjamäki
4e465f7073
variable declarations: don't simplify when declaring and assigning array in the same statement
2009-02-28 20:40:37 +00:00
Daniel Marjamäki
c3bbd603c0
variable id: handling 'return' and 'else' better
2009-02-28 20:21:48 +00:00
Daniel Marjamäki
045477e6ac
moved sizeof tests to the TestSimplifyTokens class
2009-02-28 09:09:55 +00:00
Daniel Marjamäki
c7197aed8c
refactoring unit tests
2009-02-28 08:59:48 +00:00
Daniel Marjamäki
7d9bf491ec
sizeof: fixed a problem with 'sizeof(varname)' but there are more to fix with it
2009-02-28 08:34:02 +00:00
Daniel Marjamäki
6b7b27a2e8
simplify known variable: don't simplify this ';i++;'
2009-02-27 18:25:47 +00:00
Daniel Marjamäki
dddfc50dff
Reverted changes made in [1289]
2009-02-27 07:50:39 +00:00
Daniel Marjamäki
f4a8bc85f2
simplify tokens: fixed bug when removing redundant parantheses around variable
2009-02-27 06:07:38 +00:00
Daniel Marjamäki
91011b8450
array index out of bounds: Added todo test case TestBufferOverrun::array_index_13 for ticket #118
2009-02-26 19:46:59 +00:00
Daniel Marjamäki
c1da4ae57d
simplify tokens: remove redundant parantheses around variable.. 'p = (q);'
2009-02-25 19:55:24 +00:00
Daniel Marjamäki
35583293ec
memory leak: Fixed a false positive when all is given
2009-02-25 19:20:23 +00:00
Daniel Marjamäki
dac1e91013
unused private function: Handle 'embedded' function implementations better
2009-02-25 18:03:17 +00:00
Daniel Marjamäki
66c13c7173
reverted [1282] because some changes were committed by mistake
2009-02-24 17:49:43 +00:00
Daniel Marjamäki
8c3e3faa07
checkclass: refactoring
2009-02-24 17:48:11 +00:00
Daniel Marjamäki
1e3047b9c2
simplify tokens: simplify known variable value handles ++ and -- better
2009-02-24 16:11:37 +00:00
Daniel Marjamäki
d15aea1b0c
memory leak: fixed false positive when using 'return strcpy'
2009-02-24 06:23:21 +00:00
Daniel Marjamäki
44a5cecd99
memory leaks: improved handling of --vcl
2009-02-23 19:32:54 +00:00
Daniel Marjamäki
d8927e720d
constructors: don't warn about missing constructor if class only has static variable members
2009-02-21 13:35:55 +00:00
Daniel Marjamäki
08f76279ed
buffer overrun: catch cases when using cin to read to a char array
2009-02-21 12:22:04 +00:00
Daniel Marjamäki
5269e38ae2
security: renamed classes
2009-02-21 12:12:31 +00:00
Daniel Marjamäki
b826d2e41b
security: Renamed files
2009-02-21 12:07:19 +00:00
Daniel Marjamäki
a9009ebf7d
TestClass: Added test for uninitialized "mutable int i"
2009-02-21 08:24:57 +00:00
Daniel Marjamäki
ed86d924df
buffer overrun: dangerous usage of strncpy+strncat
2009-02-20 21:16:07 +00:00
Daniel Marjamäki
15e86db3ed
buffer overrun: Added checking of strncat
2009-02-20 21:00:59 +00:00
Daniel Marjamäki
0e1ef1f45f
added todo testcases for strncat checking
2009-02-20 20:00:49 +00:00
Daniel Marjamäki
439b8c4051
simplify known variables: variable used as array index
2009-02-20 17:27:57 +00:00
Daniel Marjamäki
385be6d0d9
memory leak: Added command line flag '--vcl' that is used to suppress error messages for VCL code
2009-02-20 06:28:18 +00:00
Reijo Tomperi
4fc774deda
Multicore cpu support for Linux (currently disabled and compiling produces warnings)
...
"no errors" output removed.
2009-02-19 22:21:18 +00:00
Daniel Marjamäki
efeaac736d
security: added simple gui checking
2009-02-19 17:57:27 +00:00
Daniel Marjamäki
4e1f19a366
input validation: added checking
2009-02-19 08:03:14 +00:00
Daniel Marjamäki
a844fa017e
fixed failed tests
2009-02-18 20:04:34 +00:00
Daniel Marjamäki
19c8473294
reverted [1254] it was made by mistake
2009-02-18 20:01:44 +00:00
Daniel Marjamäki
dc2ecb8980
stl push_back: Added check (invalid iterator)
2009-02-18 19:58:50 +00:00
Daniel Marjamäki
2b04c94b95
stl push_back: Added check (invalid iterator)
2009-02-18 19:57:43 +00:00
Daniel Marjamäki
1043b76d31
Added Tokenizer::elseif for breaking up 'else if' into 'else { if ..'
2009-02-17 19:18:26 +00:00
Daniel Marjamäki
5b24319cf1
varid: Added a todo test case for giving function parameters varid
2009-02-16 20:46:24 +00:00
Daniel Marjamäki
4aef89c311
tokenizer: fixed issues related to variable ids
...
* use setVarId in simplifyTokenList
* make sure function parameters and variables declared in for example for loops get variable ids
2009-02-16 17:41:33 +00:00
Daniel Marjamäki
b1982b2041
tokenizer: improved the simplification of '*(var+num)' => 'var[num]'
2009-02-15 14:02:57 +00:00
Daniel Marjamäki
56d685c179
tokenizer: Remove redundant parantheses around number. Ticket: #105
2009-02-15 13:28:54 +00:00
Daniel Marjamäki
265ef0f4a5
Tokenizer: Fixed bug in tokenizer that removed '\' from preprocessor lines
...
Ticket: #106
2009-02-15 11:42:04 +00:00
Reijo Tomperi
669913568c
Added test case TestTokenizer::sizeof5
2009-02-14 21:49:36 +00:00
Reijo Tomperi
1e07847ecf
Constant variable converting converted struct members (foo.a => foo.45) also, fixed that.
2009-02-14 21:33:28 +00:00
Reijo Tomperi
fba8c54758
Fix ticket #107 (Convert + + into + and + - into -) and add test case for it
2009-02-14 20:56:08 +00:00
Reijo Tomperi
413bf32cf2
Fixed typos in test case and enabled it.
2009-02-14 18:44:50 +00:00
Daniel Marjamäki
4a1488b1a9
tokenizer: tokenize '++', '--' and '>>' correctly
2009-02-14 10:13:50 +00:00
Reijo Tomperi
d1e9efc66a
Fix ticket #104 (Change (error) Uninitialized member variable -> (style) Member variable not initialized in the constructor)
2009-02-14 08:52:03 +00:00
Daniel Marjamäki
5c1995ca81
memory leak: handle 'delete (p)' and 'delete [] (p)'. Fixes ticket 102
2009-02-14 06:54:23 +00:00
Daniel Marjamäki
881460f71b
simplify tokens: added todo test case, the varid is lost when simplifying variable declarations
2009-02-13 17:25:23 +00:00
Daniel Marjamäki
3b194ff851
simplify token list: Added a TODO test case. variable id is lost
2009-02-13 16:23:02 +00:00
Leandro Penz
de80baeea1
Preprocessor: support for ##-comma-eating in variadic macros; passing now fmt2 test.
2009-02-13 13:34:24 +00:00
Leandro Penz
127a910516
Tokenizer: fixed ## tokenization.
2009-02-13 13:33:12 +00:00
Leandro Penz
d511863b57
Preprocessor: initial variadic macro support; passing now on fmt1 case.
2009-02-13 13:31:40 +00:00
Daniel Marjamäki
8485e95341
Token::stringifyList: Added function that stringifies a token list
2009-02-13 06:25:29 +00:00
Reijo Tomperi
916090b389
Improved test case "double_plus"
2009-02-12 20:49:05 +00:00
Reijo Tomperi
030b35c975
Added test case double_plus and improved Token::printOut
2009-02-12 20:32:59 +00:00
Reijo Tomperi
5d3574bb03
Fix ticket #100 (Simplify constants simplifies leaks out from variable scope and simplifies whole file)
2009-02-12 19:26:42 +00:00
Daniel Marjamäki
4f121daca4
buffer overruns: added simple support for initialized array
2009-02-12 19:11:52 +00:00
Leandro Penz
62a49282eb
Incomplete statements: removed false positive when setting array of structures or multi-dimensional arrays.
2009-02-12 12:59:43 +00:00
Reijo Tomperi
de2ee0a29d
Test case TestTokenizer::simplify_constants added (commented out)
2009-02-11 22:15:22 +00:00
Daniel Marjamäki
f4a3119c18
stl dangerous usage of erase: Added test cases about using return and goto
2009-02-11 16:20:32 +00:00
Daniel Marjamäki
ba3752feb6
buffer overrun: improved checking of global variables
2009-02-11 16:12:29 +00:00
Leandro Penz
4c93b4928b
Incomplete statement: fixed and enabled intarray test case.
2009-02-11 15:17:13 +00:00
Leandro Penz
d1af0b6478
Incomplete statement: test case for statement that begins with numeric constant.
2009-02-11 15:16:32 +00:00
Daniel Marjamäki
eda1290e40
dangerous usage of erase: added check
2009-02-11 05:08:29 +00:00
Reijo Tomperi
9b9223480d
Refactoring: reportErr takes now only one parameter, ErrorLogger::ErrorMessage, which contains all required information and also some help
...
functions for formatting it for output.
2009-02-10 21:51:52 +00:00
Daniel Marjamäki
71b4e5a912
stl: added testcase for bad iterator usage
2009-02-10 20:01:39 +00:00
Reijo Tomperi
4660b7648d
Moved stloutofbounds check to CheckStl class.
2009-02-10 19:56:00 +00:00
Daniel Marjamäki
c1638996f9
STL: added check for iterator usage
2009-02-10 19:40:21 +00:00
Reijo Tomperi
9dff3f4c52
Fix ticket #94 (STL container overrun). Check is currently behind --all
2009-02-09 22:25:44 +00:00
Reijo Tomperi
1373e14bc9
Fix ticket #93 (Write xml results into error stream instead of results.xml file.) and also refactor the
...
code to use ErrorLogger::reportErr() for all errors, for both xml and plain text. And move xml formatting
from Cppcheck to CppcheckExecutor.
2009-02-09 20:51:04 +00:00
Daniel Marjamäki
a5f88862b4
memory leak: keep track of --all better
2009-02-09 20:16:00 +00:00
Daniel Marjamäki
0cdb537a6a
incomplete statement: added a testcase for a false positive
2009-02-09 20:15:14 +00:00
Daniel Marjamäki
574db37a6f
uninitialized variables: added testcases and made a fix
2009-02-09 07:47:41 +00:00
Daniel Marjamäki
e572cb3c1d
Memory leak: Test code was supposed to call unknown function
2009-02-08 18:50:34 +00:00
Daniel Marjamäki
1637e867de
mismatching allocation size: moved to error suite
2009-02-08 18:34:04 +00:00
Daniel Marjamäki
d8e8e2c7ee
Memory leaks: Make sure leak is found even when using unknown functions
2009-02-08 18:31:09 +00:00
Daniel Marjamäki
81ed48562c
Memory leak: find memory leak in TestMemleak::unknownFunction2
2009-02-08 18:27:09 +00:00
Daniel Marjamäki
0361c9d338
Memory leak: Handling function that can't be traced into
2009-02-08 11:59:04 +00:00
Reijo Tomperi
cb5974e94e
Fixed issue about 4+5 being made a single token, problem appeared in recent commits.
2009-02-08 10:56:20 +00:00
Reijo Tomperi
c345fa6186
Fix ticket #89 (False positive, (style) Redundant code - begins with numeric constant (e-value))
2009-02-08 10:39:55 +00:00
Reijo Tomperi
da3efe8fa2
Improve fix made for Ticket #85 to handle strings that are in 3 parts also.
2009-02-08 10:25:33 +00:00
Reijo Tomperi
4305d749ff
Fixed ticket #88 (False positive, (style) Redundant code - begins with numeric constant)
2009-02-08 09:51:45 +00:00
Reijo Tomperi
200a159c67
Fix ticket #85 (False positive (style) Redundant code, begins with string)
2009-02-08 08:52:03 +00:00
Daniel Marjamäki
7ee193490f
Memory leaks: Added todo testcase - handle function calls that can't be followed
2009-02-08 08:21:15 +00:00
Reijo Tomperi
d48671bdfb
Fixed more of ticket #81 (getting rid of compiler warnings)
2009-02-07 20:55:25 +00:00
Reijo Tomperi
b211b8cbe8
Fix ticket #84 (unit testing: use "protected" instead of preprocessor)
2009-02-07 20:06:00 +00:00
Reijo Tomperi
798d86216a
Fix ticket #83 (cppcheck hangs) and add a test case for it
2009-02-07 19:15:10 +00:00
Daniel Marjamäki
3c289e52c5
memory allocation: check for mismatching size
2009-02-07 10:54:39 +00:00
Daniel Marjamäki
bb71f9e83e
TestMemleak: fixed problems with wrong linenumbers. This fixes ticket 79
2009-02-07 09:44:57 +00:00
Daniel Marjamäki
67ad1d8c64
TestMemleak: Fixed tests
2009-02-06 18:49:30 +00:00
Daniel Marjamäki
3c7e40fe13
errmsg: use the error message dealloc-use
2009-02-06 06:22:44 +00:00
Daniel Marjamäki
7299d3e5b1
memleak: removed false positives for mismatching allocation and deallocation
2009-02-06 06:11:47 +00:00
Reijo Tomperi
a06861948b
Fixed: Ticket #78 Change (always) into (error) in error messages
2009-02-05 21:06:32 +00:00
Reijo Tomperi
09c13d844e
Added test case linenumbers2
2009-02-05 20:29:55 +00:00
Daniel Marjamäki
10abbda6a7
memleak: corrected the wrong line number ( #77 )
2009-02-05 20:17:01 +00:00
Reijo Tomperi
7589dc3d16
testcppcheck.cpp file added, test case "linenumbers" added, codeblocks project file updated
2009-02-05 20:06:39 +00:00
Daniel Marjamäki
05e330ed38
incomplete statement: minor update
2009-02-05 18:57:53 +00:00
Daniel Marjamäki
9707217c15
activated TestClass:function
2009-02-04 19:42:40 +00:00
Daniel Marjamäki
7ccb6217bf
remove casts: Added test case to ensure that function declarations are not reduced
2009-02-04 19:40:48 +00:00
Daniel Marjamäki
8187504cbb
testclass: added todo testcase for #74
2009-02-04 19:31:25 +00:00
Daniel Marjamäki
aeb573d529
returning pointer to local array
2009-02-04 18:49:19 +00:00
Daniel Marjamäki
bd73d0913f
charvar: fixed todo testcase
2009-02-04 17:12:53 +00:00
Daniel Marjamäki
d73e6c398f
testbufferoverrun: activated test
2009-02-04 16:58:44 +00:00
Daniel Marjamäki
c46c4c50e9
memory leak: fixed ticket #9
2009-02-04 06:11:36 +00:00
Reijo Tomperi
142a21973a
Fixed varid is 0 bug which happened with sizeof(var[0]) and added testcase for it
2009-02-03 21:42:50 +00:00
Daniel Marjamäki
59f95d311b
tokenizer: setvarid handle variable declaration at start of token list
2009-02-02 19:19:36 +00:00
Daniel Marjamäki
0059ceefb9
Tokenizer: sizeof handling of 'sizeof(var[0])'
2009-02-02 18:59:32 +00:00
Daniel Marjamäki
d0af67a1b1
Tokenizer: setVarId improved to handle declaration at the first token
2009-02-02 17:35:46 +00:00
Daniel Marjamäki
27c0f786bc
tokenizer: improved sizeof handling
2009-02-02 17:27:34 +00:00
Daniel Marjamäki
0e291c772c
TestTokenize: Added testcase sizeof2 (TODO)
2009-02-02 06:26:20 +00:00
Daniel Marjamäki
dc994c346e
testtokenize: sizeof handling
2009-02-02 06:21:48 +00:00
Daniel Marjamäki
bbf4641304
testmemleak: fixed a test case
2009-02-02 06:21:00 +00:00
Daniel Marjamäki
f66750c9f1
TestMemleak: Added test cases
2009-02-02 05:58:50 +00:00
Daniel Marjamäki
385c28a02e
xml: generating better xml output
2009-02-01 18:00:47 +00:00
Reijo Tomperi
7da34ed249
Running astyle for the previous commits
2009-01-31 18:54:34 +00:00
Leandro Penz
7adcd0c355
dangerousfunctions: added check for mktemp (ticket #69 ), and refatored gets and scanf check from bufferoverrun into dangerousfunctions.
2009-01-31 18:24:48 +00:00
Daniel Marjamäki
81174a4817
mismatching allocation / deallocation: moved to --all
2009-01-31 17:54:31 +00:00
Daniel Marjamäki
f6f72fc022
errmsg: output severity in messages. a fix to track severity in the memory leaks check
2009-01-31 13:57:27 +00:00
Daniel Marjamäki
25607d9f71
mismatching allocation and deallocation: added test case that currently generates false positives
2009-01-31 11:51:47 +00:00
Daniel Marjamäki
3457b38d7a
errmsg: write severity in the message
2009-01-31 08:33:31 +00:00
Daniel Marjamäki
7d98c74d40
added test case TestBufferOverrun::sizeof2
2009-01-30 06:11:31 +00:00
Daniel Marjamäki
988d4c0d66
added todo testcase
2009-01-30 06:06:03 +00:00
Daniel Marjamäki
e9d19840d2
preprocessor: Added testcase fmt2 that is commented out because it doesn't work yet
2009-01-28 20:19:46 +00:00
Daniel Marjamäki
b7b055e885
tokenizer: fixed TestTokenizer::sizeof1
2009-01-28 17:38:32 +00:00
Daniel Marjamäki
12b6cf8c70
bad sizeof handling
2009-01-28 05:31:26 +00:00
Reijo Tomperi
2f7dec2fc3
Partial support for sizeof x, by converting it into sizeof(x). Does not handle complex structures. Closing ticket #65
2009-01-27 20:47:00 +00:00
Reijo Tomperi
64e3250f00
Fixed bug in multiCompare, which fixes ticket #66 ([False positive] "Buffer overrun" with "--all")
2009-01-27 19:30:01 +00:00
Daniel Marjamäki
8cd2979468
uninitialized member: don't check private constructors
2009-01-27 17:39:06 +00:00
Reijo Tomperi
e764cc4f95
Fix ticket #25 (simplify "void f(x) int x; {" into "void f(int x) {")
2009-01-26 22:26:50 +00:00
Daniel Marjamäki
068b1458c2
memleak: class function usage (fixing #63 )
2009-01-26 18:15:44 +00:00
Daniel Marjamäki
ca0f007ca4
tokenizer: simplify redundant paranthesis
2009-01-26 16:38:08 +00:00
Leandro Penz
9fb11bbfcc
memleak: strcat_result_assignment fixed by checking some functions for "x = func(x[),]".
2009-01-25 20:57:34 +00:00
Daniel Marjamäki
7037a3b4f6
testmemleak: removed the test case that was added in [1105]. It has been moved to the TestTokenizer instead
2009-01-25 19:40:29 +00:00
Daniel Marjamäki
4bb43e7e4d
testtokenize: Added test case for simplifying '((x))' to '(x)'
2009-01-25 19:39:05 +00:00
Daniel Marjamäki
bada255c80
testpreprocessor: removed unused test case
2009-01-25 19:18:18 +00:00
Reijo Tomperi
da63428961
Added test case complex_free
2009-01-25 16:29:51 +00:00
Reijo Tomperi
7631b0b339
Test case added: strcat_result_assignment
2009-01-25 15:56:19 +00:00
Daniel Marjamäki
9c51729be6
preprocessor: stringify macros
2009-01-25 13:30:15 +00:00
Daniel Marjamäki
5acc6aca31
preprocessor: insert space. '#if(' => '#if ('
2009-01-24 19:28:30 +00:00
Leandro Penz
04faae2882
memleak: *x=malloc(); func(&x) is no longer reported as a leak (eliminated &use2).
2009-01-24 18:55:56 +00:00
Leandro Penz
835a749026
snprintf: more tests.
2009-01-24 18:55:07 +00:00
Reijo Tomperi
98d7f02ebc
Added test case preprocessor_and_operation for ticket #55 (also fixed style from previous commit)
2009-01-24 18:50:09 +00:00
Daniel Marjamäki
8e7ff3bace
testtokenize: updated 'TestTokenize::simplify_function_parameters'
2009-01-24 18:21:16 +00:00
Reijo Tomperi
67f30376e1
Added test case simplify_function_parameters
2009-01-24 07:56:47 +00:00
Daniel Marjamäki
ca56520c29
memory leak: don't give false positive when deallocating member variable this->i ( #53 )
2009-01-23 19:24:52 +00:00
Daniel Marjamäki
f31bd86a05
removed compiler warning
2009-01-23 18:55:40 +00:00
Daniel Marjamäki
193cffdb0b
preprocessor: fixed bug with mixed macros ABC and ABCD
2009-01-23 17:14:42 +00:00
Daniel Marjamäki
67e4ea10c9
preprocessor: handle redefinition of macro
2009-01-22 20:19:07 +00:00
Daniel Marjamäki
a9e84c5cd5
preprocessor: handle include guards by not checking for configurations in header files
2009-01-22 18:19:17 +00:00
Nicolas Le Cam
b7e4f1319c
Fix Preprocessor::read to handle char constant of more than one char, fixing issue #45 ; Fix the test that handle the case.
2009-01-21 21:45:17 +00:00
Nicolas Le Cam
42c608b6f0
Remove checks that are already covered well by most compilers (Unreachable Code; Assignment in Condition; Unused Variable).
2009-01-21 21:31:47 +00:00
Reijo Tomperi
53d02c0804
Fix Ticket #43 , preprocessor: include file doesn't work so good in subfolders (note, because of other issues, checking will be very slow now
...
that this is fixed)
2009-01-21 21:03:46 +00:00
Reijo Tomperi
176dd41306
Fixed Ticket #40 , Check copyright texts in files, now that we have new developers.
2009-01-21 20:04:20 +00:00
Reijo Tomperi
9f63e2227b
Added test case multi_character_character
2009-01-21 19:12:28 +00:00
Daniel Marjamäki
76cb2310af
preprocessor: handled problem with parsing strings when expanding macros
2009-01-21 17:11:24 +00:00
Daniel Marjamäki
1622922384
preprocessor: Added todo test. It crashes when it's used
2009-01-21 07:22:44 +00:00
Reijo Tomperi
6d8387914b
Fixes test case "file2", fixes bug with include file handling
2009-01-20 22:25:49 +00:00
Daniel Marjamäki
d82314b365
preprocessor: Handle ##
2009-01-20 18:28:24 +00:00
Daniel Marjamäki
fad65663e5
tokenizer: tokenize ## better
2009-01-20 17:26:16 +00:00
Daniel Marjamäki
45661fed21
tokenizer: added testcase with include files. It should be fixed.
2009-01-20 17:05:42 +00:00
Reijo Tomperi
df5adc5f4f
Added test case preprocessor_doublesharp, executed ./runastyle for errormessage.h
2009-01-19 21:45:59 +00:00
Reijo Tomperi
4d0e3dac45
Added a test case and fixed bug. If #include was inside a string, cppcheck hanged in preprocessor.
2009-01-19 19:24:41 +00:00
Reijo Tomperi
de28502bb1
Fixed bug in line numbers and enabled test case that spots it.
2009-01-19 18:51:27 +00:00
Daniel Marjamäki
7b90246198
testtokenize: Added test "file1". It currently fails.
2009-01-19 18:40:24 +00:00
Daniel Marjamäki
835fa1f007
testtokenize: Removed unneeded test case "define1"
2009-01-19 17:47:12 +00:00
Daniel Marjamäki
a9851f44c1
testpreprocessor: Removed test that doesn't work now that the preprocessor handles includes
2009-01-19 16:42:20 +00:00
Nicolas Le Cam
f6d121443e
unreachableCode: Moved warning of a break statement following a return in --style; Added a test case; Minor optimization.
2009-01-18 21:19:02 +00:00
Leandro Penz
e930525aa4
functionVariableUsage: no longer SIGSEGVs on unfinished struct. Fixes Ticket #31 .
2009-01-18 19:45:43 +00:00
Daniel Marjamäki
f409861492
strPlusChar: Fixed false positives
2009-01-18 17:42:41 +00:00
Daniel Marjamäki
c7311b4b3c
preprocessor: make sure macros are not expanded when they are found in strings
2009-01-18 16:58:57 +00:00
Daniel Marjamäki
965daabe60
preprocessor: Make sure that "#define ABC (a+b+c)" is expanded correctly
2009-01-18 16:56:12 +00:00
Daniel Marjamäki
ea686a1da9
preprocessor: fixed so the TestPreprocessor::preprocessor_undef succeeds
2009-01-18 16:37:40 +00:00
Reijo Tomperi
d31e0ae8a1
Fix compile warning signed-unsigned
2009-01-18 11:14:35 +00:00
Reijo Tomperi
8155b9272f
Refactoring: Style applied
2009-01-18 11:13:25 +00:00
Daniel Marjamäki
4ee4645858
Preprocessor: Reverted [1008] - The old expandMacros was readded
2009-01-18 10:54:07 +00:00
Daniel Marjamäki
e315595c36
Tokenizer: Added unit test to check that define is tokenized correctly
2009-01-18 08:52:20 +00:00
Daniel Marjamäki
a269cfc8d9
tokenizer: The tokenizer shouldn't handle comments nor preprocessor directives. The preprocessor will take care of
...
that
2009-01-18 08:38:25 +00:00
Daniel Marjamäki
86c95c27d2
Preprocessor: Removed "Preprocessor::expandMacros" and commented all its tests
2009-01-18 07:32:06 +00:00
Reijo Tomperi
58b398a4a8
Fix Ticket #32 False positive with --style: Uninitialized member variable (when stream is used)
2009-01-17 20:17:57 +00:00
Reijo Tomperi
f6452e3613
Test case for Ticket #32
2009-01-17 19:26:58 +00:00
Daniel Marjamäki
b9b250f4cc
unused var: fixed false positives when using shift operator
2009-01-17 14:32:02 +00:00
Daniel Marjamäki
8780fbf8bb
bounds checking: Added error message "snprintf size is out of bounds"
2009-01-17 13:09:02 +00:00
Daniel Marjamäki
a5e2787f72
errmsg: added varname to the message "deallocating a deallocated pointer"
2009-01-17 11:15:46 +00:00
Daniel Marjamäki
121c0ee58f
unused variable: reading the value of variable in a for loop.. "for(;a;)" see ticket #18
2009-01-17 11:12:15 +00:00
Daniel Marjamäki
f562f588fb
memory leak: detect memory leak ( #6 )
2009-01-17 07:55:40 +00:00
Daniel Marjamäki
666fc82011
Memory leak: Fixed false positives about deallocating pointer that has already been deallocated
2009-01-16 16:29:41 +00:00
Daniel Marjamäki
4cfb8ad1cb
memory leaks: Added checking of deallocate to see that the pointer isn't deallocated already
2009-01-15 20:34:39 +00:00
Daniel Marjamäki
66e93b24e2
str plus char: added simple variable handling
2009-01-15 17:12:33 +00:00
Daniel Marjamäki
8bbd4b9401
str plus char: Added check and error message for str + ch
2009-01-15 16:57:51 +00:00
Daniel Marjamäki
03cfe18c9b
errmsg: Added 'condition is always true/false'
2009-01-14 19:43:28 +00:00
Daniel Marjamäki
22583269c1
Uninitialized member variables: Checking enum variables
2009-01-14 19:34:10 +00:00
Daniel Marjamäki
97a7bc383d
memory leak: Added test case
2009-01-14 16:40:07 +00:00
Daniel Marjamäki
a604f56f19
buffer overruns: added sprintf checking
2009-01-14 06:29:35 +00:00
Daniel Marjamäki
f7e4f13ecd
Memory leak: Readded some checking to classes
2009-01-14 05:58:20 +00:00
Leandro Penz
1a14cd527c
functionVariableUsage: support for nested struct/union declaration.
2009-01-14 00:45:44 +00:00
Daniel Marjamäki
e664f255a4
Memory leak: Fixed a false positive
2009-01-13 18:30:39 +00:00
Daniel Marjamäki
c1a4e9b000
testpreprocessor: commented the "undef" test that doesn't work
2009-01-12 19:23:01 +00:00
Reijo Tomperi
ee54d4da91
Added test case which currently fails, #undef is not handled
2009-01-12 18:23:53 +00:00
Daniel Marjamäki
15a32103e2
testdivision: The 'unsigned division' is a style check
2009-01-12 17:20:32 +00:00
Daniel Marjamäki
980b10bfc9
errmsg: Added 'unsigned division'
2009-01-12 17:12:14 +00:00
Daniel Marjamäki
153487d504
preprocessor: Style updates
2009-01-12 06:43:56 +00:00
Daniel Marjamäki
eb8675ab76
preprocessor: Handle newlines better
2009-01-12 06:33:06 +00:00
Daniel Marjamäki
ea6c48b2bd
preprocessor: fixed a small bug when expanding macro without parameter
2009-01-11 16:06:37 +00:00
Daniel Marjamäki
da881fdd0a
preprocessor: Fixed bug when expanding macros without parameters
2009-01-11 15:51:46 +00:00
Daniel Marjamäki
ecdfee850d
preprocessor: expand macro without parameters
2009-01-11 15:07:13 +00:00
Daniel Marjamäki
da46e4bd96
struct member usage: bail out the check if the struct contain any functions
2009-01-11 14:39:52 +00:00
Daniel Marjamäki
2e77f3bf04
setVarId: Fixed bug (variable id for struct member not correctly set)
2009-01-11 10:03:21 +00:00
Daniel Marjamäki
e42953bd3b
preprocessor: Added a test to see that "<backslash><newline>" is handled correctly inside strings
2009-01-11 08:16:15 +00:00
Daniel Marjamäki
94667320e8
preprocessor: Handle "<backslash><newline>" better
2009-01-11 07:19:28 +00:00
Leandro Penz
764e44790f
match: skip initial !! patterns if on first token.
2009-01-10 21:13:10 +00:00
Daniel Marjamäki
7b10b0ff4d
errmsg: Added "Unused private function ..."
2009-01-10 17:35:41 +00:00
Daniel Marjamäki
dc6317878e
errmsg: Added "uninitialized member variable"
2009-01-10 17:11:47 +00:00
Leandro Penz
5570f06075
checkmemoryleak: no longer flag "dealloc ; alloc ; if continue ;" as a leak, even with --all
2009-01-10 16:28:04 +00:00
Daniel Marjamäki
1a4cfc6c4f
unused struct member: fixed false positive for member "const int a;"
2009-01-10 14:39:20 +00:00
Daniel Marjamäki
a2a8378749
astyle: updated the code style
2009-01-10 14:29:59 +00:00
Daniel Marjamäki
8c4260519c
sprintf: fixed bug "false positive when variable is used again after snprintf"
2009-01-10 14:27:31 +00:00
Daniel Marjamäki
0c3c00daec
errmsg: Added errormessage for 'the class 'classname' doesn't have a constructor'
2009-01-10 13:08:44 +00:00
Daniel Marjamäki
985b8fa05f
sprintf: fixed false positives with "sprintf(buf, "%i", sizeof(buf));
2009-01-10 11:19:17 +00:00
Leandro Penz
febdc3fe6e
token: when Token::Match reached the end of input, it returned true if the next pattern was !!. It now returns true only if all remaining patterns are !!.
2009-01-10 00:33:48 +00:00
Reijo Tomperi
c7730044c7
Added test case for preprocessor which currently fails. codeblocks project file updated, tools-files added.
2009-01-08 22:28:54 +00:00
Reijo Tomperi
42b661630b
astyle changes, missed from previous commits
2009-01-08 21:08:14 +00:00
Daniel Marjamäki
5d0f8f0cfa
errormessage: Added a few more messages for checkother.cpp
2009-01-08 20:56:51 +00:00
Daniel Marjamäki
24530ebd60
sprintf: check for dangerous usage with sprintf|snprintf with
...
overlapping data
2009-01-08 06:24:08 +00:00
Daniel Marjamäki
8f86a941aa
Simplify tokens: add a ";" after case and default
2009-01-07 17:49:21 +00:00
Reijo Tomperi
e435a1f1d6
Refactoring: Added src/ and test/ folders. Moved source files to those folders, updated makefile and codeblocks project file.
2009-01-06 14:18:36 +00:00