Commit Graph

353 Commits

Author SHA1 Message Date
Slava Semushin 58a9e05697 Fixed #696 (Tokenizer: Simplify array declaration)
http://sourceforge.net/apps/trac/cppcheck/ticket/696
2009-09-20 17:28:15 +07:00
Daniel Marjamäki 7f2ca357b0 Fixed #673 (False positive: null pointer dereference when dynamic cast is used) 2009-09-19 10:54:10 +02:00
Reijo Tomperi 55fc473a00 Fix #684 (Tokenizer: (65536*72/100) incorrectly simplified to zero)
http://sourceforge.net/apps/trac/cppcheck/ticket/684
2009-09-15 23:38:54 +03:00
Daniel Marjamäki 020321769c Fixed #658 (Assertion 'begin != __null' failed) 2009-09-14 21:49:41 +02:00
Reijo Tomperi 2b6955dde5 Fix #670 (Tokenizer: Simplify '\0' into 0)
http://sourceforge.net/apps/trac/cppcheck/ticket/670
2009-09-14 21:42:56 +03:00
Daniel Marjamäki e3119235e0 Tokenizer: Added a simple validation function that we can use during debugging 2009-09-13 15:35:37 +02:00
Daniel Marjamäki 62bdf032ac simplifyTemplates: assert that braces and parantheses are handled correctly 2009-09-13 15:00:48 +02:00
Slava Semushin 0fb89f8afa Fixed #645 (Tokenizer::simplifyCasts() breaks link() if casts function)
http://sourceforge.net/apps/trac/cppcheck/ticket/645
2009-09-13 17:31:32 +07:00
Slava Semushin eb6b5cfce6 Tokenizer::simplifyMathFunctions(): change return type to void.
Correction for 241f585d34 commit.

No functional change.
2009-09-13 14:53:15 +07:00
Daniel Marjamäki c0ca375ef7 Fixed #478 (Warnings in Visual Studio build with -W4) 2009-09-13 09:03:48 +02:00
Reijo Tomperi 241f585d34 Fix #594 (division by zero not detected when using atol or atof)
http://sourceforge.net/apps/trac/cppcheck/ticket/594
Simplify atol("0") into 0 (and other atol() calls also)
2009-09-12 23:54:47 +03:00
Daniel Marjamäki 7479b943cc Fixed #644 (Tokenizer::simplifyComma: Wrong simplification in cast) 2009-09-12 08:12:00 +02:00
Reijo Tomperi a6c809226e Fix #656 (Improve const-correctness)
http://sourceforge.net/apps/trac/cppcheck/ticket/656
Applied slightly modified patch from elfring
2009-09-10 00:25:58 +03:00
Slava Semushin 572c206755 Refactoring: move code for sizeof() simplification to method.
Introduce and use Tokenizer::simplifySizeof() method.

