Commit Graph

761 Commits

Author SHA1 Message Date
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 7e7f6eecf5 Fixed #2794 (Improper hanling of preprocessor directives #if defined) 2011-07-20 23:50:57 +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 35938e74ad Tokenizer: better handling of 'struct AB ab; sizeof(ab)' 2011-07-16 22:07:30 +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 597733bec4 Tokenizer: minor update to handle C# code better 2011-07-16 18:12:55 +02:00
Daniel Marjamäki 274fd2b985 Tokenizer: Fix minor problem with 'X&&Y' 2011-07-15 19:37:39 +02:00
Daniel Marjamäki 66d145ba1c Fixed #2892 (false positive: (portability) Assigning an address value to the integer (int/long/etc) type is not portable) 2011-07-07 15:14:33 +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
Daniel Marjamäki db4a28d60b Tokenizer::simplifyGoto: Only simplify the last label in the function. If there are many labels in the same function and all labels are simplified, this function becomes very slow. 2011-07-01 18:07:41 +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 77859b9a0f fix #2878 (derived global class not tokenized properly (class A : ::B { };)) 2011-06-30 07:25:36 -04: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 443dd4c392 partial fix for #2867 handle derived class 2011-06-29 19:39:19 -04:00
Robert Reif 1286898fa0 fix #2864 (--errorlist missing errors: variableHidingTypedef and Extra qualification) 2011-06-28 21:46:54 -04:00
Robert Reif f403de7bad partial fix for #2867 Tokenizer::removeRedundantAssignment didn't understand function local class and removed class variable 2011-06-28 19:48:28 -04:00
Robert Reif 70a32fc245 fix #2875 (segmentation fault of cppcheck ( 0; (a) < (a) )) 2011-06-28 18:47:18 -04: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
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 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 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 d1b260699a fix #2834 (crash of cppcheck (std::vector<int>::iterator)) 2011-06-12 08:24:49 -04:00
Robert Reif 5e3263235b fix #2739 (segmentation fault of cppcheck ( if()x )) 2011-06-11 15:51:12 -04:00
Robert Reif 3d4eb0d77e fix #2682 (segmentation fault of cppcheck ( x a[0] = )) 2011-06-10 15:11:45 -04:00
Robert Reif a9e2e15e40 improve #2828 fix by adding switch 2011-06-09 07:32:43 -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 a7fe9a3b50 fix 2 use after frees in simplifyEnum found by visual studio and verified by valgrind 2011-06-03 21:50:08 -04:00
Robert Reif 311651cc66 fix #2804 (Underlying type of enumerator produces a syntax error) 2011-05-27 11:17:39 -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 03cd57260a added comment about how bad typedef behaviour can be reproduced 2011-05-07 14:40:47 +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
Robert Reif 51baca0359 fix #1982 (simplifyTypedef: scope info is lost) 2011-05-02 22:42:52 -04:00
Daniel Marjamaki 297ca63868 Fixed #2721 (Tokenizer::simplifyTemplates: fail when using template argument 'char[2]') 2011-05-01 19:05:18 +02:00
Daniel Marjamäki bb3c135d81 Tokenizer: Moved a few basic simplifications from simplifyTokenList to tokenize 2011-05-01 08:36:27 +02:00
Daniel Marjamäki 168bd2ebfc Fixed #2760 (false positive: uninitialized variable ', (a) =') 2011-05-01 08:27:59 +02:00
Daniel Marjamäki fb32d5111e Fixed #2755 (cppcheck goes into infinite loop while scanning OpenSSL sources) 2011-04-29 19:47:39 +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 3c415e7833 fix #2745 (Enum vs local variable - conflict) 2011-04-23 22:08:03 -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 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
Martin Exner 2b08744b97 Fixed #2676 (setVarId: variables with global scope qualification :: don't get varids) 2011-04-18 06:56:39 +02:00
Daniel Marjamäki 05f59a1567 Tokenizer: Fixed bug. When varid is 0 then %varid% doesn't work. Ticket: #2723 2011-04-16 17:45:14 +02: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
Daniel Marjamäki 58dbbb0cab Inconclusive checking: Report inconclusive errors with reportInconclusiveError. It takes the same parameters as reportError. 2011-04-14 18:02:01 +02:00
Daniel Marjamäki 7021e3224b Fixed #2714 (False positive: ternary operator and += style warning.) 2011-04-14 17:30:50 +02: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
Daniel Marjamäki 11bd6bcd30 Fixed #2712 (false positive: Division by zero) 2011-04-10 21:27:09 +02:00
Daniel Marjamäki 1d86fb1738 Tokenizer: Code cleanup. Use %oror% to simplify code. 2011-04-10 11:55:15 +02:00
Daniel Marjamäki 0a1d6efe8c Tokenizer: Use %op% in simplifyOperatorName 2011-04-10 11:24:57 +02:00
Daniel Marjamäki f179df1f10 Tokenizer: Use %op% in simplifyCalculations 2011-04-10 11:22:00 +02:00
Daniel Marjamäki 57869e96e3 Tokenizer: Use %op% to clean up pattern 2011-04-10 11:09:49 +02:00
Daniel Marjamäki 970c989023 Tokenizer: Code cleanup. Removed redundant variable 2011-04-10 09:20:37 +02:00
Daniel Marjamäki f4f8aeca03 Tokenizer: Fixed bug in last commit 2011-04-10 09:18:37 +02:00
Daniel Marjamäki 4c753ca5ac Tokenizer: Use the %oror% in multiCompare patterns 2011-04-10 09:16:29 +02:00
Daniel Marjamäki a4471bc150 Refactoring: Use %op% 2011-04-09 18:33:37 +02:00
Daniel Marjamäki 447f61e9c7 Refactoring: Use %op% 2011-04-09 18:30:47 +02:00
Daniel Marjamäki 0730fad778 Refactoring: Use %op% 2011-04-09 18:24:41 +02:00
Daniel Marjamäki 6c4f5fc496 Token::multiCompare : allow that %op% is used in multiCompare pattern 2011-04-09 18:09:13 +02:00
Daniel Marjamäki 575cb242c2 Refactoring: Use Token::isOp 2011-04-09 16:22:47 +02:00
Daniel Marjamäki f6d910ab3d Refactoring: Use Token::isOp 2011-04-09 15:54:36 +02:00
Daniel Marjamäki 8e711b7925 Refactoring: there was almost duplicate functions 'isOp'. Created a new Token::isOp function instead. 2011-04-08 19:40:22 +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 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
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 fc258164cd fix #2675 (false positive: syntax error) 2011-03-24 22:26:42 -04:00
Robert Reif cbc81e20f5 fix Tokenizer::simplifyVarDecl() template assignment 2011-03-23 21:15:49 -04:00
Robert Reif 7e3e5d628d better fix for #2672 (False positive: function can be const, nested classes declared in one line) 2011-03-23 20:19:32 -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
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