Edoardo Prezioso
66e1761ffe
Fixed ticket #3571 (segmentation fault of cppcheck while scanning gcc-testsuite).
2012-01-31 18:42:19 +01:00
Edoardo Prezioso
9f81b48dc1
Fixed ticket #3558 (Tokenizer: improve simplifyVarDecl to take count of undefined size VLA's).
2012-01-30 23:41:43 +01:00
Edoardo Prezioso
0fd7504295
Related to ticket #3560 (conditional pointer user): remove also dead code in the lower scope if the actual scope isn't special.
2012-01-30 21:43:23 +01:00
Daniel Marjamäki
9df6088ddd
Revert "really fix #3527 (Internal error. Token::Match called with varid 0. Please report this to Cppcheck developers)"
...
This reverts commit a37031944e
.
I don't want this hard coding of macro names. Feel free to come with a more generic solution if you want.
2012-01-30 06:15:41 +01:00
Robert Reif
a37031944e
really fix #3527 (Internal error. Token::Match called with varid 0. Please report this to Cppcheck developers)
2012-01-28 20:58:51 -05:00
Edoardo Prezioso
7cf8e5dfff
TestTokenizer: moved test to proper place.
2012-01-26 22:25:19 +01:00
Edoardo Prezioso
5953ed7318
Fixed ticket #3528 (Tokenizer: improve simplifyFunctionParameters to take count of square brackets)
2012-01-23 16:10:15 +01:00
Daniel Marjamäki
9eb1a5864b
Fixed #3502 (segmentation fault of cppcheck (struct{x y:};))
2012-01-23 07:39:31 +01:00
Edoardo Prezioso
2a2d01a870
Remove some redundant 'errout.str("")' in some checks because it's already done inside tok call.
2012-01-21 00:59:12 +01:00
seb777
0be8af5214
Fix ticket #3530 (Add some windows data types to tokenizer)
2012-01-18 12:57:41 +01:00
Edoardo Prezioso
c5f7db0645
TestTokenizer: Remove redundant ';' in 'inlineasm' testcases.
2012-01-15 19:49:17 +01:00
Edoardo Prezioso
4d239d0bf7
Run astyle.
2012-01-15 19:47:51 +01:00
Edoardo Prezioso
963f6ce3ef
Tokenizer: report syntaxError if there's nothing after 'if|for|while ()' and if there's nothing inside round brackets;
...
TestTokenizer: change test cases accordingly;
TestSimplifyTokens: ditto.
2012-01-15 14:50:01 +01:00
Daniel Marjamäki
a6d96f5b72
Fixed #3496 (false positive: syntax error)
2012-01-15 14:33:53 +01:00
Edoardo Prezioso
6a248c35b5
Fixed ticket #3512 (segmentation fault of cppcheck ( 1 *p = const))
2012-01-14 00:43:58 +01:00
Daniel Marjamäki
0648b3ed5e
Fixed #3504 (segmentation fault of cppcheck)
2012-01-13 07:57:12 +01:00
Edoardo Prezioso
2dd53ec966
Fixed ticket #3485 (segmentation fault of cppcheck ( {a:1;}; ))
2012-01-09 16:24:11 +01:00
Edoardo Prezioso
54f54761b4
Fixed ticket #3482 (segmentation fault of cppcheck ( switch(){case} ))
2012-01-09 14:37:20 +01:00
Edoardo Prezioso
75fbe310ff
Extract various functions inside the Tokenizer class and fix tokenization of 'return __LINE__ ;'.
2012-01-04 12:57:58 +01:00
Daniel Marjamäki
e4f3f91c18
Reverted 9aa8a496
. I don't know why I made this fix.
2012-01-02 19:45:20 +01:00
Edoardo Prezioso
38ee7523ad
Remove redundant testcase I forgot to remove in previous commit.
2012-01-02 19:41:08 +01:00
Edoardo Prezioso
eb657034ba
Handle also C# multidimensional arrays with no specified dimension.
2012-01-02 00:22:45 +01:00
Reijo Tomperi
8cae17fda8
Update year to 2012
2012-01-01 01:05:37 +02:00
Edoardo Prezioso
38e0e25ce0
Fixed ticket #3448 (segmentation fault of cppcheck).
...
Add testcase related to previous commit (add 'A f(&x);' as declaration of variable).
2011-12-31 21:44:07 +01:00
Edoardo Prezioso
8f2ad53332
Add testcase for previous commit.
2011-12-30 18:47:42 +01:00
Edoardo Prezioso
873572d489
Improve C# simplification code with arrays of arrays.
2011-12-30 12:26:28 +01:00
Reijo Tomperi
1afd923d34
Fix bug in C# detection code. The test had a bug also, so it was not detected by the test.
2011-12-27 22:50:56 +02:00
Daniel Marjamäki
987392f254
Tokenizer: Better handling of array of function pointers
2011-12-27 11:56:40 +01:00
PKEuS
46c2bde118
Activate tests in TestTokenizer
2011-12-18 17:54:24 +01:00
Daniel Marjamäki
2bb5de4c89
Fixed #3425 (False positive: Null pointer dereference (pointer is checked in macro))
2011-12-18 13:33:23 +01:00
Daniel Marjamäki
83cdf734fe
Tokenizer: The tokenizer didn't handle '0x0E-7' correctly
2011-12-18 07:37:20 +01:00
Daniel Marjamäki
d21ca7881c
Fixed #3424 (Tokenizer: doesn't tokenize if-if-else-else correctly)
2011-12-17 19:05:14 +01:00
PKEuS
c9f5117cf5
Fixed #3407 (False positive: (inconclusive) Found duplicate branches for if and else. (inline assembler))
2011-12-13 21:42:38 +01:00
Edoardo Prezioso
79b82f115f
Tokenizer: some changes to line numbers of some tokens:
...
simplifyAsm: change line number of newly added 'asm ( )' in order to be the same as next ';'.
simplifyIfAddBraces: Change line number of newly added '}' in order to be the same as next 'else', except for '{ ; } else'.
2011-12-12 20:55:25 +01:00
Edoardo Prezioso
6506b2c016
Oops. Fix testrunner fail.
2011-12-11 20:36:56 +01:00
Edoardo Prezioso
3c098839d1
simplifyIfAddBraces: Remove restriction for jumping opening parenthesis '(' as a fix to #2873 , because even without this the original test case doesn't crash anymore. Add more jumping patterns.
...
simplifyFunctionParameters: Add more jumping patterns and an observation related to error message for equal parameter names, help needed.
Fix grammar mistake in comment.
2011-12-11 13:07:13 +01:00
Edoardo Prezioso
27801b35eb
Other improvements to tokenizer code.
...
Handle SQL code better, even when there's no ';' after 'EXEC SQL'.
simplifyVarDecl: Check with 'Token::Match' once when you have to check a pattern inside which there should be a number or a variable. Use '%any%' and after that check if that string is a number or a variable name later.
simplifyGoto: process also anonymous structs and unions which should have 'indentspecial' incremented, skip code like 'var = { ... }'.
2011-12-11 02:02:38 +01:00
Edoardo Prezioso
5134964026
Fix code in commit 5f522fb841
and reapply it again.
2011-12-10 23:49:56 +01:00
Daniel Marjamäki
04159b81b8
reverted 5f522fb841
, to avoid hang in TestBufferOverrun::arrayInfo
2011-12-10 20:51:36 +01:00
Edoardo Prezioso
5f522fb841
Tokenizer: improve code and remove redundant checks.
...
In particular: improve 'double sharp' concatenation by handling also code which begins without the [{};]. Do the same with C# code. Also, in the labels simplification function, skip also '{}' when the open bracket is after a '='.
2011-12-10 18:45:27 +01:00
PKEuS
9b685ba3c3
Code cleanup
2011-12-09 21:00:57 +01:00
Edoardo Prezioso
7d12951da0
1)Fixed ticket #3184 (Improve Tokenizer: improve simplifyMulAnd to simplify weirder code);
...
2)Fix a test case inside TestSimplifyTokens::flowControl.
2011-12-09 20:47:51 +01:00
PKEuS
167a7e3e51
Various code cleanups
2011-12-08 21:28:34 +01:00
PKEuS
1c1c31bea0
Tokenizer: Refactorings and improvements. Better handling of []
2011-12-07 21:15:00 +01:00
Edoardo Prezioso
eb5fe250ab
Partial fix ticket #3385 ('throw' isn't removed if the argument of the function is type 'struct|class').
2011-12-06 21:02:26 +01:00
Edoardo Prezioso
0504952950
Remove some redundant parenthesis - part 9
2011-12-06 16:53:57 +01:00
Edoardo Prezioso
b45d63a10a
Remove some redundant semicolons - part 5
2011-12-04 17:15:53 +01:00
Edoardo Prezioso
2fc067e6ab
Tokenizer::simplifyConst : handle also '%type% const' when the 'type' token is the first one in the list.
2011-12-04 16:59:19 +01:00
Edoardo Prezioso
a363749a17
1) Remove some redundant semicolons - part 4 ('typedef' != _tokens.str());
...
2) Tokenizer: Use Token::eraseTokens instead of using the same instructions as the ones inside such function.
2011-12-04 15:40:05 +01:00
Daniel Marjamäki
eeb6dc48a5
Fixed #3359 (False positive: array[idx++] += val triggers unexpected 'Array index out of bounds' error)
2011-12-04 12:22:21 +01:00
Edoardo Prezioso
42a557432d
Remove some redundant semicolons - part 3
2011-12-02 23:04:06 +01:00
Edoardo Prezioso
c2ddb67316
Remove some redundant semicolons - part 2
2011-12-02 22:58:29 +01:00
Edoardo Prezioso
ff1cb241a8
Remove some redundant semicolons - part 1
2011-12-02 22:39:33 +01:00
Marek Zmysłowski
3ae96600b5
Fixed #3212 (Simplify the double pointer cast)
2011-11-25 07:23:54 +01:00
Daniel Marjamäki
17f891ad34
Tokenizer::setVarId: Fixed problem with class declarations with inheritance. skip them.
2011-11-21 21:18:56 +01:00
Daniel Marjamäki
9aa8a49677
Tokenizer::setVarId: fixed 'using' bug
2011-11-21 18:04:42 +01:00
Daniel Marjamäki
004dcf834b
Fixed #3281 (Tokenizer::simplifyKnownVariables : static constant value is not used)
2011-11-20 21:50:26 +01:00
Daniel Marjamäki
b26811cdf5
astyle formatting
2011-11-20 16:50:41 +01:00
Daniel Marjamäki
097637a66c
Fixed #3316 (Cppcheck reporting internal errors - code compiles cleanly)
2011-11-20 16:22:21 +01:00
Edoardo Prezioso
42e369a4b4
Change every 'tokAt(..)->link()' to 'linkAt(..)'.
2011-11-20 14:24:27 +01:00
Daniel Marjamäki
1cf45a5cde
Fixed #3280 (False positive: assigned value that is never used)
2011-11-20 12:09:07 +01:00
Daniel Marjamäki
8c091ff968
Fixed #3340 (Internal error. Token::Match called with varid 0... union is causing problems)
2011-11-20 08:13:28 +01:00
Edoardo Prezioso
5cbfbe31c1
Add removal of consecutive braces, i.e.: '{ { ... } }'->'{ ... }'.
...
Changed a little bit the dead code tests.
2011-11-12 12:07:10 +01:00
Daniel Marjamäki
34e40502c6
Fixed #3314 (cppcheck incorrectly reporting Syntax error.)
2011-11-11 10:53:49 +01:00
Reijo Tomperi
ca70693055
Astyle fix
2011-11-10 22:32:37 +02:00
Richard Quirk
f56aa19fac
Fix varid 0 with function pointer and virtual methods
2011-11-09 21:07:55 +01:00
Daniel Marjamäki
2d00cabee1
Fixed #3279 (Token::Match called with varid 0)
2011-11-09 18:49:17 +01:00
Edoardo Prezioso
392f705b73
Oops.
2011-11-08 23:10:53 +01:00
Edoardo Prezioso
0569953753
Fixed ticket #3309 (false positive: (style) Boolean result is used in bitwise operation. Clarify expression with parentheses)
2011-11-08 22:48:14 +01:00
Edoardo Prezioso
3cc9a333c9
Fixed tokenizer: don't change '*(str+num)' if '*' means a product with a previous variable or number.
...
Ditto for '&str[num]' (still commented).
2011-11-08 18:14:43 +01:00
Edoardo Prezioso
aaa77c4709
Improve tokenizer: remove more redundant parenthesis and add a prototype code for: '&str[num]'=>'(str+num)' with reporting non obvious test failures.
2011-11-07 23:40:06 +01:00
Edoardo Prezioso
6e2f2816de
Improve same expression check: remove '%op%' pattern and add ',' for the same expressions as an argument inside a function.
...
Improve compound assignment simplification: use already defined 'isAssignmentOp' and extend the adding parenthesis to a generic operator, not only to the arithmetical ones. See: http://en.cppreference.com/w/cpp/language/operator_precedence
2011-11-06 14:35:53 +01:00
Daniel Marjamaki
b96ab6ba26
Fixed #3188 (Function parser false positive)
2011-11-05 12:23:05 +01:00
Daniel Marjamäki
085a6285fa
Fixed #3117 (Tokenizer::simplifyKnownVariables : Don't simplify static variable that is changed)
2011-11-05 08:30:11 +01:00
Daniel Marjamaki
b6b5416b42
Tokenizer: Fixed failed unit test
2011-11-02 20:42:38 +01:00
Daniel Marjamaki
0884204c2f
Fixed #3279 (Token::Match called with varid 0)
2011-11-02 18:31:13 +01:00
Daniel Marjamaki
937a4497ca
Fixed #3272 (Internal error)
2011-11-01 18:03:32 +01:00
Daniel Marjamäki
a7f27a83a7
Fixed #3271 (Regression: something related to symbol database / varid)
2011-10-31 18:33:15 +01:00
Daniel Marjamäki
92333b585a
Fixed #3092 (Tokenizer::setVarId : shadow variable in member function gets the wrong varid)
2011-10-29 21:25:58 +02:00
Daniel Marjamäki
8f49eb6a7e
Tokenizer: Make sure that friend classes don't get varid. Ticket: #2962
2011-10-29 18:22:58 +02:00
PKEuS
d6261debdf
Fixes false positives in test suite, adds unit test for void-simplification
2011-10-27 21:54:42 +03: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
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
6f8e42a5af
changed the astyle formatting flags
2011-10-13 20:53:06 +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
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
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
Daniel Marjamäki
96beb94b21
Fixed #3183 (False positive: (error) syntax error)
2011-10-09 18:42:36 +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
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
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
Robert Reif
44a926aa4d
add a few more Microsoft TCHAR function conversions
2011-09-27 07:29:36 -04:00
Robert Reif
ec377d24eb
add support for Microsoft TCHAR character constants
2011-09-26 22:08:24 -04:00
Robert Reif
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
Robert Reif
97d4277854
add Microsoft memory function conversions to standard cstring functions
2011-09-22 19:59:56 -04:00