Edoardo Prezioso
de8eb48a5c
Remove redundant function findmatch inside tokenize.cpp.
...
There's Token::findmatch which is already used inside other Tokenizer functions.
2011-10-17 13:46:27 +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
Daniel Marjamäki
4705026242
fixed a few doxygen warnings
2011-10-16 17:16:07 +02:00
Ettl Martin
1a710e5761
fixed regression on linux due to missing include
2011-10-16 14:16:35 +02:00
PKEuS
f8074b71d2
Fixed #2470 (False negative: Possible null pointer dereference (C++0x keyword 'nullptr'))
2011-10-16 12:54:58 +02:00
Daniel Marjamäki
32496fb009
Token: Updated comments
2011-10-16 08:25:11 +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
Daniel Marjamäki
1ec32e27db
Borland: Fixed compiler errors
2011-10-16 07:52:54 +02:00
Daniel Marjamäki
d5883ef0c4
astyle formatting
2011-10-16 07:50:34 +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
8afc1b6f2d
Changed the name of the removal of dead code after flow control statements for consistency (simplifyDeadCode is too generalized as name)
2011-10-15 12:45:48 +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
74c0468a18
astyle formatting
2011-10-12 22:06:19 +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
Robert Reif
af6a6f9c2d
run astyle
2011-10-12 09:08:54 -04:00
Marek Zmysłowski
07d8cd0a12
improved realloc checking '*p = realloc(*p,..'. Ticket: #1791
2011-10-11 22:07:14 +02:00
Thomas Jarosch
849bee8437
[PATCH] Detect suspicious use of semicolon after 'if/for/while'
...
statements if they are followed by a {..} block.
Examples are:
for (int i = 0; i < 10; ++i);
{
printf("i)";
}
or
if (i == 100);
{
die("Wrong argument");
}
This new check is active if you enable inconclusive checks.
2011-10-11 08:41:39 +02:00
Zachary Blair
fcf360825a
Fixed #2955 (New check: Using && instead of &)
2011-10-10 10:11:17 -07:00
Edoardo Prezioso
742858b67c
Fixed some simple errors in some old commits.
2011-10-10 17:18:47 +02:00
Edoardo Prezioso
af23a9dcbb
Fixed ticket #3140 (Improve Tokenizer: Remove dead for loop 'for (int i = 0; i < 0; ++i)')
2011-10-10 15:15:45 +02:00
PKEuS
5f9b916dcc
Fixed #2115 (new check: endless loop (unsigned comparison that is always true))
2011-10-09 20:35:46 +02:00
Daniel Marjamäki
96beb94b21
Fixed #3183 (False positive: (error) syntax error)
2011-10-09 18:42:36 +02:00
Daniel Marjamäki
175503ef94
Null pointer: improved inconclusive checking in CheckNullPointer::nullPointerAfterLoop
2011-10-09 15:09:02 +02:00
seb777
1d9a99012b
Fixed 3133 (Improve Check: Found obsolete function)
...
- add check for std::gets
- improve check when multiple obsolete functions are used
- remove false positive (declared functions)
2011-10-09 10:31:21 +02:00
Edoardo Prezioso
9270b84d64
More fixes to the label simplifier (related to ticket 3176):
...
1)Simplify the labels if there are combinations of the symbols '*','&','{' and '(' after a '%var% :' and before another '%var%';
2)but do not simplify the label if it's inside an unpreprocessed macro code.
2011-10-08 21:13:53 +02:00
Daniel Marjamäki
0b09732881
Null pointers: fixed false negatives when there are '(p && ..'
2011-10-08 12:58:10 +02:00
Stefan Weil
bf25340fd3
Settings: add missing initialisation for member variable c99 (reported by Valgrind)
2011-10-08 10:29:11 +02:00
Daniel Marjamäki
5c08979920
1.51: Updated versions
2011-10-08 07:45:39 +02:00
Daniel Marjamäki
37d4a01dcb
Added todo comments to fix false negatives caused by my fix for #3128
2011-10-08 07:39:20 +02:00
Daniel Marjamäki
e2ec5a127f
Fixed #3128 (False positive: null pointer dereference check does not handle complex boolean logic properly)
2011-10-07 21:08:21 +02:00
Robert Reif
a1a839fadc
fix tokenizer and symbol database to not mistake goto statement for variable declaration
2011-10-07 08:11:48 -04:00
Robert Reif
7dd001c9a9
run astyle
2011-10-06 21:10:20 -04:00
Edoardo Prezioso
80df7ea839
Fixed ticket #3176 (cppcheck reports wrong unused variable)
...
Label simplification didn't take count of the '(' parenthesis or the '&' and '*' operators inside or outside the parenthesis after the colon.
2011-10-07 00:54:44 +02:00
Edoardo Prezioso
fe4ce594ce
Renamed the function 'removeRedundantCodeAfterReturn' with 'simplifyDeadCode'.
...
This is a preparation in order to add new features to this function (see the @todo in the tokenize header file, ticket #3113 and #3175 for details).
2011-10-06 22:40:39 +02:00
Daniel Marjamäki
73fb6725e6
Readded CheckOther::bitwiseOnBoolean as inconclusive check
2011-10-06 22:01:48 +02:00
Marek Zmysłowski
307dd00efb
Fixed #3072 (improve check: deprecated function alloca)
2011-10-06 08:10:51 +02:00
Daniel Marjamäki
09109f19f8
Removed CheckOther::bitwiseOnBoolean check. The reasons can be seen in my comments in ticket #3062 .
2011-10-05 20:46:07 +02:00
PKEuS
494d3af3d1
Fixed #1877 (Be more strict about int vs. bool, part II)
2011-10-05 20:30:36 +02:00