Commit Graph

780 Commits

Author SHA1 Message Date
Daniel Marjamäki 5b8840c6b0 Fixed #3764 (Tokenizer::setVarId: no varid for templated variables with const/struct/union types) 2012-04-27 18:02:07 +02:00
Edoardo Prezioso 08ae15e42d Fixed the grammar in some reportError messages in the Tokenizer class, thanks to kimmov's suggestion. 2012-04-25 15:09:46 +02:00
PKEuS 88aa08e71b Refactorizations in test suite:
- Removed redundant tokenization helper functions in testtokenize.cpp and testsimplifytokens.cpp
- Pass arguments as const char[] or const std::string& to avoid instanciation or at least copying of strings
- Removed redundant calls to Tokenizer::validate() - This function is already called implicitly by tokenize() and simplifyTokenList()
2012-04-17 09:51:08 +02:00
PKEuS bac8ed7127 Refactorized stringification of tokens:
- Function that stringifies one token: Token::stringify()
- Functions that stringify a list of tokens: Token::stringifyList()
-- Single and powerful "base" function, used by several "light" functions
Refactorized
- testtokenize.cpp and testsimplifytokens.cpp: Use improved stringification functions instead of several local implementations
- Avoided redundand creation of std::string when using TestTokenizer::tokenizeAndStringify and in cmdlineparser.cpp
2012-04-16 19:51:07 +02:00
PKEuS 62d5069387 Fixed #3722: Handle associative law correctly for operator* 2012-04-13 11:55:09 +02:00
Daniel Marjamäki 6bae724cb6 Fixed #3705 (cppcheck crash (null pointer exception)) 2012-04-09 15:06:06 +02:00
Daniel Marjamäki 68e6511c87 Fixed #3532 (false positive : missing constructor) 2012-03-31 11:30:26 +02:00
PKEuS 0338153de9 Added test case for #3619 2012-03-25 10:33:18 +02:00
PKEuS 1ef99e2f21 Improved checkautovariables:
- Added support for checking a few more code patterns
- Simplified code by using more information from the symboldatabase
- Moved redundant part of c_str-check to checkstl
Two fixes according to output of pvs studio in testsimplifytokens.cpp
2012-03-01 18:38:20 +01:00
Edoardo Prezioso 4d3013d43d Improve 'Tokenizer::elseif' code in order to not touch 'else if' inside a macro parenthesis. 2012-02-26 02:50:48 +01:00
Edoardo Prezioso d7a918e549 Fixed ticket #3616 (segmentation fault of cppcheck). 2012-02-18 17:58:50 +01:00
Daniel Marjamäki bfb4dd6425 Fixed #3529 (False 'Boolean result is used in bitwise operation' in a template) 2012-02-18 08:51:09 +01:00
Edoardo Prezioso 17cd5ec906 Fixed ticket #3604 (cppcheck(1.53) crash). 2012-02-17 21:14:38 +01:00
PKEuS bb319c1c96 Improved Tokens and Tokenizer:
- Better handling of deleteThis() as last element of token list
- Code simplified
2012-02-13 17:44:08 +01:00
Edoardo Prezioso f9ade9562c Fixed ticket #3572 (segmentation fault). 2012-01-31 22:32:28 +01:00
Edoardo Prezioso f8578a380a Added test case from #3533 (segmentation fault of cppcheck). 2012-01-31 18:23:02 +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 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 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 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 5953ed7318 Fixed ticket #3528 (Tokenizer: improve simplifyFunctionParameters to take count of square brackets) 2012-01-23 16:10:15 +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
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
Edoardo Prezioso a7029291fd Tokenizer::simplifyGoto: process also derived class/structs. 2012-01-04 17:08:53 +01:00
Edoardo Prezioso 6f9cd110d0 Improve Tokenizer: improve 'simplifyDoublePlusAndDoubleMinus' when there are negative numbers. 2012-01-04 13:45:27 +01:00
Reijo Tomperi 8cae17fda8 Update year to 2012 2012-01-01 01:05:37 +02:00
Daniel Marjamäki 8a6b1dc1c9 Fixed #3449 (segmentation fault of cppcheck) 2011-12-31 12:08:49 +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 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
Robert Reif 389ab80b63 fix #2999 (false positive: (style) Struct 'Fred' hides typedef with same name) 2011-08-14 18:06:05 -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 10eb224ac7 fix #2983 (segmentation fault of cppcheck) 2011-08-09 18:31:02 -04:00
Robert Reif 829611b129 fix #2978 (segmentation fault of cppcheck ( enum E {} e enum )) 2011-08-07 16:48:47 -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 d23fb873cc fix #2970 (Incorrect report: Class does not have a constructor) 2011-08-06 17:54:02 -04:00
Robert Reif fd01a7555a fix #2966 (segmentation fault of cppcheck ( enum x : )) 2011-08-05 18:07:18 -04:00
Daniel Marjamäki fb3870071a Fixed #2885 (crash of cppcheck while checking gcc-testsuite) 2011-07-21 16:13:35 +02:00
Daniel Marjamäki 9f22d2fc6b Fixed #2897 (out of bounds false positive, using reinterpret_cast) 2011-07-21 09:32:24 +02:00
Daniel Marjamäki 481be84004 TestSimplifyTokens: removed copy/pasted comment 2011-07-17 09:14:03 +02:00
Daniel Marjamäki 35938e74ad Tokenizer: better handling of 'struct AB ab; sizeof(ab)' 2011-07-16 22:07:30 +02:00
Daniel Marjamäki 5561d81f0d Tokenizer::simplifyGoto: fixed unit tests 2011-07-03 18:35:11 +02:00
Robert Reif b143b283e9 fix #2886 (crash of cppcheck ( typedef struct x { } )) 2011-07-03 10:50:15 -04:00
Robert Reif 8ec1dfacbf fix missing pop in Tokenizer::simplifyStructDecl() when anonymous struct/union removed 2011-07-03 08:14:51 -04:00
Robert Reif 3f4cc5fa3a add class A {} a; -> class A {}; A a; conversion capability to Tokenizer::simplifyStructDecl() 2011-07-02 09:21:30 -04: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 1713eeb532 fix #2859 (Extra qualification not detected) 2011-06-26 21:13:29 -04:00
Reijo Tomperi 918b4d859f Fixed #2860, False positive: Returning value of strncat() reported as memory leak
http://sourceforge.net/apps/trac/cppcheck/ticket/2860
2011-06-26 23:53:16 +03:00
Robert Reif d80a55267c fix #2844 fix to generate correct output 2011-06-19 20:19:16 -04:00
Robert Reif 0bd26a73c4 fix #2844 (typedef causes 'syntax error') 2011-06-19 17:57:01 -04:00
Robert Reif eaf836b323 fix extra qualification check for same class name in different namespaces 2011-06-14 15:31:52 -04:00
Robert Reif d1b260699a fix #2834 (crash of cppcheck (std::vector<int>::iterator)) 2011-06-12 08:24:49 -04:00
Robert Reif 3d4eb0d77e fix #2682 (segmentation fault of cppcheck ( x a[0] = )) 2011-06-10 15:11:45 -04:00
Robert Reif 6635ed4630 fix #2828 (false positive: Function parameter 'STYLE' hides enumerator with same name) 2011-06-08 20:14:52 -04:00
Robert Reif 311651cc66 fix #2804 (Underlying type of enumerator produces a syntax error) 2011-05-27 11:17:39 -04:00
Robert Reif 51baca0359 fix #1982 (simplifyTypedef: scope info is lost) 2011-05-02 22:42:52 -04:00
Daniel Marjamäki bbd379c802 astyle formatting 2011-05-02 15:08:16 +02:00
Daniel Marjamaki 297ca63868 Fixed #2721 (Tokenizer::simplifyTemplates: fail when using template argument 'char[2]') 2011-05-01 19:05:18 +02:00
Robert Reif 3c415e7833 fix #2745 (Enum vs local variable - conflict) 2011-04-23 22:08:03 -04:00
Robert Reif 04309f74f5 fix #2738 (syntax error on valid code) 2011-04-20 19:09:28 -04:00
Robert Reif b1d3d291e6 fix #2736 (segmentation fault of cppcheck) 2011-04-20 07:49:04 -04:00
Robert Reif 877a233145 fix #2716 (Easy to reproduce crash) 2011-04-16 10:35:23 -04:00
Daniel Marjamäki 739b6a93e2 Fixed #2713 (False positive (Redundant assignment)) 2011-04-16 12:07:56 +02:00
Robert Reif 3159df958d fix #2720 (false positive: syntax error with c++0x code) 2011-04-14 19:50:17 -04:00
Robert Reif 75e5353b6d fix #2718 (Analysis failed. If the code is valid then please report this failure.) 2011-04-13 23:58:58 -04:00
Robert Reif 257197bdd1 fix #2717 (false positive: syntax error (typedef void f(int) const;)) 2011-04-13 23:24:41 -04:00
Robert Reif 50a1f28d86 run astyle 2011-04-13 21:12:35 -04:00
Daniel Marjamäki 11bd6bcd30 Fixed #2712 (false positive: Division by zero) 2011-04-10 21:27:09 +02:00
Daniel Marjamäki 447f61e9c7 Refactoring: Use %op% 2011-04-09 18:30:47 +02:00
Daniel Marjamäki f6d910ab3d Refactoring: Use Token::isOp 2011-04-09 15:54:36 +02:00
Daniel Marjamäki ea57e10c7f Tokenizer::simplifyCalculations: simplify division result if it's a whole number, even though it doesn't have precedence 2011-04-02 12:52:11 +02:00
Daniel Marjamäki f34e9e6623 Tokenizer: better simplification of calculations in conditions 2011-04-02 11:08:58 +02:00
Stefan Weil 675e63b6a7 Spell checks 2011-03-30 16:45:31 +02:00
Robert Reif fc258164cd fix #2675 (false positive: syntax error) 2011-03-24 22:26:42 -04:00
Robert Reif 7b63da4964 fix #2651 (Segmentation fault (typedef)) 2011-03-17 20:00:49 -04:00
Daniel Marjamäki dab09aedee Fixed #2648 (Tokenizer::simplifyTemplates: Segmentation fault (gcc-testsuite)) 2011-03-17 21:45:03 +01:00
Daniel Marjamäki fec9edf628 Tokenizer::simplifyTemplates: First simple fix for problems when using sizeof in template parameter 2011-03-16 22:16:30 +01:00
Robert Reif f7cbc90c84 fix #2581 (### Internal error in Cppcheck. Please report it.) 2011-03-15 23:28:45 -04:00
Robert Reif ba0b3e6451 fix #2651 function typedef with extra ()s 2011-03-15 19:24:30 -04:00
Robert Reif 7a7257f200 fix #2630 (segmentation fault of cppcheck ( typedef ... ) 2011-03-08 20:24:57 -05:00
Daniel Marjamäki 7496cd412c Fixed #2631 (Tokenizer::simplifyTemplates: template usage 'std::cout << (foo<double>(r));') 2011-03-07 21:21:06 +01:00
Robert Reif d678e4424c fix #2630 (segmentation fault of cppcheck ( typedef y x () x )) 2011-03-06 18:59:56 -05:00
Daniel Marjamäki f53ff27b71 Tokenizer::simplifyTemplates: better handling of '(foo<double>())'. Ticket: #2631 2011-03-06 21:15:42 +01:00
Daniel Marjamäki 6648267ab8 Revert "Tokenizer::simplifyTemplates: better handling of '(foo<double>())'. Ticket: #2631"
This reverts commit de31ec1e44.
2011-03-06 21:07:06 +01:00
Daniel Marjamäki de31ec1e44 Tokenizer::simplifyTemplates: better handling of '(foo<double>())'. Ticket: #2631 2011-03-06 10:28:51 -08:00
Robert Reif 0debba4409 finish fixing #2624 (better function pointer support needed) 2011-03-05 21:41:58 -05:00
Robert Reif 7d2fb2ecde partial fix for #2624 (better function pointer support needed) 2011-03-05 20:48:28 -05:00
Robert Reif f3b2acf585 really fix #2620 reference of typedef of array not simplified properly 2011-03-03 20:32:10 -05:00
Robert Reif 3f0d0446e0 revert previous commit: simplified code isn't correct 2011-03-03 07:40:43 -05:00
Robert Reif ee4b4f62d8 fix #2620 reference of typedef of array not simplified properly 2011-03-03 07:27:53 -05:00
Robert Reif 26152a9264 fix #2609 (False positive on template dependent name) 2011-02-24 06:39:46 -05:00
Daniel Marjamäki daf0e7c37d Fixed #2604 (Segmentation fault of cppcheck ( sizeof <= A )) 2011-02-23 20:44:14 +01:00
Robert Reif d1f7a8aca4 fix #2403 (simplifyTypedef: array of function pointers) Internal error message 2011-02-22 22:11:17 -05:00
Robert Reif dd12fc177f fix #2603 (segmentation fault of cppcheck ( typedef constexpr)) 2011-02-22 07:48:34 -05:00
Robert Reif 703448171a fix #2601 (segmentation fault of cppcheck) 2011-02-22 07:02:15 -05:00
Robert Reif 4e1ce93104 fix #2600 (segmentation fault of cppcheck ( enum{const} )) 2011-02-21 19:30:40 -05:00
Robert Reif 999646fca6 fix #2599 (segmentation fault of cppcheck ( sizeof )) 2011-02-21 17:49:30 -05:00
Daniel Marjamäki 63c003f92e Tokenizer: fixed so that 'p=&x; if(p)' is simplified to 'p=&x;if(&x)'. Ticket: #2596 2011-02-20 18:18:27 +01:00
Daniel Marjamäki 1cfb18be08 astyle formatting 2011-02-20 12:22:01 +01:00
Daniel Marjamäki 46f4e46d30 Tokenizer::simplifyTemplates: Better handling for multi-token template arguments such as 'Foo<std::string>' 2011-02-20 12:17:05 +01:00
Robert Reif 77fe9858e2 fix #2587 (Spurious warning about struct hiding typedef) 2011-02-19 14:18:37 -05:00
Daniel Marjamäki 0ed0d07714 Tokenizer::simplifyCalculations: basic handling of bitwise operators 2011-02-14 20:43:26 +01:00
Robert Reif cdd8d3f785 Really fix #2348 perl-tk 2011-02-13 19:02:57 -05:00
Robert Reif c03ace7378 Fix #2579 (segmentation fault of cppcheck) 2011-02-13 14:11:22 -05:00
Robert Reif 78b5361ec8 fix #2568 (False positive: (style) Union 'A_t' hides typedef with same name (forward declaration)) 2011-02-11 19:09:24 -05:00
Robert Reif 7502cea4d3 Fixed #2554 (simplifyTypedef: wrong simplification for sizeof(array)) 2011-02-08 19:47:14 -05:00
Robert Reif e9ec4bc3e4 Fixed #2536 (cppcheck hangs with 100% cpu load) 2011-02-03 07:58:49 +01:00
Robert Reif 8eb92001b3 Fixed #2530 (Tokenizer: Remove redundant 'MyClass::' inside MyClass class declaration) 2011-02-02 07:40:08 +01:00
Pete Johns 098f0bf3e6 Fixed #2526 (Make TODO_ASSERT_EQUALS take three arguments (value, to_be, as_is)?...
Removed replaced EXPECTED with...

