Daniel Marjamäki
371871b0b7
Tokenizer::removeMacrosInGlobalScope: Don't remove C/C++ keywords namespace/struct/etc. Ticket: #3193
2011-10-12 19:23:39 +02:00
Daniel Marjamäki
cf39ece8da
Fixed #3150 (Invalid warning when pointer difference is not adjacent)
2011-10-12 19:01:44 +02:00
Robert Reif
ee04c1bfb7
fix #3194 (Parsing glitch causes false 'can be const' error for an 'if' statement)
2011-10-12 09:10:34 -04:00
Robert Reif
af6a6f9c2d
run astyle
2011-10-12 09:08:54 -04:00
Marek Zmysłowski
07d8cd0a12
improved realloc checking '*p = realloc(*p,..'. Ticket: #1791
2011-10-11 22:07:14 +02:00
Thomas Jarosch
849bee8437
[PATCH] Detect suspicious use of semicolon after 'if/for/while'
...
statements if they are followed by a {..} block.
Examples are:
for (int i = 0; i < 10; ++i);
{
printf("i)";
}
or
if (i == 100);
{
die("Wrong argument");
}
This new check is active if you enable inconclusive checks.
2011-10-11 08:41:39 +02:00
Zachary Blair
fcf360825a
Fixed #2955 (New check: Using && instead of &)
2011-10-10 10:11:17 -07:00
Edoardo Prezioso
742858b67c
Fixed some simple errors in some old commits.
2011-10-10 17:18:47 +02:00
Edoardo Prezioso
af23a9dcbb
Fixed ticket #3140 (Improve Tokenizer: Remove dead for loop 'for (int i = 0; i < 0; ++i)')
2011-10-10 15:15:45 +02:00
PKEuS
5f9b916dcc
Fixed #2115 (new check: endless loop (unsigned comparison that is always true))
2011-10-09 20:35:46 +02:00
Daniel Marjamäki
96beb94b21
Fixed #3183 (False positive: (error) syntax error)
2011-10-09 18:42:36 +02:00
Daniel Marjamäki
175503ef94
Null pointer: improved inconclusive checking in CheckNullPointer::nullPointerAfterLoop
2011-10-09 15:09:02 +02:00
seb777
1d9a99012b
Fixed 3133 (Improve Check: Found obsolete function)
...
- add check for std::gets
- improve check when multiple obsolete functions are used
- remove false positive (declared functions)
2011-10-09 10:31:21 +02:00
Edoardo Prezioso
9270b84d64
More fixes to the label simplifier (related to ticket 3176):
...
1)Simplify the labels if there are combinations of the symbols '*','&','{' and '(' after a '%var% :' and before another '%var%';
2)but do not simplify the label if it's inside an unpreprocessed macro code.
2011-10-08 21:13:53 +02:00
Daniel Marjamäki
0b09732881
Null pointers: fixed false negatives when there are '(p && ..'
2011-10-08 12:58:10 +02:00
Stefan Weil
bf25340fd3
Settings: add missing initialisation for member variable c99 (reported by Valgrind)
2011-10-08 10:29:11 +02:00
Daniel Marjamäki
5c08979920
1.51: Updated versions
2011-10-08 07:45:39 +02:00
Daniel Marjamäki
37d4a01dcb
Added todo comments to fix false negatives caused by my fix for #3128
2011-10-08 07:39:20 +02:00
Daniel Marjamäki
e2ec5a127f
Fixed #3128 (False positive: null pointer dereference check does not handle complex boolean logic properly)
2011-10-07 21:08:21 +02:00
Robert Reif
a1a839fadc
fix tokenizer and symbol database to not mistake goto statement for variable declaration
2011-10-07 08:11:48 -04:00
Robert Reif
7dd001c9a9
run astyle
2011-10-06 21:10:20 -04:00
Edoardo Prezioso
80df7ea839
Fixed ticket #3176 (cppcheck reports wrong unused variable)
...
Label simplification didn't take count of the '(' parenthesis or the '&' and '*' operators inside or outside the parenthesis after the colon.
2011-10-07 00:54:44 +02:00
Edoardo Prezioso
fe4ce594ce
Renamed the function 'removeRedundantCodeAfterReturn' with 'simplifyDeadCode'.
...
This is a preparation in order to add new features to this function (see the @todo in the tokenize header file, ticket #3113 and #3175 for details).
2011-10-06 22:40:39 +02:00
Daniel Marjamäki
73fb6725e6
Readded CheckOther::bitwiseOnBoolean as inconclusive check
2011-10-06 22:01:48 +02:00
Marek Zmysłowski
307dd00efb
Fixed #3072 (improve check: deprecated function alloca)
2011-10-06 08:10:51 +02:00
Daniel Marjamäki
09109f19f8
Removed CheckOther::bitwiseOnBoolean check. The reasons can be seen in my comments in ticket #3062 .
2011-10-05 20:46:07 +02:00
PKEuS
494d3af3d1
Fixed #1877 (Be more strict about int vs. bool, part II)
2011-10-05 20:30:36 +02:00
Thomas Jarosch
abd2525339
Fixed #3161 (Show buffers size info for snprintf() buffer overruns)
2011-10-05 20:17:57 +02:00
Edoardo Prezioso
d741f64256
Merge branch 'master' of github.com:danmar/cppcheck
2011-10-05 19:52:49 +02:00
Kimmo Varis
3cfe7ca1a7
Move "information" errors to "style" errors.
...
"information" severity is documented in lib/errorlogger.h as:
Checking information.
Information message about the checking (process) itself. These
messages inform about header files not found etc issues that are
not errors in the code but something user needs to know.
It IS NOT for errors in the code. All the current "information"-
severity errors fit nicely into description of the "style"-
severity.
We definitely need to separate processing information and actual
errors in the code. It is highly confusing for users to mix these
two different things. Hence all current "information" code error
messages are moved to "style" category.
Ticket: #3165 (Stop misusing the 'information' error severity!)
2011-10-05 20:44:00 +03:00
Edoardo Prezioso
8e90ad106c
Fixed ticket #3148 (Analysis failed on "Modules/mathmodule.c")
...
Fix: Do not handle code when 'return' is inside a macro. This is valid also for 'switch' code inside a macro.
2011-10-05 19:33:46 +02:00
Edoardo Prezioso
3c370dcfdf
Fixed #3146 "Analysis failed" error on softmagic.c:
...
-Fixed: the code didn't check the rightness of the switch syntax if it was inside another switch;
-Tweaked: removed the two bool variables, so now the conditions take count of indentation unsigned variables.
2011-10-04 12:16:39 +02:00
Edoardo Prezioso
bc74213036
Fixed #3132 (Analysis failed. If the code is valid then please report this failure.)
2011-10-03 19:38:37 +02:00
Daniel Marjamäki
417dc1ff2a
Fixed #3159 (Uninitialized variable false positive)
2011-10-02 20:38:58 +02:00
Daniel Marjamäki
480c403511
Fixed #3125 (FP: Possible null pointer dereference in conditional operator)
2011-10-02 19:27:18 +02:00
Daniel Marjamäki
b2d0e48a31
Fixed #3126 (false positive: Null pointer dereference)
2011-10-02 18:24:45 +02:00
Robert Reif
65b0fb4519
fix #3153 (false positive buffer access out-of-bounds)
2011-09-30 17:28:59 -04:00
Robert Reif
272783347b
another variation of false negative from #3149
2011-09-30 16:26:08 -04:00
Stefan Weil
2193572c9e
test _WIN64 before _WIN32 (64-bit compiler defines both macros)
2011-09-30 14:12:44 -04:00
Robert Reif
1dcb8b2382
really fix #3149 (false negative: Technically the member function 'A::f' can be const.)
2011-09-30 11:16:34 -04:00
Robert Reif
556d523e4f
fix #3149 (false negative: Technically the member function 'A::f' can be const.)
2011-09-29 20:16:52 -04:00
Robert Reif
ac942c6684
fix #3151 (missing portability warning for extra qualifier on destructor)
2011-09-29 19:25:14 -04:00
Robert Reif
092ba0b1de
fix symbol database bug where function variable type of a nested class was not found
2011-09-28 22:05:26 -04:00
Reijo Tomperi
236d0eb178
Fix #2813 (False negative: Uninitialized variable not found for realloc)
...
http://sourceforge.net/apps/trac/cppcheck/ticket/2813
Patch provided by: marekzmyslowski
2011-09-28 21:46:09 +03:00
Robert Reif
9994218aa2
refactor last commit to move unknown type output to seperate function
2011-09-28 07:36:48 -04:00
Robert Reif
989235b509
show unknown variable types when debug-messages flag is set
2011-09-27 21:45:06 -04:00
Robert Reif
540207533b
fix #3008 (New check: Order of initialisation list)
2011-09-27 21:07:37 -04:00
Robert Reif
44a926aa4d
add a few more Microsoft TCHAR function conversions
2011-09-27 07:29:36 -04:00
Robert Reif
ec377d24eb
add support for Microsoft TCHAR character constants
2011-09-26 22:08:24 -04:00
Robert Reif
2d717d77cd
reduce false negatives for checking for CheckOther::checkSignOfUnsignedVariable()
2011-09-26 21:24:34 -04:00
Robert Reif
6e8bf43dc0
add some Windows TCHAR scanf and printf conversions
2011-09-25 10:02:27 -04:00
Robert Reif
545aa9e55b
start adding Windows wide character support
2011-09-24 16:02:56 -04:00
Robert Reif
f97424b242
start adding Windows ASCII TCHAR conversion support
2011-09-24 14:51:03 -04:00
seb777
424f349b88
fix #3121 ([False Positive] Incorrect obsoleted functions)
2011-09-24 10:54:58 +02:00
Robert Reif
a685f1f5b7
add operator support to ertra qualification check
2011-09-23 19:45:19 -04:00
Robert Reif
ac070b90f2
fix for loop false positives when zero length arrays present
2011-09-22 21:23:40 -04:00
Robert Reif
97d4277854
add Microsoft memory function conversions to standard cstring functions
2011-09-22 19:59:56 -04:00
Robert Reif
1dc7c0edf9
fix #3127 ([False positive] _tmain function i VS 2010 project)
2011-09-21 20:16:20 -04:00
Robert Reif
4d1dda10fa
add some more windows type conversions
2011-09-20 20:17:02 -04:00
Daniel Marjamäki
1a7511ed48
Fixed #3106 (False positive: Uninitialized variable check has inconsistent behavior with ternary operator)
2011-09-20 21:00:05 +02:00
Johan Samuelson
889c407f58
Fixed #3118 (Tokenizer: str*cmp() in hot spot code)
2011-09-20 19:03:19 +02:00
Robert Reif
af5272dfb0
only simplify Microsoft MFC code when Windows platform is selected
2011-09-20 07:20:37 -04:00
Robert Reif
e234e8cc5b
add some common windows pointer type conversions to standard types
2011-09-19 23:14:58 -04:00
Robert Reif
b349d36c50
fix #3124 (FP: Buffer access out-of-bounds when memset two dimension array (a[5][6]))
2011-09-19 20:32:50 -04:00
Robert Reif
2fe182b833
set windows platform type to type executable was compiled on
2011-09-18 13:19:00 -04:00
Robert Reif
be660003ec
start adding conversions from common Windows types to standard types
2011-09-18 13:06:54 -04:00
Robert Reif
958a53eaa8
run astyle
2011-09-18 12:58:28 -04:00
Daniel Marjamäki
96a04eee9c
Merge pull request #35 from simartin/ticket_3059
...
Ticket 3059: Report the correct line number in unused functions warnings
2011-09-18 08:15:28 -07:00
Robert Reif
66eb37c135
convert size_t to standard type
2011-09-18 10:31:31 -04:00
Robert Reif
3e35ea0972
fix sizeof long double for unix64 for #2888 (Allow defining sizes of base types)
2011-09-18 08:40:08 -04:00
Simon Martin
b493e4bf7b
Ticket 3059: Report the correct line number in unused functions warnings
2011-09-18 07:13:39 +02:00
Robert Reif
b5d22fda0d
fix #2888 (Allow defining sizes of base types)
2011-09-17 19:40:52 -04:00
Robert Reif
1717bda382
fix wrong information about constness of function
2011-09-16 18:07:25 -04:00
Robert Reif
cce4303f28
fix a problem with Qt slots immediately followed by signals
2011-09-16 16:59:43 -04:00
Robert Reif
2670525b4f
better fix for #3114 (infinite recursion when operator= is overloaded)
2011-09-14 19:58:11 -04:00
Robert Reif
2bc7da2c64
quick fix for #3114 (infinite recursion when operator= is overloaded)
2011-09-14 19:04:06 -04:00
Edoardo Prezioso
1ff7410f4f
Fixed #3075 (False positive => Improve tokenizer: remove redundant code after a 'return' state)
2011-09-13 07:55:47 +02:00
Robert Reif
735ff11469
fix #3110 (false positve: style) Boolean result is used in bitwise operation. Clarify expression with parentheses)
2011-09-12 07:32:55 -04:00
Robert Reif
3f517b5f23
partial fix for #2960 (false negative: buffer access out of bounds)
2011-09-11 21:51:05 -04:00
Robert Reif
40009d091d
add multi-dimension array support to second checkScope and use it for member arrays
2011-09-11 20:42:57 -04:00
Robert Reif
0d6592dd2e
use correct checkScope function in CheckBufferOverrun for single dimension member arrays
2011-09-11 19:21:13 -04:00
Robert Reif
19928e26d1
refactor to unify functionally identical code in CheckBufferOverrun::checkScope()
2011-09-11 14:00:53 -04:00
Robert Reif
e18fe56d56
refactor CheckBufferOverrun to only use multi-dimension array error messages and remove single dimension array message
2011-09-11 09:54:26 -04:00
Daniel Marjamäki
55230baf78
Fixed #3086 (false positive: Boolean result is used in bitwise operation.)
2011-09-11 09:46:01 +02:00
Daniel Marjamäki
9a97fbe022
Fixed #3104 (unread despite modified and used in IF statement)
2011-09-11 08:19:35 +02:00
Daniel Marjamäki
d93354a974
unused var: use 'else if' instead of 'if'
2011-09-11 08:18:32 +02:00
seb777
8ed0e3a239
Revert "The case statement requires constant-expression (C, C++, C# and Java."
...
This reverts commit 5879fe419d
.
2011-09-11 00:44:40 +02:00
seb777
5879fe419d
The case statement requires constant-expression (C, C++, C# and Java.
...
Needless to simplify the calculation of a piece of code that can not compile.
2011-09-10 17:28:32 +02:00
Robert Reif
a9b4e21f60
refactor CheckBufferOverrun::checkScope to take an ArrayInfo parameter
2011-09-10 11:21:52 -04:00
Robert Reif
794fdd056b
Merge branch 'master' of github.com:danmar/cppcheck
2011-09-10 10:14:49 -04:00
Robert Reif
547a79d4fe
calculate array size for variable length structures with array at end in CheckBufferOverrun::checkStructVariable() when possible
2011-09-10 10:14:32 -04:00
Philipp Kloke
2f62d180fe
Fixed #1740 (Undefined Behavior: Divide by zero)
2011-09-10 16:12:53 +02:00
seb777
08efad13b2
fix #3093 (Simplify code (math expression) with keywords 'return' and 'case')
2011-09-10 13:28:54 +02:00
Robert Reif
b0eab2587d
better detection of variable sized structure in CheckBufferOverrun::checkStructVariable()
2011-09-09 08:37:24 -04:00
Robert Reif
27bfa2a346
fix some CheckBufferOverrun::checkStructVariable() flase negatives for possible variable length structs
2011-09-09 07:46:06 -04:00
Robert Reif
4a71693e0c
Merge branch 'master' of github.com:danmar/cppcheck
2011-09-09 07:16:55 -04:00
Robert Reif
16924c7c7a
fix #3094 (Buffer access out-of-bounds in struct variable)
2011-09-09 07:16:39 -04:00
Daniel Marjamäki
84f190abf7
Fixed #3096 (false negative: memory leak not found when passing string to strtok)
2011-09-09 07:25:47 +02:00
Robert Reif
812a17f294
fix one of the TODO testcases added for #3094 (Buffer access out-of-bounds in struct variable)
2011-09-08 22:44:25 -04:00
Daniel Marjamäki
d10822ea11
fixed a few doxygen warnings
2011-09-08 18:28:05 +02:00
Daniel Marjamäki
184e0550b8
updated comments
2011-09-08 18:23:25 +02:00
seb777
074ad10a30
fix #195 Unusual shift operation - check this kind of code
...
return x >> ! y ? 8 : 2;
2011-09-06 22:37:19 +02:00
Robert Reif
cbbdd55177
fix some -Wconversion -Wsign-conversion warnings in checkbufferoverrun.cpp
2011-09-05 19:02:26 -04:00
Robert Reif
7451c5cece
warn when buffer is not zero terminated after memmove
2011-09-05 15:59:41 -04:00
Robert Reif
f5d71d1ac5
warn when buffer is not zero terminated after memcpy
2011-09-05 15:41:37 -04:00
Robert Reif
3c8988e7a5
warn when buffer is not zero terminated after strncpy
2011-09-05 15:19:38 -04:00
Daniel Marjamäki
2601733ff7
Uninitialized vars: handle printf a little better. Ticket: #3050
2011-09-05 20:18:58 +02:00
Daniel Marjamäki
c7d0beefa8
uninitstring: fix false negatives when non-zero memset is used. Ticket: #3050
2011-09-05 19:42:48 +02:00
Robert Reif
b27bbea44a
really fix #3079 (Spelling error in unsigned variable check 'never alwayw')
2011-09-05 09:48:59 -04:00
Robert Reif
2250a2dfc3
fix #3079 (Spelling error in unsigned variable check 'never alwayw')
2011-09-05 09:04:27 -04:00
Robert Reif
fe85b8779e
fix #2528 (false negative: buffer access out of bounds)
2011-09-04 21:39:52 -04:00
Robert Reif
50688b28fd
fix #2889 (false negative: buffer access out of bounds on local struct member)
2011-09-04 19:54:57 -04:00
Daniel Marjamäki
8240422a09
Fixed #3078 (vector::at using int causes false positive)
2011-09-04 20:48:05 +02:00
Daniel Marjamäki
c34b77cebf
Fixed #3073 (False positive: Assigning an integer (int/long/etc) to a pointer is not portable)
2011-09-04 13:03:29 +02:00
Daniel Marjamäki
85d83d86ac
Fixed #3060 (False positive: Uninitialized variable: fresh)
2011-09-04 12:53:53 +02:00
Robert Reif
e782d98241
final fix for #3063 (false negative: multi dimensional arrays not well supported)
2011-09-03 21:51:00 -04:00
seb777
5c7ed46e0c
Following the discussion XX, replace the keyword C99 '_Bool' with the 'bool' keyword in the process of tokenization\nSee f29b7f9f08
2011-09-03 23:15:33 +02:00
Daniel Marjamäki
46b5d5bd00
Fixed #3069 (False positive: Memory leak: data)
2011-09-03 20:45:48 +02:00
Daniel Marjamäki
d098ed6031
Fixed #3065 (False positive: possible null pointer dereference: vi)
2011-09-03 19:43:27 +02:00
Daniel Marjamäki
c7886ca1c4
Fixed #3058 (False positive: Uninitialized variable: data)
2011-09-03 18:53:14 +02:00
Robert Reif
7cb5c97e7d
move member variable lookup code from a check to the symbol database so it can be reused by other checks
2011-09-03 12:22:13 -04:00
Daniel Marjamäki
d23c58d387
enable: break out 'performance' and 'portability' from the 'style' id. Ticket: #3074
2011-09-03 15:30:30 +02:00
Robert Reif
d749e28dc0
another partial fix for #3063 (false negative: multi dimensional arrays not well supported)
2011-09-02 21:07:29 -04:00
Robert Reif
d85410de8c
partial fix for #3063 (false negative: multi dimensional arrays not well supported)
2011-09-02 19:35:09 -04:00
Robert Reif
f29b7f9f08
fix #3062 (false negative: Boolean variable is used in bitwise operation)
2011-09-02 17:19:06 -04:00
Robert Reif
e19cbf0cdd
fix false positive introduced by previous false negative fix commit
2011-09-02 10:39:04 -04:00
Robert Reif
833865e736
fix #3066 (False positive: Inconclusive: Assigning address of local auto-variable to a function parameter.)
2011-09-01 22:22:33 -04:00
Robert Reif
5bad978833
fix line number in messagex for CheckAutoVariables::autoVariables
2011-09-01 20:34:31 -04:00
Robert Reif
f4e07c3179
fix #3070 (Other: failed to parse a typedef string. Check continues anyway.)
2011-09-01 19:10:58 -04:00
Robert Reif
2667e34a07
fix again #3064 (false negative: returning address of stack variable)
2011-09-01 18:30:49 -04:00
Robert Reif
ff690abf80
better error message for #3064 (false negative: returning address of stack variable)
2011-09-01 07:10:11 -04:00
Robert Reif
e7dc765ece
fix #3064 (false negative: returning address of stack variable)
2011-08-31 21:36:31 -04:00
Daniel Marjamäki
a96028b43b
Fixed #3058 (False positive: Uninitialized variable: data)
2011-08-31 19:45:20 +02:00
Robert Reif
477d1e92c9
add new (nothrow) support to CheckUnusedVar::checkFunctionVariableUsage
2011-08-31 06:39:39 -04:00
Robert Reif
acebc635b5
add support for deallocating memory with realloc
2011-08-30 23:42:11 -04:00
Daniel Marjamäki
0529654e37
Fixed #3058 (False positive: Uninitialized variable: data)
2011-08-30 19:13:04 +02:00
Daniel Marjamäki
ef30da51bf
Fixed #3034 (Cppcheck crash on specific file (truecrypt).)
2011-08-29 19:16:52 +02:00
Robert Reif
7775934492
really fix multi-dimensional arrays with undefined size
2011-08-28 13:32:42 -04:00
Daniel Marjamäki
787bc4c384
Fixed #3016 (Preprocessor has incorrect precedence(?) for &&)
2011-08-28 18:30:58 +02:00
Robert Reif
cf6d04de74
fix #3044 (Symbol database: handle multidim array with unknown dimension 'char a[][4]')
2011-08-28 11:40:55 -04:00
Robert Reif
2d952c65e4
fix #3051 (False positive: operator= should return reference (when function takes pointer argument))
2011-08-28 11:14:15 -04:00
Robert Reif
9a0d076295
fix #3052 (False Positive - Technically the member function 'Example::Clear' can be const.)
2011-08-28 09:21:00 -04:00
Robert Reif
d643397a7e
better message for strncpy zero-terminated check
2011-08-28 09:06:51 -04:00
Daniel Marjamäki
a1aa66f370
Fixed #3039 (False Positive: Memory Leak 'p = pop(p);')
2011-08-28 11:28:14 +02:00
Robert Reif
8c093d0f8a
refactor CheckBufferOverrun::checkScope strncpy check and change experimental to inconclusive
2011-08-27 21:18:39 -04:00
Daniel Marjamäki
15e965b530
Fixed #3038 (False Positive - memory leak (struct member passed to subfunction))
2011-08-26 19:26:21 +02:00
Robert Reif
9539d22a1a
partial fix for #3050 (strncpy zero termination check behaving flaky)
2011-08-25 23:48:32 -04:00
Robert Reif
1d7ab77251
fix #3043 (False Positive - Member variable 'ProgramRecPriorityInfo::profile' is not assigned a value in 'ProgramRecPriorityInfo::operator=')
2011-08-25 23:27:10 -04:00
Robert Reif
423a1ff64e
add support for simplifying Qt emit in tokenizer
2011-08-25 20:54:35 -04:00
Robert Reif
dfe89f395a
fix #3049 (False Positive - Technically the member function 'VideoOutputNull::SetupDeinterlace' can be const.)
2011-08-25 19:13:53 -04:00
Daniel Marjamäki
6d9463139d
Fixed #3038 (False Positive - memory leak)
2011-08-25 19:59:44 +02:00
Robert Reif
6e78b51071
make all functions that call reportError names in checkbufferoverrun end in Error for consisentcy
2011-08-24 07:11:39 -04:00
Robert Reif
6f3131da8c
fix a serious symbol database bug where parts of a function could be skipped
2011-08-23 20:12:29 -04:00
Daniel Marjamäki
2f0fc9444f
Fixed #3041 (false positive reported for error with id='deallocuse')
2011-08-23 23:18:47 +02:00
Robert Reif
c7cb38b0b5
fix #3040 (False positive - Technically the member function 'PSIPTable::SetSection' can be const.)
2011-08-22 20:34:00 -04:00
Kimmo Varis
abf29fc531
Add doxygen grouping for the new file.
2011-08-22 20:46:53 +03:00
Kimmo Varis
71778095c6
Compile fix.
2011-08-22 20:21:25 +03:00
Kimmo Varis
716679ec7d
Move Suppressions class to own source files.
...
I want to use Suppressions class also in GUI. And that is easier
to do when it is not internal class of Settings class. And in
general is it more natural that Settings class only contains list
of suppressions and implementation is separate.
2011-08-22 19:57:28 +03:00
Robert Reif
8c1efe9bb6
improve message for #3035 (false negative: strcpy(dst, src) where src is bigger than dst)
2011-08-21 15:18:41 -04:00
Robert Reif
67e8731a96
partial fix for #3035 (false negative: strcpy(dst, src) where src is bigger than dst)
2011-08-21 14:44:55 -04:00
Daniel Marjamäki
7afec3cf6d
Fixed #3032 (False positive: possible null pointer dereference (assignment in condition))
2011-08-21 17:49:00 +02:00
Robert Reif
7eb43bc107
partial fix for #3030 (Improve check: Returning pointer to local array variable with '&' pointer operator)
2011-08-20 15:08:30 -04:00
Daniel Marjamäki
d5bf5b7ad2
Preprocessor: allow that 'missingInclude' messages are suppressed with '--suppress=missingInclude'
2011-08-20 11:23:59 +02:00
Daniel Marjamäki
939504af3c
Cppcheck: allow that 'toomanyconfigs' are suppressed. show these messages by default even though 'information' hasn't been enabled.
2011-08-20 11:20:25 +02:00
Daniel Marjamäki
27b29e5b8e
Fixed #3023 (False positive: no possible null pointer dereference here: 'WARN_ON(!abc || abc->x == 0);')
2011-08-20 09:47:55 +02:00
Daniel Marjamäki
dd09b24208
Fixed #3024 (False positive: memory leak for 'rc.bitmap' when rc is added to linux kernel list)
2011-08-20 09:17:34 +02:00
Daniel Marjamäki
fe78e28d70
Cppcheck: Don't show information messages about interrupted checking unless --enable=information has been given.
2011-08-19 22:32:57 +02:00
Kimmo Varis
80ba3d6a92
Merge pull request #32 from rpavlik/qmake-configure-rules
...
Qmake configure rules
2011-08-19 13:00:34 -07:00
Robert Reif
2dd93dff75
move unused variable checks from checkother to checkunusedvar
2011-08-19 14:35:25 -04:00
Robert Reif
9fbef3ca7b
fix #3011 (new check: when first comparison is true, the 2nd comparison is always true)
2011-08-19 13:28:37 -04:00
Daniel Marjamäki
a735790e77
using boolean result in bitwise operation. fix false positive for '.. != (char *) &x'
2011-08-19 18:55:20 +02:00
Daniel Marjamäki
2dd1e290eb
fixed false positives for the 'bitwise operator / comparison operator' check
2011-08-19 18:06:28 +02:00
Robert Reif
eda9ff6fc5
refactor checkother to move error messages to follow check and rename some error functions to end in Error
2011-08-19 11:53:43 -04:00
Daniel Marjamäki
314d5f1e79
fixed false positive for 'using bitwise operation on boolean result'
2011-08-19 17:07:26 +02:00
Daniel Marjamäki
72b01d1ca0
Improve check: Tweaked the assignAndCompare to handle | also in addition to &
2011-08-19 16:10:09 +02:00
Daniel Marjamäki
c107fdd2d4
Fixed #3018 (false positive: (style) Suspicious condition (assignment+comparison), it can be clarified with parentheses)
2011-08-19 13:54:06 +02:00
Daniel Marjamäki
40b493e621
Improve check: Clarify condition (using boolean result in bitwise operation)
2011-08-19 13:40:54 +02:00
Daniel Marjamäki
0d7c80ef21
improved comment of previous commit
2011-08-19 07:28:15 +02:00
Daniel Marjamäki
4606251ce8
Fixed #3001 (False Positive: Redundant assignment to itself)
2011-08-19 07:23:11 +02:00
Daniel Marjamäki
e5ff920ea9
Suspicious condition: Better handling when rhs is non-numeric
2011-08-19 00:56:15 +02:00
Daniel Marjamäki
a7728fef48
New check: warn about such suspicious conditions: '(a & b == c)'
2011-08-19 00:15:20 +02:00
Ryan Pavlik
50b0e95314
put the rules logic in its own .pri file, and allow easier override
2011-08-18 15:42:19 -05:00
Ryan Pavlik
33b5970c91
use the qmake config setting HAVE_RULES to enable/disable pcre rules support,
...
defaulting to on except on Windows.
2011-08-18 12:13:21 -05:00
Daniel Marjamäki
afed93d7d6
Command line: Added --std option. Right now only --std=posix is possible but other options might be added later.
2011-08-17 20:08:55 +02:00
Robert Reif
88019658b4
fix #3013 (segmentation fault of cppcheck ( struct x : virtual y ))
2011-08-16 19:16:58 -04:00
Reijo Tomperi
dd666b7c1b
Add command line option: --debug-fp ... If used, cppcheck will print out the code generating error into output stream.
...
This is ment to be used for debugging false positive errors in Cppcheck.
Current implementation tries two alternatives. Without all headers or with all headers and prints out the option with
less code. In future versions this could try with individual headers or group of header files.
2011-08-16 22:58:27 +03:00
Daniel Marjamäki
5f25f2c6e6
Fixed #3012 (False Pos Memory Leak with a Macro)
2011-08-16 20:39:17 +02:00
Daniel Marjamäki
4f962acf16
Fixed #3009 (Using numeric constants in kernel space code)
2011-08-16 20:16:33 +02:00
Robert Reif
a6c5eff1be
fix #3006 (segmentation fault of cppcheck ( x < () < ))
2011-08-15 07:19:49 -04:00
Robert Reif
4168d79b09
fix #3005 (segmentation fault of cppcheck ( enum : x ))
2011-08-15 07:07:12 -04:00
Robert Reif
5364b4f7fb
fix #3007 (false positive: (style) Struct 'Fred' hides typedef with same name)
2011-08-15 06:56:15 -04:00
Robert Reif
ed507b73ee
fix #3004 (false positive: (style) Struct 'Fred' hides typedef with same name)
2011-08-14 21:00:05 -04:00
Robert Reif
08e9d64a86
fix #3003 (segmentation fault of cppcheck (typedef a x[]; y = x ))
2011-08-14 20:38:16 -04:00
Robert Reif
b7f42535ec
fix #3000 (false positive: (style) Struct 'Fred' hides typedef with same name)
2011-08-14 18:50:33 -04:00
Robert Reif
389ab80b63
fix #2999 (false positive: (style) Struct 'Fred' hides typedef with same name)
2011-08-14 18:06:05 -04:00
Daniel Marjamäki
961b6e7752
Preprocessor: Added safety checks in case the code is corrupt. Related to ticket #2998
2011-08-14 18:35:34 +02:00
Robert Reif
da9bf37918
refactor CheckNullPointer::nullPointerByDeRefAndChec() to pull variable type lookup out of loop
2011-08-14 10:53:09 -04:00
Robert Reif
9a70ec87a8
convert CheckStl::if_find() to use the symbol database
2011-08-14 10:46:35 -04:00
Robert Reif
ad45ba718c
convert CheckOther::checkCharVariable() to use symbol database
2011-08-14 10:39:45 -04:00
Robert Reif
cd2c0fd9c8
convert CheckOther::checkSizeofForNumericParameter() to use the symbol database
2011-08-14 10:21:07 -04:00
Robert Reif
741eabba16
convert CheckOther::checkIncrementBoolean() to use the symbol database
2011-08-14 10:16:39 -04:00
Daniel Marjamäki
01b9c0707d
Settings: Removed the --enable=posix option. Ticket: #2949
2011-08-14 09:45:53 +02:00
Daniel Marjamäki
3a260822ad
1.50: Updated version
2011-08-14 08:08:37 +02:00
Robert Reif
136c617a99
fix [tokenize.cpp:6353]: (style) Checking if unsigned variable 'indentlevel' is less than zero.
2011-08-13 12:47:16 -04:00
Robert Reif
b7f963f701
removed redundant set isNumber flag from previous commit
2011-08-12 07:15:10 -04:00
Robert Reif
ce00d0d35e
fix #2963 (FP: Typedef names considered duplicate because __LINE__ not expanded)
2011-08-11 18:18:47 -04:00
Robert Reif
f7b9d4d726
fix #2991 (segmentation fault of cppcheck ( ::y(){x} ))
2011-08-11 17:57:54 -04:00
Kimmo Varis
9e2dd553fb
Add "ExtraVersion" version number information.
...
The "ExtraVersion" can be used for things like Git commit Id,
release tag (version control), release date etc. If the string
is empty, nothing is printed.
2011-08-11 17:34:59 +03:00
Daniel Marjamäki
9a24492a00
Fixed #2975 (False positive: Return of the address of an auto-variable)
2011-08-10 18:16:31 +02:00
Robert Reif
a30da73d3e
fix #2986 (segmentation fault of cppcheck ( x[y] ))
2011-08-09 19:45:18 -04:00
Robert Reif
10eb224ac7
fix #2983 (segmentation fault of cppcheck)
2011-08-09 18:31:02 -04:00
Daniel Marjamäki
2b8b0c44b2
Fixed #2969 (False positive: assign address of auto-var to function parameter, when function parameter is reassigned later)
2011-08-09 18:24:39 +02:00
Daniel Marjamäki
003956e42e
Fixed #2982 (false positive: using char type as array index (using string as key))
2011-08-09 17:03:22 +02:00
Daniel Marjamäki
2150995475
Fixed #2981 (False positive: struct member leak)
2011-08-08 19:58:49 +02:00
Daniel Marjamäki
8a6a999f09
Fixed #2979 (Improve message: using char as array index)
2011-08-08 19:35:11 +02:00
Daniel Marjamäki
e2367b4149
Fixed #2976 (False positive: array out of bounds)
2011-08-08 18:22:15 +02:00
Robert Reif
afe95be966
fix #2980 (segmentation fault of cppcheck)
2011-08-08 06:58:55 -04:00
Robert Reif
403b508371
Merge branch 'master' of github.com:danmar/cppcheck
2011-08-07 16:49:07 -04:00
Robert Reif
829611b129
fix #2978 (segmentation fault of cppcheck ( enum E {} e enum ))
2011-08-07 16:48:47 -04:00
Daniel Marjamäki
999b80bbb8
Buffer overrun: Fix false negative
2011-08-07 17:54:25 +02:00
Daniel Marjamäki
a6a966e28e
Null pointer: Fixed false positive when condition contains assignment 'if (p==NULL && (p=malloc(10))!=NULL) *p=0;'
2011-08-07 17:06:25 +02:00
Kimmo Varis
cfcfa3f000
Use "enabled" list for the style checking.
...
Settings-class currently enables style checking via dedicated
boolean attribute. All other CLI's enable-options are handled
through the enable-list. This commit moves style-check enabling
to use the enable-list.
Main advantage is the consistency how options are handled/stored
in the Settings class. Which also unifies using them for the other
code. You need to enable certain type of checks? Use the
addEnabled()-method. You want to check if certain type of checks
are enabled? Use the isEnabled()-method.
2011-08-07 10:28:52 +03:00
Robert Reif
85b2bd21dc
fix #2968 (new check: testing if unsigned variable is less than 0)
2011-08-06 19:23:09 -04:00
Robert Reif
222ed6d375
fix #2971 (Wrong warning generated)
2011-08-06 19:10:15 -04:00
Robert Reif
d23fb873cc
fix #2970 (Incorrect report: Class does not have a constructor)
2011-08-06 17:54:02 -04:00
Kimmo Varis
371838b9cb
CLI: Warn if user tries to exclude header files.
...
Filename exclusion (with -i) works only for the source files.
Print a warning if user tries to exclude header file. The warning
instructs user to use --suppress for ignoring warnings from the
header files.
2011-08-06 17:24:10 +03:00
Simon Martin
13360c2a66
Fixed #2870 (Tokenizer: simplify '0 |')
2011-08-06 06:50:29 +02:00
Robert Reif
fa82d43562
fix #2967 (segmentation fault of cppcheck ( auto_ptr< x >))
2011-08-05 18:18:30 -04:00
Robert Reif
fd01a7555a
fix #2966 (segmentation fault of cppcheck ( enum x : ))
2011-08-05 18:07:18 -04:00
Daniel Marjamäki
fd7e085c9d
Array index out of bounds: prevent false positive when a dimension for an array is unknown
2011-08-05 13:08:48 +02:00
Daniel Marjamäki
0186fc0650
tweaked the error message somewhat for id arrayIndexThenCheck
2011-08-05 09:10:07 +02:00
Robert Reif
ac6d67dc4d
add support for using global qualified :: memset on class and class member initialization
2011-08-04 20:37:27 -04:00
Robert Reif
2516aad31d
fix #2887 (infinit loop with ( A::A(std::auto_ptr<X> e){} ))
2011-08-04 19:50:18 -04:00
Daniel Marjamäki
ceb763f57a
Fixed #2956 (False negative: read array and then immediately check the index 'str[i] && i<sizeof(str)')
2011-08-04 11:15:14 +02:00
Kimmo Varis
e86abfdc5f
No unmatched suppressions list in quiet output.
...
When user wants to see only errors printed (--quiet in CLI) we
must obey that. And not print unmatchedSuppressions list.
Ticket: #2895 (Cannot suppress unmatchedSuppression reports)
2011-08-04 12:04:38 +03:00
Daniel Marjamäki
5112b0ddae
astyle formatting
2011-08-03 16:11:09 +02:00
Daniel Marjamäki
bab441b7e0
Obsolete functions: Split up functions into posix/standard sets. Only check for obsolete posix functions if --enable=posix has been given.
2011-08-03 16:10:43 +02:00
Kimmo Varis
f4950ea836
CLI: Rename --posix to --enable=posix.
...
Ticket: #2949 (new check: (style) finding non-reentrant functions)
Ticket: #2952 (CLI option --posix is wrong)
2011-08-03 10:28:36 +03:00
Daniel Marjamäki
6755d4befb
corrected a comment
2011-08-03 07:30:54 +02:00
Daniel Marjamäki
e82df7292f
Fixed #2919 (Wrong file name reported with #error in header)
2011-08-03 07:28:37 +02:00
Reijo Tomperi
ee7b8d53c6
Fix : #2942 (segmentation fault of cppcheck ( #elif (){ ))
...
http://sourceforge.net/apps/trac/cppcheck/ticket/2942
2011-08-02 22:06:27 +03:00
Daniel Marjamäki
08f27564fa
Null pointer: reduce false negatives in pointerDerefAndCheck
2011-08-02 17:04:07 +02:00
Daniel Marjamäki
825dce5c4e
Fixed #2954 (False negative: Null pointer dereference not detected '*p=4; if (p) { }')
2011-08-02 11:20:09 +02:00
Daniel Marjamäki
5fc2a55bac
Fixed #2900 (found memory leak in kernel p54usb and a false positive reported)
2011-08-02 09:04:13 +02:00
Daniel Marjamäki
0c2f2e1c38
Null pointers: Fixed false negative when struct is dereferenced in condition
2011-08-01 21:57:23 +02:00
Daniel Marjamäki
207038a087
AssignIf: detect more problems for 'if' and 'else if' conditions
2011-08-01 11:33:09 +02:00
Daniel Marjamäki
103542bb15
Fixed #2908 (common logic when using bitwise and)
2011-08-01 09:36:12 +02:00
Daniel Marjamäki
a6c7ae8d51
Fixed #2789 (null pointer: problems not detected when pointer is assigned and checked if it's null in a if statement)
2011-08-01 07:51:32 +02:00
Daniel Marjamäki
8e888a0dfb
astyle formatting
2011-08-01 07:48:18 +02:00
Daniel Marjamäki
880e0e3b5f
AssignIf: Improved the error message for mismatching comparison
2011-08-01 07:13:47 +02:00
Robert Reif
bc4db75aa9
fix #2146 (uninitialized variable: false negative for 'return x ? 1 : y;')
2011-07-31 21:33:43 -04:00
Daniel Marjamäki
69c3287e31
Memory leaks: fix endless loop for 'if )'. the check assumed that the link after the 'if' pointed forwards. Ticket: #2404
2011-07-31 19:38:39 +02:00
Robert Reif
daf0c71f77
fix #2911 (Token::Match(tok, %oror%|&&) doesn't match &&)
2011-07-31 13:26:26 -04:00
Moritz Lipp
8d68981119
Fixed #2793 (SIGABRT on filenames without file extension)
2011-07-31 18:35:28 +02:00
Daniel Marjamäki
4433e621f8
removed the unused function CheckMemoryLeakInFunction::matchFunctionsThatReturnArg
2011-07-31 17:36:56 +02:00
Daniel Marjamäki
1640f3d1ca
Null pointer: fix false negatives when unknown function is called and pointer is local/argument
2011-07-31 17:32:25 +02:00
Daniel Marjamäki
cc89687e8c
Null pointer: better handling when calling standard functions with possible null pointer
2011-07-31 17:19:23 +02:00
Daniel Marjamäki
afc825da68
AssignIf: handle parantheses. ticket: #2909
2011-07-31 17:09:53 +02:00
Daniel Marjamäki
dd6982a616
Fixed #2935 (possible null pointer dereference when using strcpy etc)
2011-07-31 14:07:35 +02:00
Daniel Marjamäki
ad166d3a54
astyle formatting
2011-07-31 14:05:06 +02:00
Daniel Marjamäki
00e28f5c4e
AssignIf: Match lhs and rhs for comparisons. Ticket: #2909
2011-07-31 11:23:38 +02:00
Daniel Marjamäki
e47aac2501
AssignIf: Detect problem for 'y=x&4; if(y!=3)..'. Ticket: #2909
2011-07-31 10:48:31 +02:00
Daniel Marjamäki
47f13860b7
AssignIf: Added new check. Ticket: #2909
2011-07-30 21:43:21 +02:00
Daniel Marjamäki
7f193fb7a1
Fixed #2788 (null pointer: dereference and then check 'if (abc->a == 3) { } if (!abc) ..')
2011-07-30 19:51:06 +02:00
Robert Reif
e687ee9a9a
assume all std::*::size() and std::*::empty() are const in CheckClass::checkConstFunc()
2011-07-30 10:30:31 -04:00
Robert Reif
addcec704f
fix cppcheck warning in Tokenizer::duplicateTypedef()
2011-07-30 10:12:35 -04:00
Robert Reif
c6a804d306
add std::*.empty() to possible const functions in CheckClass::checkConstFunc
2011-07-30 09:44:20 -04:00
Robert Reif
74c1bdde77
fix #1593 (false negative: the function can be declared as const)
2011-07-30 08:48:11 -04:00
Robert Reif
2f4aee2923
fix missing else in patch that added support for unused const local variables
2011-07-30 07:16:59 -04:00
Simon Martin
50f78ce329
Fixed #2951 (Small code factorization in checkmemoryleak.cpp)
2011-07-30 13:10:44 +02:00
Ettl Martin
c00a1526bd
nonreentrant-functions: added more functions to check
2011-07-30 11:15:51 +02:00
Robert Reif
cb4282d69a
use simpleMatch where possible in checkother.cpp
2011-07-29 22:37:05 -04:00
Ettl Martin
f441a958cd
mathlib: fixed #2950 : comparison of floating point values
2011-07-29 23:37:40 +02:00
Ettl Martin
6b23dd9928
added a check to detect nonreentrant functions and a --posix switch
2011-07-29 18:27:01 +02:00
Ettl Martin
35bb5dffa4
Added a new check for finding non-reentrant functions
2011-07-28 23:29:16 +02:00
Daniel Marjamäki
dc629b4c39
Fixed 'possible null pointer dereference' warning messages
2011-07-28 08:12:21 +02:00
Daniel Marjamäki
d2c0e5e7e6
Fixed #2821 (New Check : bool pointer null truth assignment)
2011-07-28 07:28:24 +02:00
Robert Reif
ca2e8b057b
fix #2947 (False positive: member variable is not initialized (a[x::y] = 0;))
2011-07-27 12:03:44 -04:00
Robert Reif
54141f2e7f
fix #2943 (Symbol database: Wrong parsing of std::vector as base class.)
2011-07-27 11:23:22 -04:00
Daniel Marjamäki
2b48c7624c
Auto Variables: Reverted fix for #1514 because my idea was wrong. See ticket: #2944
2011-07-27 10:43:44 +02:00
Daniel Marjamäki
5cb701d3c1
Fixed #2946 (False positive: Uninitialized buffer variable (init in subfunction))
2011-07-27 10:34:12 +02:00
Daniel Marjamäki
4e55fb604c
Fixed #2945 (False positive: Uninitialized variable reading from stream)
2011-07-26 21:30:58 +02:00
Daniel Marjamäki
a6740200cf
Null pointer: Added check for 'if (fred); return fred->a;'
2011-07-25 21:58:00 +02:00
Daniel Marjamäki
6e14da7eba
Fixed #2812 (false negative: null pointer dereference when returning struct member)
2011-07-25 21:40:32 +02:00
Daniel Marjamäki
63a0c6ad4a
Fixed #2796 (uninitialized and leaving scope)
2011-07-25 16:35:30 +02:00
Daniel Marjamäki
2c6e4c423a
Fixed #2681 (False negative: Possible null pointer dereference)
2011-07-25 15:45:00 +02:00
Daniel Marjamäki
c1138cf7f9
Fixed #2941 (False positive: unused function (individual checking of files))
2011-07-25 13:25:09 +02:00
Daniel Marjamäki
9a3f95613a
Uninitialized variables: Fixed false positive if there is assignment in return statement
2011-07-24 22:41:40 +02:00
Daniel Marjamäki
1bb7a1c23c
Fixed #2938 (Uninitialized variable not detected when part of expression)
2011-07-24 22:26:11 +02:00
Simon Martin
7346d07871
Fix GCC warning about float comparison. Ticket: #2936
2011-07-24 21:35:21 +02:00
Robert Reif
9a4447c835
add support for unused const local variables
2011-07-24 12:09:59 -04:00
Daniel Marjamäki
4e6800c474
Fixed #2921 (False positive: Memory leak with static pointer)
2011-07-24 16:08:29 +02:00
Daniel Marjamäki
1ce261e44d
astyle formatting
2011-07-24 14:54:13 +02:00
Daniel Marjamäki
158fa25623
Fixed #2817 (valgrind errors in simplifyTemplate when running tests)
2011-07-24 13:32:54 +02:00
Simon Martin
539c2e5acb
Fixed #2932 (segmentation fault of cppcheck ( i / i ))
2011-07-24 09:06:38 +02:00
Simon Martin
fc0f75fe6a
Preprocessor: Fix #if0 #elif todo test case. Ticket: #2619
2011-07-24 08:54:24 +02:00
Robert Reif
aa65eed02b
convert CheckPostfixOperator::postfixOperator() to use the symbol database
2011-07-23 15:14:15 -04:00
Robert Reif
5e1fd81ea7
add support for local variables with constructors to the symbol database
2011-07-23 15:12:30 -04:00
Robert Reif
e332f0c186
Merge branch 'master' of github.com:danmar/cppcheck
2011-07-22 08:32:08 -04:00
Robert Reif
527c1aae33
fix #2931 (another false negative in auto variables checking when function parameter is a struct)
2011-07-22 08:31:31 -04:00
Daniel Marjamäki
0dd5472642
Tokenizer::simplifyFunctionPointer: don't simplify function call. Ticket: #2873
2011-07-22 07:58:53 +02:00
Robert Reif
84ca1902a5
fix #1514 (Improve CheckAutoVariables: assign autovariable address to effective parameter)
2011-07-21 22:37:36 -04:00
Robert Reif
4e64d35462
fix #2926 (false negative in auto variables checking when function parameter is a struct)
2011-07-21 22:26:42 -04:00
Robert Reif
c3c3eb74e8
fix #2929 (Additional Unused variable check)
2011-07-21 18:37:37 -04:00
Robert Reif
cc1ecccd01
fix #2928 (False positive (static variable misinterpreted as auto variable))
2011-07-21 18:20:19 -04:00
Daniel Marjamäki
fb3870071a
Fixed #2885 (crash of cppcheck while checking gcc-testsuite)
2011-07-21 16:13:35 +02:00
Daniel Marjamäki
31e3844f3f
Fixed #2856 (--errorlist not printing all auto-variable errors)
2011-07-21 14:50:38 +02:00
Daniel Marjamäki
d34a778848
Fixed #2848 (False positive: Memory leak when assigning and freeing from another struct)
2011-07-21 13:33:20 +02:00
Daniel Marjamäki
9f22d2fc6b
Fixed #2897 (out of bounds false positive, using reinterpret_cast)
2011-07-21 09:32:24 +02:00
Robert Reif
32f94a47cc
fix #2925 (False negative: auto variables - assigning address of array to function parameter)
2011-07-20 19:02:54 -04:00
Daniel Marjamäki
7e7f6eecf5
Fixed #2794 (Improper hanling of preprocessor directives #if defined)
2011-07-20 23:50:57 +02:00
Daniel Marjamäki
f0a7cc5961
Merge pull request #28 from bwy/master
...
Fix "auto_ptr assignment" false positive
2011-07-20 10:45:49 -07:00
Benjamin Wolsey
e6d8f3fb73
Fix tested auto_ptr false positive.
2011-07-20 19:17:59 +02:00
Daniel Marjamäki
5ea79677a3
Fixed #2924 (Unable to turn on unused function detection from command line)
2011-07-20 11:12:08 +02:00
Daniel Marjamäki
6ce5107e49
Tokenizer: Better handling of constants. Related with #2920
2011-07-20 09:07:47 +02:00
Daniel Marjamäki
3cfef6285c
Fixed #2920 (False positive: Array 'arr[0]' index 0 out of bounds (array size and index are unknown))
2011-07-20 07:57:42 +02:00
Daniel Marjamäki
b66e6e73db
Fixed #2917 (Problem with || in #if)
2011-07-18 21:44:23 +02:00
Robert Reif
ed30edf9d3
simplify CheckOther::checkIncorrectLogicOperator() by using more pattern matching
2011-07-18 07:34:49 -04:00
Robert Reif
76d0872c0d
made #2827 fix more generic by adding more ops and using pattern matching rather than string matching
2011-07-17 16:28:00 -04:00
Daniel Marjamäki
7dcb68f5a4
CheckBufferOverrun: Detect overflows when buffer is allocated with alloca
2011-07-17 09:35:51 +02:00
Robert Reif
4149617978
fix #2827 to use numeric comparisons
2011-07-16 23:05:35 -04:00
Robert Reif
430d22032d
fix #2827 condition always false or true)
2011-07-16 22:06:23 -04:00
Daniel Marjamäki
35938e74ad
Tokenizer: better handling of 'struct AB ab; sizeof(ab)'
2011-07-16 22:07:30 +02:00
Daniel Marjamäki
cf3ab649fb
Fixed #2873 (segmentation fault of cppcheck while scanning rose-compiler suite)
2011-07-16 19:26:11 +02:00
Daniel Marjamäki
597733bec4
Tokenizer: minor update to handle C# code better
2011-07-16 18:12:55 +02:00
Daniel Marjamäki
35178cc161
Fixed #2912 (false positive: (portability) Assigning an integer (int/long/etc) to a pointer is not portable)
2011-07-16 17:08:03 +02:00
Daniel Marjamäki
c55b0ff651
Fixed #2871 (Define in source not set when -D is used)
2011-07-16 16:59:06 +02:00
Daniel Marjamäki
c299d02dba
astyle formatting
2011-07-16 09:32:35 +02:00
Daniel Marjamäki
07a1222ac6
Preprocessor: fix handling of (1&&2) condition
2011-07-16 09:24:27 +02:00
Daniel Marjamäki
274fd2b985
Tokenizer: Fix minor problem with 'X&&Y'
2011-07-15 19:37:39 +02:00
Daniel Marjamäki
d78d8660ab
astyle formatting
2011-07-15 19:02:16 +02:00
John Smits
7f2d62cbde
Fixed #2882 (One-character token can be mistaken for a multiCompare)
2011-07-15 19:01:36 +02:00
Robert Reif
af1e51f648
fix some more false negatives for #2904 (Memory leak not detected when creating a new class instance)
2011-07-14 20:45:27 -04:00
Zachary Blair
997a3652d2
Fixed #2822 (New check: Duplicate break statements in switch)
2011-07-14 17:12:56 -07:00
Robert Reif
270b2b1772
fix #2904 (Memory leak not detected when creating a new class instance)
2011-07-14 19:15:59 -04:00
Daniel Marjamäki
66d145ba1c
Fixed #2892 (false positive: (portability) Assigning an address value to the integer (int/long/etc) type is not portable)
2011-07-07 15:14:33 +02:00
Daniel Marjamäki
4055b0ec5f
64-bit portability: fixed two of the TODO test cases. Ticket: #2791
2011-07-06 17:57:39 +02:00
Daniel Marjamäki
827fb01ec1
updated error message about assigning address to integer. Thanks Kimmo for the suggestion.
2011-07-06 12:57:45 +02:00
Daniel Marjamäki
8f0f184058
64-bit checking: Added simple check for assigning pointer address to int/long. Ticket: #2791
2011-07-06 08:55:17 +02:00
Daniel Marjamäki
0007351ef4
spell check of error message. contant => constant
2011-07-05 19:59:58 +02:00
Daniel Marjamäki
8cd2c3115e
Fixed #2866 (Detect sign extension bugs)
2011-07-05 18:41:27 +02:00
Greg Hewgill
657b003dc8
Fix spelling error in warning identifier
2011-07-05 19:54:23 +12:00
Daniel Marjamäki
982b645ff4
Fixed #2775 (Uninitialized variable: Not detected when uninitialized struct pointer is dereferenced in sub function)
2011-07-04 21:04:32 +02:00
Robert Reif
b143b283e9
fix #2886 (crash of cppcheck ( typedef struct x { } ))
2011-07-03 10:50:15 -04:00
Robert Reif
8ec1dfacbf
fix missing pop in Tokenizer::simplifyStructDecl() when anonymous struct/union removed
2011-07-03 08:14:51 -04:00
Robert Reif
b32b2c6d87
add support for checking unused std::string local variables
2011-07-02 19:25:10 -04:00
Robert Reif
3f4cc5fa3a
add class A {} a; -> class A {}; A a; conversion capability to Tokenizer::simplifyStructDecl()
2011-07-02 09:21:30 -04:00
Robert Reif
d447e61b09
fix #2884 (Integer overflow warning in 64-bit build)
2011-07-01 16:59:17 -04:00
Daniel Marjamäki
db4a28d60b
Tokenizer::simplifyGoto: Only simplify the last label in the function. If there are many labels in the same function and all labels are simplified, this function becomes very slow.
2011-07-01 18:07:41 +02:00
Robert Reif
301e59cea0
fix false positive for unused local class/struct variable
2011-07-01 08:45:29 -04:00
Robert Reif
18e6509c5d
add support in CheckOther::functionVariableUsage() for checking structures that are declared with struct keyword
2011-07-01 07:42:20 -04:00
Robert Reif
3225c9dd9b
cleanup isStatic in CheckOther::functionVariableUsage()
2011-07-01 07:15:59 -04:00
Robert Reif
7826b5e22d
add support for detecting unused function variables of type class or struct
2011-06-30 21:58:11 -04:00
Reijo Tomperi
6d4799e0b8
Minor cleanup related to previous fix.
...
This code should not be needed anymore as tokenizer should simplify question mark away.
2011-06-30 22:10:17 +03:00
Reijo Tomperi
89fd5bacf9
Fix #2849 , False positive: memory leak (using question mark operator)
...
http://sourceforge.net/apps/trac/cppcheck/ticket/2849
Simplify: *d = b ? b : a; into if-else
Simplify { ; { ; } } into { ; }
Removed one memleak test which should be redundant now as question marks
should not get into memleak check.
2011-06-30 22:04:26 +03:00
Daniel Marjamäki
6375e1d3dc
Fixed #2849 (False positive: memory leak (using question mark operator))
2011-06-30 17:31:22 +02:00
Robert Reif
77859b9a0f
fix #2878 (derived global class not tokenized properly (class A : ::B { };))
2011-06-30 07:25:36 -04:00
Robert Reif
586fdd24f2
fix #2825 (missing varid on class variables when multiple inheritance is used)
2011-06-29 20:04:04 -04:00
Robert Reif
c99a15516d
fix symbol database derived template class support
2011-06-29 19:52:07 -04:00
Robert Reif
18369ea6ac
add global namespace derived class support
2011-06-29 19:43:39 -04:00
Robert Reif
443dd4c392
partial fix for #2867 handle derived class
2011-06-29 19:39:19 -04:00
Kimmo Varis
7af920a70b
Document that Path::simplifyPath() needs / as separators.
2011-06-29 21:44:53 +03:00
Daniel Marjamäki
d76861270a
Fixed #2797 (Inline suppressions do not handle filenames correctly)
2011-06-29 20:23:39 +02:00
Daniel Marjamäki
cacca00080
Fixed #2855 (False positive: resource leak when reusing fd)
2011-06-29 20:00:21 +02:00
Daniel Marjamäki
e597ad72e7
Fixed #2841 (False positive: Array index out of bounds, can't compare ints to chars)
2011-06-29 18:44:05 +02:00
Robert Reif
6eecab5d73
fix #2807 (Wrong handling of function references when prefixed with &)
2011-06-29 07:19:34 -04:00
Robert Reif
1286898fa0
fix #2864 (--errorlist missing errors: variableHidingTypedef and Extra qualification)
2011-06-28 21:46:54 -04:00
Robert Reif
f403de7bad
partial fix for #2867 Tokenizer::removeRedundantAssignment didn't understand function local class and removed class variable
2011-06-28 19:48:28 -04:00
Robert Reif
70a32fc245
fix #2875 (segmentation fault of cppcheck ( 0; (a) < (a) ))
2011-06-28 18:47:18 -04:00
Robert Reif
272eb445fb
fix #2865 (segmentation fault of cppcheck ( char a[1] ))
2011-06-27 07:31:10 -04:00
Robert Reif
1713eeb532
fix #2859 (Extra qualification not detected)
2011-06-26 21:13:29 -04:00
Reijo Tomperi
918b4d859f
Fixed #2860 , False positive: Returning value of strncat() reported as memory leak
...
http://sourceforge.net/apps/trac/cppcheck/ticket/2860
2011-06-26 23:53:16 +03:00
Reijo Tomperi
382520ee9f
Fix #2840 , False positive: Null pointer dereference
...
http://sourceforge.net/apps/trac/cppcheck/ticket/2840
2011-06-26 22:46:33 +03:00
Robert Reif
93495613dd
replace some pattern matching with variable lookup in checkGlobalAndLocalVariable
2011-06-24 08:02:41 -04:00
Robert Reif
4656eba34c
set symbol database array variable dimensions specified by a variable to the maximum size that variable can hold
2011-06-23 22:35:15 -04:00
Robert Reif
65ecbfd4ff
fix an off by 1 error introduced in 48e6ea271a
that prevented checking all variables
2011-06-23 22:31:16 -04:00
Daniel Marjamäki
40a14736b7
Added TODO test case for the simplifyKnownVariables to better simplify local variables
2011-06-23 17:03:14 +02:00
Daniel Marjamäki
2d1b7285d2
Fixed #2815 (FP: Null pointer dereference error about a member)
2011-06-23 16:58:01 +02:00
Robert Reif
a87fb388e3
use symbol database to lookup variable type for buffer overrun checks
2011-06-22 23:11:17 -04:00
Robert Reif
48e6ea271a
start using symbol database array info for buffer overrun checks
2011-06-22 22:44:11 -04:00
Robert Reif
0c46f44e3d
add array information to symbol database
2011-06-22 22:41:11 -04:00
Robert Reif
dac826d0ac
use a more conventional technique for accessing ArrayInfo private variables
2011-06-22 20:35:58 -04:00
Reijo Tomperi
5a72bed064
Fix #2847 , cppcheck hangs with 100% cpu load
...
http://sourceforge.net/apps/trac/cppcheck/ticket/2847
2011-06-22 14:09:42 +03:00
Daniel Marjamäki
e4f6d4c987
Fixed #2808 (False positive 'Possible null pointer dereference')
2011-06-21 18:45:30 +02:00
Robert Reif
db39f4364e
fix #2845 (segmentation fault of cppcheck)
2011-06-21 07:31:55 -04:00
seb777
172903cde4
fix 2846 (false positive for auto_ptr check with container element)
2011-06-20 23:02:05 +02:00
Daniel Marjamäki
47a15b6486
Fixed #2830 (false positive: resource leak when using fdopen)
2011-06-20 18:42:13 +02:00
Robert Reif
d80a55267c
fix #2844 fix to generate correct output
2011-06-19 20:19:16 -04:00
Robert Reif
0bd26a73c4
fix #2844 (typedef causes 'syntax error')
2011-06-19 17:57:01 -04:00
seb777
20de3f90ef
fix 2838 (Token::Match called with varid 0 on auto_ptr check) cleanup code and better check varid
2011-06-17 21:09:27 +02:00
seb777
5b940c0c7f
fix #747 and #748 (incorrect use of auto_ptr - new check)
2011-06-16 20:26:00 +02:00
Robert Reif
eaf836b323
fix extra qualification check for same class name in different namespaces
2011-06-14 15:31:52 -04:00
Lauri Nurmi
be57aa5ad5
Fixed #2836 ([PATCH] FP: Dereferenced iterator has been erased)
2011-06-14 07:26:59 +02:00
Daniel Marjamäki
a8cb7b445f
1.49: updated version
2011-06-12 18:24:31 +02:00
Robert Reif
e584b08066
fix #2835 (crash of cppcheck ( ><,f<i, ))
2011-06-12 12:09:52 -04:00
Robert Reif
729ee72a5a
fix #2831 (crash of cppcheck ( z<y<x> ))
2011-06-12 08:38:15 -04:00
Robert Reif
d1b260699a
fix #2834 (crash of cppcheck (std::vector<int>::iterator))
2011-06-12 08:24:49 -04:00
Robert Reif
5e3263235b
fix #2739 (segmentation fault of cppcheck ( if()x ))
2011-06-11 15:51:12 -04:00
Robert Reif
3d4eb0d77e
fix #2682 (segmentation fault of cppcheck ( x a[0] = ))
2011-06-10 15:11:45 -04:00
Robert Reif
a9e2e15e40
improve #2828 fix by adding switch
2011-06-09 07:32:43 -04:00
Robert Reif
6635ed4630
fix #2828 (false positive: Function parameter 'STYLE' hides enumerator with same name)
2011-06-08 20:14:52 -04:00
Daniel Marjamäki
97d47fa20e
Fixed #2805 (false positive: [NotAssigned1.cpp:5]: (style) Variable 'y' is not assigned a value)
2011-06-08 19:54:01 +02:00
Robert Reif
0f6da27b9f
fix #2795 (hash operator[] is not 'const') (original patch by Sebastien Debrard) (modified to use the symbol database)
2011-06-03 22:00:27 -04:00
Robert Reif
a7fe9a3b50
fix 2 use after frees in simplifyEnum found by visual studio and verified by valgrind
2011-06-03 21:50:08 -04:00
Daniel Marjamäki
1b4b4ee43e
Fixed #2806 (False positive with g_strstrip())
2011-05-29 17:44:10 +02:00
seb777
e06b2419a4
fix #2786 (new check: Using sizeof with numeric constant)
...
Add unit test and improve check with negative constant because in cppcheck %num%
means 'integer'
2011-05-28 16:40:01 +08:00
Robert Reif
a99aded1a4
add support for null pointer checking struct pointers
2011-05-27 23:30:19 -04:00
Robert Reif
311651cc66
fix #2804 (Underlying type of enumerator produces a syntax error)
2011-05-27 11:17:39 -04:00
Robert Reif
42316f3e0b
fix #2792 (false positive: Member variable 'class::m_val' is not assigned a value in 'class::operator=')
2011-05-24 20:25:34 -04:00
seb777
287840e6bc
fix #2786
2011-05-25 01:45:58 +08:00
Daniel Marjamäki
1c841535ee
Fixed #2798 (False positive: Invalid iterator check doesn't respect code paths)
2011-05-22 17:17:24 +02:00
Daniel Marjamäki
52499ca8f8
Fixed #2790 (Incorrect allocation mismatch error)
2011-05-19 19:41:18 +02:00
Stefan Weil
21a2a91b3c
executionpath: fix memory leak
2011-05-19 19:31:51 +02:00
Daniel Marjamäki
c971fa0d4b
cmake: cleanup unmaintained cmake files
2011-05-19 17:16:04 +02:00
Daniel Marjamäki
ab1b293f23
Fixed #2737 ((error) Analysis failed. If the code is valid then please report this failure.)
2011-05-19 17:04:36 +02:00
WenChung Chiu
1ea52cfa02
Fixed #2784 (Pointer issue: *&f=open())
2011-05-18 07:25:30 +02:00
Daniel Marjamäki
b6dcdd7b79
Preprocessor: Don't report that there are missing system includes unless --debug-warnings has been given.
2011-05-15 09:38:13 +02:00
Daniel Marjamäki
be9e66efff
Fixed #2782 (Segfault with #asm)
2011-05-11 19:27:19 +02:00
Daniel Marjamäki
144d811e54
Fixed #2780 (false positive: variable p is not assigned a value 'int p[2]; *p = 0;')
2011-05-11 18:58:25 +02:00
Daniel Marjamäki
1c992fe25a
Fixed #2783 (Improve check: struct member leaks when analysing c file)
2011-05-11 18:19:14 +02:00
Robert Reif
2db67863a7
#2700 (common logic or cut and paste errors) make duplicate branches inclnclusive
2011-05-08 13:22:42 -04:00
Daniel Marjamäki
03cd57260a
added comment about how bad typedef behaviour can be reproduced
2011-05-07 14:40:47 +02:00
Daniel Marjamäki
8e5c63104c
Fixed #2743 (segmentation fault of cppcheck 'std::vector<void(*)()> v1 = a, v2 = b;')
2011-05-07 14:23:14 +02:00
Daniel Marjamäki
af7c97f972
Fixed #1684 (false positive: buffer access out of bounds when using extern variable declaration)
2011-05-07 11:34:48 +02:00
Robert Reif
bb5dfa58a1
fix #2765 (Non local address detected as address of local auto-variable)
2011-05-06 19:26:04 -04:00
Robert Reif
ccb831d375
fix regression #1819 (False positive: auto variable assignment (unseen typedef))
2011-05-06 18:18:48 -04:00
Daniel Marjamäki
3629f953f0
Fixed #2770 (False positives (scope can be reduced / variable is assigned value that is never used))
2011-05-06 21:16:01 +02:00
Daniel Marjamäki
b9ee867344
Fixed #2764 (False positive: Uninitialized variable '&(x[0])')
2011-05-05 21:26:18 +02:00
Daniel Marjamäki
9e97da8a57
Reverted fix for string::size. Ticket: #2756
2011-05-05 20:57:17 +02:00
Robert Reif
51baca0359
fix #1982 (simplifyTypedef: scope info is lost)
2011-05-02 22:42:52 -04:00
Daniel Marjamäki
d998477c69
renamed --check-includes to --check-config
2011-05-02 21:28:33 +02:00
Daniel Marjamäki
8603919b2d
Missing includes - normally just report that there are missing includes. The --check-includes can then be used to check what missing includes there are. Ticket: #2719
2011-05-02 14:58:16 +02:00
Daniel Marjamäki
cc8a5fd23e
reverted 761dd419
- reporting excessive missing include messages
2011-05-02 14:02:49 +02:00
Daniel Marjamaki
297ca63868
Fixed #2721 (Tokenizer::simplifyTemplates: fail when using template argument 'char[2]')
2011-05-01 19:05:18 +02:00
Daniel Marjamäki
761dd419af
Fixed #2719 (Fix excessive false positives in include-file handling)
2011-05-01 12:59:08 +02:00
Daniel Marjamäki
bb3c135d81
Tokenizer: Moved a few basic simplifications from simplifyTokenList to tokenize
2011-05-01 08:36:27 +02:00
Daniel Marjamäki
168bd2ebfc
Fixed #2760 (false positive: uninitialized variable ', (a) =')
2011-05-01 08:27:59 +02:00
Daniel Marjamäki
fb32d5111e
Fixed #2755 (cppcheck goes into infinite loop while scanning OpenSSL sources)
2011-04-29 19:47:39 +02:00
Robert Reif
e30852200e
fix tokenizer bug where 'class B : private ::A { };' was tokenized to 'class B : private: : A { } ;'
2011-04-29 09:19:22 -04:00
Robert Reif
e8eb20c6ef
fix debug warning for function parameters with template with varid of 0
2011-04-28 20:53:31 -04:00
Robert Reif
a2938b7212
fix
2011-04-28 19:08:18 -04:00
Kimmo Varis
c7d99fe9a7
Remove ErrorLogger::reportStatus() method.
...
The ErrorLogger::reportStatus() is not lib code interface. The CLI
code does the looping through file list and gives one file at a
time for the core code. Hence lib has no any idea about the
progress and it can't provide such information.
Also the recent commit (6d858b6
) caused a GUI build failure by
adding CLI code dependency to GUI. Which is big no-no.
This is admittedly a hack. But it allow us to build all modules
again.
2011-04-27 23:27:02 +03:00
Daniel Marjamäki
6e48ab4384
astyle formatting
2011-04-27 18:30:37 +02:00
Greg Hewgill
d8a4383f5f
Use tolowerWrapper wherever appropriate
2011-04-27 21:13:05 +12:00
Greg Hewgill
f0468952f8
Portability: Raise an error if a platform-specific filename compare function is not specified
2011-04-27 21:08:10 +12:00
Robert Reif
6abf29bd22
fix spelling of initialized in checkclass messages
2011-04-26 20:37:16 -04:00
Robert Reif
29c73e0571
fix false positive introduced in CheckAutoVariables::autoVariables conversion to use symbol database
2011-04-26 20:16:09 -04:00
Daniel Marjamäki
e22f69daf4
Fixed #2753 (False negative: dereference uninitialized pointer 'buf[0] = 0;')
2011-04-26 20:26:09 +02:00
Greg Hewgill
6d858b63a1
Report percentage complete based on file size
...
This patch makes the (reasonable) assumption that the total size of all checked
files fits in a 'long' type.
2011-04-26 22:26:23 +12:00
Zachary Blair
46645ab327
Fixed #2722 (new check: statement that is always true (strcmp))
2011-04-25 22:45:27 -07:00
Kimmo Varis
f240574107
Modify the Cppcheck class to check one file at a time.
...
Unify usage and API of CppCheck class. Allow only one file checked
at a time, instead of list of files. Clients can then handle file
lists more naturally and as they see fit. Also clients have better
knowledge of how checking status should be handled.
The single-threaded CLI checking was only one using the file list.
Other clients were giving files (to list) one file at a time.
2011-04-24 19:17:52 +03:00
Robert Reif
3c415e7833
fix #2745 (Enum vs local variable - conflict)
2011-04-23 22:08:03 -04:00
Robert Reif
670741271e
fix #2746 (false positive: syntax error (typedef in __attribute__ )))
2011-04-23 21:04:02 -04:00
Robert Reif
55898c0dfc
convert last check in checkautovariables to use the symbol database
2011-04-23 09:50:56 -04:00
Robert Reif
cd64d8476c
fixed #2614 (missing varid on function parameter)
2011-04-23 09:37:50 -04:00
Robert Reif
6750c7b492
don't debug warn about class function definitions without body having missing varid on function parameters
2011-04-22 21:41:55 -04:00
Daniel Marjamäki
6fc59b0257
Fixed #2740 (inline cmd // cppcheck-suppress does not work anymore for 1.48)
2011-04-22 20:25:17 +02:00
Greg Hewgill
3fc1db51d1
Change symbol database such that the typestart token skips over type modifiers (const/static/mutable).
...
This fixes checking for the case of a memset() on a static variable.
2011-04-23 01:13:23 +12:00
Robert Reif
04309f74f5
fix #2738 (syntax error on valid code)
2011-04-20 19:09:28 -04:00
Robert Reif
79e5d2db15
run astyle
2011-04-20 19:07:28 -04:00
Daniel Marjamäki
061eab4d22
Virtual destructors: Enabled the check again. I think it is conclusive now. Ticket: #2728
2011-04-20 18:03:16 +02:00
Daniel Marjamäki
a79e979ae4
Memory leaks: Fixed TODO test case. Ticket: #2733
2011-04-20 17:16:09 +02:00
Robert Reif
b1d3d291e6
fix #2736 (segmentation fault of cppcheck)
2011-04-20 07:49:04 -04:00
Daniel Marjamäki
46afc54c10
astyle formatting
2011-04-20 06:41:26 +02:00
Daniel Marjamäki
aac65247ba
Fixed #2733 (Memory leak: not all branch are checked)
2011-04-20 06:41:14 +02:00
Daniel Marjamäki
8417c4eb28
const parameter: Added comment to reduce false negatives for various classes in the std namespace
2011-04-20 05:40:06 +02:00
Daniel Marjamäki
68e7003bb1
Fixed #2734 (False positive: reports 'should be passed by reference' for std::streamoff)
2011-04-19 20:07:54 +02:00
Ettl Martin
47a1332e6a
#2733 added sizeof to checkmemory-leaks white list, added a todo-testcase
2011-04-19 16:55:27 +02:00
Robert Reif
c238b1bba6
fix #2730 (The same expression on both sides of != is OK when checking for NaN)
2011-04-18 19:20:27 -04:00
Martin Exner
2b08744b97
Fixed #2676 (setVarId: variables with global scope qualification :: don't get varids)
2011-04-18 06:56:39 +02:00
Daniel Marjamäki
05f59a1567
Tokenizer: Fixed bug. When varid is 0 then %varid% doesn't work. Ticket: #2723
2011-04-16 17:45:14 +02:00
Robert Reif
877a233145
fix #2716 (Easy to reproduce crash)
2011-04-16 10:35:23 -04:00
Daniel Marjamäki
0beef13794
ErrorLogger: Refactoring/fixing the serializer/deserializer for inconclusive messages
2011-04-16 13:42:48 +02:00
Daniel Marjamäki
739b6a93e2
Fixed #2713 (False positive (Redundant assignment))
2011-04-16 12:07:56 +02:00
Robert Reif
3159df958d
fix #2720 (false positive: syntax error with c++0x code)
2011-04-14 19:50:17 -04:00
Daniel Marjamäki
58dbbb0cab
Inconclusive checking: Report inconclusive errors with reportInconclusiveError. It takes the same parameters as reportError.
2011-04-14 18:02:01 +02:00
Daniel Marjamäki
7021e3224b
Fixed #2714 (False positive: ternary operator and += style warning.)
2011-04-14 17:30:50 +02:00
Robert Reif
75e5353b6d
fix #2718 (Analysis failed. If the code is valid then please report this failure.)
2011-04-13 23:58:58 -04:00
Robert Reif
257197bdd1
fix #2717 (false positive: syntax error (typedef void f(int) const;))
2011-04-13 23:24:41 -04:00
Robert Reif
50a1f28d86
run astyle
2011-04-13 21:12:35 -04:00
Daniel Marjamäki
7d6e923bd4
inconclusive: don't report such messages in xml version 1 format. until we decide how they will be reported in xml version 2 format I don't report it.
2011-04-10 21:51:27 +02:00
Daniel Marjamäki
11bd6bcd30
Fixed #2712 (false positive: Division by zero)
2011-04-10 21:27:09 +02:00
Daniel Marjamäki
f6b23e1d90
ErrorLogger: Added severities for inconclusive error and inconclusive warning
2011-04-10 16:39:36 +02:00
Robert Reif
56212370d1
add check for same expression on both sides of an operator (part of #2700 )
2011-04-10 10:25:02 -04:00
Robert Reif
434783530a
Merge branch 'master' of github.com:danmar/cppcheck
2011-04-10 09:57:34 -04:00
Robert Reif
4a50aca7b2
fix a bug in checkDuplicateBranch where removed type info like signed/unsigned was not checked for difference
2011-04-10 09:57:09 -04:00
Daniel Marjamäki
e5d43d4ed2
Renamed Settings::stupid to Settings::experimental
2011-04-10 15:55:08 +02:00
Daniel Marjamäki
30ee9ba6e4
Added Settings::stupid flag that can be used to hide checking that generates false positives.
2011-04-10 13:23:45 +02:00
Daniel Marjamäki
1178d47a9b
--inconclusive : Added command line flag that enable inconclusive checking. It is added for experimental purposes.
2011-04-10 12:52:59 +02:00
Daniel Marjamäki
1d86fb1738
Tokenizer: Code cleanup. Use %oror% to simplify code.
2011-04-10 11:55:15 +02:00
Daniel Marjamäki
f284c3a11f
CheckOther: Code cleanup. Use %oror%
2011-04-10 11:52:12 +02:00
Daniel Marjamäki
76679255a3
Preprocessor: Use %oror% in multiCompare pattern
2011-04-10 11:50:19 +02:00
Daniel Marjamäki
e94e3eca82
Preprocessor: Use %oror% in multiCompare pattern
2011-04-10 11:47:49 +02:00
Daniel Marjamäki
ec5ddb16b4
CheckOther: Use %op% in CheckUnsignedDivision
2011-04-10 11:31:04 +02:00
Daniel Marjamäki
ad8fb37fb0
CheckUninitVar: Use %op%
2011-04-10 11:28:18 +02:00
Daniel Marjamäki
0a1d6efe8c
Tokenizer: Use %op% in simplifyOperatorName
2011-04-10 11:24:57 +02:00
Daniel Marjamäki
f179df1f10
Tokenizer: Use %op% in simplifyCalculations
2011-04-10 11:22:00 +02:00
Daniel Marjamäki
57869e96e3
Tokenizer: Use %op% to clean up pattern
2011-04-10 11:09:49 +02:00
Daniel Marjamäki
970c989023
Tokenizer: Code cleanup. Removed redundant variable
2011-04-10 09:20:37 +02:00
Daniel Marjamäki
f4f8aeca03
Tokenizer: Fixed bug in last commit
2011-04-10 09:18:37 +02:00
Daniel Marjamäki
4c753ca5ac
Tokenizer: Use the %oror% in multiCompare patterns
2011-04-10 09:16:29 +02:00
Daniel Marjamäki
747a2331c6
Token::Match : Allow that %oror% and %or% is used in multiCompare patterns
2011-04-10 08:39:55 +02:00
Robert Reif
66de41b313
partial fix for #2700 (common logic or cut and paste errors)
2011-04-09 17:05:27 -04:00
Robert Reif
d22fcb8184
fix bug in previous commit: fix #311 (add detection of duplicated if else-cases)
2011-04-09 16:34:16 -04:00
Robert Reif
7e403ae210
fix #311 (add detection of duplicated if else-cases)
2011-04-09 15:14:01 -04:00
Robert Reif
77aebd357e
Refactoring: add Token::isAssignmentOp and use it in CheckClass::checkConstFunc
2011-04-09 14:36:05 -04:00
Daniel Marjamäki
7d93bfb42e
Refactoring: Use Token::isArithmeticalOp instead of hardcoded conditions
2011-04-09 18:50:05 +02:00
Daniel Marjamäki
f76eb5541c
Refactoring: Use %op% instead of Token::isOp
2011-04-09 18:47:01 +02:00
Daniel Marjamäki
7320bbd8fd
Refactoring: Use %op%
2011-04-09 18:44:07 +02:00
Daniel Marjamäki
bd93997e4f
Refactoring: Use %op% instead of Token::isOp in CheckBufferOverrun
2011-04-09 18:37:03 +02:00
Daniel Marjamäki
a4471bc150
Refactoring: Use %op%
2011-04-09 18:33:37 +02:00
Daniel Marjamäki
447f61e9c7
Refactoring: Use %op%
2011-04-09 18:30:47 +02:00
Daniel Marjamäki
0730fad778
Refactoring: Use %op%
2011-04-09 18:24:41 +02:00
Daniel Marjamäki
6c4f5fc496
Token::multiCompare : allow that %op% is used in multiCompare pattern
2011-04-09 18:09:13 +02:00
Daniel Marjamäki
575cb242c2
Refactoring: Use Token::isOp
2011-04-09 16:22:47 +02:00
Daniel Marjamäki
f6d910ab3d
Refactoring: Use Token::isOp
2011-04-09 15:54:36 +02:00
Daniel Marjamäki
e75acd7476
Release: Updated versions to 1.48
2011-04-09 07:55:07 +02:00
Daniel Marjamäki
a3f177fc97
Fixed cppcheck warnings: Removed extra 'Token::' from statement
2011-04-09 06:56:31 +02:00
Daniel Marjamäki
8e711b7925
Refactoring: there was almost duplicate functions 'isOp'. Created a new Token::isOp function instead.
2011-04-08 19:40:22 +02:00
Daniel Marjamaki
fbc8223a6b
Preprocessor: Fixed expandMacros problem. Ticket: #2707
2011-04-07 16:53:42 +02:00
Stefan Weil
8482eb9d5c
Obsolete functions: Fix messages for gethostbyaddr, gethostbyname
2011-04-07 00:33:54 +02:00
Daniel Marjamäki
b5bdb9eeae
fixed gcc compiler warning
2011-04-06 21:40:50 +02:00
Daniel Marjamaki
cb473a48b7
Preprocessor: Use Settings::debugwarnings instead of NDEBUG to determine if 'missing system include' should be reported or not
2011-04-06 19:49:04 +02:00
Robert Reif
23e4f020e9
fix #2706 (Analysis failed. If the code is valid then please report this failure.)
2011-04-04 22:18:12 -04:00
Daniel Marjamäki
4ac3c7fe3b
clarify calculation: fixed false negative for 'int x = a - b ? 2 : 3'
2011-04-04 21:33:16 +02:00
Daniel Marjamäki
0d3874693a
Buffer overrun: broke out duplicate code
2011-04-04 17:33:43 +02:00
Daniel Marjamäki
63acd9bb3e
Clarify calculation: Added warnings for << and >>
2011-04-03 22:12:22 +02:00
Daniel Marjamäki
266d1cc4d3
Null pointer: cleanup the code. Ticket: #2642
2011-04-03 21:55:21 +02:00
Martin Exner
bc3507118d
Fixed #2696 (False positive nullpointer)
2011-04-03 21:06:42 +02:00
Daniel Marjamäki
ed8cdddcf5
Tokenizer: execute the simplifyIfNot and simplifyIfNotNull in the normal token list. ticket #2642
2011-04-02 21:21:05 +02:00
Daniel Marjamäki
29422b8552
clarify precedence: made the short message shorter
2011-04-02 17:27:36 +02:00
Daniel Marjamäki
8a28a63e68
Merge commit 'elfring/2679d'
2011-04-02 14:16:14 +02:00
Markus Elfring
8cde24597f
Determination of rule support in CMake scripts (bug #2679 , #2524 )
...
The support for check rules will be automatically included in the generated
software if build settings were accordingly selected for PCRE.
https://sourceforge.net/apps/trac/cppcheck/ticket/2679
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
2011-04-02 13:25:18 +02:00
Daniel Marjamäki
ea57e10c7f
Tokenizer::simplifyCalculations: simplify division result if it's a whole number, even though it doesn't have precedence
2011-04-02 12:52:11 +02:00
Daniel Marjamäki
855b01cd5a
Clarify precedence 'a*b?c:d' : warn for addition, subtraction and division also. tried to clarify the message more
2011-04-02 11:43:20 +02:00
Daniel Marjamäki
f34e9e6623
Tokenizer: better simplification of calculations in conditions
2011-04-02 11:08:58 +02:00
Robert Reif
64fa7bf8d4
symbol database: add support for anonymous struct and union
2011-03-31 20:54:23 -04:00
Robert Reif
a39444a40f
change CheckClass::operatorEqToSelf to make better use of the symbol database
2011-03-31 19:53:35 -04:00
Robert Reif
cf65a73c47
fix CheckClass::operatorEq to check return type more closely (to match check description)
2011-03-31 19:40:28 -04:00
Daniel Marjamäki
0dbf5c6151
fixed doxygen warnings about undocumented function parameters
2011-03-31 19:16:43 +02:00
Robert Reif
faaff942d2
symbol database: improve function argument count and default argument count
2011-03-30 21:59:43 -04:00
Robert Reif
d17a204096
symbol database: get function argument count using argument list size rather than counting commas
2011-03-30 21:14:24 -04:00
Daniel Marjamäki
b8cda19ca6
Fixed #2655 (false positive: (warning) Redundant code: Found a statement that begins with numeric constant)
2011-03-30 21:57:01 +02:00
Lieven de Cock
97328f08de
Improve/cleanup Path::removeQuotationMarks().
2011-03-30 21:46:41 +03:00
Daniel Marjamäki
ae2a8d839b
Fixed #2693 (__declspec attribute not removed properly)
2011-03-30 19:49:55 +02:00
Stefan Weil
675e63b6a7
Spell checks
2011-03-30 16:45:31 +02:00
Stefan Weil
0e4cf7a2d6
Spell checks
2011-03-30 16:44:16 +02:00
Robert Reif
ce934f03a4
symbol database: handle default values for function arguments properly
2011-03-29 23:16:13 -04:00
Robert Reif
9612573d8e
add support for array of unnamed struct and union to symbol database
2011-03-29 19:48:12 -04:00
Kimmo Varis
4d4b28b075
Remove './' at begin of path in Path::simplifyPath.
...
The './' is not needed at begin of path for files we check. And it
only makes paths longer. This also makes it easier to match paths.
2011-03-29 20:53:18 +03:00
Daniel Marjamäki
0a2f11c2cd
Fixed #2695 (False positive: null pointer dereference and ternary operator (?:))
2011-03-29 18:45:32 +02:00
Robert Reif
b31da161a7
more support for anonymous struct to symbol database
2011-03-29 07:47:39 -04:00
Robert Reif
678486f0db
add support for anonymous struct to symbol database
2011-03-29 07:08:59 -04:00
Robert Reif
e9a23d9cb5
fix #2692 (False positive: if parsed as function in operator >>)
2011-03-28 20:02:06 -04:00
Robert Reif
1aca09a8bf
add support for checking struct/class member container in CheckStl::size()
2011-03-28 19:31:23 -04:00
Kimmo Varis
b889f663ae
Add Path::removeQuotationMarks() to clean path.
2011-03-28 22:14:19 +03:00
Daniel Marjamäki
a1dba61cee
Null pointer: prefer longer error message that says 'otherwise condition at line X is redundant'
2011-03-28 18:48:27 +02:00
Daniel Marjamäki
7426bd3daf
Null pointer: prefer longer error message that says 'otherwise condition at line X is redundant'
2011-03-28 18:44:25 +02:00
Daniel Marjamäki
4a7b60942b
Fixed #2691 (False positive: struct dereference and check (switch-break))
2011-03-28 17:28:21 +02:00
Robert Reif
31f8ff723b
skip nested anonymous unions when searching for variables in symbol database
2011-03-27 18:37:31 -04:00
Daniel Marjamäki
57056bcf61
Fixed #2689 (False positive: Possible null pointer dereference)
2011-03-27 21:29:49 +02:00
Robert Reif
dd5e15b40c
output a debug message when a member variable is used that has a varid of 0
2011-03-27 14:27:14 -04:00
Robert Reif
1e1434e191
make member variable change detection simpler and more accurate for CheckClass::checkConst
2011-03-27 13:59:12 -04:00
Robert Reif
20853fe273
add anonymous union support to the symbol database
2011-03-27 13:48:41 -04:00
Daniel Marjamäki
c87037c29d
Fixed #2674 (False positive: possible null pointer dereference (check if pointer is null in one function, dereference it in another function))
2011-03-27 11:04:58 +02:00
Daniel Marjamäki
e89f6d6ec0
Fixed #2660 (False positive: Variable 'v' is assigned a value that is never used)
2011-03-27 08:19:09 +02:00
Daniel Marjamäki
3c2d3ca3a4
Fixed #2653 (segmentation fault of cppcheck 'x=b=0;')
2011-03-26 12:20:23 +01:00
Daniel Marjamäki
7d9872a134
Tokenizer::setVarId: Prevent that wrong varid is given when uncertain. Ticket: #2680
2011-03-26 10:05:07 +01:00
Daniel Marjamäki
0ff5320d19
CMake: There is no need for PCRE when building the lib
2011-03-26 09:33:21 +01:00
Daniel Marjamäki
2b1277aa64
Fixed #2680 (setVarId: variables with class qualification don't get varid)
2011-03-26 08:56:41 +01:00
Robert Reif
c27ecf5aeb
only break when we know we are inc/dec a member variable in CheckClass::checkConstFunc
2011-03-25 23:22:28 -04:00
Robert Reif
168db82fd6
better checking of assignment to array element in CheckClass::checkConstFunc
2011-03-25 23:02:13 -04:00
Robert Reif
f8e1735b0f
add support to CheckClass::checkConstFunc for ++/-- array elements
2011-03-25 22:37:32 -04:00
Robert Reif
ca50bc7850
move 2 CheckClass helper functions to follow externally called functions so code matches comments
2011-03-25 22:21:40 -04:00
Markus Elfring
9301ee28a8
Added CMake files
2011-03-25 07:14:53 +01:00
Robert Reif
710eb8ffd9
add support for global namespace to Tokenizer::simplifyVarDecl()
2011-03-24 23:06:20 -04:00
Robert Reif
fc258164cd
fix #2675 (false positive: syntax error)
2011-03-24 22:26:42 -04:00
Robert Reif
d643918761
symbol database: add a link from a Function to its Function Scope namd make function parameters belong to Function Scope
2011-03-24 22:08:18 -04:00
Daniel Marjamäki
74105f5d83
Fixed #2673 (false positive: memory leak (address stored in list))
2011-03-24 17:14:12 +01:00
Robert Reif
61e720c82b
fix #1288 (Use of memset on struct - nested structs not handled)
2011-03-23 21:58:58 -04:00
Robert Reif
cbc81e20f5
fix Tokenizer::simplifyVarDecl() template assignment
2011-03-23 21:15:49 -04:00
Robert Reif
7e3e5d628d
better fix for #2672 (False positive: function can be const, nested classes declared in one line)
2011-03-23 20:19:32 -04:00
Daniel Marjamäki
5f36ede4f5
Fixed #2662 (Segfault: overloaded function call function with same name)
2011-03-23 18:45:47 +01:00
Robert Reif
3259239dfe
fix #2672 (False positive: function can be const, nested classes declared in one line)
2011-03-23 07:48:18 -04:00
Robert Reif
14c07e988e
fix pointer/reference check in CheckClass::noMemset symbol database conversion
2011-03-22 22:29:39 -04:00
Robert Reif
5314cc02b2
convert remainder of CheckClass::noMemset to use symbol database
2011-03-22 22:23:57 -04:00
Robert Reif
468a983db1
use the symbol database to look up base classes in CheckClass::noMemset check
2011-03-22 21:24:28 -04:00
Robert Reif
d36ed9aff1
fix #2670 (False positive: function can be const, overloaded functions)
2011-03-22 19:23:36 -04:00
Robert Reif
5cdd635701
run astyle
2011-03-22 19:20:05 -04:00
Ettl Martin
8308fb72e3
fixed performance issues, found by selfcheck with cppcheck.
2011-03-22 23:15:15 +01:00
Ettl Martin
ff1de4c896
extended checkmemoryleak-whitelist
2011-03-22 22:13:29 +01:00
Zachary Blair
f89f0c748f
Fixed #2665 (Slightly sped-up how Token::Match() parses patterns)
2011-03-22 00:15:12 -07:00
Robert Reif
c043e6e1a2
fix
2011-03-21 20:57:17 -04:00
Robert Reif
dc0dfea079
fix invalid bitfield match and simplification that created invalid code
2011-03-21 20:17:14 -04:00
Robert Reif
15fc071514
add virtual base class support to symbol database
2011-03-21 20:03:41 -04:00
Robert Reif
3c5134bb21
run astyle
2011-03-21 19:59:53 -04:00
Ettl Martin
7e31c91a79
extended checkmemoryleak white list
2011-03-21 23:59:43 +01:00
Ettl Martin
38cf9f26df
#2667 added open(), _open() and _wopen() function to checkmemoryleak whitelist, incl. unittests;
2011-03-21 23:20:46 +01:00
Ettl Martin
78bcb07e19
#2667 added perror to checkmemoryleak white list; added unit-tests.
2011-03-21 17:43:26 +01:00
Ettl Martin
f242cb639e
#2668 fixed memory leak ( freopen() )
2011-03-21 15:12:21 +01:00
Ettl Martin
a975301ce4
#2659 added chown,chmod and chdir functions to checkmemoryleak white list; added unittests for each case;
2011-03-21 00:07:37 +01:00
Ettl Martin
01249d4f48
#2659 added access()-function to checkmemoryleak white-list and provided untittests.
2011-03-20 23:39:44 +01:00
Ettl Martin
7afc0978c2
#2659 added stat function to white list and provide unit tests.
2011-03-20 22:17:51 +01:00
Ettl Martin
ab6888dbfe
fixed ticket 2659: added lstat function to white list; provided unit-tests.
2011-03-20 21:52:25 +01:00
Robert Reif
2277cb6965
fix #2663 (False negative: function can be const (changing unknown or uninitialised variable))
2011-03-20 13:29:52 -04:00
Robert Reif
41d80b5c8d
fix #2664 (False negative: function can be const (using type from another namespace))
2011-03-20 12:53:37 -04:00
Daniel Marjamäki
27506b4231
Fixed #2661 (False positive: object destroyed immediately)
2011-03-20 09:55:26 +01:00
Daniel Marjamäki
2613780b85
Fixed #2662 (Segfault: overloaded function call function with same name)
2011-03-20 09:16:52 +01:00
Robert Reif
fc13854095
fix #1280 (Pointer to function support)
2011-03-19 16:21:26 -04:00
Robert Reif
92316e5745
fix #1987 (Internal error:: CheckClass::SpaceInfo::getVarList found variable 'element_size' with varid 0.)
2011-03-19 16:00:43 -04:00
Daniel Marjamäki
2dcd0128b0
Fixed #2213 (false negative: resource leak (calling allocating subfunction twice))
2011-03-19 14:05:22 +01:00
Daniel Marjamäki
31af3a64bc
Tokenizer::setVarId: Fixed problem with same variable name in multiple classes
2011-03-19 11:09:51 +01:00
Daniel Marjamäki
45a3828da7
Tokenizer::setVarId: Better handling of class declarations when variable usage comes before variable declaration
2011-03-19 09:04:03 +01:00
Robert Reif
afc7fd82ed
#2630 (segmentation fault of cppcheck (template <typedef A>)
2011-03-18 20:44:58 -04:00
Robert Reif
1de35c168d
fix #2657 (segmentation fault of cppcheck ( gcc-testsuite: return f(){} ))
2011-03-17 20:10:56 -04:00
Robert Reif
7b63da4964
fix #2651 (Segmentation fault (typedef))
2011-03-17 20:00:49 -04:00
Daniel Marjamäki
dab09aedee
Fixed #2648 (Tokenizer::simplifyTemplates: Segmentation fault (gcc-testsuite))
2011-03-17 21:45:03 +01:00
Robert Reif
7e04ea0859
fix removal of throw() from const functions
2011-03-16 19:54:52 -04:00
Daniel Marjamäki
fec9edf628
Tokenizer::simplifyTemplates: First simple fix for problems when using sizeof in template parameter
2011-03-16 22:16:30 +01:00
Robert Reif
f7cbc90c84
fix #2581 (### Internal error in Cppcheck. Please report it.)
2011-03-15 23:28:45 -04:00
Robert Reif
47531dd99c
fix #2637 (segmentation fault of cppcheck ( {} const const ))
2011-03-15 22:33:14 -04:00
Robert Reif
ba0b3e6451
fix #2651 function typedef with extra ()s
2011-03-15 19:24:30 -04:00
Greg Hewgill
fa868e44ae
Support use of 'this->' when checking operator=() return type
2011-03-15 20:19:30 +13:00
Robert Reif
3babf6a9eb
look for function prototypes but don't save them in the symbol database yet
2011-03-13 22:59:25 -04:00
Robert Reif
47a90851f1
save pointer to Function info in function scope in symboldatabase
2011-03-13 21:18:49 -04:00
Robert Reif
836fadcb6a
save location of using directive (not used yet)
2011-03-13 21:01:33 -04:00
Daniel Marjamäki
07fe361964
Fixed #2638 (Tokenizer::setVarId : varid is wrongly given when unknown macro is used)
2011-03-13 17:52:45 +01:00
Daniel Marjamäki
3e1df1b463
Clarify condition: re-enabled check
2011-03-13 12:16:55 +01:00
Daniel Marjamäki
f26bc6a75c
Fixed #2621 (Segmentation fault for GCC statement expression)
2011-03-13 10:34:54 +01:00
Daniel Marjamäki
384729204f
Refactoring: Use SymbolDatabase to determine if variable is a iterator
2011-03-13 09:48:53 +01:00
Daniel Marjamäki
85daa26fdf
Refactoring: Use symbol database to get variable type
2011-03-13 08:48:38 +01:00
Daniel Marjamäki
ed11a9e3cb
Fixed #2639 (False positive: confusion between struct and function)
2011-03-13 08:38:40 +01:00
Robert Reif
27f4b8b88b
Convert CheckClass::noMemset to use the symbol database to lookup types. This adds better support for namespaces and nested classes.
2011-03-12 22:41:21 -05:00
Robert Reif
51662eeedd
save start parentheses of global functions
2011-03-12 20:35:52 -05:00
Daniel Marjamäki
f3728c0b76
Fixed #2647 (False positive: Possible null pointer dereference (member function call))
2011-03-12 20:57:19 +01:00
Daniel Marjamäki
6bd56dbe20
Fixed #2643 (False positive: iterator increment and insert)
2011-03-12 20:29:54 +01:00
Robert Reif
6a2848e50f
fix another false negative introduced by fix for #2641
2011-03-12 12:27:19 -05:00
Robert Reif
384bd96766
fix false negative introduced by fix for #2641
2011-03-12 11:42:58 -05:00
Daniel Marjamäki
0a28b7309f
Fixed #2641 (False positive: Possible null pointer dereference (global pointer, function call))
2011-03-12 15:02:06 +01:00
Daniel Marjamäki
29ab409af5
Merge branch '2390b' of https://github.com/elfring/cppcheck into elfring-2390b
2011-03-12 11:58:24 +01:00
Greg Hewgill
2716b856f4
throwing an exception is a valid immediate exit from switch
2011-03-12 07:27:31 +13:00
Robert Reif
79f0fe7d1c
refactor symbol database and checks to use list of Scope rather than list of Scope pointers
2011-03-10 19:43:29 -05:00
Greg Hewgill
256e7dee21
Allow suppressing all warnings (using *) for specified file or files
2011-03-10 22:00:48 +13:00
Greg Hewgill
1ec6a642dc
Revert "Check for memset on nested structs (ticket #1288 )"
...
Turns out this fix is incomplete.
This reverts commit a084697410
.
2011-03-10 20:19:31 +13:00
Daniel Marjamäki
e94ebd829d
suspicious condition: commented out the check temporarily - there are some false positives I'll need to fix
2011-03-09 22:29:50 +01:00
Daniel Marjamäki
db48158b28
Suspicious condition: Added new check for conditions that contains assignment+comparison
2011-03-09 22:20:14 +01:00
Daniel Marjamäki
5a0ec56fc2
Fixed #2632 (segmentation fault of cppcheck ( void>(); void>() ))
2011-03-09 21:25:44 +01:00
Daniel Marjamäki
bea3875386
Fixed #2607 (segmentation fault of cppcheck ( struct C {} {} x))
2011-03-09 21:00:28 +01:00
Daniel Marjamäki
be33f6b945
Fixed #2635 (False positive: resource leak)
2011-03-09 19:53:59 +01:00
Greg Hewgill
a084697410
Check for memset on nested structs (ticket #1288 )
2011-03-09 23:02:49 +13:00
Greg Hewgill
3883afcbf4
Check for memset on objects with virtual functions (ticket #607 )
2011-03-09 22:10:39 +13:00
Greg Hewgill
70b4076111
refactor noMemset so it recursively checks parent classes for non-memset-compatible things
2011-03-09 21:29:30 +13:00
Robert Reif
7a7257f200
fix #2630 (segmentation fault of cppcheck ( typedef ... )
2011-03-08 20:24:57 -05:00
Robert Reif
c457179ce6
fix null pointer dereference found by clang++ --analyze
2011-03-08 20:14:46 -05:00
Daniel Marjamäki
0b8581e717
Fixed #2620 (Tokenizer::setVarId : wrong handling of member function parameters)
2011-03-08 20:41:41 +01:00
Daniel Marjamäki
bf2362d558
Fixed #2634 (False positive: buffer access out of bounds)
2011-03-08 19:49:56 +01:00
Robert Reif
d74ae3b0f0
copy all flag fields in a Token
2011-03-07 20:04:25 -05:00
Robert Reif
e305a155af
convert CheckStl::size() to use symbol database, fix false positives, and remove inconclusive
2011-03-07 19:49:43 -05:00
Daniel Marjamäki
a177fc4b24
Preprocessor: made sure string::iterator is valid after string::erase
2011-03-07 22:00:30 +01:00
Daniel Marjamäki
06abaf95a5
Incorrect string compare: reduce noise when using strncmp on string literal
2011-03-07 21:37:13 +01:00
Daniel Marjamäki
7496cd412c
Fixed #2631 (Tokenizer::simplifyTemplates: template usage 'std::cout << (foo<double>(r));')
2011-03-07 21:21:06 +01:00
Daniel Marjamäki
8e571c04e4
Fixed #2633 (False positive: Memory leak for tree node)
2011-03-07 20:17:52 +01:00
Robert Reif
d678e4424c
fix #2630 (segmentation fault of cppcheck ( typedef y x () x ))
2011-03-06 18:59:56 -05:00
Daniel Marjamäki
a77993db75
Refactoring of the CheckNullPointer::isPointer. Use the symbol database. Ticket: #2629
2011-03-06 21:23:33 +01:00
Daniel Marjamäki
e26a7819d3
Symbol database: variable fix. ticket: #2629
2011-03-06 21:21:42 +01:00
Daniel Marjamäki
80235b0d53
astyle formatting
2011-03-06 21:15:58 +01:00
Daniel Marjamäki
f53ff27b71
Tokenizer::simplifyTemplates: better handling of '(foo<double>())'. Ticket: #2631
2011-03-06 21:15:42 +01:00
Daniel Marjamäki
6648267ab8
Revert "Tokenizer::simplifyTemplates: better handling of '(foo<double>())'. Ticket: #2631 "
...
This reverts commit de31ec1e44
.
2011-03-06 21:07:06 +01:00
Greg Hewgill
7daa6b9370
Always pass unsigned char to ::isspace to prevent runtime error in MSVC
2011-03-07 07:58:44 +13:00
Daniel Marjamäki
de31ec1e44
Tokenizer::simplifyTemplates: better handling of '(foo<double>())'. Ticket: #2631
2011-03-06 10:28:51 -08:00
Daniel Marjamäki
10db7c4a48
error logger: explain the severities better
2011-03-06 14:26:02 +01:00
Kimmo Varis
080603148c
Document error message severities.
2011-03-06 14:29:52 +02:00
Daniel Marjamäki
ca4015f905
CheckMemoryLeak: Refactoring the code
2011-03-06 09:42:16 +01:00
Daniel Marjamäki
779dba9160
Fixed #2612 (segmentation fault of cppcheck ( <><< ))
2011-03-06 09:33:46 +01:00
Robert Reif
0debba4409
finish fixing #2624 (better function pointer support needed)
2011-03-05 21:41:58 -05:00
Robert Reif
7d2fb2ecde
partial fix for #2624 (better function pointer support needed)
2011-03-05 20:48:28 -05:00
Greg Hewgill
b9df7735c5
switchCaseFallThrough is now an inconclusive check
2011-03-06 13:06:30 +13:00
Greg Hewgill
c8394909c0
Relax detection of 'fall through' comment so it only adds a suppression if it immediately precedes 'case' or 'default'
2011-03-06 12:14:10 +13:00
Greg Hewgill
8c245cfd2f
switchCaseFallThrough is now a coding style check (ticket #2623 )
2011-03-06 09:43:27 +13:00
Greg Hewgill
e12ae654a8
Support a few more common styles of "fall through" comment
2011-03-05 18:02:38 +13:00
Greg Hewgill
c30125111a
Merge branch 'switch-case-fall-through'
2011-03-05 00:55:33 +13:00
Greg Hewgill
cc7e05a5b0
fix case where fall through comment precedes preprocessor line
2011-03-05 00:45:58 +13:00
Greg Hewgill
70fcbe94f4
avoid warning on first case (in case there are declarations before first case)
2011-03-05 00:45:58 +13:00
Greg Hewgill
1a606a57fd
slightly more flexible detection of 'fall through' comment
2011-03-05 00:45:58 +13:00
Greg Hewgill
8c1d7ef316
avoid crash when else condition doesn't have braces to link
2011-03-05 00:45:58 +13:00
Greg Hewgill
610d2efaea
recognise fall through in c style comments
2011-03-05 00:45:58 +13:00
Greg Hewgill
ad45737805
more gracefully handle unexpected blocks inside switch
2011-03-05 00:45:57 +13:00
Greg Hewgill
a532a9690e
full implementation of switch case fall through
2011-03-05 00:45:57 +13:00
Greg Hewgill
93ea774484
initial simplistic implementation of switchCaseFallThrough
2011-03-05 00:45:57 +13:00
Robert Reif
f3b2acf585
really fix #2620 reference of typedef of array not simplified properly
2011-03-03 20:32:10 -05:00
Daniel Marjamäki
d7a6e729b8
Tokenizer::simplifyKnownVariables: Don't simplify 'strcpy(a,"ab"); b=a;'. Ticket: #2031
2011-03-03 20:07:56 +01:00
Robert Reif
3f0d0446e0
revert previous commit: simplified code isn't correct
2011-03-03 07:40:43 -05:00
Robert Reif
ee4b4f62d8
fix #2620 reference of typedef of array not simplified properly
2011-03-03 07:27:53 -05:00
Robert Reif
4b0edccec4
convert some of the checks in CheckAutoVariables to use the variable symbol table
2011-03-02 21:21:46 -05:00
Robert Reif
c9b2ab3c26
add debug message for function argument missing varid
2011-03-02 21:08:27 -05:00
Daniel Marjamäki
8e9a1c33ad
Fixed #2618 (Tokenizer::simplifyKnownVariables: Don't use known string value if address is wanted)
2011-03-01 20:20:48 +01:00
Daniel Marjamäki
db04d7b71e
Fixed #2616 (Segmentation fault with unknown macro)
2011-03-01 18:02:50 +01:00
Greg Hewgill
2efb2efaca
refactor #if 0 handling to leave preprocessor statements alone
2011-03-01 20:04:11 +13:00
Greg Hewgill
a331516735
handle #if (0) after removing parentheses
2011-03-01 19:50:17 +13:00
Greg Hewgill
31c56d7353
handle embedded whitespace in #if 0 processing
2011-03-01 19:32:47 +13:00
Robert Reif
92efbd748e
fix #2595 bitfield fix for case x: break; and default: break;
2011-02-28 19:35:00 -05:00
Daniel Marjamäki
893b84a87c
Fixed #2615 (Segmentation fault in cppcheck 1.47)
2011-02-28 20:29:34 +01:00
Zachary Blair
e1b2569b81
Fixed #432 (New check: wrong usage of ! operator in conditions)
2011-02-27 12:30:22 -08:00
Robert Reif
3db0e7ef8f
fix symbol database bug where delete can be considered a variable declaration
2011-02-27 10:35:59 -05:00
Robert Reif
962183f964
add an array flag to symbol database Variable class
2011-02-27 10:21:14 -05:00
Robert Reif
0872f1291e
fix a symbol database bug where a return statement could be considered a variable declaration
2011-02-27 10:13:40 -05:00
Daniel Marjamäki
e3f779a41c
Symbol database: Fixed debug warnings for true/false. true/false doesn't have varId.
2011-02-26 23:58:02 -08:00
Robert Reif
2b03bfaf38
fix a bug in symbol database while scope processing
2011-02-26 23:00:06 -05:00
Robert Reif
b74ebbda02
fix potential null pointer dereference for unnamed function arguments
2011-02-26 18:34:17 -05:00
Robert Reif
31a18b9b23
convert CheckClass::noMemset to use new variable lookup capability
2011-02-26 16:00:05 -05:00
Robert Reif
8152cbbd1b
add a varId to Variable lookup table and fill it in with all variables
2011-02-26 15:57:16 -05:00
Robert Reif
7638a4554e
add local scopes to the symbol database
2011-02-26 15:53:57 -05:00
Robert Reif
eda25f6502
add a list of function arguments to symbol database Function class
2011-02-26 15:51:12 -05:00
Daniel Marjamäki
c1c9b96bb6
Fixed #2031 (Tokenizer: simplify known value (string has known value after strcpy))
2011-02-26 21:11:56 +01:00
Daniel Marjamäki
96c85104ab
astyle formatting
2011-02-26 20:09:14 +01:00
Daniel Marjamäki
92ab1ef8e7
fix
2011-02-26 20:08:37 +01:00
Daniel Marjamäki
ab2bf0ee0c
Fixed #2575 (false positive: Preprocessor does not ignore #include within #if 0 block)
2011-02-26 10:04:38 -08:00
Jnos Maros
39114e3482
Fixed #2608 ([lib/checkpostfixoperator.cpp:87]: (error) Possible null-pointer dereference: decltok)
2011-02-24 07:37:33 +01:00
Daniel Marjamäki
32a49235e3
Fixed #2578 (Preprocessor does not correctly handle #define A 0 / #if A)
2011-02-23 13:08:24 -08:00
Daniel Marjamäki
daf0e7c37d
Fixed #2604 (Segmentation fault of cppcheck ( sizeof <= A ))
2011-02-23 20:44:14 +01:00
Robert Reif
d1f7a8aca4
fix #2403 (simplifyTypedef: array of function pointers) Internal error message
2011-02-22 22:11:17 -05:00
Sébastien Debrard
458fc7454e
update the message when bcopy function is used
2011-02-23 00:27:50 +01:00
Daniel Marjamäki
9983aa5721
Fixed #2605 (cppcheck hangs with 100% cpu load ( #define = ))
2011-02-22 19:55:02 +01:00
Robert Reif
dd12fc177f
fix #2603 (segmentation fault of cppcheck ( typedef constexpr))
2011-02-22 07:48:34 -05:00
Robert Reif
703448171a
fix #2601 (segmentation fault of cppcheck)
2011-02-22 07:02:15 -05:00
Robert Reif
ba6c2ca310
fix #2602 (segmentation fault of cppcheck ( class A {A& operator=(const A&); }; ))
2011-02-22 06:47:28 -05:00
Robert Reif
4e1ce93104
fix #2600 (segmentation fault of cppcheck ( enum{const} ))
2011-02-21 19:30:40 -05:00
Robert Reif
999646fca6
fix #2599 (segmentation fault of cppcheck ( sizeof ))
2011-02-21 17:49:30 -05:00
Robert Reif
5f84272a52
fix segfault: #2591 (cppcheck hangs with 100% cpu load ( class A : ))
2011-02-21 14:25:35 -05:00
Daniel Marjamäki
55711698d0
Fixed #2591 (cppcheck hangs with 100% cpu load ( class A : ))
2011-02-21 19:41:34 +01:00
Robert Reif
5984b6b53f
fix #2595 (False positive Technically the member function 'A::foo' can be const)
2011-02-20 20:01:54 -05:00
Robert Reif
763763fa9b
fix bitfields to support non-numeric bitfield width
2011-02-20 18:22:49 -05:00
Daniel Marjamäki
bfe28d3b26
Fixed #2597 (False positive: Buffer access out-of-bounds for u_char, uint*_t, ...)
2011-02-20 21:24:57 +01:00
Daniel Marjamäki
c52704e636
astyle formatting
2011-02-20 21:00:03 +01:00
Daniel Marjamäki
c3fba356c0
Fixed #2563 (#if equality testing does not ignore parentheses)
2011-02-20 20:57:28 +01:00
Daniel Marjamäki
5dea79a07d
cppcheckError: Rephrazed the error message. The 'internal error' sounds like something dangerous happens that needs to be fixed. So I think 'analysis failed' is better. If the code has a syntax error then 'analysis failed' is entirely ok.
2011-02-20 19:56:13 +01:00
Daniel Marjamäki
63c003f92e
Tokenizer: fixed so that 'p=&x; if(p)' is simplified to 'p=&x;if(&x)'. Ticket: #2596
2011-02-20 18:18:27 +01:00
Daniel Marjamäki
7894d86132
Null pointers: Fixed false negative for such code: 'if (p && *p) {} else { *p=0; }'. Ticket: #2379
2011-02-20 14:38:49 +01:00
Robert Reif
537ac0cb34
use func->start rather than searching for '{' in CheckClass::privateFunctions
2011-02-20 08:36:06 -05:00
Robert Reif
597aea9f15
save start of function '{' and start of variable declaration in symbol database so checks don't have to find them
2011-02-20 08:25:42 -05:00
Daniel Marjamäki
1cfb18be08
astyle formatting
2011-02-20 12:22:01 +01:00
Daniel Marjamäki
46f4e46d30
Tokenizer::simplifyTemplates: Better handling for multi-token template arguments such as 'Foo<std::string>'
2011-02-20 12:17:05 +01:00
Robert Reif
7dd8a3283a
fix comment in CheckClass::initializeVarList
2011-02-19 20:09:07 -05:00
Robert Reif
fef1142997
fix #2592 (False positive: 'operator=' should return reference to self)
2011-02-19 20:02:16 -05:00
Greg Hewgill
d20987c3da
Merge branch 'inline-suppression-c-style'
2011-02-20 13:26:35 +13:00
Greg Hewgill
98ab34b2b5
Support cppcheck-suppression in C style comments
2011-02-20 11:44:42 +13:00
Daniel Marjamäki
5f0206725b
Null pointers: Fixed false negative for such code 'if (p && *p==0) {} *p = 0;'. Ticket: #2379
2011-02-19 21:28:18 +01:00
Daniel Marjamäki
29d05cf5f2
Null pointers: Fixed false negative for such code: 'abc->a = 0; if (abc && ..'. Ticket: #2379
2011-02-19 21:10:31 +01:00
Daniel Marjamäki
e7ef1b3627
Null pointer: fixed false negative when dereferencing struct and then checking if it's null. Ticket: #2379
2011-02-19 21:01:38 +01:00
Robert Reif
e6eb160395
fix [B#2589 (segmentation fault of cppcheck (struct B : A))
2011-02-19 14:38:00 -05:00
Daniel Marjamäki
caca6e94e6
Fixed #2231 (uninitialized variable: undetected when initialization in for loop)
2011-02-19 20:19:46 +01:00
Robert Reif
77fe9858e2
fix #2587 (Spurious warning about struct hiding typedef)
2011-02-19 14:18:37 -05:00
Robert Reif
f9b1505115
fix Scope::findInNestedListRecursive to check all children
2011-02-19 13:40:02 -05:00
Daniel Marjamäki
85b1ea21cf
Fixed #2590 (segmentation fault of cppcheck ( {}int ))
2011-02-19 09:56:17 +01:00
Greg Hewgill
7e5d8e42d4
remove stray BOM from source file
2011-02-19 16:10:50 +13:00
Daniel Marjamäki
f363bc1560
Borland C++: Fixed compiler error
2011-02-18 20:21:48 +01:00
Daniel Marjamäki
9a760b9654
Fixed #2582 (segmentation fault of cppcheck ( if() ))
2011-02-18 20:05:44 +01:00
Daniel Marjamäki
dfba4b7332
Fixed #2585 (segmentation fault of cppcheck (CheckOther::clarifyCalculation))
2011-02-17 21:30:59 +01:00
Daniel Marjamäki
cf2a04377e
Fixed #2586 (segmentation fault of cppcheck (template<>))
2011-02-17 21:15:17 +01:00
Greg Hewgill
e2581da30c
Merge branch 'unmatched-suppressions'
2011-02-17 21:46:43 +13:00
Greg Hewgill
a4de6a3455
be sure to list unmatched suppressions only for the currently processed file
2011-02-17 21:46:14 +13:00
Daniel Marjamäki
0ee583e324
Fixed gcc compiler warnings (signedness)
2011-02-16 20:56:02 +01:00
Daniel Marjamäki
54e0b60cc5
Fixed #2584 (false positive 'variable n is never used')
2011-02-16 20:33:24 +01:00
Greg Hewgill
5d74325015
implement unmatchedSuppression information message
2011-02-16 23:02:37 +13:00
Greg Hewgill
331788246b
factor out addSuppressionLine from file reading function
2011-02-16 22:26:16 +13:00
Greg Hewgill
8a85b18283
use suppression wildcard glob instead of special-case empty filename
2011-02-16 20:19:18 +13:00
Robert Reif
218464df89
fix #2580 (false postive with Unused private function)
2011-02-14 19:50:13 -05:00
Daniel Marjamäki
0ed0d07714
Tokenizer::simplifyCalculations: basic handling of bitwise operators
2011-02-14 20:43:26 +01:00
Daniel Marjamäki
805773663e
Build: Renamed HAVE_DEPENDENCIES to HAVE_RULES
2011-02-14 19:37:58 +01:00
Robert Reif
cdd8d3f785
Really fix #2348 perl-tk
2011-02-13 19:02:57 -05:00
Ettl Martin
d2a1d3f14a
fixed pre/post increment warings, found during selfcheck
2011-02-13 23:57:07 +01:00
Daniel Marjamäki
0d2d0c864a
Tokenizer::simplifyKnownVariables: Fixed TODO testcases (better handling of comparisons)
2011-02-13 22:24:45 +01:00
Daniel Marjamäki
2182ede486
Tokenizer::simplifyKnownVariables: Fixed TODO testcase (better handling of ^)
2011-02-13 22:13:19 +01:00
Daniel Marjamäki
472d8154ca
Tokenizer::simplifyKnownVariables: Fixed TODO testcase (better handling of |)
2011-02-13 22:09:04 +01:00
Daniel Marjamäki
467c984cd1
Tokenizer::simplifyKnownVariables: Fixed TODO testcase (better handling of %)
2011-02-13 22:03:46 +01:00
Robert Reif
c03ace7378
Fix #2579 (segmentation fault of cppcheck)
2011-02-13 14:11:22 -05:00
Robert Reif
ad22aebf8c
Really fix : #2376 (simplifyTypedef: upx-ucl)
2011-02-13 13:34:55 -05:00
Daniel Marjamäki
d8da1ac390
Merge branch 'suppress-glob' of https://github.com/ghewgill/cppcheck into ghewgill-suppress-glob
2011-02-13 18:17:44 +01:00
Greg Hewgill
1418c12261
astyle formatting
2011-02-13 10:01:32 +13:00
Greg Hewgill
421b32efb4
use std::stack instead of std::list where appropriate
2011-02-13 09:55:45 +13:00
Robert Reif
2aefa5deb5
fix #2577 (segmentation fault of cppcheck)
2011-02-12 15:35:48 -05:00
Daniel Marjamäki
de75bdfed5
Tokenizer: comments/refactorings
2011-02-12 21:11:20 +01:00
Daniel Marjamäki
4d1aae5859
Tokenizer::simplifyTemplates: Broke out the functionality that instantiates a template
2011-02-12 20:58:45 +01:00
Daniel Marjamäki
9021f0f180
Tokenizer::simplifyTemplates: Broke out the functionality that handles default template arguments
2011-02-12 20:27:44 +01:00
Daniel Marjamäki
00bdf618f2
Tokenizer::simplifyTemplates: Broke out the functionality that extract a list of template instantiations
2011-02-12 20:17:58 +01:00
Daniel Marjamäki
25d6bfe3c4
Tokenizer::simplifyTemplates: broke out the functionality that extract a list of template declarations
2011-02-12 20:12:07 +01:00
Daniel Marjamäki
654116af61
Tokenizer::simplifyTemplates: Broke out handling for 'template<>..'
2011-02-12 19:43:33 +01:00
Daniel Marjamäki
518a495334
Fixed #2576 (False positive: (error) Buffer access out-of-bounds)
2011-02-12 18:34:12 +01:00
Daniel Marjamäki
07e8325e50
Fixed #2549 (segmentation fault of cppcheck)
2011-02-12 16:51:59 +01:00
Daniel Marjamäki
7507f64ee7
Fixed #2558 (false positive: (error) Returning reference to auto variable)
2011-02-12 15:39:26 +01:00
Daniel Marjamäki
2657d36d03
Fixed #2502 (False positive: redundant assingment of object to itself)
2011-02-12 14:27:07 +01:00
Daniel Marjamäki
318f2e8a57
Fixed #2561 (False positive on array index when using conditional operator)
2011-02-12 11:31:10 +01:00
Daniel Marjamäki
63ade3e4f6
Tokenizer::simplifyKnownVariables: Split up the function into smaller functions. Broke out ..GetData function that extracts info about assigned variable before the simplification is made.
2011-02-12 09:24:20 +01:00
Daniel Marjamäki
27febb062b
cppcheck: Added HAVE_DEPENDENCIES define. Cppcheck cli can be compiled without dependencies.
2011-02-12 08:06:59 +01:00
Robert Reif
78b5361ec8
fix #2568 (False positive: (style) Union 'A_t' hides typedef with same name (forward declaration))
2011-02-11 19:09:24 -05:00
Sébastien Debrard
f5ed52b84b
fix #2569 check postfix increment on boolean
2011-02-11 23:38:23 +01:00
Daniel Marjamäki
951a81d0d2
Tokenizer::simplifyKnownVariables: Broke out the simplification into a separate function
2011-02-11 20:12:51 +01:00
Daniel Marjamäki
227a6100f7
astyle formatting
2011-02-11 19:31:37 +01:00
Greg Hewgill
f2f2d1f885
Fixed #2571 (Preprocessor: better handling for #undef)
2011-02-11 18:51:22 +01:00
Greg Hewgill
751f8d46e5
Fixed #2570 (Preprocessor: #define parsing when there is no whitespace between a macro symbol and its double-quoted string expansion)
2011-02-11 18:01:27 +01:00
Robert Reif
b8c5426bb8
fix #2567 Unused private function when implemented in different file
2011-02-11 08:00:41 -05:00
Erik Lax
b3e8ef9d48
Fixed #2559 (Refactoring Preprocessor::read)
2011-02-11 06:30:42 +01:00
Daniel Marjamäki
08811c8179
CheckBufferOverrun: Refactoring. Broke out checkScope code for parsing 'for' bodies
2011-02-10 21:56:06 +01:00
Reijo Tomperi
a71204b8e3
Change "tinyxml/tinyxml.h" includes into <tinyxml.h> and modify dmake to work with it.
...
This should allow usage of libtinyxml-dev or such libraries without modifications to code or makefile.
2011-02-10 22:35:48 +02:00
Robert Reif
2900d44ff0
#2560 (False positive: The class 'Altren' does not have a constructor, because base class is in namespace.)
2011-02-10 07:37:55 -05:00
Robert Reif
e6848aef98
Tokenizer: refactor duplicated token copy code info function
2011-02-09 22:02:17 -05:00
Daniel Marjamäki
5175e4ff3f
Fixed #2535 (false positive: (style) Variable 'A' is not assigned a value)
2011-02-09 19:20:44 +01:00
Robert Reif
301f83767e
replace tok->strAt(0) with tok->str()
2011-02-09 07:45:19 -05:00
Robert Reif
7502cea4d3
Fixed #2554 (simplifyTypedef: wrong simplification for sizeof(array))
2011-02-08 19:47:14 -05:00
Daniel Marjamäki
56ae77ba87
Fixed #2555 (Cppcheck 1.47 - Crash on WinMerge-Trunk (Win7 x64))
2011-02-08 20:18:15 +01:00
Erik Lax
aeae5a867d
Fixed #2550 (Bad substr/strncmp comparison)
2011-02-08 19:49:29 +01:00
Greg Hewgill
7a219b1fb8
support wildcard characters * and ? in suppression list
2011-02-09 00:19:57 +13:00
Greg Hewgill
a9f2879889
factor out file matching into own class
2011-02-09 00:19:56 +13:00
Robert Reif
1e0d538273
checkautovariables: refactor to use the symbol database
2011-02-07 19:26:34 -05:00
Daniel Marjamäki
7c9e52546d
Fixed #2552 (preprocessor check XX is already guaranteed to be defined -- too eager?)
2011-02-07 20:26:29 +01:00
Daniel Marjamäki
4a7c56f970
1.47: Updated versions
2011-02-06 12:05:42 +01:00
Zachary Blair
44a350a6dc
Ticket #2388 . Added more detail to the 'exceptRethrowCopy' error message.
2011-02-06 02:01:14 -08:00
Zachary Blair
daa04872a0
Merge branch 'master' of github.com:danmar/cppcheck
2011-02-06 01:31:09 -08:00
Daniel Marjamäki
f7dcf2d3b9
Tokenizer: Added a comment about sizeof for struct/class. We always assume that the size is 100
2011-02-06 09:58:07 +01:00
Zachary Blair
8a494cf8bb
Fixed #2388 (Use throw without argument to rethrow exceptions)
2011-02-05 01:11:09 -08:00
Robert Reif
95e917b27f
Tokenizer: Replace __null with 0 (gcc constant)
2011-02-05 09:03:31 +01:00
Robert Reif
c592ccd35d
Fixed #2547 (segmentation fault of cppcheck)
2011-02-05 08:59:59 +01:00
Daniel Marjamäki
5640845a17
Fixed #2498 (False positive: redundant assignment)
2011-02-04 21:08:42 +01:00
Daniel Marjamäki
d06fde77ff
Fixed #2531 (False positive: Redudant assignment to itself)
2011-02-04 20:55:38 +01:00
Daniel Marjamäki
dbc5929fa2
Fixed #2503 (false positive: memory leak (struct member, address is taken))
2011-02-04 20:41:35 +01:00
Robert Reif
f87056fca3
Fixed #2539 (segmentation fault of cppcheck)
2011-02-04 20:19:49 +01:00
Robert Reif
514c9b9b23
Fixed #2546 (make CheckMemoryLeakInClass also check structures)
2011-02-04 20:17:25 +01:00
Daniel Marjamäki
447d29938e
Fixed #2544 (XML output does not specify encoding used)
2011-02-04 20:14:19 +01:00
Kimmo Varis
7d73b523be
Clarify few verbose messages.
...
Dan pointed out to me earlier that he wants both short- and
verbose messages to be independently understandable. So modifying
some verbose messages to be easier to understand without the short
message.
2011-02-04 11:10:24 +02:00
Daniel Marjamäki
39c68e12ce
Fixed #2533 (false positive: (error) Uninitialized variable: cBuffer)
2011-02-03 22:29:32 +01:00
Daniel Marjamäki
398190460f
astyle formatting
2011-02-03 22:20:59 +01:00
Robert Reif
e9ec4bc3e4
Fixed #2536 (cppcheck hangs with 100% cpu load)
2011-02-03 07:58:49 +01:00
Robert Reif
8288c28b3f
Fixed #2537 (segmentation fault of cppcheck)
2011-02-03 07:57:10 +01:00
Raphael Geissert
c9a0d95e89
A few more Token::Match -> ::simpleMatch replacements
2011-02-02 13:27:02 -06:00
Raphael Geissert
f8e2d50e6f
Use Token::simpleMatch where no special patterns are needed
2011-02-02 13:27:02 -06:00
Raphael Geissert
45e5dc20a2
Try to match custom rules as many times as possible, not just once
2011-02-02 13:27:02 -06:00
Raphael Geissert
15dceed6cd
Remove uneeded indentation
2011-02-02 13:27:01 -06:00
Raphael Geissert
8d5863133c
Use Token::simpleMatch where no patterns are used
2011-02-02 13:27:01 -06:00
Raphael Geissert
cf2b6f7bc1
Remove useless spacing at the end of *Match strings
2011-02-02 13:27:01 -06:00
Raphael Geissert
d592250284
Fix sizeof sizeof check to handle sizeof(sizeof type)
2011-02-02 11:49:32 -06:00
Daniel Marjamäki
9a383388be
xml2: added <errors> element
2011-02-02 18:46:07 +01:00
Greg Hewgill
bea36d1f83
use instances of less<Check *> to compare pointers for list::sort()
2011-02-02 22:58:25 +13:00
Greg Hewgill
be195a72c9
initialise Check::_name in constructor rather than relying on virtual Check::name()
2011-02-02 22:58:25 +13:00
Robert Reif
8eb92001b3
Fixed #2530 (Tokenizer: Remove redundant 'MyClass::' inside MyClass class declaration)
2011-02-02 07:40:08 +01:00
Daniel Marjamäki
defeded4b5
Fixed #2529 (False positive: array 'req[3]' index 4 out of bounds)
2011-02-01 21:46:07 +01:00
Kimmo Varis
c2de1a8a52
Convert "too many configurations" message to information message.
...
The "too many configurations"-message is currently only printed to the
log. So it won't be seen by users integrating Cppcheck using XML
error file. It is also easily missed in the GUI as it only shows up
in the checking log. Making it a information message it shows up
with the other errors and tells user that file was not completely
checked.
Ticket #2527 (Make "too many configurations" message an error message)
2011-02-01 17:53:30 +02:00
Daniel Marjamäki
202c8eb4a0
Fixed #2525 (False positive 'Possible null pointer dereference')
2011-01-31 17:30:27 +01:00
Raphael Geissert
386de53ff7
Formatting, sorry
2011-01-30 20:37:37 -06:00
Raphael Geissert
29ca5fbe1e
Minor optimisations to the preprocessor
2011-01-30 18:47:49 -06:00
Raphael Geissert
b4a249f26e
Reduce std::string::find() abuse
2011-01-30 18:40:59 -06:00
Raphael Geissert
66253af1e5
Handle "#endif !defined" conditionals
2011-01-30 17:33:44 -06:00
Raphael Geissert
b944168bdc
Check for cpp conditionals where a define is already guaranteed
2011-01-30 12:47:17 -06:00
Raphael Geissert
5137f5fb7f
Detect null pointer dereferences for many FILE-related functions
...
Ticket #1415 : check for calling f{eof,read,close,...} with NULL
2011-01-30 02:34:58 -06:00
Raphael Geissert
49848fd752
Remove duplicated defines
...
After simplifying define(A) conditionals, the final list of
configurations could end up containing duplicate items.
Ticket #1468
2011-01-30 02:13:32 -06:00
Robert Reif
09998d9e18
Memory leaks: less conservative checking of classes. ticket: #2517
2011-01-30 08:38:20 +01:00
Daniel Marjamäki
49fc53165c
Tokenizer: remove some unhandled macros in the global scope. ticket: #2523
2011-01-30 08:34:58 +01:00
Daniel Marjamäki
0624e418f1
Memory leaks: bug fix. don't skip '}' by accident
2011-01-29 18:46:55 +01:00
Daniel Marjamäki
a299411a82
Tokenizer: Better simplifications of static constants
2011-01-29 16:14:09 +01:00
Daniel Marjamäki
83625d8055
Fixed #2505 (Check processing of a preprocessor macro 'FREE')
2011-01-28 09:19:30 +01:00
Robert Reif
79862573ba
Symbol database: better unit testing. ticket: #2468
2011-01-28 08:33:02 +01:00
Daniel Marjamäki
88abeeebba
Fixed #2518 (Crash when checking rockbox's firmwire)
2011-01-27 21:16:25 +01:00
Daniel Marjamäki
524498e439
Tokenizer: collapse operator function names into a single token. ticket: #2519
2011-01-27 18:44:20 +01:00
Sébastien Debrard
078c36921d
runastyle
2011-01-26 20:10:56 +01:00
Sébastien Debrard
3e7f29d6f9
fix #2510 Improve check 'sizeof for array given as function argument'
2011-01-26 20:08:06 +01:00
Sébastien Debrard
5d661d25a8
typo: message
2011-01-26 09:35:11 +01:00
Sébastien Debrard
e82c190429
Merge branch 'master' of https://github.com/danmar/cppcheck
...
Conflicts:
test/testother.cpp
2011-01-25 10:05:03 +01:00
Sébastien Debrard
4cf56dac2b
Fix 2495 incorrect sizeof error message
2011-01-25 09:57:58 +01:00
Daniel Marjamäki
a596a7a8fe
Fixed #2494 (New check: clarify calculation when using ?: operator)
2011-01-24 21:40:49 +01:00
Sébastien Debrard
c7b8bd543f
fix ticket 155 - char array
2011-01-24 19:04:56 +01:00
Robert Reif
f5b26222ff
Symbol database: better handling of functions returning function pointer. ticket: #2468
2011-01-23 22:31:35 +01:00
Daniel Marjamäki
586cbd5839
Tokenizer: Upon createLinks error, report error and bailout
2011-01-23 09:38:38 +01:00
Daniel Marjamäki
b10f0aabd6
Fixed #2376 (simplifyTypedef: upx-ucl)
2011-01-23 09:04:34 +01:00
Robert Reif
2a3cce5001
Symbol database: fixed corruptions. ticket: #2468
2011-01-23 08:41:31 +01:00
Daniel Marjamäki
86e6822264
Fixed #2493 (false positive: (error) Possible null pointer dereference: pExpr)
2011-01-23 08:38:09 +01:00
Daniel Marjamäki
9d3b242cd8
Fixed #1952 (false negative: buffer acces out of bounds with memcpy)
2011-01-22 21:31:26 +01:00
Debrard Sébastien
27dce075e0
Fixed #155 (check size of a variable whose type is a sized array)
2011-01-22 19:21:56 +01:00
Robert Reif
8abae6f1e5
Symbol database: match copy-constructor better. ticket: #2484
2011-01-22 17:43:36 +01:00
Daniel Marjamäki
1e25d74ba4
Class: better check if there are friends. ticket: #2459
2011-01-22 17:35:54 +01:00
Daniel Marjamäki
f947955c63
Fixed #2492 (False positive: memory leak 'return &self->foo;')
2011-01-22 13:40:19 +01:00
Daniel Marjamäki
9551332321
Fixed #2459 (False positive with unused private function and friend)
2011-01-22 13:00:03 +01:00
Daniel Marjamäki
5c88129f01
Fixed #2484 (false positive because template is not instantiated properly)
2011-01-22 12:42:53 +01:00
Daniel Marjamäki
bc31f317bc
Fixed #2491 (Tokenizer::setVarId : wrong handling of function call: 'a(b * c, 1);')
2011-01-22 09:27:16 +01:00
Robert Reif
0746c2410a
Symbol database: Fixed memory leak. ticket: #2468
2011-01-22 08:36:47 +01:00
Robert Reif
69eee86ee4
Tokenizer: Only create 1 symbol database. ticket: #2468
2011-01-22 08:34:24 +01:00
Robert Reif
767e01e24a
Fixed #2478 (Crash when trying to analyze files (CheckClass::checkReturnPtrThis))
2011-01-21 19:54:41 +01:00
Robert Reif
d73709a620
Symbol database: rename variables. ticket: #2468
2011-01-21 07:42:41 +01:00
Daniel Marjamäki
87e3e9e703
Fixed #2488 (false positive with updating iterator in a for loop)
2011-01-20 20:48:35 +01:00
Daniel Marjamäki
a21f8eec7c
Fixed #2481 (false positive with break: After insert, the iterator '*' may be invalid)
2011-01-20 19:26:52 +01:00
Robert Reif
9dce0dd75c
Symbol database: refactoring of classAndStructTypes parsing. ticket: #2468
2011-01-20 18:02:52 +01:00
Daniel Marjamäki
70eadb37bd
Fixed #2481 (false positive with 'break;': After insert, the iterator '*' may be invalid)
2011-01-19 21:00:46 +01:00
Daniel Marjamäki
ecac93ebed
Fixed #2462 (false positive: (warning) Redundant code: Found a statement that begins with numeric constant)
2011-01-19 18:37:33 +01:00
Pete Johns
94aafa482c
Fixed #2480 (false positive on unused private function)
2011-01-19 20:32:08 +11:00
Daniel Marjamäki
856a631f35
Fixed #2483 (SymbolDatabase compiler warning (VS2008/VS2010))
2011-01-19 07:33:38 +01:00
Kimmo Varis
b8b2e3fae9
Move filelister* to cli.
...
Ticket #2445 (Move FileLister classes from LIB to CLI).
2011-01-18 19:58:49 +02:00
Kimmo Varis
86ac25456e
Move sameFileName() method to Path class.
...
Ticket #2445 (Move FileLister classes from LIB to CLI). Moving
sameFileName() to Path allows moving FileLister* classes to CLI.
2011-01-18 19:58:16 +02:00
Pete Johns
0e1bab6dc3
Merge branch 'multi_indirection_templates'
2011-01-18 21:08:04 +11:00
Pete Johns
ea01c04108
Added parenths to fix build breakage.
2011-01-18 21:07:33 +11:00
Pete Johns
62063aa250
Refactored to remove code duplication.
2011-01-18 20:51:57 +11:00
Pete Johns
abfd907763
Made isVariableDeclarationIdentifiesTemplatedPointerToPointerVariable() pass.
...
And added isVariableDeclarationIdentifiesTemplatedArrayVariable() (passing) into the bargain.
2011-01-18 20:14:12 +11:00
Robert Reif
8631ee65a3
Fixed #2474 (false positive: Member variable 'A::m_SemVar' is not initialised in the constructor.)
2011-01-18 07:34:11 +01:00
Robert Reif
c994508c3e
Symbol database: Refactor the variables API. ticket: #2468
2011-01-18 07:32:06 +01:00
Daniel Marjamäki
965c1a94fd
Fixed #2475 (False positive in structure initialisation: The scope of the variable bits can be reduced)
2011-01-17 20:51:15 +01:00
Daniel Marjamäki
b5020468f6
Fixed #2467 (false positive: possible nullptr dereference)
2011-01-17 19:23:00 +01:00
Daniel Marjamäki
065e2e277e
Fixed #2473 (False positive: Memory leak when there is local struct)
2011-01-17 19:00:21 +01:00
Robert Reif
959e10cee5
Symbol database: renamed classes. ticket: #2468
2011-01-17 18:29:19 +01:00
Robert Reif
bf9528558e
Symbol database: pulled out classes into global scope. ticket: #2468
2011-01-17 07:21:59 +01:00
Zachary Blair
481907ef14
Fixed #2457 (CheckOther::checkIncorrectLogicOperator: hang if variable id is 0)
2011-01-16 13:57:29 -08:00
Pete Johns
9c300813a4
Fixed gcc warning.
2011-01-17 08:52:26 +11:00
Pete Johns
7918c4b804
isVariableDeclaration() now detects template variables.
2011-01-17 08:36:53 +11:00
Pete Johns
38c37ad2d8
Moved array declaration detection into isVariableDeclaration()
2011-01-17 08:36:52 +11:00
Daniel Marjamäki
93d1313186
Refactoring: Check if type is class/struct through symbol database
2011-01-16 19:57:29 +01:00
Daniel Marjamäki
e6a1efa13b
Fixed #2302 (Duplicate id 'unusedVariable')
2011-01-16 18:45:05 +01:00
Robert Reif
d341b42b0c
Symbol database: increased constness. ticket: #2468
2011-01-16 18:13:54 +01:00
Daniel Marjamäki
657c22d23b
cppcheck: output errorlist to stdout
2011-01-16 17:18:09 +01:00
Robert Reif
66be74a5af
Symbol database: Refactorings. Move check-specific code to check. Ticket: #2468
2011-01-16 16:37:11 +01:00
Daniel Marjamäki
a97e28491f
Fixed #2407 (False positive: unused private function)
2011-01-16 12:16:31 +01:00
Daniel Marjamäki
f72fd6960e
Fixed #2449 (segfault in tokenize.cpp, incorrect parsing)
2011-01-16 11:54:28 +01:00
Raphael Geissert
da998fec68
Tokenizer: simplify restrict
2011-01-16 11:37:03 +01:00
Robert Reif
beb2db82a2
Fixed #980 (false negative: division by zero when using enum)
2011-01-16 11:24:58 +01:00
Robert Reif
0f6644e1ea
Symbol database: Refactorings
2011-01-16 11:18:12 +01:00
Daniel Marjamäki
8ef47dc576
astyle formatting
2011-01-16 09:57:56 +01:00
Daniel Marjamäki
8fa26fbd28
Memory leaks: Optimised and refactored
2011-01-16 09:56:04 +01:00
Daniel Marjamäki
433ae8abf4
STL: Optimised checking
2011-01-15 22:38:05 +01:00
Daniel Marjamäki
bb2862bc97
fixed unit test
2011-01-15 21:04:20 +01:00
Daniel Marjamäki
94ebb24d3d
Optimising: about 5% improvement with Visual Studio executable
2011-01-15 20:55:51 +01:00
Daniel Marjamäki
6edf35ebf5
Fixed #2463 (false positive: possible nullpointer dereference)
2011-01-15 12:09:36 +01:00
Daniel Marjamäki
97d0755750
Fixed #2454 (Tokenizer::simplifyKnownVariables: problem with float/double variables)
2011-01-15 08:48:42 +01:00
Daniel Marjamäki
5920dbb7e7
Fixed #2466 (Tokenizer: simplification of enum)
2011-01-15 08:21:06 +01:00
Robert Reif
8ecba0af90
Fixed #2464 (False positive: not initialised/not assigned Static variable in copy constructors.)
2011-01-15 08:04:50 +01:00
Robert Reif
79b9939610
Fixed #2465 (False positive: not initialised variable, but there is default constructor for it.)
2011-01-15 07:59:37 +01:00
Daniel Marjamäki
00b49a51da
Fixed #2451 (False positive when incrementing map value via iterator)
2011-01-14 19:50:07 +01:00
Robert Reif
708a75e363
Fixed #2452 (syntax error when 'void f(typedef int x)' is used. causes segmentation fault.)
2011-01-14 07:41:22 +01:00
Kimmo Varis
dffe1a0acd
Fix doxgen comment.
2011-01-13 23:25:17 +02:00
Kimmo Varis
4668e19060
Modify Cppcheck::addFile() only take one file as a parameter.
...
CLI and GUI already do the directory walking for us and we have list
of files to check. So we were duplicating this directory walking.
Practically doing check again for each file if it is a directory.
Which can take some time with large amount of files.
2011-01-13 23:18:04 +02:00
Daniel Marjamäki
b247d7d56e
Fixed #2450 (False positive when iterator reused)
2011-01-13 20:57:44 +01:00
Daniel Marjamäki
36c1807228
Fixed #2458 (false positive: (warning) Redundant code: Found a statement that begins with numeric constant)
2011-01-13 20:12:57 +01:00
Zachary Blair
38be7056b0
Fixed #2434 (FP memleakOnRealloc)
2011-01-12 22:33:46 -08:00
Daniel Marjamäki
09f900ce79
Fixed #2440 (False negative: basic memory leak)
2011-01-11 20:14:15 +01:00
Kimmo Varis
846d3dae99
Accept include paths ending with backslash.
...
Convert include path to use internal path separators when parsing
command line. Convert back to native separators when using paths.
Ticket #2448 (Error in handling -I command line parameter)
2011-01-11 21:04:21 +02:00
Daniel Marjamäki
79e52a8c45
Fixed #2296 (Tokenizer: simplifyKnownVariable doesn't simplify pointer properly 'delete [] p;')
2011-01-11 19:34:35 +01:00
Daniel Marjamäki
9658e2299d
Fixed #2443 (Possible null pointer dereference: xxx - otherwise it is redundant to check if xxx is null at line)
2011-01-10 19:57:26 +01:00
Daniel Marjamäki
2d92f1ff6a
Fixed #2442 (False positive: Memory leak when function returns in 'if' instead of 'else if')
2011-01-10 19:35:06 +01:00
Reijo Tomperi
226b605774
Change year 2010 -> 2011 in license texts.
2011-01-09 21:33:36 +02:00
Daniel Marjamäki
2848abbf36
Fixed #1219 (improve check: null pointer not detected 'if (p) return; *p = 0;')
2011-01-09 20:16:16 +01:00
Daniel Marjamäki
79ef02812d
Fixed #2211 (false negative: buffer access out of bounds for(int i=0; i !=6;i++))
2011-01-09 18:51:28 +01:00
Daniel Marjamäki
88abb32ddf
Fixed #2429 (Tokenizer: Wrong simplification of 'sizeof .1250E+04')
2011-01-09 10:09:54 +01:00
Daniel Marjamäki
d316f6005f
Fixed #2409 (print a warning if provided path (commandline option -I [PATH]) does not exist)
2011-01-09 09:29:38 +01:00
Daniel Marjamäki
68beffca04
Fixed #2437 (false positive: possible null pointer dereference: tok2)
2011-01-08 17:16:52 +01:00
Daniel Marjamäki
67a1c6817b
Error message: Replace " with ' around variable name
2011-01-08 14:35:18 +01:00
Daniel Marjamäki
d758929490
Fixed #2433 (strtol: false positive when strtol isn't used in function call)
2011-01-08 09:23:51 +01:00
Daniel Marjamäki
d27b6a1598
astyle formatting
2011-01-07 20:48:02 +01:00
Daniel Marjamäki
14cbaebfe2
Fixed #2428 (false alarm with code containing a throw clause)
2011-01-07 20:45:33 +01:00
Daniel Marjamäki
989e0e7ccb
Preprocessor: fix bug when determining location when there is a missing include. ticket: #2326
2011-01-07 19:48:51 +01:00
Ettl Martin
9b66f7a754
#ticket 2429: added a test to the mathlib to ensure the used floating point number is recognized correctly
2011-01-07 12:27:12 +01:00
Robert Reif
bfc95e01c1
Fixed #2426 (### Internal error in Cppcheck. Please report it.)
2011-01-07 08:02:47 +01:00
Robert Reif
56ffde402f
Fixed #2425 (segmentation fault of cppcheck)
2011-01-07 07:42:00 +01:00
Daniel Marjamäki
1b3a5ed0be
Tokenizer: simplify NULL to 0 in the normal token list
2011-01-06 20:16:14 +01:00
Daniel Marjamäki
a7835c4054
Preprocessor: Reverted fix for #2131 , it didn't work well so a better fix is needed
2011-01-06 20:01:09 +01:00
Daniel Marjamäki
37b1f7c296
memsetZeroBytes: improved error message. ticket: #2421
2011-01-06 16:27:22 +01:00
Daniel Marjamäki
77ed6ecb5d
Null pointers: Added comments
2011-01-06 13:18:49 +01:00
Daniel Marjamäki
04a117938d
Buffer overrun: Added comments
2011-01-06 13:02:21 +01:00
Daniel Marjamäki
ca294544ca
CheckStl: Added comments
2011-01-06 12:20:54 +01:00
Daniel Marjamäki
616914c1ff
Tokenizer: simple refactorings. and added a few comments
2011-01-06 12:07:37 +01:00
Raphael Geissert
6ec4497919
[PATCH] Check for calls to memset() where 0 bytes are to be filled
...
Inspired by Silvio Cesare's work
2011-01-06 11:31:58 +01:00
Daniel Marjamäki
d1854e330b
Fixed #2413 (fflush() with NULL argument is valid.)
2011-01-06 08:12:34 +01:00
Robert Reif
03a484554c
Fixed #2415 (false positive: Member variable not initialized in constructor calling assignment operator)
2011-01-06 07:56:34 +01:00
Daniel Marjamäki
c74b2e3cbf
Fixed #2411 (possible null pointer dereference (aborting via function pointer not detected))
2011-01-05 21:48:26 +01:00
Daniel Marjamäki
033e759c39
command line: added 'information' id to enable
2011-01-05 21:20:21 +01:00
Daniel Marjamäki
21af64049c
Fixed #2401 (false positive: Uninitialized variable: result)
2011-01-05 20:44:04 +01:00
Daniel Marjamäki
68de938d23
Uninitialized variables. Fixed false positive when there are multiple related conditions. ticket: #2399
2011-01-05 19:54:56 +01:00
Daniel Marjamäki
a0d62e041f
Tokenizer: Fixed memory corruption
2011-01-05 19:38:22 +01:00
Robert Reif
157498e694
Fixed #2412 (typedef: struct with inheritance)
2011-01-05 17:42:55 +01:00
Robert Reif
ed6f683573
typedef: better handling. ticket: #2414
2011-01-05 17:39:53 +01:00
Zachary Blair
188871c428
Removed an unnecessary newline in the message. Ticket #2343
2011-01-05 00:06:53 -08:00
Zachary Blair
3f97bd5477
Fixed #2343 (The ftime obsolete function warning seems wrong)
2011-01-04 23:21:02 -08:00
Kimmo Varis
bb719774b1
Improve suspicious condition (string::find) message.
...
See forum thread:
https://sourceforge.net/apps/phpbb/cppcheck/viewtopic.php?f=3&t=192
2011-01-04 23:19:23 +02:00
Kimmo Varis
66e8b7bc1e
Improve dangerous iterator usage (after erase()) message.
...
See forum thread:
https://sourceforge.net/apps/phpbb/cppcheck/viewtopic.php?f=3&t=192
2011-01-04 23:18:48 +02:00
Kimmo Varis
b750a52f6d
Improve strncat 3rd parameter usage warning message.
...
See forum thread:
https://sourceforge.net/apps/phpbb/cppcheck/viewtopic.php?f=3&t=192
2011-01-04 23:17:44 +02:00
Daniel Marjamäki
d700f25518
Fixed #2399 (Tokenizer::simplifyKnownVariables: variables in conditions)
2011-01-04 21:35:35 +01:00
Daniel Marjamäki
63c1ee375e
Fixed #2398 (false positive: Uninitialized variable)
2011-01-04 19:36:29 +01:00
Daniel Marjamäki
c2a194ead0
Fixed #2393 (Token::Match called with varid 0)
2011-01-04 18:34:51 +01:00
Daniel Marjamäki
2c6421d162
Merge branch 'master' of https://github.com/rgeissert/cppcheck into rgeissert-realloc
2011-01-04 18:21:18 +01:00
Daniel Marjamäki
85897c3991
Merge branch 'debug-warnings' of https://github.com/rgeissert/cppcheck into rgeissert-debug-warnings
2011-01-04 18:17:39 +01:00
Robert Reif
63208e87d3
typedef: delete unhandled typedefs. ticket: #2348
2011-01-04 07:43:40 +01:00
Robert Reif
a782d3ddf7
typedef: fix testcase 4. ticket: #2375
2011-01-04 07:39:41 +01:00
Robert Reif
63ad1fbe69
Fixed #2400 (Tests crashing in Windows)
2011-01-04 07:34:32 +01:00
Raphael Geissert
2b1ec9a07f
Mention the name of the variable in the inconclusive leak msg
2011-01-03 20:40:31 -06:00
Markus Elfring
e459ed1de3
Fixed #2389 (mistakable warning from 'CheckClass::uninitVarError')
2011-01-03 19:03:42 +01:00
Markus Elfring
3fc0317997
Bug #2390 : Enclose the output of a variable name with quotes in "CheckOther::variableScopeError"
...
The variable name output was enclosed by quotation marks in the member
function "CheckOther::variableScopeError" and corresponding test functions.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
2011-01-03 05:15:20 +01:00
Raphael Geissert
3d9550b0bf
Simplify "x = realloc (0, n);" to "x = malloc(n);"
2011-01-02 17:46:10 -06:00
Raphael Geissert
e75a81669e
Move simplification of realloc after simplification of math ops
2011-01-02 16:41:34 -06:00
Daniel Marjamäki
d2714fefda
typedef: Fixed testcase. ticket: #2375
2011-01-02 17:28:47 +01:00
Daniel Marjamäki
97f7a36e91
Buffer overruns: Added comments
2011-01-02 14:16:58 +01:00
Daniel Marjamäki
2e7e118cb8
Fixed #2392 (Preprocessor: Wrong simplification of __VA_ARGS__)
2011-01-02 11:19:37 +01:00
Daniel Marjamäki
b5876f00ff
Fixed #2391 (cstdlib file and memory function check misbehavior)
2011-01-02 08:32:51 +01:00
Daniel Marjamäki
4ec9d418ff
Fixed #2215 (Improve check: Writing outside malloc bounds not detected)
2011-01-01 20:56:21 +01:00
Daniel Marjamäki
789d944912
typedef: don't simplify typedef after 'case'. it means that there is a typedef and constant with the same names. Ticket: #2386
2011-01-01 20:20:03 +01:00
Daniel Marjamäki
2a77dd3df1
Fixed #2246 (Improve check: Memory leak, function is not noreturn if return value is taken)
2011-01-01 20:14:01 +01:00
Daniel Marjamäki
c8775344d6
uninitialized variables: Added some comments
2011-01-01 18:24:27 +01:00
Daniel Marjamäki
3c238882a2
Fixed TODO testcase. Use symbol database instead of token list. Ticket: #2375
2011-01-01 17:54:37 +01:00
Daniel Marjamäki
3eabb4ebe0
Added comments in the memory leaks checking
2011-01-01 13:28:34 +01:00
Daniel Marjamäki
0cc49188c0
Memory leaks: localized variables
2011-01-01 12:27:57 +01:00
Daniel Marjamäki
62145431a7
Tokenizer: Added more comments
2011-01-01 11:40:32 +01:00
Daniel Marjamäki
e385323b65
Tokenizer: Added doxygen comments
2011-01-01 11:26:48 +01:00
Daniel Marjamäki
71acf78c64
Tokenizer: added doxygen comments
2011-01-01 09:26:24 +01:00
Zachary Blair
68700b3561
Fixed #2382 (Catching exceptions by value instead of reference)
2010-12-31 12:48:24 -08:00
Daniel Marjamäki
2da3fea1b8
Fixed #2386 (segmentation fault occurs in the checking when typedef has same name as an enum constant)
2010-12-31 20:55:28 +01:00
Daniel Marjamäki
3e5614a5a3
Null Pointer: Refactoring - broke out CheckNullPointer::isPointer
2010-12-31 18:30:04 +01:00
Daniel Marjamäki
04eb9cf305
Fixed #2378 (Refactoring: create utility function that skips redundant if/for/while)
2010-12-31 18:07:46 +01:00
Daniel Marjamäki
ed6c76ce04
Fixed #2385 (False positive: array index out of bounds)
2010-12-31 17:43:38 +01:00
Daniel Marjamäki
b04885cd4f
astyle formatting
2010-12-31 15:57:08 +01:00
Daniel Marjamäki
4d8fae186b
added more comments
2010-12-31 15:56:41 +01:00
Daniel Marjamäki
b634242a58
Added comments for CheckNullPointer::nullPointerLinkedList
2010-12-31 14:37:34 +01:00
Daniel Marjamäki
377bcbe729
Remove redundant condition
2010-12-31 14:24:15 +01:00
Daniel Marjamäki
1a8c410c06
gcc: fixed compiler warning (suggest parantheses around assignment)
2010-12-31 14:18:24 +01:00
Daniel Marjamäki
3de9d9cb31
Refactoring and commenting CheckNullPointer::nullPointerAfterLoop
2010-12-31 14:17:10 +01:00
Daniel Marjamäki
59c86b5876
added doxygen comments
2010-12-31 14:16:22 +01:00
Daniel Marjamäki
1fa730d963
added some comments
2010-12-31 13:58:17 +01:00
Pete Johns
502cfe7243
Fixed #2384 ("The function 's::f' can be const" reported for pointer-to-pointer)
...
Moved check for pointer variables into isVariableDeclaration()
Can now handle multiple scopes and multiple levels of indirection. Simplified check for strucs and unions, too, reducing the size of getVarList().
skipScopeIdentifiers() and skipPointers() should probably be methods on class Token.
2010-12-31 22:12:32 +11:00
Zachary Blair
d11b5163b7
Fixed #2382 (Catching exceptions by value instead of reference)
2010-12-31 03:01:38 -08:00
Daniel Marjamäki
f1f1a21c23
Borland C++: Fixed compiler errors
2010-12-31 10:24:51 +01:00
Daniel Marjamäki
d8f241e033
gcc: fixed -Wconversion errors
2010-12-31 09:51:27 +01:00
Daniel Marjamäki
68b9c6ec94
gcc: Fixed -Wconversion warnings in symbol database
2010-12-31 09:39:42 +01:00
Daniel Marjamäki
cab338dffe
gcc: fixed -Wconversion warnings in tokenizer
2010-12-31 09:38:03 +01:00
Daniel Marjamäki
fa3853803b
gcc: fixed -Wconversion warnings
2010-12-31 09:30:56 +01:00
Daniel Marjamäki
f3ce02462e
improved TODO comments
2010-12-30 22:41:22 +01:00
Daniel Marjamäki
c7f2ddf63c
CheckStl: Added comments
2010-12-30 22:36:25 +01:00
Daniel Marjamäki
d005245188
fixed doxygen warnings
2010-12-30 22:13:31 +01:00
Daniel Marjamäki
742f5897b9
gcc: fixed compiler warning
2010-12-30 22:13:10 +01:00
Daniel Marjamäki
3d60d33280
Added comments
2010-12-30 22:07:27 +01:00
Daniel Marjamäki
8bdb05da6e
Uninitialized variables: typeof doesn't dereference. Ticket: #2367
2010-12-30 21:30:46 +01:00
Daniel Marjamäki
307178d3c2
Tokenizer: Better handling of duplicate enums. Ticket: #2381
2010-12-30 20:55:23 +01:00
Daniel Marjamäki
7ec169f66a
Fixed #2321 (false positive: (performance) Prefer prefix ++/-- operators for non-primitive types.)
2010-12-30 14:27:32 +01:00
Pete Johns
2e61736c73
Refactoring following #2377 (Technically the member function xxx can be const)
...
symboldatabase now recognises variables with arbitrarily many scopes.
Extracted method isVariableDeclaration()
Added unit tests for isVariableDeclaration in new file testsymboldatabase.cpp
Extracted givenACodeSampleToTokenize helper class into testutils.h to reduce duplication.
2010-12-30 19:46:44 +11:00
Pete Johns
5d0ace3a50
Fixed #2377 (Technically the member function xxx can be const)
...
TODO: Add unit test for getVarList() and refactor variable check.
[Removed my testcase for #2377 and removed two TODOs.]
2010-12-30 17:56:28 +11:00
Daniel Marjamäki
3d3593e6e7
Fixed #2374 (False 'memory leak' report (assigning to map in subfunction))
2010-12-29 22:18:23 +01:00
Robert Reif
3900ac731e
simplifyTypedef: Better handling of 'typedef int RexxFunctionHandler();'. Ticket: #2348
2010-12-29 20:25:47 +01:00
Robert Reif
3f1f50e970
simplifyTypedef: operator typedef. Ticket: #2375
2010-12-29 20:22:06 +01:00
Daniel Marjamäki
38e7209d26
Fixed #2373 (Using XML2 in --errorlist output)
2010-12-29 12:43:29 +01:00
Daniel Marjamäki
fd27be2440
Fixed #2372 (internal error in logicaloperator check (varid=0))
2010-12-29 10:07:28 +01:00
Robert Reif
137d0e2ba7
typedef: fixed problem with 'typedef int pread_f(int);'. ticket: #2348
2010-12-29 09:18:41 +01:00
Robert Reif
e82b1f8946
typedef: fix typedef simplification. ticket: #2348
2010-12-28 21:21:13 +01:00
Daniel Marjamäki
bdf0cb7115
Fixed #2370 (false negative: Buffer access out-of-bounds (for with if, no break))
2010-12-28 20:46:31 +01:00
Daniel Marjamäki
0667fcf53c
Fixed #2355 (simplifyTypedef: wrong simplification of 'typedef FMAC1 void (*a)();')
2010-12-28 14:04:44 +01:00
Robert Reif
1b92eeae1e
Fixed #2354 (simplifyTypedef: function pointers are not simplified into valid code)
2010-12-28 08:01:32 +01:00
Daniel Marjamäki
d4e3e7e201
Fixed #2367 (false positive: (error) Uninitialized variable: s)
2010-12-27 21:19:10 +01:00
Daniel Marjamäki
448c03c6e6
Fixed #2367 (false positive: (error) Uninitialized variable: s)
2010-12-27 21:05:33 +01:00
Daniel Marjamäki
92acca3d0c
Fixed #2368 (assigned a value that is never used)
2010-12-27 20:49:07 +01:00
Kimmo Varis
e8b81f909d
Change 'Scope of variable'-message to information message.
2010-12-27 16:48:03 +02:00
Daniel Marjamäki
660de98c0c
Fixed #2365 (Internal error: Token::Match called with varid 0)
2010-12-27 14:06:32 +01:00
Daniel Marjamäki
2367cfcf1e
Fixed #2361 (false positive on t[0X10])
2010-12-27 08:09:05 +01:00
Kimmo Varis
12f2850777
Improve the message about const function.
...
See discussion thread:
https://sourceforge.net/apps/phpbb/cppcheck/viewtopic.php?f=3&t=192
2010-12-26 23:44:03 +02:00
Kimmo Varis
f5f2a2ce2a
Improve message for container type range check.
...
See thread:
https://sourceforge.net/apps/phpbb/cppcheck/viewtopic.php?f=3&t=192&start=0
2010-12-26 23:44:02 +02:00
Kimmo Varis
ad89a84796
Improve error message about overlapping buffers for s[n]printf().
...
See forum thread:
https://sourceforge.net/apps/phpbb/cppcheck/viewtopic.php?f=3&t=192&start=0
2010-12-26 23:44:01 +02:00
Daniel Marjamäki
6aa400fd80
Buffer overrun: UB when pointer arithmetic result points out of bounds. Ticket #1774
2010-12-26 21:23:28 +01:00
Daniel Marjamäki
6178459c15
Fixed #2304 (Tokenizer::simplifyKnownVariables: known strcpy parameter)
2010-12-26 20:34:07 +01:00
Daniel Marjamäki
5f3d2a7e35
Fixed #2090 (False negative: null pointer dereference 's=0; strcpy(s,p);')
2010-12-26 19:29:58 +01:00
Daniel Marjamäki
f4581d833d
Tokenizer: Bailout if @ is encountered in the code
2010-12-26 15:07:14 +01:00
Daniel Marjamäki
243a524909
Fixed #2350 (false positive: possible null pointer dereference)
2010-12-26 13:38:16 +01:00
Pete Johns
59acbb3da0
Fixed Linux build.
...
OSX built without limits.h
2010-12-26 23:08:51 +11:00
Pete Johns
64e2c8668c
Fixed #2358 (Compilation fail on Mac)
...
Added test case to prove it works. Not a true unit-test as it accesses the file-system.
2010-12-26 23:04:07 +11:00
Daniel Marjamäki
4fd8d2e056
Fixed #2326 (Preprocessor: inline-suppr does not work for id=missingInclude)
2010-12-26 11:14:57 +01:00
Pete Johns
7943d8ce53
canonicalize_file_name() is a GNU-extension.
...
Replaced with call to realpath() to build on non-Linux systems, such as Mac OSX.
2010-12-26 14:15:42 +11:00
Daniel Marjamäki
ecad249ae2
Fixed #2346 (False positive: pointer is assigned value that is never used. used here: 'pCol = pCol->GetNext()')
2010-12-25 19:17:53 +01:00
Daniel Marjamäki
10ee43790d
Fixed #2339 (Tokenizer::setVarId : Wrong handling of 'int gr = id - (TLFPressProperties::OIL_FLUID * nb);')
2010-12-25 12:40:44 +01:00
Daniel Marjamäki
6f8f0e1aa1
Fixed #2353 (Tokenizer::simplifyKnownVariables: wrong simplification after return)
2010-12-25 10:07:57 +01:00
Daniel Marjamäki
81c5576eb4
Misused scope objects: Don't use this check if the checked file is a pure C file. Ticket: #2352
2010-12-25 08:43:52 +01:00
Daniel Marjamäki
65041cf0ff
Fixed #2349 (Empty 'msg' in output when using '-j')
2010-12-24 11:13:57 +01:00
Daniel Marjamäki
335d164cdf
Fixed #2356 (False positive reported with iterator deletion)
2010-12-24 10:33:48 +01:00
Daniel Marjamäki
18fd12006a
Tokenizer::simplifyGoto: Don't simplify 'goto' inside unhandled macro calls. Ticket: #2348
2010-12-23 22:03:58 +01:00
Daniel Marjamäki
472ecd8805
Tokenizer: Fixed calculation simplification of '0*(*p)'. Ticket: #2348
2010-12-23 18:59:18 +01:00
Daniel Marjamäki
aff3623fec
Fixed #2345 (False positive: uninitialized variable (in sub-condition in if inside a loop))
2010-12-23 09:16:29 +01:00
Daniel Marjamäki
b89f486d0d
Fixed #2344 (FileLister Unix: Don't convert to absolute paths)
2010-12-22 21:01:51 +01:00
Daniel Marjamäki
be46d453c4
Information: Added new severity
2010-12-22 19:53:17 +01:00
Daniel Marjamäki
22a1f3332f
xml2: changed the format of the cppcheck-version info
2010-12-22 18:45:09 +01:00
Robert Reif
fc7e2d1ac1
Fixed #2341 (false positive for function pointer returning typedef)
2010-12-22 18:37:23 +01:00
Daniel Marjamäki
00e9822cb3
Fixed #2337 (False Positive: memory leak)
2010-12-22 18:32:00 +01:00
Daniel Marjamäki
3a612d7cd8
xml2: Added cppcheck-version
2010-12-22 10:29:23 +01:00
Daniel Marjamäki
f392dbef95
Fixed #2338 (False positive: Deallocating a deallocated pointer)
2010-12-22 08:24:50 +01:00
Daniel Marjamäki
6951c32683
Fixed #2336 (False positive: memory leak (passing pointer to subfunction))
2010-12-21 21:12:45 +01:00
Daniel Marjamäki
0f9415a5fb
Fixed #2330 (unreadVariable error for a fstream object when only extraction operator (>>) is used)
2010-12-21 19:02:00 +01:00
Robert Reif
244974a61a
unused variables: fixed false negatives with the help of the symbol database. ticket: #2317
2010-12-21 08:13:40 +01:00
Daniel Marjamäki
f73cce9eca
Fixed #2317 ((style) Variable is allocated memory that is never used)
2010-12-20 18:31:16 +01:00
Daniel Marjamäki
cdc8801be0
Fixed #2334 (Internal class index function (no need to 'strchr'))
2010-12-20 18:13:26 +01:00
Daniel Marjamäki
c0bedb5036
Fixed #2331 (Token::Match is called with varid 0)
2010-12-19 21:27:28 +01:00
Daniel Marjamäki
02892499d2
Fixed #2286 (Variable 'ownKilled' is assigned a value that is never used)
2010-12-19 18:27:31 +01:00
Daniel Marjamäki
1cd6f16ecf
Fixed #2322 (cppcheck follows recursive symlinks)
2010-12-19 11:22:27 +01:00
Daniel Marjamäki
8247270f35
Fixed #2328 (false positive: buffer overrun (for loop with a break => the end value is not reached))
2010-12-19 10:39:43 +01:00
Daniel Marjamäki
41ac2c252f
Fixed #2325 (Tokenizer: Remove for-loop if condition is false)
2010-12-18 21:43:12 +01:00
Robert Reif
a2aa601899
CheckOther: Use SymbolDatabase. Ticket: #2318
2010-12-18 20:35:40 +01:00
Kimmo Varis
062eabf246
Don't use relative paths in lib.pri.
...
Using relative path in included file binds it to be usable only
included from one directory. Instead use variable for giving the
base path for files.
2010-12-18 17:03:46 +02:00
Daniel Marjamäki
79ea453913
Preprocessor: Report 'missing system include' with debug severity. temporary solution until the handling of system includes is better.
2010-12-18 14:45:53 +01:00
Daniel Marjamäki
8ffc2b0ac6
Tokenizer: better handling for switch/break in the simplifyKnownVariables. Ticket: #2324
2010-12-18 11:14:31 +01:00
Daniel Marjamäki
f6c00fc478
Fixed #2323 (false positive: Buffer access out of bounds)
2010-12-18 10:54:36 +01:00
Daniel Marjamäki
fc9c450eed
Fixed #2320 (false positive: Uninitialized variable: kbuf)
2010-12-18 10:06:21 +01:00
Daniel Marjamäki
7eb9855104
Tokenizer: Remove redundant parantheses in rhs. Ticket: #2320
2010-12-18 09:44:58 +01:00
Daniel Marjamäki
18933ea0e6
QMake: auto-generate the visual studio project files with qmake
2010-12-17 21:43:47 +01:00
Daniel Marjamäki
814efb2512
Fixed #2313 (False Positive: memory leak)
2010-12-17 21:34:22 +01:00
Daniel Marjamäki
c2335f845e
Fixed #2306 (False positive: array of std::string is reported as uninitialized)
2010-12-17 21:20:04 +01:00
Daniel Marjamäki
696550abd3
Fixed #2299 (false positive: possible nullpointer dereference)
2010-12-17 21:09:12 +01:00
Daniel Marjamäki
845d1491f9
Fixed #2307 (No constructor defined false positive when class is enclosed in namespace)
2010-12-17 20:56:46 +01:00
Daniel Marjamäki
e0a0ed6fac
removed the NOLONGLONG handling. it seems unlikely it is needed
2010-12-16 21:53:18 +01:00
Daniel Marjamäki
0cebcc8fa9
Fixed #2300 (false positive: possible nullpointer dereference)
2010-12-16 21:41:50 +01:00
Daniel Marjamäki
49ee1533d9
Fixed #2301 (false positive: The given size 3 is mismatching)
2010-12-16 21:27:33 +01:00
Daniel Marjamäki
2d97189486
Fixed #2311 (False positive: Index out of bounds)
2010-12-16 20:16:59 +01:00
Robert Reif
f2d69acbfd
Symbol database: reuse in CheckOther. Ticket: #2318
2010-12-16 19:04:47 +01:00
Robert Reif
bf136f0123
Fixed #2314 (False positive: (style) Template instantiation 'Foo' hides typedef with same name)
2010-12-16 07:48:46 +01:00
Kimmo Varis
ac8eb30d68
Fixed #2309 (cppcheck-suppress issue because of path slash/backslash)
...
Internally we are using forward-slash and only convert to backslash
for Windows output. For suppressing we must use internal
forward-slash format of paths.
2010-12-15 22:39:46 +02:00
vBm
46a11183a5
Fixed some spelling mistakes
2010-12-15 18:45:53 +01:00
Daniel Marjamäki
5ce63a1df0
Fixed #2292 (segmentation fault with cppcheck 1.46 with --errorlist)
2010-12-13 18:17:33 +01:00
Daniel Marjamäki
48241c81f8
dmake: add include path '../externals' to lib.pri in case the pcre.h is placed there.
2010-12-12 17:26:13 +01:00
Daniel Marjamäki
2d3865a671
Add support for user defined rules
2010-12-12 11:56:22 +01:00
Daniel Marjamäki
b90e514b32
1.46: updated version information
2010-12-12 08:33:05 +01:00
Daniel Marjamäki
1cfd3309bc
XML2: Added severity 'portability' for future use. Ticket: #2106
2010-12-11 21:54:06 +01:00
Daniel Marjamäki
9de016b96d
Obsolete functions: added better verbose messages
2010-12-09 19:49:33 +01:00
Daniel Marjamäki
69bacde479
Tokenizer: Cleanup redundant statement '; x = x + 0;'. Ticket: #2283
2010-12-09 19:35:52 +01:00
Daniel Marjamäki
ee083cd7a0
Fixed #2284 (False positive: Possible null pointer reference)
2010-12-09 18:17:56 +01:00
Robert Reif
4d2c210f2a
Symbol database: use in checkmemoryleaks.cpp. ticket: #2219
2010-12-09 06:15:01 +01:00
Daniel Marjamäki
cad9c5f232
Fixed #2285 (False Positive: memory leak)
2010-12-08 21:02:02 +01:00
Robert Reif
c6e67d4aad
Symbol database: use symbol database in the memory leaks function checking. Ticket: #2219
2010-12-08 07:49:01 +01:00
Robert Reif
980a90071c
Fixed #2282 (Improve check: Function can be const)
2010-12-07 19:42:30 +01:00
Robert Reif
b6acfa809b
Symbol database: creates a single symbol database within Tokenizer on demand and changes all checks to use it
2010-12-07 07:08:49 +01:00
Robert Reif
271d8988aa
Symbol database: fixed a TODO test where class variables were qualified with the class name
2010-12-07 07:07:36 +01:00
Robert Reif
6c719c5806
Symbol database: removed unnecessary null pointer checks
2010-12-07 07:07:07 +01:00
Daniel Marjamäki
26864dd011
Memory leaks: Removed the experimental checking using ExecutionPath.
2010-12-06 21:46:18 +01:00
Daniel Marjamäki
0b696b7079
Fixed #2280 (Tokenizer::setVarId : variable id not set for inner iterator)
2010-12-06 17:52:44 +01:00
Robert Reif
626a814241
Symbol database: better handling of inline functions. Ticket: #2219
2010-12-05 20:26:52 +01:00
Daniel Marjamäki
b25e6ff24c
Fixed #2279 ((style) struct of union member is never used)
2010-12-05 18:33:53 +01:00
Robert Reif
c20b8831ee
Fixed #2275 (False Positive: Member variable not initialized in the constructor)
2010-12-04 20:24:13 +01:00
Robert Reif
04b811b74f
Fixed #2273 (False Positive: Member variable not initialized in the constructor)
2010-12-04 17:47:00 +01:00
Daniel Marjamäki
ab336b9088
Tokenizer: Added a few comments
2010-12-04 15:49:25 +01:00
Daniel Marjamäki
11a0ac4e07
xml2: rename '--xmlver' to '--xml-version'. bugfix in settings, change the type of _xml_version from bool to int.
2010-12-04 14:20:51 +01:00
Daniel Marjamäki
1f1df0645b
Merge branch 'xml2' of github.com:danmar/cppcheck
2010-12-04 14:06:57 +01:00
Kimmo Varis
d14b5039ce
Improve 'Use x.empty() instead of x.size() for emptiness' warning.
...
Improve the performance warning message as discussed at dev-forum:
https://sourceforge.net/apps/phpbb/cppcheck/viewtopic.php?f=3&t=192#p926
2010-12-04 10:15:48 +02:00
Kimmo Varis
8369d0ddd6
Improving 'Wrong assignment of auto variable' error message.
...
Improving the error message as discussed at dev-forum:
https://sourceforge.net/apps/phpbb/cppcheck/viewtopic.php?f=3&t=192&start=0
2010-12-04 09:55:20 +02:00
Robert Reif
758fc85a12
Memory leaks: Determine that some classes are not auto-deallocated. Reduce false negatives. Ticket: #2219 and #1618
2010-12-04 07:29:12 +01:00
Daniel Marjamäki
93ebdca313
Fixed #2264 (False positive: variable assigned value that is never used)
2010-12-03 18:45:49 +01:00
Robert Reif
b29568c81d
Fixed #2271 (Tokenizer: simplify Qt signals and slots)
2010-12-03 08:14:09 +01:00
Robert Reif
2cd8bc74cc
Symbol database: The symbol database has a bug where it can find an out of line constructor when looking for a destructor. Ticket: #2272
2010-12-03 07:35:06 +01:00
Daniel Marjamäki
8118e4755a
Fixed #2263 (False positive: variable assigned value that is never used)
2010-12-02 20:08:05 +01:00
Daniel Marjamäki
66f0948395
Preprocessor: Don't include system headers twice.
2010-12-02 18:07:32 +01:00
Robert Reif
eda4bcae29
Fixed #2271 (Tokenizer: simplify Qt signals and slots)
2010-12-02 17:41:49 +01:00
Daniel Marjamäki
af80384ae7
xml2: replace --xml2 with --xmlver=2. Ticket: #2106
2010-12-02 17:32:51 +01:00
Robert Reif
1bc8a2b6ba
Fixed #2172 (False positive: struct is not initialized in constructor)
2010-12-02 07:35:01 +01:00
Daniel Marjamäki
12c8eeff2c
xml2: Added experimental --xml2 result format. Ticket: #2106
2010-12-01 21:24:17 +01:00
Daniel Marjamäki
b4be71aa4e
checkuninitvar: fixed possible null-pointer dereference. thanks orbitcowboy for spotting it.
2010-12-01 18:05:57 +01:00
Robert Reif
f12c0c7ada
Tokenizer: add assert(_settings) to Tokenizer to insure the tokenizer always has settings. Ticket: #2219
2010-12-01 18:00:55 +01:00
Kimmo Varis
1a3175741f
Fixed #2268 ([GUI] Generic class name is shown for 'Message' while correct one for 'Summary')
2010-12-01 17:55:22 +02:00
Robert Reif
43dcc51752
Fixed #2252 (segmentation fault with enable=all)
2010-11-30 19:52:42 +01:00
Robert Reif
f90236a183
Fixed #2252 (segmentation fault with enable=all)
2010-11-30 19:40:32 +01:00
Daniel Marjamäki
0081800a20
Fixed #2261 (False positive: memory leak)
2010-11-30 19:36:04 +01:00
Daniel Marjamäki
6761765a70
Fixed #2262 (False positive: Resource leak: fd)
2010-11-30 19:14:31 +01:00
Daniel Marjamäki
234b1e0098
Fixed #2265 (False positive: Uninitialized variable: path)
2010-11-30 18:40:36 +01:00
Daniel Marjamäki
065af5c444
Fixed #2251 (False positive: Possible null pointer reference)
2010-11-29 20:30:23 +01:00
Daniel Marjamäki
cdb685c83c
Fixed #2245 (False positive: Possible null pointer dereference)
2010-11-29 20:19:31 +01:00
Daniel Marjamäki
4de64209fb
Fixed #2248 (memory leak : pointer inserted in an object)
2010-11-29 19:53:34 +01:00
Kimmo Varis
6bf0e7eb08
Remove extra space char from begin of verbose message.
2010-11-29 20:27:31 +02:00
Kimmo Varis
f467e3120e
Improve redundant STL container condition -message.
...
Have separate summary and verbose messages. Se discusion at forum:
https://sourceforge.net/apps/phpbb/cppcheck/viewtopic.php?f=3&t=192
2010-11-29 20:24:08 +02:00
Kimmo Varis
8d8945ac57
Improve "Assert statement 'varname' -message.
...
Modifying the message so that we have short message and verbose
message. As discussed in dev-forum:
https://sourceforge.net/apps/phpbb/cppcheck/viewtopic.php?f=3&t=192
2010-11-29 20:12:21 +02:00
Daniel Marjamäki
add8584612
Fixed #2232 (segmentation fault of cppcheck)
2010-11-29 17:46:10 +01:00
Kimmo Varis
564d896715
Run astyle.
2010-11-28 23:29:06 +02:00
Kimmo Varis
85735e382f
Improve the 'suspicious code sizeof sizeof' -message.
...
As discussed at dev-forum:
https://sourceforge.net/apps/phpbb/cppcheck/viewtopic.php?f=3&t=192
2010-11-28 14:20:46 +02:00
Daniel Marjamäki
3068dbf22e
Preprocessor: Temporarily skip 'missing include' warnings for system headers in release mode. When the handling works better these messages should not be skipped. Ticket: #1937
2010-11-28 12:38:06 +01:00
Daniel Marjamäki
00da0adf25
Fixed #2236 (False positive: Assignment to itself)
2010-11-28 11:48:06 +01:00
Daniel Marjamäki
ea405d95c6
Fixed #2241 (Segfault checking a file)
2010-11-28 07:35:42 +01:00
Kimmo Varis
c9c6de24a6
Remove extra space from error message.
2010-11-27 20:54:02 +02:00
Kimmo Varis
2c3f9a9dce
Small fix to error message.
...
Start with capital letter and no space in beginning.
2010-11-27 20:41:08 +02:00
Daniel Marjamäki
095f725b3c
Fixed #2218 (False positive: Data is allocated but not initialized)
2010-11-27 17:34:54 +01:00
Daniel Marjamäki
03a92582ca
Fixed #2235 (false Resource leak)
2010-11-27 11:09:42 +01:00
Kimmo Varis
2ed14431fe
Ticket #2237 (Too long "short" message about iterator increment)
...
Improve the message for suspicious iterator increment in loop.
2010-11-27 10:57:26 +02:00
Kimmo Varis
837605b05b
Ticket #2239 (Too long "short" message about function parameter passing)
...
Have a proper short message for the parameter passing warning and
improve the message.
2010-11-27 10:46:34 +02:00
Kimmo Varis
9b4b8b2abe
Ticket #2238 (Improve postincrement warning message)
...
Have a proper short message for post ++/-- operators.
Pre ++/-- operators are usually more efficient for non-primitive types.
2010-11-27 10:30:57 +02:00
Kimmo Varis
87b69a10fa
Ticket #2240 (Improve no constructor-message).
...
Improve the message about missing constructor but having class
attributes. Have proper short and long messages.
2010-11-27 10:17:03 +02:00
Robert Reif
88a1448a07
Symbol database: refactor CheckMemoryLeakInClass::checkPublicFunctions to use the symbol database. Ticket: #2219
2010-11-25 21:04:49 +01:00
Daniel Marjamäki
0a744c0c6e
Fixed #2234 (Variable is assigned a value that is never used)
2010-11-25 18:16:11 +01:00
Robert Reif
ad91f414db
Symbol database: Avoid possible null pointer dereference if _settings is null. Ticket: #2219
2010-11-25 17:55:44 +01:00
Robert Reif
03b12c5494
Fixed #2230 (segmentation fault of cppcheck)
2010-11-25 07:43:39 +01:00
Robert Reif
08b86e0b7e
Fixed #2228 (False positive: Claims function can be const when it can not be (shared_ptr))
2010-11-25 07:15:33 +01:00
Daniel Marjamäki
fc57e06cdd
Fixed #2226 (segmentation fault of cppcheck)
2010-11-24 18:08:21 +01:00
Daniel Marjamäki
22a4dd2cc3
Fixed #2225 (false positive: variable is assigned a value that is never used '*(stack[0])+=arg')
2010-11-23 20:35:08 +01:00
Robert Reif
1842a122da
reuse symbol database in checkmemoryleak.cpp. ticket: #2219
2010-11-23 18:41:07 +01:00
Robert Reif
f1eef49fcb
Fixed #2221 (segmentation fault of cppcheck)
2010-11-23 07:31:15 +01:00
Daniel Marjamäki
bb745da5f9
Tokenizer::simplifyKnownVariables: suppress debug warnings about pointer aliases. Temporary solution that limits the amount of debug warnings somewhat.
2010-11-21 13:50:57 +01:00
Daniel Marjamäki
9d88e17c39
Tokenizer::simplifyKnownVariables: Reduce debug-warnings for conditional increment
2010-11-21 13:40:42 +01:00
Daniel Marjamäki
9d9a5b0623
VS: Fixed compiler warnings. Ticket: #2200
2010-11-21 11:48:27 +01:00
Daniel Marjamäki
ee333598fc
gcc: fixed compiler warnings
2010-11-21 11:06:28 +01:00
Zachary Blair
215cb5ac8d
Fixed #2162 (false positive: Mutual exclusion over ||)
2010-11-21 00:06:43 -08:00
Daniel Marjamäki
0fe4249cfc
Fixed #2216 (wrong warning when C++0x keyword delete is used)
2010-11-20 17:20:25 +01:00
Ettl Martin
f10e433593
mathlib: toString() parameter changed to const reference
2010-11-20 14:21:18 +01:00
Daniel Marjamäki
cda44e0c39
VS: Fixed compiler warnings
2010-11-20 11:48:03 +01:00
Daniel Marjamäki
d021cd9074
VS: fixed compiler warning. Ticket: #2200
2010-11-20 11:28:47 +01:00
Daniel Marjamäki
e8ca76e02e
Fixed #2200 (MathLib: Calculation overflow)
2010-11-20 10:05:33 +01:00
Daniel Marjamäki
9ccc57a455
Fixed #2214 (Improve check: Memory leak not detected when pointer is incremented)
2010-11-20 08:35:23 +01:00
Daniel Marjamäki
fd64a7e683
Mutual exclusion: Disable this check until #2162 is fixed.
2010-11-20 07:43:07 +01:00
Robert Reif
27cae2f0d7
Symbol database: add global space and add all global functions and variables to it. Ticket: #2198
2010-11-20 07:26:50 +01:00
Daniel Marjamäki
66c2825b23
Fixed #2210 (False positive: buffer overrun (snprintf, unknown type))
2010-11-18 19:26:46 +01:00
Daniel Marjamäki
aa653fe42b
Uninitialized variables: Fixed simple undetected case for '= %var% |' and '| %var% ;'
2010-11-16 20:16:44 +01:00
Daniel Marjamäki
eb54be2b2a
Uninitialized variables: Cleanup '+=' handling. This is simplified in the Tokenizer now.
2010-11-16 20:09:23 +01:00
Daniel Marjamäki
35c72db251
Uninitialized variables: Fixed simple undetected case for '= %var% -'
2010-11-16 20:07:41 +01:00
Daniel Marjamäki
cbdae275ed
Uninitialized variables: Fixed false negative. Ticket: #2207
2010-11-16 20:01:57 +01:00
Robert Reif
77a5d4e399
Fixed #2204 (False positive when using const class members)
2010-11-16 07:30:55 +01:00
Daniel Marjamäki
29bb553782
Fixed #2207 (False positive: uninitialized variable (return if uninitialized))
2010-11-15 20:35:01 +01:00
Daniel Marjamäki
d250cb5aa2
Fixed #2206 (False positive: variable is assigned a value that is never used (array initializers))
2010-11-15 17:53:55 +01:00
Daniel Marjamäki
7b3e7f6467
Fixed #2205 (False positive: variable is assigned a value that is never used (assigning to dereferenced casted pointers))
2010-11-15 17:30:07 +01:00
Daniel Marjamäki
6d1c0687c9
Fixed #2202 (false postive: Data is allocated but not initialized: rbdc)
2010-11-15 17:11:08 +01:00
Zachary Blair
36d80d6eaa
Fixed #2058 (Warn for unused variable when only doing malloc/free)
2010-11-14 17:37:36 -08:00
Daniel Marjamäki
378e83e73d
Fixed #2201 (false positive: Uninitialized variable: __v0)
2010-11-14 17:35:22 +01:00
Daniel Marjamäki
71ea6213d0
Fixed #2131 (Preprocessor: incorrect include file loading)
2010-11-14 08:35:32 +01:00
Robert Reif
6a06970e1b
CheckClass: Refactoring - organize each check so the check function comes first, any helper functions come second, and the message functions come last. Ticket: #2198
2010-11-14 06:50:33 +01:00
Daniel Marjamäki
71c1ce71ce
Tokenizer::simplifyKnownVariables: Simplify known variables for struct members
2010-11-13 18:45:35 +01:00
Daniel Marjamäki
667cc8f6e5
Tokenizer: Skip debug warnings in Tokenizer::simplifyKnownVariables for loop variable
2010-11-13 16:40:04 +01:00
Daniel Marjamäki
3d195f2326
Auto variables: improved the check for 'return retval.c_str()'. Ticket: #2191
2010-11-13 15:38:21 +01:00
Daniel Marjamäki
47d37e7a05
Uninitialized variables: Fixed false negatives when calling unknown function with uninitialized variable by value: 'f(a+1)'
2010-11-13 15:10:17 +01:00
Daniel Marjamäki
6836198a5c
system headers: merged the systemheaders branch into master. it works pretty well. Ticket: #1937
2010-11-13 13:06:58 +01:00
Daniel Marjamäki
bf15236b9e
Fixed #2196 (False positive: Invalid data is allocated but not initialized (initialization in loop))
2010-11-13 10:33:35 +01:00
Daniel Marjamäki
a06a1a6574
Symbol database: Added files
2010-11-13 08:08:45 +01:00
Daniel Marjamäki
3303c40879
uninitialized variables: fixed problem when parsing loop bodies
2010-11-13 08:03:59 +01:00
Robert Reif
894586f4dd
Fixed #2198 (SymbolDatabase: separate SymbolDatabase from CheckClass)
2010-11-13 07:31:56 +01:00
Daniel Marjamäki
f7ca4f09ef
Fixed #2151 (false negative: memory leak when calling subfunction that doesn't deallocate the memory)
2010-11-12 21:09:34 +01:00
Daniel Marjamäki
a8d7ac0f0d
Fixed #2193 (false negative: nullpointer dereference)
2010-11-12 19:42:02 +01:00
Robert Reif
0fffa1f651
This patch fixes a bug I introduced in the previous patch. It also speeds up nested class parsing by skipping the entire class implementation using { link to jump to } rather than parsing for }. Ticket: #2172
2010-11-12 19:29:20 +01:00
Daniel Marjamäki
9d7a623985
Uninitialized variables: Passing uninitialized array as parameter to function. Ticket: #2188
2010-11-12 17:38:25 +01:00
Daniel Marjamäki
e523d5a3a3
Fixed #914 (improve check: usage of uninitialized variable)
2010-11-12 17:14:37 +01:00
Daniel Marjamäki
1204043556
Fixed #2148 (uninitialized variable: false negative, function parameter that is passed by value)
2010-11-12 17:06:14 +01:00
Daniel Marjamäki
6b489230e8
Fixed #2188 (Does not detect initialization)
2010-11-12 16:11:44 +01:00
Daniel Marjamäki
a605bdc8a2
Fixed #2195 (unit tests failing)
2010-11-12 15:43:16 +01:00
Daniel Marjamäki
ba7a3b376e
Fixed #2167 (Drop linefeeds from error messages)
2010-11-11 19:54:43 +01:00
Daniel Marjamäki
0328d26fcb
Fixed #2192 (false positive: resource leak)
2010-11-11 17:40:20 +01:00
Robert Reif
07f4067fa8
typedef: better handling of __typeof__
2010-11-11 17:02:04 +01:00
Robert Reif
a09c221014
typedefs: handle __typeof__
2010-11-11 06:40:49 +01:00
Daniel Marjamäki
624ce205b9
Fixed #2185 (False negative: when constant is undefined a 'dangerous usage of strncpy' is not found)
2010-11-10 20:20:05 +01:00
Daniel Marjamäki
41bbe5d0cf
Fixed #2182 (Context sensitive false positive)
2010-11-10 18:24:40 +01:00
Daniel Marjamäki
28c53cabea
Fixed #2184 (False Positive: memory leak)
2010-11-10 17:46:40 +01:00
Robert Reif
4ddf6f3b44
Symbol database: code cleanups
2010-11-10 16:52:52 +01:00
Daniel Marjamäki
2102b9598e
FileLister: fixed compiler errors in win32. accept all files given by user.
2010-11-09 19:32:11 +01:00
Daniel Marjamäki
14bf9fbbdb
Fixed #2181 (How can I select the extension of the files to check?)
2010-11-09 19:20:31 +01:00
Daniel Marjamäki
81cac166d6
FileLister: minor cleanup
2010-11-09 19:11:43 +01:00
Daniel Marjamäki
508c171945
Symbol database: add support for class inline functions with classes
2010-11-09 17:06:07 +01:00
Robert Reif
36b03bdd3e
Fixed #2179 (Segmentation fault in assignment operator)
2010-11-09 06:58:19 +01:00
Daniel Marjamäki
c2bf3647a4
Fixed #2178 (segmentation fault of cppcheck)
2010-11-08 19:47:19 +01:00
Daniel Marjamäki
6a4f70e496
Fixed #2169 (Inline suppression does not work unless filename is given)
2010-11-08 18:53:48 +01:00
Daniel Marjamäki
21ec772e31
Tokenizer: Only show 'failed to instantiate template' debug messages if the --debug-warnings has been given
2010-11-08 18:01:28 +01:00
Daniel Marjamäki
27b7638901
Visual Studio: Fixed compiler warnings about assignment in condition
2010-11-08 17:29:08 +01:00
Robert Reif
23b50a3d81
Symbol database: delay finding class variables until after all classes have been found.
2010-11-08 17:12:25 +01:00
Daniel Marjamäki
586f4992d8
Tokenizer::simplifyKnownVariables: Fixed TODO test cases in TestBufferOverrun
2010-11-07 17:42:32 +01:00
Daniel Marjamäki
47e9fcb5a8
Revert "Tokenizer: More specific bailout in simplifyKnownVariables for loop variable"
...
This reverts commit 7e9bb62dff
.
2010-11-07 17:40:27 +01:00
Daniel Marjamäki
7e9bb62dff
Tokenizer: More specific bailout in simplifyKnownVariables for loop variable
2010-11-07 17:20:03 +01:00
Daniel Marjamäki
cd94fa89e0
Tokenizer: More specific bail outs in simplifyKnownVariables
2010-11-07 11:07:56 +01:00
Daniel Marjamäki
b881718d9f
Tokenizer: better bailout in simplifyKnownVariables when there is loop
2010-11-07 10:42:08 +01:00
Daniel Marjamäki
fb068a4e71
Fixed #2170 (false positive: After a strncpy() the buffer should be zero-terminated)
2010-11-07 09:37:45 +01:00
Daniel Marjamäki
bd2b1b2914
Tokenizer: better handling of const variables
2010-11-07 08:43:30 +01:00
Daniel Marjamäki
25391cb562
Tokenizer: Bailout simplifyKnownVariables for loop variables
2010-11-07 08:10:09 +01:00
Robert Reif
662cd27f87
Symbol database: fixed problem
2010-11-06 20:27:12 +01:00
Daniel Marjamäki
2833a5ebb5
Tokenizer: Refactoring the simplifyKnownVariable
2010-11-06 20:23:49 +01:00
Daniel Marjamäki
5be12a1d27
Tokenizer: improved simplifyKnownVariables
2010-11-06 19:43:32 +01:00
Daniel Marjamäki
53fc0ca5e6
Tokenizer: Refactoring. Merged two patterns into one pattern.
2010-11-06 15:55:37 +01:00
Daniel Marjamäki
afcc28e9ee
Tokenizer: Added debug warning that is shown when bailing out in simplifyKnownVariables
2010-11-06 15:42:41 +01:00
Robert Reif
8a379d4826
Fixed #2176 (Tokenizer::simplifyTypedef function pointer bug)
2010-11-06 15:15:50 +01:00
Robert Reif
0205498a12
Symbol database: improved handling of out of line functions returning function pointers
2010-11-06 13:31:56 +01:00
Robert Reif
c49a8a99a3
Fixed #2175 (Tokenizer::simplifyTypedef : wrong simplification of 'typedef float vec_t[3];')
2010-11-06 13:28:44 +01:00
Daniel Marjamäki
c39fbb86db
Tokenizer::simplifyKnownVariables : Fixed TODO test case when simplifying pointer alias in function call
2010-11-06 13:24:33 +01:00
Daniel Marjamäki
13c2a73d3f
Tokenizer::simplifyKnownVariables: Fixed TODO test case.
2010-11-06 11:38:58 +01:00
Daniel Marjamäki
dd41c74d7f
Fixed #2136 (false negative: array bounds)
2010-11-06 09:10:10 +01:00
Daniel Marjamäki
314e5b838b
Tokenizer: removed redundant assignments such as 'x+=0;'. Ticket: #2173
2010-11-06 07:23:35 +01:00
Robert Reif
431201dd67
Fixed #2174 (Tokenizer::simplifyFunctionReturn bug)
2010-11-06 06:53:09 +01:00
Daniel Marjamäki
52faadda89
Tokenizer: simplify calculations with zero better
2010-11-05 20:35:31 +01:00
Daniel Marjamäki
4fdb420454
Tokenizer: simplifyknownvariables, improved handling of string constant
2010-11-05 20:05:57 +01:00
Daniel Marjamäki
65c7b6eb8b
Uninitialized variables: better handling of for example 'a[1] = 1+a[2];'
2010-11-05 19:24:14 +01:00
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