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
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
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
Thomas Jarosch
7d13d25638
Fixed #3181 (Add missing return statements)
2011-10-08 12:45:56 +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
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
Kimmo Varis
4ef4cb26e9
CLI: Add support for ignoring case in PathMatch.
...
In Windows (or in Windows code?) we want to ignore case in the
paths. This patch implements the case ignore for the PathMatch-
class.
2011-10-02 11:46:27 +03: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
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
Kimmo Varis
70b153cc1e
Disable fileListStdin test from testcmdlineparser.
...
That test hangs the test run.
2011-09-30 08:35:23 +03: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
4d12372b65
run astyle
2011-09-29 19:23:30 -04:00
Kimmo Varis
24ce170554
Merge pull request #37 from joshbeck/master
...
Added support for reading file lists from stdin, correctly this time
2011-09-29 10:50:37 -07: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
540207533b
fix #3008 (New check: Order of initialisation list)
2011-09-27 21:07:37 -04:00
Joshua Beck
15cb2a0c61
Merge remote-tracking branch 'upstream/master'
2011-09-27 18:43:09 -05:00
Robert Reif
44a926aa4d
add a few more Microsoft TCHAR function conversions
2011-09-27 07:29:36 -04:00
Joshua Beck
9583394eba
Fix test and add info to -h output.
2011-09-27 01:02:58 -05:00
Robert Reif
ec377d24eb
add support for Microsoft TCHAR character constants
2011-09-26 22:08:24 -04:00
Joshua Beck
87cff36f9d
Updated manual and added test for reading file list from stdin.
2011-09-26 20:43:39 -05: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
5e329d7280
fix typo in last commit
2011-09-21 19:55:11 -04:00
Robert Reif
de0f2dc1d0
add test case for false negatives introduced by fix for 3106
2011-09-21 07:32:23 -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
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
be660003ec
start adding conversions from common Windows types to standard types
2011-09-18 13:06:54 -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
Simon Martin
ba2591b002
Take into account kimmov's review comments
2011-09-17 16:55:59 +02:00
Simon Martin
21a4999c1b
Make the build warning clean with clang++
2011-09-17 14:40:17 +02: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
2bc7da2c64
quick fix for #3114 (infinite recursion when operator= is overloaded)
2011-09-14 19:04:06 -04:00
Kimmo Varis
288efd832c
Tests: Add more commandlineparser tests.
...
Add commandlineparser tests for giving two suppressions. Giving
two suppressions in one parameter is not yet supported so it is
todo-test.
2011-09-13 17:55:00 +03: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
302daeb9bd
add test for #3110 (false positve: style) Boolean result is used in bitwise operation. Clarify expression with parentheses)
2011-09-12 20:46:00 -04:00
seb777
f3193ef611
Remove invalid test case.
...
The code does not compile. In addition, it's a "todo test case".
2011-09-12 19:38:38 +02: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
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
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
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
Robert Reif
65b1a4df19
add soem test cases for #3094 (Buffer access out-of-bounds in struct variable)
2011-09-08 22:41:18 -04: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
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