Daniel Marjamäki
893f7fa347
Fixed #2130 (Invalid possible NULL pointer dereference, etc.)
2010-10-26 17:40:30 +02:00
Daniel Marjamäki
bdd6d6d53d
null pointer: use simplified token list in the 'check and deref' checking
2010-10-25 21:05:43 +02:00
Daniel Marjamäki
132aa8d0c4
uninitialized variables: fixed fp when analysing loops
2010-10-25 20:56:15 +02:00
Daniel Marjamäki
026514db1a
Fixed #2127 (null pointer dereference after condition (SRD nr 522))
2010-10-25 19:43:54 +02:00
Zachary Blair
26afb04dc5
Fixed #2105 (Incorrect operator: mutual exclusion over ||)
2010-10-24 18:14:21 -07:00
Daniel Marjamäki
24a2def3ad
Execution Path: Fixed FP in improved handling of loop bodies
2010-10-24 19:14:40 +02:00
Daniel Marjamäki
8f707e5e46
Null pointers: Better handling of loops
2010-10-24 18:51:14 +02:00
Daniel Marjamäki
6601de7681
uninitialized variables: refactoring handling of loop bodies
2010-10-24 18:26:59 +02:00
Daniel Marjamäki
b66d3c8858
Fixed #2125 (uninitialized variable: better handling of for loops)
2010-10-24 18:12:48 +02:00
Daniel Marjamäki
92a1e9e76e
Severities: Added 'warning' and 'performance' severities. No changes to the command line options nor to the XML format. Ticket: #2106
2010-10-17 14:41:00 +02:00
Debrard Sebastien
fb928b6778
Fixed #2018 (Postfix Operators)
2010-10-14 19:17:40 +02:00
Pete Johns
fbd3d92aa9
Fixed #2084 (False positive: object destroyed immediately (struct and function with same name))
...
Tightened up class definition matching so as not to match C-style struct tags.
2010-10-13 20:37:53 +11:00
Debrard Sebastien
1a4e3dcc44
increment check
2010-10-12 19:54:39 +02:00
Daniel Marjamäki
3dfcbfc0e0
assignment in assert: modified the error message to better explain the reason why the warning is given.
2010-10-11 17:59:08 +02:00
Zachary Blair
d9967d4fd2
Fixed #2079 (detect side effects in assert)
2010-10-10 13:05:06 -07:00
Daniel Marjamäki
3340010376
fix unit testing
2010-10-10 14:23:05 +02:00
Daniel Marjamäki
a3367874d9
Fixed #1778 (false negative: nullpointer dereference (std::string pointer))
2010-10-09 07:57:34 +02:00
Daniel Marjamäki
7b4e08385d
STL: refactoring CheckStl::erase so ExecutionPath is used
2010-10-05 20:54:13 +02:00
Pete Johns
4bf9ff26ea
Fixed 2071 (false positive: object destroyed immediately (when using '= { ... }'))
...
Simplified check within CheckOther::checkMisusedScopedObject() as a result.
2010-10-04 08:16:11 +11:00
Daniel Marjamäki
cd8ef1cded
Revert "temporarily disable the 'object destroyed immediately' message"
...
This reverts commit fa94312c9a
.
2010-10-03 18:05:08 +02:00
Daniel Marjamäki
fa94312c9a
temporarily disable the 'object destroyed immediately' message
2010-10-03 16:59:13 +02:00
Pete Johns
78795dc3ac
Fix false positive: Misused Scope Object does not pick constructors of local class declarations.
...
It does pick up if there is an unused construction within the function, though.
2010-10-02 22:59:04 +10:00
Pete Johns
365b1bed1a
Fixed false positive: checkMisusedScopedObject no longer errors on calls to function objects.
2010-10-02 21:25:16 +10:00
Pete Johns
b72b699b76
Fixed false-positive: Object is referenced on construction
...
struct Foo {
void bar() {
}
};
void fn() {
Foo().bar(); // This caused a false-positive
}
2010-10-02 20:26:29 +10:00
Pete Johns
3f72d3a877
Check misused scope object does not pick local class method.
...
Also fixed mistyped withinFuntion ->withinFunction.
2010-10-02 20:12:52 +10:00
Pete Johns
0017655f55
Added test for functor false-positive [passing]
...
Also removed typedef's following danmar's review and renamed isClassresults -> isClassResults to make more clear.
2010-10-02 18:45:24 +10:00
Pete Johns
6e0ef3eda2
Fixed #1132 (Detection of misused scope objects in functions)
...
Emits error in the form:
[useless_lock.cpp:18]: (error) instance of "Lock" object destroyed immediately
...if an instance of a class or struct is unnamed and therefore destroyed
straight after creation.
Only checks for misused scope objects within functions.
Optimised isIdentifierObjectType() by memoizing.
2010-10-02 14:22:26 +10:00
Pete Johns
50c2fa9ab0
Revert "Fixed #1132 (Detection of misused scope objects)"
...
This reverts commit c6acdccfa0
.
2010-10-01 20:52:16 +10:00
Pete Johns
c6acdccfa0
Fixed #1132 (Detection of misused scope objects)
...
Emits error in the form:
[useless_lock.cpp:18]: (error) instance of "Lock" object destroyed immediately
...if an instance of a class or struct is unnamed and therefore destroyed
straight after creation.
Removed "internal error" from token.cpp, since in this case varid would be NULL.
2010-10-01 20:30:21 +10:00
Daniel Marjamäki
415cbc63c3
Fixed #2066 (false positive: uninitialized variable when initializing through function pointer)
2010-09-27 19:26:09 +02:00
Daniel Marjamäki
de3c761790
Fixed #2052 (False positive: possible null pointer dereference 'else continue')
2010-09-18 14:56:07 +02:00
Daniel Marjamäki
fce70508f7
Fixed #2045 (False negative: Uninitialized variable (found with gcc))
2010-09-17 20:38:37 +02:00
Daniel Marjamäki
1c3862bd35
Execution Paths: fixed TODO test cases
2010-09-17 19:31:45 +02:00
Daniel Marjamäki
f843678a07
Redundant conditions: some refactorings
...
* removed the 'redundant null pointer' check. sometimes it's unsafe to delete NULL pointer. and this check doesn't point out errors anyway.
* moved the 'redundant condition' check for set::remove. Moved it to CheckStl.
2010-09-16 18:49:23 +02:00
Daniel Marjamäki
7e67bb53b8
Fixed #2049 (False negative: 'Uninitialized variable' error won't show)
2010-09-15 20:04:50 +02:00
Daniel Marjamäki
0418731473
Fixed #2030 (False positive: Uninitialized variable when function does not return)
2010-09-10 19:02:40 +02:00
Daniel Marjamäki
5688412f00
Fixed #2030 (False positive: Uninitialized variable when function does not return)
2010-09-07 20:25:29 +02:00
Daniel Marjamäki
cfbc06c8b6
removed 'empty catch block' check. to avoid false positives we'll need to check if it is bad with an empty catch block (dead pointer/undefined behaviour/etc)
2010-09-05 13:27:58 +02:00
Daniel Marjamäki
a2b4e5641f
Fixed #2010 (missing continue in switch check ?)
2010-09-04 14:24:45 +02:00
Daniel Marjamäki
fb4fce466e
Fixed #2014 (False positive with longjmp)
2010-09-03 07:18:01 +02:00
Daniel Marjamäki
190a0040b7
Null pointer: Fixed false positive
2010-09-02 21:08:58 +02:00
Daniel Marjamäki
df87ce9e04
Fixed #1945 (False positives when a for loop header is in a macro)
2010-08-26 21:57:48 +02:00
Daniel Marjamäki
72916caee6
Reverted 7398453cb0
2010-08-15 21:25:14 +02:00
Sbastien Debrard
7398453cb0
Refactoring of obsolete functions checks. Ticket: #1940
2010-08-15 21:22:33 +02:00
Zachary Blair
c8087d3389
Fixed #162 (Initialisation of a variable by itself)
2010-08-14 21:34:04 -07:00
Daniel Marjamäki
5846630fa9
Added scanf check. Modified patch submitted by Eric Sesterhenn
2010-08-14 15:15:12 +02:00
Daniel Marjamäki
029613d4c4
Fixed #1923 (False positive: Possible null pointer derefence in else if)
2010-08-07 19:59:56 +02:00
Daniel Marjamäki
e7e86ef333
calculation in sizeof: added two more ASSERT_EQUALS to guard against false positives
2010-08-07 10:12:39 +02:00
Daniel Marjamäki
c395e51389
New check: look for calculation inside sizeof
2010-08-06 22:57:10 +02:00
Daniel Marjamäki
65f7bcbfa5
null pointers: fixed TODO assertion - dereference pointer in function call and then checking that it is not NULL
2010-08-05 08:19:36 +02:00
Daniel Marjamäki
6f228033d2
null pointers: fixed todo test case
2010-08-05 08:06:19 +02:00
Daniel Marjamäki
239d264432
uninitialized variables: fixed false negatives when uninitialized pointer data is read
2010-08-04 21:13:40 +02:00
Daniel Marjamäki
9c17114668
Fixed #1893 (false positive: dereferencing null pointer (try/catch))
2010-07-24 14:27:18 +02:00
Daniel Marjamäki
bbf2c6c6e6
Fixed #1880 (false positive: Uninitialized array (initialized in subfunction))
2010-07-19 10:03:54 +02:00
Martin Ettl
6cc3f76668
#1880 : added todo testcase (false positive: (error) Uninitialized variable: y)
2010-07-18 18:55:53 +02:00
Daniel Marjamäki
1fb4758583
Fixed #1855 (false positive: uninitialized variable (function call in switch condition))
2010-07-18 13:19:37 +02:00
Daniel Marjamäki
11a72461f3
Fixed #1835 (false positive: uninitialized variable when using ?)
2010-07-08 11:16:49 +02:00
Daniel Marjamäki
a1793edabe
Fixed #1825 (*log(0) error)
2010-07-07 09:03:40 +02:00
Daniel Marjamäki
1b20f8d27d
Fixed #1824 (false positive: unitialised variable)
2010-07-06 13:18:28 +02:00
Daniel Marjamäki
c811acaa50
Fixed #1818 (False positive: Dangerous usage of strncpy (copying a constant string))
2010-07-05 12:45:39 +02:00
Zachary Blair
5ea28ccbba
Fixed #157 (Forgetting to put a break in a switch statement)
2010-06-30 00:10:30 -07:00
Daniel Marjamäki
c6888845a0
Fixed #1815 (False positive: uninitialized variable when using ? operator)
2010-06-30 08:28:34 +02:00
Daniel Marjamäki
ad0908cb3f
Fixed #1808 (false positive: uninitialized variable with multiple assignment)
2010-06-25 19:39:30 +02:00
Nicolás Alvarez
df3d98a7c2
Fix typos in sizeofsizeof error message.
2010-06-19 17:16:14 -03:00
Daniel Marjamäki
82b63dd736
Fixed #1633 (tokenizer: simplifyKnownVariable: improved handling of arithmetic)
2010-06-19 14:00:45 +02:00
Zachary Blair
efefceabae
Fixed #920 (new style check: find empty catch blocks)
2010-06-14 23:45:46 -07:00
Daniel Marjamäki
cb7e9fbec1
Fixed #1776 (False Negative: Unitialized array)
2010-06-14 08:36:34 +02:00
Martin Ettl
c9cd5ea250
added a todo testcase for ticket 1778
2010-06-09 01:21:52 +02:00
Daniel Marjamäki
472bd9dabe
Fixed #1726 (False negative: null pointer dereference in switch block)
2010-06-06 12:15:31 +02:00
Daniel Marjamäki
07e00d57d9
Fixed #1725 (segfault in ExecutionPath::bailOutVar (probably caused by #1721 fix))
2010-06-05 09:45:35 +02:00
Daniel Marjamäki
b11e23eb08
Fixed #1721 (False negative: uninitialized variable in switch block)
2010-06-03 20:02:58 +02:00
Daniel Marjamäki
37ae4692bb
Uninitialized variables: fixed false negative when using uninitialized variable inside malloc call
2010-05-30 10:30:51 +02:00
Daniel Marjamäki
1ec49430e3
Uninitialized variables: better handling when uninitialized variables are used in function calls
2010-05-30 09:31:10 +02:00
Daniel Marjamäki
ab41879246
ExecutionPath: Better handling of 'FOREACH (..) {}'
2010-05-30 09:00:18 +02:00
Daniel Marjamäki
f41334e58a
ExecutionPath: better handling of 'FOREACH(..){..}'
2010-05-30 08:26:44 +02:00
Daniel Marjamäki
406cbda563
Uninitialized variables: better handling of struct variables
2010-05-30 07:55:11 +02:00
Daniel Marjamäki
d3c20cac81
Fixed #1712 (False negative: dereferencing uninitialized pointer)
2010-05-27 19:00:52 +02:00
Daniel Marjamäki
88e9a4ade6
Fixed #1704 (false negative: null pointer dereference)
2010-05-26 19:16:42 +02:00
Daniel Marjamäki
75c9355e9a
Added some multipass checking for the uninitialized variables. It is still experimental. You can activate it with the '--test-2-pass' switch. Some more refactorings are needed to make it truly usable, the main thing is to make it thread safe.
2010-05-21 19:35:18 +02:00
Daniel Marjamäki
6edb2e77b4
Refactoring: Removed Severity::possibleStyle
2010-05-16 14:43:42 +02:00
Daniel Marjamki
972046c4bd
Added test CheckOther::sizeofsizeof. Inspired by #1682
2010-05-15 14:06:45 +02:00
Daniel Marjamäki
7c52c8683d
Fixed #1662 (false positive: Data is allocated but not initialized, when using sprintf)
2010-05-09 07:48:52 +02:00
Daniel Marjamäki
2901434773
Fixed #1658 (false negative: uninitialized pointer usage)
2010-05-08 19:23:46 +02:00
Daniel Marjamäki
bd22a18dc1
Refactoring: Changed 'possible style' to 'style'
2010-05-08 09:49:01 +02:00
Zachary Blair
21b7eb61f5
Fixed #959 : (new check: wrong usage of fflush()) Simplified and set severity to error
2010-05-06 23:08:10 -07:00
Zachary Blair
707d27f3d8
Fixed #959 (new check: wrong usage of fflush())
2010-05-03 23:14:45 -07:00
Daniel Marjamäki
cccccff96f
Fixed #1629 (False negative: null pointer derefence not detected 'c[0] = 0')
2010-04-28 22:07:39 +02:00
Daniel Marjamäki
2666aad207
Fixed #1632 (false positive: unintialized variable)
2010-04-28 21:33:11 +02:00
Daniel Marjamäki
eb82a89758
ExecutionPath: Better handling of if
2010-04-25 11:55:57 +02:00
Daniel Marjamäki
a15e25f9fe
Fixed #1571 ('C-style pointer casting' should not be reported for C files)
2010-04-24 16:46:09 +02:00
Daniel Marjamäki
f3bea249ac
Removed the check for unreachable code. The g++ warning -Wunreachable-code is recommended instead. This closes #1603 (break after a return or goto should not be an error in a switch statement).
2010-04-24 14:30:45 +02:00
Zachary Blair
680a470741
Fixed #1564 (CppCheck does not recognise redundant IF)
2010-04-22 01:21:54 -07:00
Zachary Blair
c26e619b23
Fixed #855 (Refactoring: move conditions into checks)
2010-04-20 23:38:25 -07:00
Reijo Tomperi
35d2a27b9c
Update copyright year in all source files
2010-04-13 22:23:17 +03:00
Zachary Blair
bd7dc9946e
Fixed #1530 (possible new check: strlen return value versus zero.)
2010-04-13 19:30:25 +02:00
Daniel Marjamäki
38a28e28ec
Fixed #1581 (False positives 'The scope of the variable x can be reduced')
2010-04-09 16:53:27 +02:00
Martin Ettl
4bc325f077
#ticket 1513: added sqrt() support
2010-04-05 20:20:20 +02:00
Martin Ettl
fe7c6aed9f
#ticket 1513: added pow() support
2010-04-05 20:07:53 +02:00
Martin Ettl
218c18496d
#ticket 1513 added fmod() support
2010-04-05 19:45:33 +02:00
Martin Ettl
d4923e2a92
added atan2() check to ticket #1513
2010-04-05 19:35:56 +02:00
Daniel Marjamäki
61e1c4183f
Uninitialized variables: better handling of 'a[b[..]]' when b is not initialized
2010-04-05 09:04:30 +02:00
Daniel Marjamäki
d26a2cfc16
Uninitialized variables: Detect reading uninitialized data through array/pointer variable
2010-04-05 08:38:26 +02:00
Daniel Marjamäki
abceff497b
Refactoring: some refactoring of ExecutionPath. The foundError was removed. No automatic bailout of all checks are made when errors are found.
2010-04-04 11:24:52 +02:00
Daniel Marjamäki
78852b08ab
Fixed #1566 (false negative: uninitialized variable)
2010-04-04 09:17:53 +02:00
Daniel Marjamäki
849be383e6
Tokenizer: tokenize 1E-2 into a single token
2010-04-04 08:01:05 +02:00
Reijo Tomperi
a1d0defbc0
astyle fix
2010-04-02 21:42:06 +03:00
Martin Ettl
c391a03db6
added acos() check to ticket #1513 ; added testcases for MathLib::toDoubleNumber(), now double conversion of zeros is handled correctly; changed assertEquals() function of testsuite parameters from unsigned int to double. This is needed to avoid overflow of unsigned int by comparing negative floating point values.
2010-04-02 20:23:37 +02:00
Daniel Marjamäki
734b10e650
Fixed #1479 (false positive: unintialized variable when using goto)
2010-04-02 08:35:05 +02:00
Daniel Marjamäki
8b5aae9adb
astyle formatting
2010-04-02 07:32:03 +02:00
Daniel Marjamäki
0cad22314e
Reverted 'astyle fix'. Those changes are not in sync with my astyle configuration/setup.
2010-04-02 07:30:58 +02:00
Martin Ettl
193aa7d1d3
astyle fix
2010-04-02 02:21:53 +02:00
Martin Ettl
b5fb01c202
ticket #1513 new check: Detecting obviously wrong math call arguments passed to math functions)
2010-04-02 02:19:38 +02:00
Daniel Marjamäki
c3edc5fd89
Fixed #1148 (improve check: usage of uninitialized variables)
2010-03-28 21:27:06 +02:00
Daniel Marjamäki
c7867af3c5
Fixed #1533 (False positive: Uninitialized variable)
2010-03-28 10:42:37 +02:00
Raphael Geissert
c0e09c4cb3
Fixed #1511 (false negative null pointer deref when dereferencing pointers to constants)
2010-03-26 16:44:46 +01:00
Daniel Marjamäki
15d67a2369
Fixed #1503 (False positive for uninitialized variable)
2010-03-16 19:09:37 +01:00
Daniel Marjamäki
7f42ed3ad0
Fixed #1472 (false positive: Data is allocated but not initialized: service)
2010-03-07 09:08:52 +01:00
Daniel Marjamäki
6ca4b008d0
null pointer: Fixed better error message for 'possible null pointer' + removed redundant check in our Tokenizer.
2010-02-28 07:26:50 +01:00
Reijo Tomperi
b35acc1e6b
Add TODO test case for #1444 (inline suppression suppress all errors of the same type in a function)
...
http://sourceforge.net/apps/trac/cppcheck/ticket/1444
2010-02-25 22:55:09 +02:00
Daniel Marjamäki
0b2ad2164f
Fixed #1442 (false positive: getting offset instead of dereferencing a null pointer)
2010-02-22 21:30:21 +01:00
Daniel Marjamäki
6a03fa604c
Fixed #1402 (false positive: uninitialized variable)
2010-02-20 09:35:57 +01:00
Daniel Marjamäki
b59d79c303
readded checks for unused variables and unreachable code that were removed in 42c608b6f0
2010-02-18 18:45:13 +01:00
Daniel Marjamäki
db2c362604
Fixed #1389 (false positive: uninitialized variable)
2010-02-17 18:10:50 +01:00
Reijo Tomperi
7e2e20c2d3
astyle fix
2010-02-08 09:35:53 +02:00
Monika Lukow
2d5d060514
Fixed #1094 (Improve check: unusual pointer arithmetic: 'ch+str')
2010-02-07 21:44:11 +01:00
Daniel Marjamäki
0d18050b55
Fixed #984 (improve output if strncpy is followed by strncat)
2010-02-05 17:35:18 +01:00
Daniel Marjamäki
1b9afc82a4
Reverted 4f30468c80
. There was false positives such as #1335 so please fix them and then re-commit.
2010-02-01 19:46:51 +01:00
Monika Lukow
4f30468c80
Fixed #1094 (Improve check: unusual pointer arithmetic: 'ch+str')
2010-01-31 11:42:02 +01:00
Daniel Marjamäki
48f3921c36
Null pointer dereference: sending to output stream
2010-01-30 14:40:33 +01:00
Daniel Marjamäki
019f775aa5
TestOther::uninitvar1: refactoring. splitting up this function into multiple functions
2010-01-24 15:23:21 +01:00
Daniel Marjamäki
43c8fe895c
Fixed #1301 (False positive: Data is allocated but not initialized)
2010-01-23 21:25:17 +01:00
Daniel Marjamäki
037ecffc34
detect when function pointer that is null is used
2010-01-23 09:15:30 +01:00
Daniel Marjamäki
7b986c831d
Report when using uninitialized function pointer
2010-01-23 07:57:57 +01:00
Daniel Marjamäki
2e707974d0
Fixed #1273 (scope of variable limited not detected in latest versions)
2010-01-21 18:50:56 +01:00
Daniel Marjamäki
fbf428550a
Fixed #1262 (cppcheck false positives: 'Possible null pointer dereference', 'Uninitialized variable')
2010-01-17 19:08:45 +01:00
Daniel Marjamäki
a7bddc8fd3
Fixed #1268 (Null pointer dereference false positive)
2010-01-14 20:02:38 +01:00
Daniel Marjamäki
cefa695dba
Fixed #1265 ((error) Uninitialized variable on macro expansion)
2010-01-13 19:37:55 +01:00
Daniel Marjamäki
374def4a53
Fixed #1070 (Improve scope error message)
2010-01-12 19:34:33 +01:00
Daniel Marjamäki
d3b7f5931f
Fixed #1174 (improve check: Unintialized variable not detected in subfunction)
2010-01-11 22:28:07 +01:00
Daniel Marjamäki
b8b6b0ec32
Uninitialized variables: fixed false positives when using pointer aliasing
2010-01-11 19:25:01 +01:00
Daniel Marjamäki
8be54b592d
ExecutionPath: better handling of for/while/do/switch, it doesn't bail out everything
2010-01-10 22:05:51 +01:00
Daniel Marjamäki
c5966bba59
Fixed #1225 (false negative :: uninitialized variable not detected when using enums)
2010-01-10 20:36:15 +01:00
Daniel Marjamäki
b82cb2e41e
Fixed #1218 (Improve check: incrementing uninitialized variable i++)
2010-01-10 09:09:37 +01:00
Daniel Marjamäki
4c641ed80c
Fixed #1189 (false negative: using uninitialized variable i 'a[i] = 0;')
2010-01-09 22:26:05 +01:00
Daniel Marjamäki
2dd0907146
fixed segmentation fault
2010-01-08 21:54:24 +01:00
Daniel Marjamäki
ca74f57fd0
Fixed #1237 (Uninitialized variable false positive for return-value pattern in pan source code.)
2010-01-08 21:24:48 +01:00
Daniel Marjamäki
e248f7d3e5
Fixed #1023 (improve check: Unintialized variable not detected when using +=)
2010-01-03 18:49:13 +01:00
Daniel Marjamäki
e286896d75
Fixed #1216 (false positive: uninitialized variable when using exit|abort)
2010-01-03 15:35:32 +01:00
Daniel Marjamäki
fa535ff3ae
Fixed #440 (NULL referencing not detected)
2010-01-03 13:30:20 +01:00
Daniel Marjamäki
1032eb2449
Fixed #1214 (false positive: uninitialized variable 'bool fixed = std::ios_base::fixed;')
2010-01-03 08:03:28 +01:00