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
Robert Reif
4d1dda10fa
add some more windows type conversions
2011-09-20 20:17:02 -04: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
be660003ec
start adding conversions from common Windows types to standard types
2011-09-18 13:06:54 -04: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
Robert Reif
b5d22fda0d
fix #2888 (Allow defining sizes of base types)
2011-09-17 19:40:52 -04:00
Robert Reif
cce4303f28
fix a problem with Qt slots immediately followed by signals
2011-09-16 16:59:43 -04:00
Edoardo Prezioso
1ff7410f4f
Fixed #3075 (False positive => Improve tokenizer: remove redundant code after a 'return' state)
2011-09-13 07:55:47 +02:00
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
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
seb777
08efad13b2
fix #3093 (Simplify code (math expression) with keywords 'return' and 'case')
2011-09-10 13:28:54 +02: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
a96028b43b
Fixed #3058 (False positive: Uninitialized variable: data)
2011-08-31 19:45:20 +02:00
Daniel Marjamäki
0529654e37
Fixed #3058 (False positive: Uninitialized variable: data)
2011-08-30 19:13:04 +02:00
Robert Reif
423a1ff64e
add support for simplifying Qt emit in tokenizer
2011-08-25 20:54:35 -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
a6c5eff1be
fix #3006 (segmentation fault of cppcheck ( x < () < ))
2011-08-15 07:19:49 -04:00
Robert Reif
ce00d0d35e
fix #2963 (FP: Typedef names considered duplicate because __LINE__ not expanded)
2011-08-11 18:18:47 -04:00
Robert Reif
afe95be966
fix #2980 (segmentation fault of cppcheck)
2011-08-08 06:58:55 -04: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
3bd8bf0e75
run astyle
2011-08-06 17:53:06 -04:00
Simon Martin
13360c2a66
Fixed #2870 (Tokenizer: simplify '0 |')
2011-08-06 06:50:29 +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
0dd5472642
Tokenizer::simplifyFunctionPointer: don't simplify function call. Ticket: #2873
2011-07-22 07:58:53 +02:00
Daniel Marjamäki
6ce5107e49
Tokenizer: Better handling of constants. Related with #2920
2011-07-20 09:07:47 +02:00
Daniel Marjamäki
cf3ab649fb
Fixed #2873 (segmentation fault of cppcheck while scanning rose-compiler suite)
2011-07-16 19:26:11 +02:00
Daniel Marjamäki
274fd2b985
Tokenizer: Fix minor problem with 'X&&Y'
2011-07-15 19:37:39 +02: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
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
70a32fc245
fix #2875 (segmentation fault of cppcheck ( 0; (a) < (a) ))
2011-06-28 18:47:18 -04:00
Daniel Marjamäki
40a14736b7
Added TODO test case for the simplifyKnownVariables to better simplify local variables
2011-06-23 17:03:14 +02:00
Daniel Marjamäki
2d1b7285d2
Fixed #2815 (FP: Null pointer dereference error about a member)
2011-06-23 16:58:01 +02:00
Robert Reif
db39f4364e
fix #2845 (segmentation fault of cppcheck)
2011-06-21 07:31:55 -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
5e3263235b
fix #2739 (segmentation fault of cppcheck ( if()x ))
2011-06-11 15:51:12 -04: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
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
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
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
670741271e
fix #2746 (false positive: syntax error (typedef in __attribute__ )))
2011-04-23 21:04:02 -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
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
Daniel Marjamäki
7021e3224b
Fixed #2714 (False positive: ternary operator and += style warning.)
2011-04-14 17:30:50 +02:00
Robert Reif
23e4f020e9
fix #2706 (Analysis failed. If the code is valid then please report this failure.)
2011-04-04 22:18:12 -04:00