Commit Graph

501 Commits

Author SHA1 Message Date
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 1c1c31bea0 Tokenizer: Refactorings and improvements. Better handling of [] 2011-12-07 21:15:00 +01:00
Edoardo Prezioso b9224439c1 Add 'exit' and 'abort' to the flow control list in order to simplify code after them. 2011-12-06 22:56:12 +01:00
Edoardo Prezioso 0504952950 Remove some redundant parenthesis - part 9 2011-12-06 16:53:57 +01:00
Edoardo Prezioso 9cadd7c17a Remove some redundant semicolons - part 8 2011-12-04 19:11:51 +01:00
Edoardo Prezioso 4946b036ad Remove some redundant semicolons - part 7 2011-12-04 18:08:35 +01:00
Edoardo Prezioso 52a174fa9d Remove some redundant semicolons - part 6 2011-12-04 17:30:25 +01:00
Edoardo Prezioso b45d63a10a Remove some redundant semicolons - part 5 2011-12-04 17:15:53 +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 49784a44e1 Tokenizer: improved handling of inner templates. Partial fix for #3226 2011-12-04 11:38:41 +01:00
Edoardo Prezioso f47ac539d6 Tokenizer::simplifyFlowControl: 1) remove consecutive 'break' or 'continue', since they don't influence the CheckOther results; 2) improve the code speed where possible;
Tokenizer::eraseDeadCode: Ditto.
2011-12-03 17:15:19 +01:00
Daniel Marjamäki 50dfdf7c2e Fixed #3350 (Analysis failed) 2011-12-03 15:15:15 +01:00
Edoardo Prezioso 00bae586e9 Add 'throw' to the flow control statements list for simplification of dead code. 2011-12-03 02:04:29 +01:00
Edoardo Prezioso 42a557432d Remove some redundant semicolons - part 3 2011-12-02 23:04:06 +01:00
Edoardo Prezioso d0d5a2fcd8 Completed ticket #3230 (Refactoring: add function to remove tokens when a label is found.) and fixed ticket #3264 (False positive: Variable is assigned a value that is never used). 2011-11-20 18:37:00 +01:00
Edoardo Prezioso fa34a14d57 Add more tests for flow control simplification. 2011-11-18 21:10:56 +01:00
Edoardo Prezioso 44e348d018 Add test for the consecutive braces simplification, thanks to thomasjfox's example. 2011-11-18 21:04:24 +01:00
Thomas Jarosch c317c8979c Run astyle 2011-11-14 09:21:42 +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
Edoardo Prezioso a546fc6e9d Fixed ticket #3310 (segmentation fault of cppcheck) 2011-11-08 17:37:24 +01:00
Edoardo Prezioso 3abece027e Refactoring: unify same dead code tests with a list. 2011-11-08 14:13:26 +01:00
Daniel Marjamäki acaa9c456f Fixed #3152 (Tokenizer: template constructor is removed) 2011-10-29 19:45:47 +02:00
PKEuS d6261debdf Fixes false positives in test suite, adds unit test for void-simplification 2011-10-27 21:54:42 +03:00
Erik Lax b7ab1e7d7e Fixed #3237 (Bug in parser of class operator functions) 2011-10-23 10:25:14 +02:00
Johan Samuelson 3d8fa2f76e Fixed #3123 ([False Positive] Shadowed enum) 2011-10-22 13:43:53 +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 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
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 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
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
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
Robert Reif ac942c6684 fix #3151 (missing portability warning for extra qualifier on destructor) 2011-09-29 19:25:14 -04:00
Robert Reif f97424b242 start adding Windows ASCII TCHAR conversion support 2011-09-24 14:51:03 -04:00
Robert Reif a685f1f5b7 add operator support to ertra qualification check 2011-09-23 19:45:19 -04:00
Robert Reif 97d4277854 add Microsoft memory function conversions to standard cstring functions 2011-09-22 19:59:56 -04:00
Robert Reif 66eb37c135 convert size_t to standard type 2011-09-18 10:31:31 -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
Daniel Marjamäki 46b5d5bd00 Fixed #3069 (False positive: Memory leak: data) 2011-09-03 20:45:48 +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 f4e07c3179 fix #3070 (Other: failed to parse a typedef string. Check continues anyway.) 2011-09-01 19:10:58 -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