Commit Graph

1008 Commits

Author SHA1 Message Date
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
Edoardo Prezioso 11e724df46 Tokenizer::simplifyTypedef: some optimizations on new code. 2012-01-30 17:08:35 +01:00
Edoardo Prezioso 7cd36f44b6 Tokenizer::simplifyTypedef: 'tokAt(offset)=>tokOffset': finished. 2012-01-30 16:38:04 +01:00
Edoardo Prezioso 67d095a10e Tokenizer::simplifyTypedef: 'tokAt(offset)=>tokOffset': work in progress.. 2012-01-30 16:20:15 +01:00
Edoardo Prezioso 7c596a2b90 Tokenizer::simplifyTypedef: 'tokAt(offset)=>tokOffset': work in progress.. 2012-01-30 16:18:42 +01:00
Edoardo Prezioso 187c463475 Tokenizer::simplifyTypedef: 'tokAt(offset)=>tokOffset': work in progress.. 2012-01-30 16:17:57 +01:00
Edoardo Prezioso b366bf69ad Tokenizer::simplifyTypedef: 'tokAt(offset)=>tokOffset': work in progress.. 2012-01-30 16:16:08 +01:00
Edoardo Prezioso fa077ede94 Tokenizer::simplifyTypedef: 'tokAt(offset)=>tokOffset': work in progress.. 2012-01-30 15:08:01 +01:00
Edoardo Prezioso 9438d1c2d0 Tokenizer::simplifyTypedef: 'tokAt(offset)=>tokOffset': work in progress.. 2012-01-30 15:04:41 +01:00
Edoardo Prezioso fe3fd1a073 Tokenizer::simplifyTypedef: redundant assignment to 'offset'. 2012-01-30 13:33:27 +01:00
Edoardo Prezioso 5a1585dcfb Tokenizer::simplifyTypedef: 'tokAt(offset)=>tokOffset': work in progress.. 2012-01-30 13:24:31 +01:00
Edoardo Prezioso d9e9c0aceb Tokenizer::simplifyTypedef: 'tokAt(offset)=>tokOffset': in progress.. 2012-01-30 13:15:25 +01:00
Edoardo Prezioso 017f0090fa Tokenizer::simplifyTypedef: 'tokAt(offset)=>tokOffset': begin conversion. 2012-01-30 13:10:50 +01:00
Edoardo Prezioso e530d770e1 Tokenizer::simplifyTypedef: to be sure there are no problems, promote to 'int' the variable 'offset'. 2012-01-30 13:04:10 +01:00
Edoardo Prezioso a93af0dba6 Tokenizer:: Use 'link' instead of 'parens' variable. 2012-01-30 12:22:37 +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 415aaca6dd Merge branch 'master' of git://github.com/danmar/cppcheck 2012-01-28 20:59:51 -05: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 fa77f98b1c Tokenizer: it's possible to set null lower bound for eraseDeadCode when used inside simplifyFlowControl.
Remove now unused 'beginindent' and moved 'goto' simplification together with 'return' group.
2012-01-28 21:37:30 +01:00
Edoardo Prezioso bb703f4d0b Fixed: (warning) Found simple pattern inside Token::Match() call. 2012-01-28 20:31:12 +01:00
Robert Reif 42afd2d63a fix #3561 (SymbolDatabase: throw foo; creates a variable with type throw) 2012-01-27 19:24:01 -05:00
Edoardo Prezioso 8289e2428d Tokenizer: Stylish change to condition. 2012-01-27 17:12:28 +01:00
Edoardo Prezioso 0dd4b9ad3a Temporary workaround to ticket #3459 (Simplify goto before loop) :
don't simplify code which contains the label pointed by 'goto'.
2012-01-27 16:56:12 +01:00
Edoardo Prezioso 6314d04a04 Tokenizer: Add 'BOOST_FOREACH' pattern where it was missing. 2012-01-27 16:47:26 +01:00
Edoardo Prezioso ca8e8d26c7 Tokenizer: extract realloc simplification and simplify also when each argument is done by more than one token.
Restyling of a comment in tokenize.h.
2012-01-27 13:56:06 +01:00
Edoardo Prezioso 421ae9df03 simplifyCondition: handle also '( a || true || b)' -> '(true)' and '( a && false && b)' -> '(false)'.
Clarify a comment about previous commit.
2012-01-26 23:14:44 +01:00
Edoardo Prezioso 0f1f3c0f5f Tokenizer::removeRedundantCondition: refactoring due to various reasons.
1) Remove the dead code with 'eraseDeadCode', not with 'eraseTokens' because of the possible presence of labels.
2) It's impossible that in tokenizer there is pattern like 'if (true|false) {code;} else if (cond) {code_cond;}' because the function 'Tokenizer::elseif' adds '{' between 'else' and 'if', hence a code path is redundant, so it's removed from code.
2012-01-26 22:32:11 +01:00
Edoardo Prezioso b6763313c5 Tokenizer::simplifyQuestionMark: use links instead of indentation level number. 2012-01-26 17:55:22 +01:00
Edoardo Prezioso 6e164ae7ed Fixed ticket #3557 (Tokenizer: simplification of '[]' doesn't work well):
extract undefined size array simplification and handle multiple arrays and combos between pointers and arrays, don't handle the definitions as arguments of function.
2012-01-26 17:25:52 +01:00
Edoardo Prezioso f428a29d8e Improve simplifyReturnStrncat when each argument is not composed by one token. 2012-01-26 16:09:32 +01:00
Edoardo Prezioso b6a0896ce6 Change 'simplifyReturn' to 'simplifyReturnStrncat' because it's not clear what this function does. 2012-01-26 11:49:08 +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
PKEuS 36479499e7 - Solved FIXME: Made detection of code that is no pointer-dereference more robust, uncommented code (checknullpointer.cpp)
- Removed more indendation level counters
- Make use of symbol database more often
- Other refactorizations
2012-01-21 19:55:32 +01:00
Edoardo Prezioso b0dac2fa2e Tokenizer::copyTokens: add optional parameter which preserve the line number differences between tokens to be copied. 2012-01-21 17:18:16 +01:00
seb777 0be8af5214 Fix ticket #3530 (Add some windows data types to tokenizer) 2012-01-18 12:57:41 +01:00
Edoardo Prezioso 9019190a37 Tokenizer: various improvements to code. 2012-01-17 11:51:11 +01:00
Edoardo Prezioso 40739eb3fb Reverted some changes in commits 4b05c3e19f and 4b08b13845. 2012-01-16 11:44:31 +01:00
Edoardo Prezioso 4b05c3e19f Tokenizer::simplifyIfAddBraces: improve comments; handle independently 'a = { .. };'; reduce use of 'Token::(simple)Match' functions. 2012-01-15 19:53:11 +01:00
Edoardo Prezioso 4b08b13845 Tokenizer: reduce usage of Token::Match in some cases. 2012-01-15 15:00:52 +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
Robert Reif 6f3807d915 add some more windows types 2012-01-10 21:55:24 -05:00
Reijo Tomperi be7691c7b4 Refactoring: Move rest of the template simplification into TemplateSimplifier
simplifyCalculations() was temporarily moved into TemplateSimplifier also, it should be moved to a better place.
2012-01-09 21:33:11 +02:00
Reijo Tomperi 756b8762ab Catch InternalError by reference instead of creating a copy of it. 2012-01-09 18:30:36 +02: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
Reijo Tomperi 194327048a Add InternalError and change MathLib to throw it in case of an error.
- Previously MathLib errors did not provide a filename, but after this change at least source file name should be printed
and if token is provided, also line number should be printed.
- Change also Token to use InternalError
- Modify Cppcheck-class to catch InternalError instead of Token
- Run dmake to update Makefile
2012-01-08 22:19:44 +02:00
Reijo Tomperi 3c0ada52e6 Refactoring: Extract sizeof simplifying from template simplifying 2012-01-08 00:21:12 +02:00