Daniel Marjamäki
a90a7202cb
Uninitialized variables: detect usage of dead pointer: '*p += 10'
2010-11-05 17:04:41 +01:00
Daniel Marjamäki
95bfa50d7e
Null pointers: Fixed false negatives in the CheckAndDeRef checking
2010-11-04 21:22:29 +01:00
Daniel Marjamäki
f3bf14ba13
Fixed #2171 (false positive: possible nullpointer dereference)
2010-11-04 21:09:32 +01:00
Daniel Marjamäki
06ec4d9a84
GCC: Fixed compiler warnings about sign-conversion
2010-11-04 20:52:20 +01:00
Daniel Marjamäki
d21974777c
Fixed #2161 (false positive: assigned a value that is never used)
2010-11-04 20:16:17 +01:00
Daniel Marjamäki
0984a0be47
Tokenizer: Fixed 'a[b-1]+=1'
2010-11-04 19:38:19 +01:00
Daniel Marjamäki
fce6f11ed8
Tokenizer: simplify 'a[b-1]+=1' better
2010-11-04 19:02:54 +01:00
Daniel Marjamäki
c29940b114
Fixed #2166 (false positive: possible null pointer dereference)
2010-11-04 18:18:19 +01:00
Robert Reif
bc8ecf2aa7
Fixed #2168 (Segmentation fault of cppcheck)
2010-11-04 17:54:04 +01:00
Zachary Blair
10a4dde105
Fixed #2137 (Invalid mutual exclusion report)
2010-11-04 00:10:25 -07:00
Robert Reif
003f99da82
Symbol database: Fixed bug. Ticket: #2149
2010-11-04 06:58:37 +01:00
Robert Reif
cf0403434d
Symbol database: Bug fix
2010-11-03 20:33:07 +01:00
Daniel Marjamäki
1323cbdb6d
Fixed #2160 ( #2160 (Invalid unused variable report (style)))
2010-11-03 19:30:00 +01:00
Daniel Marjamäki
14803643ca
empty string test: Removed this check
2010-11-03 17:56:14 +01:00
Daniel Marjamäki
19f809c9b4
Unused variables: better handling of '= %var% ++'. Ticket: #2160
2010-11-02 20:01:12 +01:00
Daniel Marjamäki
dd4b2b8b46
Tokenizer: simplify 'x[0] += 1;'
2010-11-02 19:22:48 +01:00
Robert Reif
0fe72839d8
Symbol Database: Better handling of namespaces. Ticket: #2149
2010-11-02 18:30:57 +01:00
Daniel Marjamäki
c4452effa3
Tokenizer: simplify 'x.y += 1;'
2010-11-01 20:33:55 +01:00
Daniel Marjamäki
1b9de20f9b
Tokenizer: simplify 'case 0: x += y;'
2010-11-01 19:31:30 +01:00
Daniel Marjamäki
94fc13f0c4
Fixed #2159 (False positive: Null pointer dereference 'if (!x) return *y;')
2010-11-01 19:21:08 +01:00
Daniel Marjamäki
3fb17baa12
Fixed #2158 (False positive: value is not unused when using +=)
2010-11-01 17:36:54 +01:00
Daniel Marjamäki
285d76a413
Null pointers: Fixed false positive for 'x && x->y'
2010-10-31 19:48:58 +01:00
Daniel Marjamäki
69c6358198
CheckNullPointer: Reuse CheckNullPointer::isPointerDeRef in CheckNullPointer::nullPointerByDeRefAndChec
2010-10-31 16:07:50 +01:00
Daniel Marjamäki
32def3a3f0
CheckNullPointer: Reuse the CheckNullPointer::isPointerDeRef function
2010-10-31 15:46:08 +01:00
Daniel Marjamäki
33d3fd4716
CheckNullPointer: Reduced false negatives by making pattern more generic
2010-10-31 15:40:34 +01:00
Daniel Marjamäki
6faa4b79d3
CheckNullPointer: Refactoring. Created the function CheckNullPointer::isPointerDeRef that can be used to detect if a pointer is dereferenced
2010-10-31 15:32:19 +01:00
Daniel Marjamäki
1e866c3235
Visual Studio: Fixed compiler error
2010-10-31 11:42:45 +01:00
Daniel Marjamäki
bc283d8b99
Uninitialized variables: Broke out the checking into separate file
2010-10-31 12:31:11 +01:00
Daniel Marjamäki
df8a93bf97
Null pointers: Broke out the checking into separate file
2010-10-31 11:51:25 +01:00
Daniel Marjamäki
1ef09147f3
CheckOther: updated CheckOther::getErrorMessages
2010-10-31 10:07:35 +01:00
Daniel Marjamäki
6c19ea7b53
Tokenizer: Added a few comments
2010-10-31 09:58:44 +01:00
Daniel Marjamäki
558899dc74
Variable usage: Fixed false negative that I introduced when simplifying compound assignments
2010-10-31 09:34:25 +01:00
Daniel Marjamäki
23d3fd3a5a
Fixed #2147 (uninitialized variable: false negative for 'x += y;')
2010-10-31 08:47:13 +01:00
Daniel Marjamäki
8d96697623
GCC: Fixed compiler warnings
2010-10-30 14:53:25 +02:00
Daniel Marjamäki
b55f6458a2
Fixed #2120 (False positive: array index out of bounds (unknown type in struct, sub function))
2010-10-30 12:32:43 +02:00
Daniel Marjamäki
7b630cc581
Fixed #2154 (false positive: The loop might unintentionally skip an element in the container)
2010-10-30 11:22:30 +02:00
Kimmo Varis
9627b667a1
Move simplifyPath method from FileLister to Path class.
...
simplifyPath() "fits" better to Path class conceptually. It handles
paths, not lists them. Also this way we get rid of few unneeded
dependencies to FileLister class.
2010-10-29 22:21:27 +03:00
Daniel Marjamäki
9435fde551
Tokenizer: Added function for checking if code is Java/C#
2010-10-28 18:51:55 +02:00
Daniel Marjamäki
fee20bafa0
Java: Removed bailout added in 120073f000
2010-10-28 18:01:51 +02:00
Daniel Marjamäki
995e39200b
Fixed #2130 (Invalid possible NULL pointer dereference, etc.)
2010-10-27 20:20:10 +02:00
Daniel Marjamäki
fc98bcdcb2
Fixed #2141 (false positive: possible null pointer dereference)
2010-10-27 19:42:47 +02:00
Daniel Marjamäki
fd153eac02
Fixed #2142 (false positive: null pointer dereference (throw))
2010-10-27 19:38:42 +02:00
Robert Reif
b6aca47e11
Fixed #1195 (Uninitialized member variable not detected 'std::vector<int> *ints;')
2010-10-27 19:28:15 +02:00
Robert Reif
5a8f490f07
Fixed #2135 (False positive 'Can be const')
2010-10-27 19:25:34 +02:00
Pete Johns
8022baec2a
Removed unnecessary code duplication.
2010-10-27 19:34:06 +11:00
Cary R
59139b17cb
Fixed #2138 (Add support for comments in suppression file)
2010-10-26 21:22:11 +02:00
Daniel Marjamäki
a38b14d582
Tokenizer: Remove redundant semi colons
2010-10-26 21:05:20 +02:00
Daniel Marjamäki
79583ee45d
#2133 (cppcheck: floating point exception)
2010-10-26 20:05:34 +02:00
Daniel Marjamäki
6200d4505a
Fixed #2118 (Invalid syntax error report.)
2010-10-26 19:39:48 +02:00
Daniel Marjamäki
9370f552ac
Fixed #2134 (sizeof(*list) complains of null pointer dereference)
2010-10-26 18:26:02 +02:00
Daniel Marjamäki
b6106ddf72
Fixed #2132 (Internal error. Token::Match called with varid 0.)
2010-10-26 18:10:03 +02:00
Daniel Marjamäki
27235f27ae
Fixed #2129 (Invalid dereference after release report)
2010-10-26 17:49:48 +02:00
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
Daniel Marjamäki
41a06a21d9
using deallocated pointer: detect first problem reported in ticket #2090
2010-10-25 17:36:46 +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
40aeb17738
uninitialized variables: handling loop bodies. end upon '}'
2010-10-24 18:28:25 +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
cf86e11d05
Fixed #2111 (Class methods writing to a union are detected as 'can be const')
2010-10-24 16:43:10 +02:00
Daniel Marjamäki
13b8544436
Visual Studio: Fixed compiler warning. Ticket: #2123
2010-10-24 11:52:28 +02:00
Daniel Marjamäki
306587b1d0
Buffer overruns: Fixed TODO test case
2010-10-24 11:32:27 +02:00
Daniel Marjamäki
f3c6c64e9a
Fixed #2121 (False positive: Buffer access out-of-bounds when using uint32_t)
2010-10-23 13:12:17 +02:00
Daniel Marjamäki
120073f000
Java: fixed false positives about uninitialized variable
2010-10-23 10:56:30 +02:00
Daniel Marjamäki
5deb046ac5
Fixed #2120 (False positive: array index out of bounds (unknown type in struct, sub function))
2010-10-23 08:49:03 +02:00
Daniel Marjamäki
c907acf767
Fixed #1819 (False positive: auto variable assignment (unseen typedef))
2010-10-22 21:12:56 +02:00
Daniel Marjamäki
9fdc03fc1d
Fixed #2117 (false positive: buffer access out of bounds)
2010-10-22 20:15:51 +02:00
Daniel Marjamäki
9ae4a758b8
Fixed #2116 (Internal error. Token::Match called with varid 0)
2010-10-21 21:28:32 +02:00
Daniel Marjamäki
eba827bc4b
Fixed #2112 (Crash scanning qtcreator sources)
2010-10-21 19:42:09 +02:00
Daniel Marjamäki
6a66d32871
JAVA: better handling of java code
2010-10-20 22:15:35 +02:00
Daniel Marjamäki
4ff52b5883
Objective C: activate checking of .m and .mm files. The normal checking is used.
2010-10-20 21:09:07 +02:00
Daniel Marjamäki
8b866178ff
Fixed #2103 (false positive when variable is checked to NULL and not freed)
2010-10-20 20:38:37 +02:00
Daniel Marjamäki
68dd2f8378
Fixed #2113 (False positive: Memory leak where a pointer is passed in a struct to another function to be freed)
2010-10-20 18:39:40 +02:00
Daniel Marjamäki
02ba2b202e
Fixed #2110 (Tokenizer::simplifyTypedef: regression - wrong simplification of 'typedef char TString[256];')
2010-10-20 06:09:29 +02:00
Daniel Marjamäki
f8c02718a5
Activated checking of .java and .cs files
2010-10-19 21:54:15 +02:00
Daniel Marjamäki
20674e08d0
Stl: improved check for dangerous usage of c_str
2010-10-19 20:21:58 +02:00
Daniel Marjamäki
2ca7dbc004
Fixed #2109 (false positive: buffer overrun)
2010-10-19 18:23:44 +02:00
Daniel Marjamäki
0864a0700a
Fixed #2108 (False positive: the loop might unintentionally skip an element in the container.)
2010-10-18 20:05:54 +02:00
Daniel Marjamäki
e54129fa8d
STL: check for dangerous usage of string::c_str(). Ticket: #1116
2010-10-17 19:18:46 +02:00
Ettl Martin
7d1995dfaa
Merge branch 'master' of github.com:danmar/cppcheck
2010-10-17 21:56:05 +08: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
Ettl Martin
f25f3c64b4
fixed style waring (You should use ++ and -- as prefix whenever possible as these are more efficient than postfix operators) in lib/checkclass.cpp
2010-10-17 20:15:29 +08:00
Kimmo Varis
ddfc7b2d5a
Run dmake to update Makefile and lib/lib.pri.
2010-10-17 00:57:25 +03:00
Kimmo Varis
7a84e7dcca
Add comment that qmake doesn't add _UNICODE define for project files.
2010-10-17 00:32:31 +03:00
Daniel Marjamäki
28e40cb9b0
unicode: updates to the handling of unicode filenames. Ticket: #2100
2010-10-16 21:39:58 +02:00
Daniel Marjamäki
88a98a2ef0
unicode: use short filenames when long filename doesn't work. Temporary solution for #2100
2010-10-16 12:40:21 +02:00
Daniel Marjamäki
4e121c94ab
some more comments
2010-10-15 18:37:48 +02:00
Daniel Marjamäki
d182079c5e
added comments in CheckStl
2010-10-15 18:21:53 +02:00
Daniel Marjamäki
0b6948a805
Fixed #2101 (list in vector iterator usage)
2010-10-15 18:11:41 +02:00
Daniel Marjamäki
ba2b986ece
Fixed #2097 (false positive: buffer access out of bounds)
2010-10-14 20:00:32 +02:00
Daniel Marjamäki
e11d9f1628
astyle formatting
2010-10-14 19:59:10 +02:00
Debrard Sebastien
fb928b6778
Fixed #2018 (Postfix Operators)
2010-10-14 19:17:40 +02:00
Daniel Marjamäki
b6c995ea47
Fixed #2096 (False positive: buffer overrun (extern array))
2010-10-13 20:57:59 +02:00
Robert Reif
267d1f273e
Fixed #2082 (Tokenizer::simplifyTypedef: wrong handling of array)
2010-10-13 20:02:37 +02:00
Daniel Marjamäki
229604b3e3
Fixed #2093 (False positive: buffer access out of bounds (unknown type))
2010-10-13 18:06:50 +02:00
Pete Johns
afe52fa9f2
Fixed MSVC++ compiler warning (pointers are not bools)
2010-10-13 21:19:18 +11:00
Pete Johns
52e16454fa
Removed redundant code.
...
localClassDefinition is no longer required due to improved isIdentifierObjectType() in commit fbd3d92
.
2010-10-13 20:48:37 +11: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
Robert Reif
a58094e827
Fixed #2089 (False negative: Function can be const (calling const function))
2010-10-13 07:26:41 +02:00
Daniel Marjamäki
2334192bff
Fixed #2087 (False positive: Array 'str[1]' index 1 out of bounds)
2010-10-12 21:52:02 +02:00
Debrard Sebastien
d0629803a9
warning de compilation
2010-10-12 19:57:17 +02:00
Debrard Sebastien
3273f964c8
comment
2010-10-12 19:56:35 +02:00
Debrard Sebastien
1a4e3dcc44
increment check
2010-10-12 19:54:39 +02:00
Daniel Marjamäki
9e15c4ef38
Fixed #2088 ([test.c:12]: (error) Buffer access out-of-bounds: l)
2010-10-12 19:35:20 +02:00
Robert Reif
907ed0ac6f
Fixed #2085 (False negative: function can be const when member variable is compared)
2010-10-12 07:57:09 +02:00
Daniel Marjamäki
74bf1821e6
Array index: detect array index out of bounds when datatype is unknown. Ticket: #2086
2010-10-11 20:52:14 +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
Robert Reif
a6e915f0cd
Fixed #2081 (false negative: the function can be declared as const)
2010-10-11 17:43:36 +02:00
Zachary Blair
d9967d4fd2
Fixed #2079 (detect side effects in assert)
2010-10-10 13:05:06 -07:00
Daniel Marjamäki
81aed3fbd7
Tokenize: Fixed bug in Tokenize::simplifyKnownVariables
2010-10-10 19:27:42 +02:00
Daniel Marjamäki
ef4ce6f46b
STL: fixed false positives in the new double-increment check when iterator shadows outer iterator
2010-10-10 14:28:14 +02:00
Daniel Marjamäki
5cc7c9dcf7
Parameter passed by value: updated error message so it mentions the reason.
2010-10-10 14:12:11 +02:00
Daniel Marjamäki
ae0528ef59
STL: fixed false positives for the new double-increment check
2010-10-10 11:22:44 +02:00
Daniel Marjamäki
835b511bee
STL: Added double-increment check.
2010-10-10 10:52:41 +02:00
Daniel Marjamäki
a73ada54d5
Fixed #1705 (false negative: access past end of buffer)
2010-10-10 09:15:18 +02:00
Daniel Marjamäki
14f12e0647
Fixed #2078 (false negative: member variable not intialized)
2010-10-10 07:57:26 +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
068317bed1
STL: Fixed TODO test case TestStl::erase5
2010-10-09 07:15:34 +02:00
Daniel Marjamäki
e0ba626351
ClassInfo: Removed unused functionality
2010-10-08 19:43:41 +02:00
Robert Reif
02027eb750
Fixed #2074 ('Internal error in Cppcheck' on complex function typedef (even 2 typedefs!))
2010-10-06 05:43:07 +02:00
Daniel Marjamäki
7b4e08385d
STL: refactoring CheckStl::erase so ExecutionPath is used
2010-10-05 20:54:13 +02:00
Pete Johns
4e11e71a21
Fixed 2072 (object destroyed immediately: add --doc info)
2010-10-04 08:54:19 +11: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
5bf2a300d9
1.45: updated version information
2010-10-03 17:05:36 +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
Daniel Marjamäki
e4c3b390cc
Fixed #2069 (cppcheck fails to scan OpenBSDs ftp source code)
2010-10-02 13:28:44 +02: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
9a9302cba1
Prevent Tokenizer::simplifyCalculations() from removing parantheses from calls to Functors.
2010-10-02 21:19:05 +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
6eeed00888
Fixed #2067 (Template methods do not 'use' private ones)
2010-09-30 21:22:49 +02: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
80069f016e
Fixed #2065 (false positive: memory leak)
2010-09-27 17:53:10 +02:00
Pete Johns
6a52538a9a
Fixed #1949 : assert() hides memory leaks
...
Added separate unit-test (trac1949), initially broken to highlight the error and added "assert" to call_func_white_list.
Left TestMemleakInFunction::call_func() as is, as this wouldn't highlight the actual problem.
2010-09-27 20:25:34 +10:00
Daniel Marjamäki
cdecbe29d0
Optimisation: Made Tokenizer::simplifyInitVar faster
2010-09-26 15:54:41 +02:00
Daniel Marjamäki
ff7a99ad37
Revert "Optimisation: small speedups in the Tokenizer::simplifyTokenList handling"
...
This reverts commit 056037feed
.
2010-09-24 22:18:51 +02:00
Daniel Marjamäki
056037feed
Optimisation: small speedups in the Tokenizer::simplifyTokenList handling
2010-09-24 22:14:18 +02:00
Daniel Marjamäki
86e517c5d3
Fixed #1951 (Preprocessor: Compound macro statements not handled correctly)
2010-09-24 21:38:11 +02:00
Daniel Marjamäki
4c98a7e67b
Optimisation: Removed unused and slow code. The code was added to fix #1225 but it is now redundant.
2010-09-24 20:56:21 +02:00
Daniel Marjamäki
8950beac37
Optimisation to make the CheckUninitVar::parse slightly faster
2010-09-23 21:40:08 +02:00