WANTED (to-be):     The future expected value.
CURRENT (as-is):    Documenting how cppcheck behaves now.

This removes the need for an ASSERT_EQUALS but enforces the check for every TODO_ASSERT_EQUALS.
2011-01-30 23:20:11 +11:00
Daniel Marjamäki 524498e439 Tokenizer: collapse operator function names into a single token. ticket: #2519 2011-01-27 18:44:20 +01:00
Daniel Marjamäki b10f0aabd6 Fixed #2376 (simplifyTypedef: upx-ucl) 2011-01-23 09:04:34 +01:00
Raphael Geissert da998fec68 Tokenizer: simplify restrict 2011-01-16 11:37:03 +01:00
Robert Reif beb2db82a2 Fixed #980 (false negative: division by zero when using enum) 2011-01-16 11:24:58 +01:00
Daniel Marjamäki 5920dbb7e7 Fixed #2466 (Tokenizer: simplification of enum) 2011-01-15 08:21:06 +01:00
Robert Reif 8ecba0af90 Fixed #2464 (False positive: not initialised/not assigned Static variable in copy constructors.) 2011-01-15 08:04:50 +01:00
Robert Reif 708a75e363 Fixed #2452 (syntax error when 'void f(typedef int x)' is used. causes segmentation fault.) 2011-01-14 07:41:22 +01:00
Reijo Tomperi 226b605774 Change year 2010 -> 2011 in license texts. 2011-01-09 21:33:36 +02:00
Robert Reif bfc95e01c1 Fixed #2426 (### Internal error in Cppcheck. Please report it.) 2011-01-07 08:02:47 +01:00
Robert Reif d7e170b3ca typedef: fixed problem. ticket: #2414 2011-01-06 07:52:59 +01:00
Robert Reif 157498e694 Fixed #2412 (typedef: struct with inheritance) 2011-01-05 17:42:55 +01:00
Daniel Marjamäki d700f25518 Fixed #2399 (Tokenizer::simplifyKnownVariables: variables in conditions) 2011-01-04 21:35:35 +01:00
Daniel Marjamäki 2c6421d162 Merge branch 'master' of https://github.com/rgeissert/cppcheck into rgeissert-realloc 2011-01-04 18:21:18 +01:00
Robert Reif 63208e87d3 typedef: delete unhandled typedefs. ticket: #2348 2011-01-04 07:43:40 +01:00
Robert Reif a782d3ddf7 typedef: fix testcase 4. ticket: #2375 2011-01-04 07:39:41 +01:00
Raphael Geissert 3d9550b0bf Simplify "x = realloc (0, n);" to "x = malloc(n);" 2011-01-02 17:46:10 -06:00
Daniel Marjamäki d2714fefda typedef: Fixed testcase. ticket: #2375 2011-01-02 17:28:47 +01:00
Daniel Marjamäki 320604f073 typedef: added more tests. ticket: #2375 2011-01-02 07:42:47 +01:00
Daniel Marjamäki 307178d3c2 Tokenizer: Better handling of duplicate enums. Ticket: #2381 2010-12-30 20:55:23 +01:00
Robert Reif 3900ac731e simplifyTypedef: Better handling of 'typedef int RexxFunctionHandler();'. Ticket: #2348 2010-12-29 20:25:47 +01:00
Robert Reif 137d0e2ba7 typedef: fixed problem with 'typedef int pread_f(int);'. ticket: #2348 2010-12-29 09:18:41 +01:00
Robert Reif e82b1f8946 typedef: fix typedef simplification. ticket: #2348 2010-12-28 21:21:13 +01:00
Daniel Marjamäki 0667fcf53c Fixed #2355 (simplifyTypedef: wrong simplification of 'typedef FMAC1 void (*a)();') 2010-12-28 14:04:44 +01:00
Robert Reif 1b92eeae1e Fixed #2354 (simplifyTypedef: function pointers are not simplified into valid code) 2010-12-28 08:01:32 +01:00
Daniel Marjamäki 6f8f0e1aa1 Fixed #2353 (Tokenizer::simplifyKnownVariables: wrong simplification after return) 2010-12-25 10:07:57 +01:00
Daniel Marjamäki 18fd12006a Tokenizer::simplifyGoto: Don't simplify 'goto' inside unhandled macro calls. Ticket: #2348 2010-12-23 22:03:58 +01:00
Daniel Marjamäki 472ecd8805 Tokenizer: Fixed calculation simplification of '0*(*p)'. Ticket: #2348 2010-12-23 18:59:18 +01:00
Robert Reif fc7e2d1ac1 Fixed #2341 (false positive for function pointer returning typedef) 2010-12-22 18:37:23 +01:00
Daniel Marjamäki 41ac2c252f Fixed #2325 (Tokenizer: Remove for-loop if condition is false) 2010-12-18 21:43:12 +01:00
Robert Reif bf136f0123 Fixed #2314 (False positive: (style) Template instantiation 'Foo' hides typedef with same name) 2010-12-16 07:48:46 +01:00
vBm 46a11183a5 Fixed some spelling mistakes 2010-12-15 18:45:53 +01:00
Daniel Marjamäki 69bacde479 Tokenizer: Cleanup redundant statement '; x = x + 0;'. Ticket: #2283 2010-12-09 19:35:52 +01:00
Robert Reif f12c0c7ada Tokenizer: add assert(_settings) to Tokenizer to insure the tokenizer always has settings. Ticket: #2219 2010-12-01 18:00:55 +01:00
Daniel Marjamäki add8584612 Fixed #2232 (segmentation fault of cppcheck) 2010-11-29 17:46:10 +01:00
Robert Reif 07f4067fa8 typedef: better handling of __typeof__ 2010-11-11 17:02:04 +01:00
Robert Reif a09c221014 typedefs: handle __typeof__ 2010-11-11 06:40:49 +01:00
Robert Reif 8a379d4826 Fixed #2176 (Tokenizer::simplifyTypedef function pointer bug) 2010-11-06 15:15:50 +01:00
Robert Reif c49a8a99a3 Fixed #2175 (Tokenizer::simplifyTypedef : wrong simplification of 'typedef float vec_t[3];') 2010-11-06 13:28:44 +01:00
Daniel Marjamäki c39fbb86db Tokenizer::simplifyKnownVariables : Fixed TODO test case when simplifying pointer alias in function call 2010-11-06 13:24:33 +01:00
Daniel Marjamäki e901ee2e68 Added TODO unit test for ticket #2175. simplify 'typedef float x[3];' 2010-11-06 09:31:43 +01:00
Robert Reif 431201dd67 Fixed #2174 (Tokenizer::simplifyFunctionReturn bug) 2010-11-06 06:53:09 +01:00
Daniel Marjamäki 52faadda89 Tokenizer: simplify calculations with zero better 2010-11-05 20:35:31 +01:00
Daniel Marjamäki 4fdb420454 Tokenizer: simplifyknownvariables, improved handling of string constant 2010-11-05 20:05:57 +01:00
Daniel Marjamäki a38b14d582 Tokenizer: Remove redundant semi colons 2010-10-26 21:05:20 +02:00
Daniel Marjamäki 02ba2b202e Fixed #2110 (Tokenizer::simplifyTypedef: regression - wrong simplification of 'typedef char TString[256];') 2010-10-20 06:09:29 +02:00
Robert Reif 267d1f273e Fixed #2082 (Tokenizer::simplifyTypedef: wrong handling of array) 2010-10-13 20:02:37 +02:00
Daniel Marjamäki 2334192bff Fixed #2087 (False positive: Array 'str[1]' index 1 out of bounds) 2010-10-12 21:52:02 +02:00
Robert Reif 24eba7ef02 Unit Testing: Added more typedef tests 2010-10-08 16:00:21 +02:00
Daniel Marjamäki e4c3b390cc Fixed #2069 (cppcheck fails to scan OpenBSDs ftp source code) 2010-10-02 13:28:44 +02:00
Pete Johns 9a9302cba1 Prevent Tokenizer::simplifyCalculations() from removing parantheses from calls to Functors. 2010-10-02 21:19:05 +10:00
Robert Reif 2fc2859b68 Fixed #2035 (Enum 'qboolean' hides typedef with same name) 2010-09-08 06:45:57 +02:00
Daniel Marjamäki cfe694330f Fixed #2024 (Internal Error on multiple append calls on same string object) 2010-09-06 21:34:51 +02:00
Robert Reif fbffaade2e Fixed #2011 (Parser error in template function) 2010-09-02 19:09:06 +02:00
Daniel Marjamäki 7ec3c72a19 Fixed #1997 (operator new [] simplified wrong) 2010-08-30 21:06:22 +02:00
Robert Reif 0d530711f6 Fixed #1988 (segmentation fault of cppcheck with wrong syntax of -std=c++0x) 2010-08-30 07:25:17 +02:00
Daniel Marjamäki d45186d645 Added --debug-warnings that we can use to enable various debug warnings 2010-08-27 20:28:00 +02:00
Robert Reif 499a12c896 Tokenizer::simplifyTypedef: Report about unhandled typedefs. Ticket: #1821 2010-08-26 20:44:13 +02:00
Daniel Marjamäki ca9cdf5bf5 Tokenizer: If syntax errors are found then don't return a token list. Ticket: #1961 2010-08-25 22:10:21 +02:00
Robert Reif 4a6070d2af fix 2 problems related to ticket 1976:
1. nested unnamed anonymous structures and unions were not supported.
 2. declaration split up in class had bug if proceeded by access specifier.