No functional change.
2009-09-06 18:23:17 +07:00
Slava Semushin 587e96322d Tokenizer(simplifyNestedStrcat): correctly set line numbers for new tokens.
Pointed out by aggro80@ in IRC. Thanks!
2009-09-06 17:33:55 +07:00
Daniel Marjamäki 535fe17ffd Templates: Scaled up the handling of default values for template parameters (#638) 2009-09-06 08:22:45 +02:00
Reijo Tomperi 75a65a02a8 Fix another issue related to #647 (Crash during tokenizing (wrong) K&R function declaration)
http://sourceforge.net/apps/trac/cppcheck/ticket/647
2009-09-05 23:41:39 +03:00
Reijo Tomperi a3d9863725 Fix #647 (Crash during tokenizing (wrong) K&R function declaration)
http://sourceforge.net/apps/trac/cppcheck/ticket/647
Thanks to undingen for providing a patch
2009-09-05 22:21:25 +03:00
Slava Semushin a9273c9d39 Fixed #629 (Tokenizer: expand nested strcat() calls)
http://sourceforge.net/apps/trac/cppcheck/ticket/629
2009-09-05 23:46:27 +07:00
Daniel Marjamäki 7a9e4a7bd4 templates: remove typename tokens 2009-09-03 22:19:44 +02:00
Daniel Marjamäki 2719724a97 templates: Quick fix for the problem with default value for a template argument 2009-09-03 21:46:07 +02:00
Slava Semushin 92f436b474 Tokenizer::syntaxError(): throw exception when debug enabled.
This allows to stop test suite when first syntax error found.
2009-09-02 00:38:49 +07:00
Slava Semushin 953183d905 Print error messages to stderr (instead of stdout). 2009-09-02 00:38:43 +07:00
Slava Semushin d8f2ec934b Tokenizer::syntaxError: show details about unlogged syntax error. 2009-09-01 23:58:36 +07:00
Daniel Marjamäki 03d7573208 Borland C++: Don't warn about uninitialized variables that are declared in the __published section. These are auto-initialized 2009-08-31 19:40:49 +02:00
Daniel Marjamäki f9b84805d9 Refactoring: Use the Token::link 2009-08-30 10:27:26 +02:00
Reijo Tomperi fc343b3e9e astyle fix 2009-08-29 23:33:12 +03:00
Slava Semushin d3118d85c0 Tokenizer::setVarId(): simplify code a bit.
No functional change.
2009-08-30 03:25:14 +07:00
Slava Semushin 6bb6cbadc2 Tokenizer::setVarId(): use Token::link() instead of loop.
No functional change.
2009-08-30 03:17:01 +07:00
Slava Semushin 00113eea92 Tokenizer::setVarId(): simplify condition.
No functional change.
2009-08-30 03:12:08 +07:00
Slava Semushin fd94bb0cea Tokenizer: don't call simplifyCalculations() twice.
No functional change.
2009-08-30 02:42:28 +07:00
Slava Semushin 18fd2528f8 Tokenizer::simplifyFunctionParameters(): change return type to void.
No functional change.
2009-08-30 02:37:15 +07:00
Slava Semushin 19e327607f Tokenizer::simplifyConditionOperator(): change return type to void.
No functional change.
2009-08-30 02:33:21 +07:00
Slava Semushin 33ee1b8d98 Tokenizer::elseif(): change return type to void.
No functional change.
2009-08-30 02:33:14 +07:00
Slava Semushin 8efacf5dc3 Tokenizer::simplifyDoWhileAddBraces(): change return type to void.
No functional change.
2009-08-30 02:33:03 +07:00
Slava Semushin a1f40f3c17 Tokenizer::simplifyIfAddBraces(): change return type to void.
No functional change.
2009-08-30 02:32:45 +07:00
Slava Semushin ea45d985c7 Tokenizer::simplifyComma(): change return type to void.
No functional change.
2009-08-30 02:23:39 +07:00
Slava Semushin 80a305a2ce Tokenizer::simplifyIfNotNull(): change return type to void.
No functional change.
2009-08-30 02:21:06 +07:00
Slava Semushin 3f905da9c6 Tokenizer::simplifyIfNot(): change return type to void.
No functional change.
2009-08-30 02:19:45 +07:00
Slava Semushin b435764083 Tokenizer::simplifyIfAssign(): change return type to void.
No functional change.
2009-08-30 02:17:17 +07:00
Slava Semushin 030a0c19df Tokenizer::simplifyVarDecl(): change return type to void.
No functional change.
2009-08-30 02:07:09 +07:00
Slava Semushin 1cb1709d7c Tokenizer::simplifyCasts(): change return type to void.
No functional change.
2009-08-30 02:06:14 +07:00
Slava Semushin 6f93182580 Tokenizer::simplifyLogicalOperators(): change return type to void.
No functional change.
2009-08-30 02:03:37 +07:00
Slava Semushin 085187b445 Tokenizer: enhance simplifyNot() and rename to simplifyLogicalOperators().
Don't replace "and" everything becuse it may be used as variable name.

Better fix for #620
Corrections for commit eb05cf904d
2009-08-29 20:42:14 +07:00
Slava Semushin 0582572867 Tokenizer(simplifyNot): replace "if" by "else if" and added braces.
No functional change.
2009-08-29 20:32:48 +07:00
Slava Semushin eb05cf904d Fixed #620 (Tokenizer: replace "and" by "&&")
http://sourceforge.net/apps/trac/cppcheck/ticket/620
2009-08-29 19:26:01 +07:00
Slava Semushin 840bbcfcbb Tokenizer(simplifyIfAssign): fixed to link() just inserted tokens.
Fixed segfault on samba sources.
2009-08-29 18:10:43 +07:00
Slava Semushin d6017756f4 Tokenizer(simplifyComma): join two if bodies to one.
No functional change.
2009-08-29 16:48:44 +07:00
Slava Semushin ae413a1ef0 Fixed #618 (Tokenizer: Wrong handling of enum)
http://sourceforge.net/apps/trac/cppcheck/ticket/618
2009-08-29 16:42:42 +07:00
Slava Semushin fe1101771a Tokenizer: call createLinks() only once.
Fixed simplifyIfAssign() and simplifyIfNot() to link() just inseted
tokens.

No functional change.
2009-08-29 16:10:04 +07:00
Reijo Tomperi 0f0d7e92ee Fixed bug in Token::deleteThis and optimized createLinks() calls. 2009-08-28 23:31:11 +03:00
Reijo Tomperi bf4ac5521d astyle fix 2009-08-28 23:29:08 +03:00
danmar 4f6b79b761 Fixed #625 (cppcheck dumps core on valid code) 2009-08-28 12:57:29 +02:00
danmar bb2bda0be4 Fixed #622 (Tokenizer: Calculations are wrong) 2009-08-28 12:13:46 +02:00
Slava Semushin dd64637ff1 Fixed #616 (Tokenizer: simplifyTemplates() should link() all inserted brackets)
This also fixed #619.

http://sourceforge.net/apps/trac/cppcheck/ticket/616
http://sourceforge.net/apps/trac/cppcheck/ticket/619
2009-08-27 23:45:59 +07:00
Slava Semushin 9e32a0a595 Revert "Fixed #616 (cppcheck crashes with Eigen/src/Cholesky/CholeskyInstantiations.cpp)"
This reverts commit 89f9645174.

This change not fully and properly fixes a problem but just work
arround it. The root of problem is because
Tokenizer::simplifyTemplates() inserts new tokens with brackets which
not link()-ed.
2009-08-27 23:40:58 +07:00
Daniel Marjamäki f94aab35e7 Fixed #498 (Tokenizer: simplify 'goto') 2009-08-26 18:46:56 +02:00
Slava Semushin 89f9645174 Fixed #616 (cppcheck crashes with Eigen/src/Cholesky/CholeskyInstantiations.cpp)
http://sourceforge.net/apps/trac/cppcheck/ticket/616
2009-08-26 23:44:01 +07:00
Slava Semushin 9a2a12c333 Tokenizer(simplifyGoto): create links for inserted braces. 2009-08-26 01:58:50 +07:00
Daniel Marjamäki 9569f758f8 fixed segmentation fault 2009-08-25 17:54:04 +02:00
Daniel Marjamäki c25e1963b1 Fixed #498 (Tokenizer: simplify 'goto') 2009-08-24 23:10:12 +02:00
Slava Semushin 8cafaf2960 Fixed #603 (Tokenizer: Incorrect simplification of < >)
http://sourceforge.net/apps/trac/cppcheck/ticket/603
2009-08-23 13:26:16 +07:00
Slava Semushin 703fd45f78 Tokenize: minimize createLinks() calls.
No functional change.
2009-08-23 10:36:34 +07:00
Slava Semushin 7ac6162947 Token::createMutualLinks(): introduce and use.
No functional change.
2009-08-22 21:22:50 +07:00
Slava Semushin 368bacff9a Tokenizer: propagate Token::eraseTokens().
No functional change.
2009-08-22 21:04:58 +07:00
Slava Semushin 282f9104e7 Tokenizer::simplifyTokenList(): call link() for just inserted tokens. 2009-08-22 20:41:26 +07:00
Slava Semushin 6a5afd6243 Refactoring: Use the MathLib::toString() to stringify a number.
No functional change.
2009-08-22 18:47:14 +07:00
Slava Semushin acc38a8bbf Fixed #592 (Tokenizer: improve the tokenization of do .. while)
http://sourceforge.net/apps/trac/cppcheck/ticket/592
2009-08-22 17:49:42 +07:00
Daniel Marjamäki 94c49bc34e Fixed #608 (Tokenizer: simplifyKnownVariables doesn't handle 'while (--i)' correctly) 2009-08-22 10:23:55 +02:00
Slava Semushin 2664bcf650 Tokenizer::simplifyIfAddBraces: use Token::link() instead of loop.
No functional change.
2009-08-22 14:54:28 +07:00
Slava Semushin cbeb45566b Fixed #609 (Tokenizer: don't add {} after do-while();)
http://sourceforge.net/apps/trac/cppcheck/ticket/609
2009-08-22 14:49:45 +07:00
Reijo Tomperi 9d1907be66 Fix ticket #600 (Tokenizer: if(!(fclose(fd) == 0)) is simplified incorrectly)
http://sourceforge.net/apps/trac/cppcheck/ticket/600
2009-08-20 22:37:05 +03:00
Reijo Tomperi 4f8a06ed0d Initial work for class and member function/variable list in tokenizer. 2009-08-12 23:50:03 +03:00
Slava Semushin 6a7624054e Fixed ticket #584 (Tokenizer: don't set varId for class declaration)
http://sourceforge.net/apps/trac/cppcheck/ticket/584
2009-08-12 01:58:49 +07:00
Slava Semushin c66103f7bc Fixed ticket #574 (Tokenizer: not assign varId when variable first afer keyword and has long type)
http://sourceforge.net/apps/trac/cppcheck/ticket/574
2009-08-09 15:41:31 +07:00
Slava Semushin 1fd2c0ff28 Fixed ticket #572 (Tokenizer: improve detection of arrays)
http://sourceforge.net/apps/trac/cppcheck/ticket/572
2009-08-09 15:16:37 +07:00
Slava Semushin 50f7fa5828 Fixed ticket #565 (Tokenizer: simplify variable declaraion like 'int z = x >> 16')
http://sourceforge.net/apps/trac/cppcheck/ticket/565
2009-08-08 17:33:07 +07:00
Reijo Tomperi e93179dd9a Improve speed with files containing classes.
E.g. measured speed difference was 1m11.042s --> 0m45.005s with one large test file.
2009-08-08 00:49:37 +03:00
Reijo Tomperi d719606201 Fixed ticket #564 (set variable id for "struct ABC **p")
http://sourceforge.net/apps/trac/cppcheck/ticket/564
2009-08-07 00:31:39 +03:00
Reijo Tomperi 80953633ee Fix ticket #563 (set variable id for **p)
http://sourceforge.net/apps/trac/cppcheck/ticket/563
2009-08-06 23:11:29 +03:00
Reijo Tomperi eb691857fd Improve speed a lot for files that have long number lists like = { 0,1,2,3,4, etc. } 2009-08-05 23:02:40 +03:00
Daniel Marjamäki e1beb70f80 Fixed #558 (Tokenizer: Bad simplification of 'for(unsigned i = 0; i < 100; ++i)') 2009-08-05 20:15:48 +02:00
Daniel Marjamäki 1c59e4a51b Fixed #528 (Tokenizer: Simplify: 'if(!(a->x=b()))') 2009-08-05 19:45:05 +02:00
Reijo Tomperi e0f416e52e astyle fix 2009-08-02 22:11:17 +03:00
Slava Semushin 35e35b38a7 MathLib: introduce and use calculate() method.
No functional change.
2009-08-02 19:29:30 +07:00
Slava Semushin 98e8e69c8e src/tokenize.cpp: don't call std::string.c_str() for Token::str() argument.
In 4286fdbabb commit I introduce
Token::str() method with std::string argument and now we may get rid
of useless std::string.c_str() calls.

No functional change.
2009-08-02 15:54:46 +07:00
Slava Semushin ed86eda07d Fixed ticket #549 (Tokenizer: improve calculation simplification)
http://sourceforge.net/apps/trac/cppcheck/ticket/549
2009-08-02 15:45:33 +07:00
Slava Semushin 0445edf6fe Fixed #542 (Tokenizer: allow numbers in templates parameters)
http://sourceforge.net/apps/trac/cppcheck/ticket/542
2009-08-01 23:17:35 +07:00
Slava Semushin 0e2273833e Fixed ticket #539 (Tokenizer: don't replace constants variables with varid 0)
http://sourceforge.net/apps/trac/cppcheck/ticket/539
2009-08-01 20:57:54 +07:00
Slava Semushin 8588012df7 Fixed #521 (Tokenizer: improve static variable detection)
Also change cppcheck default behavior to don't show "If you see this,
there is a bug" message for each variable without varId. This feature
was very helpful for developers but may annoying users.

http://sourceforge.net/apps/trac/cppcheck/ticket/521
2009-08-01 00:40:36 +07:00
Slava Semushin fa8e1c82f0 Fixed ticket #534 (Segmentation fault when checking VLC sourcecode)
Fixed all valgrind errors.

http://sourceforge.net/apps/trac/cppcheck/ticket/534
2009-07-31 23:06:16 +07:00
Slava Semushin 5db677bc30 Fixed ticket #523 (Tokenizer: set varId for types with long namespaces)
FIXME: skip namespaces by the best way.

http://sourceforge.net/apps/trac/cppcheck/ticket/533
2009-07-31 00:40:41 +07:00
Slava Semushin 681b836389 Fixed ticket #532 (Tokenizer: set varId for types which have comma in template parameter)
http://sourceforge.net/apps/trac/cppcheck/ticket/532
2009-07-31 00:25:26 +07:00
Reijo Tomperi b56fdb83da Fixed ticket #529 (Tokenizer: simplify if((x==0)))
http://sourceforge.net/apps/trac/cppcheck/ticket/529
2009-07-30 00:37:01 +03:00
Slava Semushin 8b0c1daf98 Fixed ticket #522 (Tokenizer: recognize comma in container with STL type declaration)
http://sourceforge.net/apps/trac/cppcheck/ticket/522
2009-07-29 02:46:33 +07:00
Slava Semushin f50aa1e188 Fixed ticket #520 (Tokenizer: properly set varId for containers with STL types)
http://sourceforge.net/apps/trac/cppcheck/ticket/520
2009-07-29 00:54:13 +07:00
Slava Semushin c8caefa94c Fixed ticket #519 (Tokenizer converts commas in for-loops)
http://sourceforge.net/apps/trac/cppcheck/ticket/519
2009-07-28 23:40:15 +07:00
Slava Semushin 600f3a834d Fixed ticket #514 (false positive:: memory leak when using comma near delete[])
http://sourceforge.net/apps/trac/cppcheck/ticket/514
2009-07-28 02:13:08 +07:00
Slava Semushin 5ce151983e Replace simpleMatch() to operator==() from std::string.
No functional change.
2009-07-28 00:13:11 +07:00
Daniel Marjamäki b4a6d74e42 astyle formatting 2009-07-26 22:13:08 +02:00