Daniel Marjamaki
0eb4e3032a
Preprocessor: handle '#undef' better. Ticket: #2131
2011-10-24 19:51:00 +02:00
Daniel Marjamaki
08ba378730
Preprocessor: Improved 'normal' preprocessing. better handling of multiple #elif and #else blocks
2011-10-24 08:11:44 +02:00
Daniel Marjamaki
3de70a7244
Preprocessor: Better 'normal' preprocessing. Simple handling of '#elif'
2011-10-24 07:37:47 +02:00
Reijo Tomperi
36ef8e771f
Improve null pointer dereference test coverage
2011-10-24 00:36:57 +03:00
Thomas Jarosch
1ccb57e595
Document and test Token::concatStr()
2011-10-23 21:21:42 +02:00
Thomas Jarosch
5b97cc1440
Bugfix: Update token properties on string changes
2011-10-23 21:06:56 +02:00
Daniel Marjamaki
9e50b7cb68
Preprocessor: updates to 'normal' preprocessing
2011-10-23 19:17:29 +02:00
Daniel Marjamäki
1a5aba062c
test/test.pro: indentation update
2011-10-23 15:45:56 +02:00
Daniel Marjamaki
605bd23517
Visual Studio: auto generated new visual studio project files
2011-10-23 15:42:02 +02:00
Thomas Jarosch
db8c7deb30
Fixed #3232 (Check if container is modified inside BOOST_FOREACH)
2011-10-23 13:07:43 +02:00
Thomas Jarosch
9a1b195d79
Fixed #3187 (Remove code duplication in 'other' unit test)
2011-10-23 12:20:43 +02:00
PKEuS
54b3d72ee3
Added Token::nextArgument()
2011-10-23 11:23:48 +02:00
Erik Lax
b7ab1e7d7e
Fixed #3237 (Bug in parser of class operator functions)
2011-10-23 10:25:14 +02:00
Daniel Marjamäki
65380d16d6
Test: Fixed testing
2011-10-23 10:22:10 +02:00
Daniel Marjamäki
8579270582
astyle formatting
2011-10-23 10:11:43 +02:00
Daniel Marjamäki
a381581a8b
Merge pull request #43 from makulik/master
...
#3244 'Get include pathes from file'
2011-10-23 01:04:31 -07:00
Reijo Tomperi
3568b5a841
Improved memset with 0 bytes check. TODO done (unit test).
...
Patch from: PKEuS <philipp.kloke@web.de>
2011-10-22 23:34:10 +03:00
unknown
597a37cc32
#3244 'Get include pathes from file'
...
Signed-off-by: Günther Makulik <g-makulik@t-online.de>
2011-10-22 21:24:23 +02:00
Edoardo Prezioso
91c6608175
Improve fix of #934 (be careful of macros code).
2011-10-22 20:43:42 +02:00
PKEuS
20179673ce
Fixed #934 (new check: missuse of std::cout)
2011-10-22 17:12:52 +02:00
Johan Samuelson
3d8fa2f76e
Fixed #3123 ([False Positive] Shadowed enum)
2011-10-22 13:43:53 +02:00
Erik Lax
2b54f00c87
Fixed #3238 (Crash in obsolete functions check.)
2011-10-22 12:36:45 +02:00
Thomas Jarosch
55d9f0873a
Fix #3243 (Improve non reentrant function check)
...
- Use std::map instead of linear std::list walk
and run fast tests like tok->isName() first.
Global speed up is 4.8% (profiled with google-perftools)
- Catch function invocations in global namespace
and ignore other namespaces except "std".
std::localtime() and others are also non-thread safe on POSIX.
Note: The check matches f.e. also on "std::getrpcbyname()",
but that would result in a compile error anyway.
No need to have an extra "std::xxxxx" whitelist.
- Remove double listed "rand" and "getrpcbyname" function names
2011-10-22 11:54:52 +02:00
Daniel Marjamäki
a9d2d45fbc
astyle formatting
2011-10-22 11:11:54 +02:00
Daniel Marjamäki
ab827e3631
Merge pull request #40 from joshbeck/master
...
Added option to set #ifdef configuration check limit
2011-10-22 00:51:05 -07:00
Marek Zmysłowski
b332ea8222
Fixed #3204 (Refactor standards support in Settings)
2011-10-22 09:45:48 +02:00
Edoardo Prezioso
9e5beab4a8
Nitpicky fix of the missing ';' after the memset command inside the test case.
2011-10-20 21:46:34 +02:00
seb777
41d9daa03d
Fixed ticket #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-19 20:21:50 +02:00
Edoardo Prezioso
9257e82475
Improve tokenizer: don't confuse between a label and the case/default statements.
2011-10-19 18:49:02 +02:00
Edoardo Prezioso
882b0c15a0
Improve tokenizing of "do{ ... } while(0)".
...
The simplification will be the same for every combination, except for the 'continue' and the 'break'. In that case, keep the block braces.
2011-10-19 18:20:29 +02:00
Edoardo Prezioso
73f0e2c5b9
Fixed ticket #3227 (Improve tokenizer: labels are not handled correctly after a case or another label instruction)
...
Moved the labels simplification after combining the tokens and moved the case/default simplification inside the labels.
2011-10-19 14:20:09 +02:00
Joshua Beck
56561835f8
Add option to set #ifdef configuration check limit
2011-10-18 19:52:55 -05:00
Edoardo Prezioso
f4cdf57955
Fixed ticket #3229 (Segfault with goto):
...
Don't handle labels, gotos, returns and indentations inside the round braces. This is applied not only for simplifyGoto, but also to simplifyFlowControl.
Rewrite enum badly handled by astyle inside mathlib.cpp and move simplifyFlowControl at the end of the simplifyTokenList in order to catch more dead code, not related to the ticket.
2011-10-18 23:56:35 +02:00
PKEuS
dc15641954
Fixed #3223 (Improve check: Check more STL algorithms for missmatching containers check)
2011-10-18 21:55:41 +02:00
PKEuS
ea02bd905a
Fixed #3225 (Boolean comparison with string literals)
2011-10-18 21:37:03 +02:00
Daniel Marjamäki
3d18fdfa3f
Fixed #3220 (False positive: possible null pointer dereference: 'SwDoc *pDoc = NULL; pDoc->do_something();')
2011-10-18 19:34:14 +02:00
Daniel Marjamaki
bf0386c938
Preprocessor: Started working on new preprocessing that uses -D information better. Ticket: #2131
2011-10-17 20:12:46 +02:00
Edoardo Prezioso
c3caade3ca
- Fixed mispelled function name;
...
changed variable name inside simplifyFlowControl for consistency;
improved simplifyFlowControl to handle better this kind of code:
"return; { { } { label : ; ok ( ) ; } }"->"return ; { { label: ok ( ) ; } }".
2011-10-17 02:16:49 +02:00
Edoardo Prezioso
6f80c5ff64
Removed redundant test, which was related to the Tokenizer, not to the memory leak checker.
2011-10-16 21:19:18 +02:00
PKEuS
f8074b71d2
Fixed #2470 (False negative: Possible null pointer dereference (C++0x keyword 'nullptr'))
2011-10-16 12:54:58 +02:00
Thomas Jarosch
a52b73f9f9
Fix #3208 (Simplify pointer to standard type, C only)
...
The symbol database is unavailable during token simplification
and &data[0] might return something completely different for C++.
Moved code_is_c() from checkOther to Tokenizer.
2011-10-16 08:09:57 +02:00
PKEuS
71a1d98693
Fixed ##3211 (Crash in gitHEAD when arglist count is smaller than format string)
2011-10-16 07:06:18 +02:00
Edoardo Prezioso
57ead6988e
Fixed ticket #3138 (Tokenizer: remove unreachable code below goto inside a namespace|class|struct block)
2011-10-15 11:35:45 +02:00
Edoardo Prezioso
f95b692a69
Fixed ticket #3113 (complete simplification of dead code after control flow statements)
2011-10-15 01:34:07 +02:00
Thomas Jarosch
7824e5c0f5
Fixed #3210 (STL check: Add support for reverse iterator)
2011-10-14 19:54:20 +02:00
Thomas Jarosch
7ae39f13cc
Fixed #3198 (Add check for readlink())
2011-10-14 19:45:51 +02:00
Jonathan Neuschäfer
4fb7865f49
fix typos using codespell
...
Codespell is available at http://git.profusion.mobi/cgit.cgi/lucas/codespell/ .
2011-10-13 22:04:41 +02:00
Daniel Marjamäki
6f8e42a5af
changed the astyle formatting flags
2011-10-13 20:53:06 +02:00
Edoardo Prezioso
b792efb761
Fix ticket 3140 and 3137 (Improve Tokenizer: Remove dead for loop - simplify while(0) better.
...
Note: it doesn't remove dead code if there's a label inside. Will be improved in another ticket.
2011-10-13 13:01:24 +02:00
Edoardo Prezioso
16506f0a8c
Remove redundant simplifyDeadCode call inside the Tokenizer::tokenize and move the relative tests in the file 'testsimplifytokens.cpp'.
2011-10-13 12:26:27 +02:00
Zachary Blair
82366918ff
Fixed #2627 (switch case fall through: redundant strcpy)
2011-10-13 01:27:22 -07:00
PKEuS
91d7621994
Fixed #3180 (New check: Detect nullpointers given to printf via variable argument list)
2011-10-12 22:11:27 +02:00
Daniel Marjamäki
b73896bcc5
Fixed #3163 (Out of bounds pointer arithmetic not reset)
2011-10-12 20:54:39 +02:00
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
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
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
Kimmo Varis
0c42f46717
Tests: Add tests for new --enable flags.
...
Adding tests for new --enable flafgs (performance, portability)
to CommandLineParser tests.
2011-09-04 21:45:52 +03:00
Robert Reif
c2b76cd41f
add some variable length array tests
2011-09-04 14:39:24 -04: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
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
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
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
c4fdb8d113
better test for symbol database bug fixed in last commit
2011-08-24 06:53:27 -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
3765a7f8f8
Update VS2008/2010 project files.
2011-08-22 20:13:03 +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
21c9b6d262
add another test for #3030 (Improve check: Returning pointer to local array variable with '&' pointer operator)
2011-08-20 16:41:12 -04: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
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
Kimmo Varis
57e3a4a34b
Update test project VS project files.
...
Ticket: #3025 (Visual Studio projects needs updating for new lib/checkunusedvar files)
2011-08-19 22:47:13 +03:00
Kimmo Varis
385a569ff2
Rename Test VC project files.
...
When the target name of the test runner binary changed to 'testrunner'
also the filenames of the generated project files changed.
2011-08-19 22:44:32 +03: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
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
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
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
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
01b9c0707d
Settings: Removed the --enable=posix option. Ticket: #2949
2011-08-14 09:45:53 +02: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
a71ce607a4
Tests: Re-enable style param for testdivision.
...
My earlier commit (cfcfa3f0
) removed the use of style parameter.
This commit adds it back.
Ticket: #2987 (GCC: warning: unused parameter ‘style’ in test/testdivision.cpp:39:10)
2011-08-10 23:46:26 +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
Robert Reif
3bd8bf0e75
run astyle
2011-08-06 17:53:06 -04:00
Kimmo Varis
babfba53fb
Tests: Disable tests for CLI -i option.
...
The tests use non-existing relative paths. Currently the code
checks if the paths added to -i exist and hence these tests
fail.
2011-08-06 19:18:20 +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
Edoardo Prezioso
973e61087e
Fixed #2961 (Test executable name differs between Makefile and test.pro)
2011-08-04 21:20:39 +02: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
7e8f5be4b6
Update VS project files.
2011-08-03 18:39:02 +03: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
196a96d93a
Add missing test files to test.pro -project.
2011-08-03 10:38:07 +03: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
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 Marjamaki
6dc7554310
Visual Studio: Updated project files
2011-08-02 17:29:02 +02:00
Daniel Marjamäki
493cfa5df2
Null pointer: Added todo test case to better handle dereference in condition
2011-08-02 17:20:13 +02: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
Robert Reif
9b9a0de777
add test for #2937 (Scope::checkVariable found variable 'sMMF' with varid 0.)
2011-08-01 06:45:06 -04: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
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
Robert Reif
daf0c71f77
fix #2911 (Token::Match(tok, %oror%|&&) doesn't match &&)
2011-07-31 13:26:26 -04: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
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
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
Ettl Martin
2aec4577c0
Merge branch 'master' of github.com:danmar/cppcheck
2011-07-29 23:38:02 +02:00
Ettl Martin
f441a958cd
mathlib: fixed #2950 : comparison of floating point values
2011-07-29 23:37:40 +02:00
Kimmo Varis
335b52653e
Tests: add semicolons after TEST_CASE()
2011-07-29 22:00:24 +03:00
Kimmo Varis
a50f75ef86
Add --posix CLI option.
...
Part of ticket #2949 (new check: (style) finding non-reentrant functions)
2011-07-29 20:17:02 +03: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
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
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
Simon Martin
3fa3a53580
Added testcases for #2933 (Postfix operator check fails to warn for structs)
2011-07-24 14:53:03 +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
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
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
Daniel Marjamäki
6ce5107e49
Tokenizer: Better handling of constants. Related with #2920
2011-07-20 09:07:47 +02:00
Benjamin Wolsey
c983608d88
Test false auto_ptr positive.
...
Assignments after a function returning an auto_ptr is declared are
detected as auto_ptr assignments!
2011-07-20 08:22:35 +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
Ettl Martin
80ed0b2ad1
testmathlib: improved testcoverage of mathlib
2011-07-19 09:10:34 +02:00
Daniel Marjamäki
b66e6e73db
Fixed #2917 (Problem with || in #if)
2011-07-18 21:44:23 +02: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
Daniel Marjamäki
481be84004
TestSimplifyTokens: removed copy/pasted comment
2011-07-17 09:14:03 +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
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
Kimmo Varis
74d086d5a0
Add more tests for ErrorLogger.
...
Add tests that have two items in error location stack.
2011-07-16 16:04:43 +03:00
Robert Reif
76960e54a1
testcase for broken Token::Match %oror%|&&
2011-07-16 07:28:26 -04: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
f39e462e8e
Merge branch 'master' of git@github.com:danmar/cppcheck
2011-07-06 12:57:57 +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
Kimmo Varis
7cf84cb92b
Update Visual Studio 2008/2010 project files.
2011-07-06 11:31:20 +03: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
a1953f0964
TestCharVar::pointer: Added one more test case to see that error message disappears when code is fixed
2011-07-05 19:57:07 +02:00
Daniel Marjamäki
8cd2c3115e
Fixed #2866 (Detect sign extension bugs)
2011-07-05 18:41:27 +02: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
Daniel Marjamäki
5561d81f0d
Tokenizer::simplifyGoto: fixed unit tests
2011-07-03 18:35:11 +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
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
7826b5e22d
add support for detecting unused function variables of type class or struct
2011-06-30 21:58:11 -04: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
443dd4c392
partial fix for #2867 handle derived class
2011-06-29 19:39:19 -04: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
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
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
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
f1782799cb
run astyle
2011-06-20 23:06:18 +02: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
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
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
e9bc72b4f2
todo tests for #2812 (false negative: null pointer dereference when returning struct member)
2011-06-03 22:16:08 -04: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
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
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
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
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
Kimmo Varis
959a73f02e
Add test for --check-config.
2011-05-04 21:07:02 +03:00
Kimmo Varis
e7c56aebac
Make "failing" cmdlineparser tests todo-tests.
2011-05-04 21:00:22 +03:00
Greg Hewgill
fb290a7197
Fix testsuppressions for Windows builds for now, pending further refactoring
2011-05-03 10:41:52 +00:00
Greg Hewgill
8dd4eb39a1
Revert "Remove the testsuppressions because it doesn't contain any unit tests. A testsuppressions would be nice if it was more specific. Ticket: #2748 "
...
This reverts commit 6bf5eb67be
.
2011-05-03 10:18:05 +00:00
Greg Hewgill
ca25c1c0fe
Revert "TestSuppressions: Updated Visual Studio project files"
...
This reverts commit 8ec570837a
.
2011-05-03 10:17:44 +00:00
Robert Reif
51baca0359
fix #1982 (simplifyTypedef: scope info is lost)
2011-05-02 22:42:52 -04:00
Daniel Marjamäki
bbd379c802
astyle formatting
2011-05-02 15:08:16 +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 Marjamaki
8ec570837a
TestSuppressions: Updated Visual Studio project files
2011-05-01 17:58:54 +02:00
Daniel Marjamäki
168bd2ebfc
Fixed #2760 (false positive: uninitialized variable ', (a) =')
2011-05-01 08:27:59 +02:00
Daniel Marjamäki
68efad05af
TestTokenizer: code cleanup
2011-05-01 07:50:19 +02:00
Daniel Marjamäki
6bf5eb67be
Remove the testsuppressions because it doesn't contain any unit tests. A testsuppressions would be nice if it was more specific. Ticket: #2748
2011-04-30 13:05:21 +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
bd03768415
move symbol database tests to testsymboldatabase.cpp
2011-04-28 21:03:57 -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
c3c8b71176
Fixed #2749 (Different test count using Makefile and QtCreator project)
2011-04-27 18:25:09 +02: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
Greg Hewgill
b0ed595e24
FileLister: don't assume that all files have nonzero size in test case
2011-04-27 07:38:53 +12: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
ce29342661
Merge branch 'single-file-check'
2011-04-25 15:31:46 +03:00
Kimmo Varis
7d00d47404
Update tests VS project files.
2011-04-24 23:41:24 +03:00
Kimmo Varis
b62ec4ae8a
Remove outdated comment from tests.pro.
2011-04-24 19:38:09 +03:00
Kimmo Varis
b59449113e
Add suppressions tests to qmake project.
2011-04-24 19:34:13 +03: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
c5b81c6a79
add another test case for #2614 (missing varid on function parameter)
2011-04-22 21:23:40 -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
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
a9d8f456ee
astyle formatting
2011-04-19 20:13:10 +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
Robert Reif
1b7183a294
fix previous patch: test for #2614 (missing varid on function parameter)
2011-04-18 18:53:11 -04:00
Robert Reif
6a09ee0be1
add test for #2614 (missing varid on function parameter)
2011-04-18 07:45:38 -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
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
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
af60f2c4ef
Token: Added testcase for matching of %op%
2011-04-10 11:15:57 +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
Daniel Marjamäki
447f61e9c7
Refactoring: Use %op%
2011-04-09 18:30:47 +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
f6d910ab3d
Refactoring: Use Token::isOp
2011-04-09 15:54:36 +02:00
Daniel Marjamäki
3ad7568df8
TestFileLister: astyle formatting and removed commented debug code
2011-04-09 08:20:34 +02:00
Robert Reif
3c8644fcf8
added tests for #2710 (False negative on uninitialized member variable in a ctor.)
2011-04-08 07:39:30 -04:00
Daniel Marjamaki
8601c64d99
Fixed TestFileLister tests in windows
2011-04-07 17:49:18 +02:00
Daniel Marjamäki
6f7e9a67b0
Fixed #2684 (TestFileLister test assumes there are source files in the same directory)
2011-04-07 17:36:42 +02:00
Daniel Marjamaki
fbc8223a6b
Preprocessor: Fixed expandMacros problem. Ticket: #2707
2011-04-07 16:53:42 +02:00
Kimmo Varis
803203a876
Fix test VS2008 project file attributes.
2011-04-07 14:10:31 +03:00
Stefan Weil
8482eb9d5c
Obsolete functions: Fix messages for gethostbyaddr, gethostbyname
2011-04-07 00:33:54 +02:00
Robert Reif
d985fc008a
run astyle
2011-04-04 22:25:56 -04: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
Ettl Martin
af632a6aa0
Added todo testcase for ticket #2705
2011-04-04 23:29:18 +02: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
63acd9bb3e
Clarify calculation: Added warnings for << and >>
2011-04-03 22:12:22 +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
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
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
b8cda19ca6
Fixed #2655 (false positive: (warning) Redundant code: Found a statement that begins with numeric constant)
2011-03-30 21:57:01 +02: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
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
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
d539cf59ca
Null pointer: Added TODO test case for ticket #2681
2011-03-28 19:27:07 +02: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
1e1434e191
make member variable change detection simpler and more accurate for CheckClass::checkConst
2011-03-27 13:59:12 -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
Markus Elfring
ce198f85fc
Addition of a file name in a CMake script (bug #2524 , #1690 )
...
A few source files were added because of the feature request "Ability to
exclude files and directories from checks".
6401271ceb
A CMake build script was updated for these changes.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
2011-03-26 20:41:01 +01:00
Daniel Marjamaki
c6b176014b
cmake: removed the non-working pcre. ticket: #2679
2011-03-26 19:03:11 +01: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
2b1277aa64
Fixed #2680 (setVarId: variables with class qualification don't get varid)
2011-03-26 08:56:41 +01: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
Sebastien Debrard
29b7d4b9c3
sync cmake files with the master branch
2011-03-26 02:03:52 +01:00
Robert Reif
6e6c86365f
add some missing ; at end of class and struct definitions in checkclass tests
2011-03-25 07:58:51 -04:00
Daniel Marjamäki
5058cc6aa1
Reverted non-CMake changes in previous 'Added CMake files' commit
2011-03-25 07:59:48 +01: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
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
ac7f1f874e
add some more CheckClass::noMemset tests
2011-03-22 22:45:19 -04:00
Robert Reif
d36ed9aff1
fix #2670 (False positive: function can be const, overloaded functions)
2011-03-22 19:23:36 -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
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
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
3407561df6
#2667 removed wrong unittests;
2011-03-20 23:02:18 +01:00
Ettl Martin
c9a5051ea0
#2667 created unit-tests
2011-03-20 22:31:29 +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
6dd9676d43
FileLister: Updated Visual Studio files
2011-03-20 14:47:15 +01:00
Daniel Marjamäki
c60edb5af6
FileLister: updated qmake files
2011-03-20 14:37:28 +01:00
Daniel Marjamäki
8caf96be63
FileLister: Moved back the code into a single cpp file
2011-03-20 14:25:11 +01: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
61d5229d06
Refactoring: Renamed showAll flag to inconclusive
2011-03-19 10:51:38 +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