2010-08-25 20:17:31 +02:00
Robert Reif d961a6ec9e Tokenizer: Fixed cppcheck and compiler warnings 2010-08-24 07:28:56 +02:00
Robert Reif 7173e01926 Fixed #1965 (tokenizer::simplifyEnum add support for C++0x enums) 2010-08-21 07:44:56 +02:00
Robert Reif f123e951ec Fixed #1963 (typedef array incorrectly simplified) 2010-08-20 07:11:02 +02:00
Daniel Marjamäki cfa7b4906e Symbol database: bug fixes. Ticket: #1895 2010-08-18 22:42:04 +02:00
Daniel Marjamäki 2e2baa23a6 Fixed #1909 (### Internal error in Cppcheck. Please report it) 2010-07-28 21:03:15 +02:00
Daniel Marjamäki 7c5219324e Refactoring: Cleanup include that checkheaders reported as not needed 2010-07-26 22:05:51 +02:00
Daniel Marjamäki e1612bc175 Fixed #1891 (Internal error when enum assigned to sizeof without brackets) 2010-07-22 22:21:12 +02:00
Robert Reif c572e6af87 Fixed #1846 (False positive with -s: Variable hides typedef with same name) 2010-07-13 08:08:12 +02:00
Robert Reif b0f1d5669b Fixed #1829 (### Internal error in Cppcheck. Please report it.) 2010-07-07 07:40:11 +02:00
Robert Reif 1799e4a575 Fixed #1827 (### Internal error in Cppcheck. Please report it.) 2010-07-06 08:26:30 +02:00
Robert Reif c949a29d1e Fixed #1821 (simplifyTypedef: better typedef support) 2010-07-05 23:03:54 +02:00
Robert Reif 28c265b20c Fixed #1821 (simplifyTypedef: better typedef support) 2010-07-02 15:22:29 +02:00
Robert Reif b33fb48618 Fixed #1816 (Tokenizer: remove restrict keyword) 2010-06-30 08:10:39 +02:00
Daniel Marjamäki 46e2f1e64b --author=Robert Reif <reif@earthlink.net>
Fixed #1814 (false positive: Variable hides typedef with same name)
2010-06-28 15:33:27 +02:00
Robert Reif ec61c6fa26 Fixed #1801 (simplifyTypedef: duplicate typedefs not handled properly) 2010-06-18 07:16:05 +02:00
Robert Reif f116e74f6e Fixed #1801 (Segmentation fault while scanning Qt's qcups.cpp) 2010-06-17 06:59:01 +02:00
Robert Reif 61e7e759f0 Fixed #1798 (structure templates) 2010-06-16 07:13:52 +02:00
Daniel Marjamäki f3fbdc96e1 Fixed #1788 (Tokenizer: template destructor is lost) 2010-06-12 08:32:05 +02:00
Robert Reif 6b65b77acf Fixed #1782 ((error) ### Internal error in Cppcheck. Please report it.) 2010-06-10 07:18:55 +02:00
Daniel Marjamäki 08b6e6ee09 Fixed #1717 (False positive: Resource leak with while) 2010-05-30 13:15:15 +02:00
Daniel Marjamäki 83c62eca9c Tokenizer: simplify loops that continue while errno is EINTR 2010-05-30 12:49:39 +02:00
Daniel Marjamäki 46b5e4e79a Fixed #1716 (Wrong reporting of leak with close() in a while loop condition) 2010-05-29 22:20:10 +02:00
Daniel Marjamäki d09e1df0d7 Fixed #1714 (Wrong precedence for shift operators when simplifying calculations?) 2010-05-29 20:27:08 +02:00
Robert Reif 1a25183e8f Fixed #1671 (simplifyTypedef: support for more typedefs) 2010-05-29 07:52:06 +02:00
Robert Reif 3fb0260ef1 Fixed #1713 (remove Microsoft variants of inline) 2010-05-29 07:43:58 +02:00
Robert Reif 26a7d29760 Fixed #1671 (simplifyTypedef: support for more typedefs) 2010-05-28 06:55:54 +02:00
Robert Reif 8881a0c361 Fixed #1671 (simplifyTypedef: support for more typedefs) 2010-05-27 07:00:33 +02:00
Robert Reif 019e1f9dfe Fixed #1671 (simplifyTypedef: support for more typedefs) 2010-05-25 20:43:44 +02:00
Daniel Marjamäki 78255fdfc5 Tokenizer: Removed the Tokenizer::simplifyNamespaces. Ticket: #1700 2010-05-23 13:51:41 +02:00
Robert Reif b20cf06b66 Fixed #1671 (simplifyTypedef: support for more typedefs) 2010-05-23 10:46:39 +02:00
Robert Reif 41c43c1790 Fixed #1691 (False positive: Function parameter 'x' is passed by value. It could be passed by reference instead.) 2010-05-18 18:20:11 +02:00
Robert Reif 0d7474042a Fixed #1685 (segmentation fault of cppcheck) 2010-05-18 07:11:23 +02:00
Robert Reif 9dfbd3946a Fixed #1673 (Tokenizer::simplifyTypedef causes segfault for boost library) 2010-05-17 19:58:27 +02:00
Erik Lax 19aaa32a99 Fixed #1688 (Tokenizer::simplifyKnownVariables and pointer assignments) 2010-05-16 19:38:44 +02:00
Daniel Marjamki 8b1ffefd74 Fixed #1682 (Internal error) 2010-05-14 18:40:15 +02:00
Robert Reif f8cceface5 Fixed #1677 (False positive: (style) Variable 'xxx' is assigned a value that is never used) 2010-05-13 13:59:41 +02:00
Robert Reif 963108d957 Fixed #1671 (simplifyTypedef: support for more typedefs) 2010-05-11 21:41:33 +02:00
Robert Reif a390f3c8f4 Better handling of function pointer typedef 2010-05-10 17:50:40 +02:00
Robert Reif ac7515cdcc Fixed #1666 (simplifyTypedef: add support for typedefs of functions) 2010-05-10 07:12:06 +02:00
Daniel Marjamäki 6bb93b5eb7 Fixed #943 (Tokenizer: improve handling of pointer aliasing) 2010-04-25 15:12:47 +02:00
Daniel Marjamäki 8ccd95a643 Fixed #836 (buffer overrun: memmove) 2010-04-24 21:48:58 +02:00
Robert Reif 99a7755218 tokenizer improvements: remove calling convention (#1619) 2010-04-24 09:40:05 +02:00
Robert Reif f4ce5a37d7 Fixed #1615 (False positive - C-style pointer casting) 2010-04-22 20:08:29 +02:00
Robert Reif 90541386da Fixed #1619 (tokenizer: remove calling convention) 2010-04-21 21:08:47 +02:00
Robert Reif bee4608b27 Fixed #1613 (False -s positive: Template instantiation hides typedef with same name) 2010-04-18 09:13:55 +02:00
Daniel Marjamäki c0e9a546f7 Refactoring: Refactoring the Settings class 2010-04-17 09:23:54 +02:00
Daniel Marjamäki c718a7c595 astyle: Update to astyle 1.24 2010-04-15 20:08:51 +02:00
Daniel Marjamäki 3fa2137ee3 Fixed #1596 ('Index out of bounds' false positive) 2010-04-15 19:09:19 +02:00
Robert Reif d2bb4964d0 Fixed #1588 (typedef struct incorrectly simplified) 2010-04-14 19:06:51 +02:00
Reijo Tomperi 0912836c25 Fix: sizeof(char*) was not simplified correctly 2010-04-13 23:17:27 +03:00
Reijo Tomperi 4a33b226e6 Fix #1599 (false positive on if( (f = fopen("foo", "r")) == ((FILE*)NULL) ))
http://sourceforge.net/apps/trac/cppcheck/ticket/1599
2010-04-13 22:57:52 +03:00
Reijo Tomperi 35d2a27b9c Update copyright year in all source files 2010-04-13 22:23:17 +03:00
Robert Reif 67fafd4028 Fixed #1588 (typedef struct incorrectly simplified) 2010-04-12 19:05:31 +02:00
Daniel Marjamäki e9b4ea44a2 Refactoring: Disable inconclusive checks. They can still be activated for debugging/testing purposes 2010-04-10 14:05:33 +02:00
Zachary Blair 3152816619 Fixed #779 (Tokenizer: delete register keyword everywhere) 2010-04-10 09:58:09 +02:00
Reijo Tomperi 6dc3860ae9 Fix more -Wshadow compile warnings 2010-04-09 22:40:37 +03:00
Robert Reif bc0a318b6d Fixed #1580 (unnamed anonymous struct can segfault) 2010-04-08 17:40:23 +02:00
Daniel Marjamäki f5b1a4db36 Refactoring unit testing 2010-04-04 19:28:15 +02:00
Daniel Marjamäki 0cad22314e Reverted 'astyle fix'. Those changes are not in sync with my astyle configuration/setup. 2010-04-02 07:30:58 +02:00
Martin Ettl 193aa7d1d3 astyle fix 2010-04-02 02:21:53 +02:00
Robert Reif 62d2845014 Fixed #1492 (false negatives: array index out of bounds) 2010-03-28 15:56:13 +02:00
Reijo Tomperi 86fabd03b3 Fix #1532 (hang due to commit 772aa95c8a)
http://sourceforge.net/apps/trac/cppcheck/ticket/1532
2010-03-27 21:52:31 +02:00
Robert Reif 9c2248254e Here is a patch that adds support for derived structs and fixes a bug that missed some nested structs. (#1493) 2010-03-19 16:17:25 +01:00
Robert Reif 5ea7e32bf9 Partial fix for #1493 (false positives: function can be const and struct or union member is never used) 2010-03-18 18:14:52 +01:00
Daniel Marjamäki 89719b023e unit testing: made Tokenizer functions public so they can be unit tested 2010-03-17 22:08:02 +01:00
Robert Reif b3856cbc5e Fixed #1506 (typedef name hiding check combined with forward declaration leeds to false positive) 2010-03-17 17:31:08 +01:00
Daniel Marjamäki 12c45a1aba Fixed #1476 (false positive: Uninitialized variable) 2010-03-16 19:53:09 +01:00
Daniel Marjamäki 772aa95c8a Fixed #1477 (false positive: Uninitialized variable when pointer given to struct) 2010-03-13 11:52:48 +01:00
Daniel Marjamäki 587081cab5 Fixed #1488 (Invalid warning about shadowed variable) 2010-03-10 16:47:39 +01:00
Daniel Marjamäki 770d2ff835 Simplify enum: Fixed segmentation fault if code ends with enum type id 2010-03-07 13:01:56 +01:00
Daniel Marjamäki fa493b7fd1 Fixed #1474 (segmentation fault of cppcheck) 2010-03-07 12:50:45 +01:00
Reijo Tomperi b88126a669 Fix #1469 (False positive: Resource leak when fclose() is inside while)
http://sourceforge.net/apps/trac/cppcheck/ticket/1469
2010-03-06 16:28:52 +02:00
Daniel Marjamäki fe30c1ca9d Fixed #1432 (false positive: uninitialized variable) 2010-03-06 13:48:43 +01:00
Reijo Tomperi d881fd7a31 Partial fix #1464 (takes too long (days) to process some files)
Fix template functions that return "&T".
http://sourceforge.net/apps/trac/cppcheck/ticket/1464
2010-03-03 23:02:32 +02:00
Daniel Marjamäki 50210857a6 Fixed #1439 (false positive: memory leak when using realloc) 2010-02-27 19:41:14 +01:00
Daniel Marjamäki a8ee4a03f0 Fixed #1456 (PATCH: Variable hides typedef with same name false positive) 2010-02-27 07:27:51 +01:00
Daniel Marjamäki ce0131a1e6 Fixed #1397 (false positive: Memory leak in while loop) 2010-02-26 22:14:56 +01:00
Robert Reif 54bf67e766 Fixed #1456 (PATCH: Variable hides typedef with same name false positive) 2010-02-26 21:43:00 +01:00
Robert Reif f4d600e93b Fixed #1457 (PATCH: Variable hides enumerator with same name false negative) 2010-02-26 21:40:57 +01:00
Daniel Marjamäki 377d3091a9 Fixed #1452 (Simplify goto better) 2010-02-25 20:03:39 +01:00
Robert Reif f9d444ed52 Fixed #1445 (segfault in Tokenizer::simplifyRedundantParanthesis()) 2010-02-25 07:24:32 +01:00
Reijo Tomperi 01c5bdfc68 Add TODO test case for #1452 (Simplify goto better)
http://sourceforge.net/apps/trac/cppcheck/ticket/1452
2010-02-24 22:55:16 +02:00
Robert Reif 7d8adfb4df Fixed #1449 (segmentation fault of cppcheck) 2010-02-24 17:50:02 +01:00