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