Commit Graph

509 Commits

Author SHA1 Message Date
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
Daniel Marjamäki ed8cdddcf5 Tokenizer: execute the simplifyIfNot and simplifyIfNotNull in the normal token list. ticket #2642 2011-04-02 21:21:05 +02:00
Daniel Marjamäki ae2a8d839b Fixed #2693 (__declspec attribute not removed properly) 2011-03-30 19:49:55 +02:00
Stefan Weil 675e63b6a7 Spell checks 2011-03-30 16:45:31 +02:00
Robert Reif e9a23d9cb5 fix #2692 (False positive: if parsed as function in operator >>) 2011-03-28 20:02:06 -04:00
Daniel Marjamäki e89f6d6ec0 Fixed #2660 (False positive: Variable 'v' is assigned a value that is never used) 2011-03-27 08:19:09 +02:00
Daniel Marjamäki 3c2d3ca3a4 Fixed #2653 (segmentation fault of cppcheck 'x=b=0;') 2011-03-26 12:20:23 +01:00
Daniel Marjamäki 7d9872a134 Tokenizer::setVarId: Prevent that wrong varid is given when uncertain. Ticket: #2680 2011-03-26 10:05:07 +01:00
Daniel Marjamäki 2b1277aa64 Fixed #2680 (setVarId: variables with class qualification don't get varid) 2011-03-26 08:56:41 +01:00
Robert Reif 710eb8ffd9 add support for global namespace to Tokenizer::simplifyVarDecl() 2011-03-24 23:06:20 -04:00
Robert Reif cbc81e20f5 fix Tokenizer::simplifyVarDecl() template assignment 2011-03-23 21:15:49 -04:00
Robert Reif 3259239dfe fix #2672 (False positive: function can be const, nested classes declared in one line) 2011-03-23 07:48:18 -04:00
Robert Reif c043e6e1a2 fix 2011-03-21 20:57:17 -04:00
Robert Reif dc0dfea079 fix invalid bitfield match and simplification that created invalid code 2011-03-21 20:17:14 -04:00
Robert Reif fc13854095 fix #1280 (Pointer to function support) 2011-03-19 16:21:26 -04:00
Robert Reif 92316e5745 fix #1987 (Internal error:: CheckClass::SpaceInfo::getVarList found variable 'element_size' with varid 0.) 2011-03-19 16:00:43 -04:00
Daniel Marjamäki 31af3a64bc Tokenizer::setVarId: Fixed problem with same variable name in multiple classes 2011-03-19 11:09:51 +01:00
Daniel Marjamäki 45a3828da7 Tokenizer::setVarId: Better handling of class declarations when variable usage comes before variable declaration 2011-03-19 09:04:03 +01:00
Robert Reif afc7fd82ed #2630 (segmentation fault of cppcheck (template <typedef A>) 2011-03-18 20:44:58 -04:00
Daniel Marjamäki 07fe361964 Fixed #2638 (Tokenizer::setVarId : varid is wrongly given when unknown macro is used) 2011-03-13 17:52:45 +01:00
Daniel Marjamäki 5a0ec56fc2 Fixed #2632 (segmentation fault of cppcheck ( void>(); void>() )) 2011-03-09 21:25:44 +01:00
Daniel Marjamäki 0b8581e717 Fixed #2620 (Tokenizer::setVarId : wrong handling of member function parameters) 2011-03-08 20:41:41 +01:00
Daniel Marjamäki 779dba9160 Fixed #2612 (segmentation fault of cppcheck ( <><< )) 2011-03-06 09:33:46 +01:00
Daniel Marjamäki d7a6e729b8 Tokenizer::simplifyKnownVariables: Don't simplify 'strcpy(a,"ab"); b=a;'. Ticket: #2031 2011-03-03 20:07:56 +01:00
Daniel Marjamäki 8e9a1c33ad Fixed #2618 (Tokenizer::simplifyKnownVariables: Don't use known string value if address is wanted) 2011-03-01 20:20:48 +01:00
Daniel Marjamäki db04d7b71e Fixed #2616 (Segmentation fault with unknown macro) 2011-03-01 18:02:50 +01:00
Robert Reif 92efbd748e fix #2595 bitfield fix for case x: break; and default: break; 2011-02-28 19:35:00 -05:00
Daniel Marjamäki 893b84a87c Fixed #2615 (Segmentation fault in cppcheck 1.47) 2011-02-28 20:29:34 +01:00
Daniel Marjamäki c1c9b96bb6 Fixed #2031 (Tokenizer: simplify known value (string has known value after strcpy)) 2011-02-26 21:11:56 +01:00
Daniel Marjamäki 9bf6e67898 Fixed #2610 (segmentation fault of cppcheck ( if () < {} )) 2011-02-24 18:49:16 +01:00
Robert Reif 763763fa9b fix bitfields to support non-numeric bitfield width 2011-02-20 18:22:49 -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 cf2a04377e Fixed #2586 (segmentation fault of cppcheck (template<>)) 2011-02-17 21:15:17 +01:00
Daniel Marjamäki 54e0b60cc5 Fixed #2584 (false positive 'variable n is never used') 2011-02-16 20:33:24 +01:00
Daniel Marjamäki 0d2d0c864a Tokenizer::simplifyKnownVariables: Fixed TODO testcases (better handling of comparisons) 2011-02-13 22:24:45 +01:00
Daniel Marjamäki 2182ede486 Tokenizer::simplifyKnownVariables: Fixed TODO testcase (better handling of ^) 2011-02-13 22:13:19 +01:00
Daniel Marjamäki 472d8154ca Tokenizer::simplifyKnownVariables: Fixed TODO testcase (better handling of |) 2011-02-13 22:09:04 +01:00
Daniel Marjamäki 467c984cd1 Tokenizer::simplifyKnownVariables: Fixed TODO testcase (better handling of %) 2011-02-13 22:03:46 +01:00
Daniel Marjamäki 07e8325e50 Fixed #2549 (segmentation fault of cppcheck) 2011-02-12 16:51:59 +01:00
Robert Reif 95e917b27f Tokenizer: Replace __null with 0 (gcc constant) 2011-02-05 09:03:31 +01:00
Daniel Marjamäki defeded4b5 Fixed #2529 (False positive: array 'req[3]' index 4 out of bounds) 2011-02-01 21:46:07 +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 49fc53165c Tokenizer: remove some unhandled macros in the global scope. ticket: #2523 2011-01-30 08:34:58 +01:00
Daniel Marjamäki a299411a82 Tokenizer: Better simplifications of static constants 2011-01-29 16:14:09 +01:00
Daniel Marjamäki 83625d8055 Fixed #2505 (Check processing of a preprocessor macro 'FREE') 2011-01-28 09:19:30 +01:00
Daniel Marjamäki 88abeeebba Fixed #2518 (Crash when checking rockbox's firmwire) 2011-01-27 21:16:25 +01: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 bc31f317bc Fixed #2491 (Tokenizer::setVarId : wrong handling of function call: 'a(b * c, 1);') 2011-01-22 09:27:16 +01:00
Daniel Marjamäki f72fd6960e Fixed #2449 (segfault in tokenize.cpp, incorrect parsing) 2011-01-16 11:54:28 +01:00
Daniel Marjamäki 97d0755750 Fixed #2454 (Tokenizer::simplifyKnownVariables: problem with float/double variables) 2011-01-15 08:48:42 +01:00
Daniel Marjamäki cf32016444 removed old comment 2011-01-15 08:30:54 +01:00
Daniel Marjamäki 79e52a8c45 Fixed #2296 (Tokenizer: simplifyKnownVariable doesn't simplify pointer properly 'delete [] p;') 2011-01-11 19:34:35 +01:00
Reijo Tomperi 226b605774 Change year 2010 -> 2011 in license texts. 2011-01-09 21:33:36 +02:00
Daniel Marjamäki 0b0c46e373 astyle formatting 2011-01-09 18:39:59 +01:00
Daniel Marjamäki 88abb32ddf Fixed #2429 (Tokenizer: Wrong simplification of 'sizeof .1250E+04') 2011-01-09 10:09:54 +01:00
Daniel Marjamäki 1b3a5ed0be Tokenizer: simplify NULL to 0 in the normal token list 2011-01-06 20:16:14 +01:00
Daniel Marjamäki d700f25518 Fixed #2399 (Tokenizer::simplifyKnownVariables: variables in conditions) 2011-01-04 21:35:35 +01:00
Daniel Marjamäki 63c1ee375e Fixed #2398 (false positive: Uninitialized variable) 2011-01-04 19:36:29 +01:00
Daniel Marjamäki 92acca3d0c Fixed #2368 (assigned a value that is never used) 2010-12-27 20:49:07 +01:00