Commit Graph

1141 Commits

Author SHA1 Message Date
Slava Semushin 13b2edd61e Token::getStrLength(): use Token::strValue().
No functional change.
2009-09-13 15:03:28 +07:00
Slava Semushin 1617abf053 Token::strValue(): added const modifier.
Correction for 241f585d34 commit.

No functional change.
2009-09-13 15:02:59 +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 5df28c51c6 memory leaks: minor refactorings 2009-09-12 21:13:47 +02:00
Daniel Marjamäki f4b6c822d3 Fixed #375 (new check: Detect when using 'this-x') 2009-09-12 15:25:02 +02:00
Daniel Marjamäki ab4a7fdef2 Fixed #518 (False positive for leaks when function from err()-family used) 2009-09-12 14:11:17 +02:00
Daniel Marjamäki 7479b943cc Fixed #644 (Tokenizer::simplifyComma: Wrong simplification in cast) 2009-09-12 08:12:00 +02:00
Daniel Marjamäki 37dae83e06 More Fixing of #635 (Preprocessor: remove 'asm(...)') 2009-09-11 23:34:24 +02:00
Reijo Tomperi ed1c9bed49 Fix ticket #632 (Mathlib isInt() identifies "330L" as not int)
http://sourceforge.net/apps/trac/cppcheck/ticket/632
2009-09-11 23:46:59 +03:00
Daniel Marjamäki 8837e0dcff Simple fix for #635 (preprocessor: remove 'asm(...)') 2009-09-11 21:22:41 +02:00
Reijo Tomperi 9828117aff Fixed some "is passed by value" errors from cppcheck source. 2009-09-10 22:22:57 +03: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
Daniel Marjamäki 48846c008d Fixed #650 ('possible style' pre-incrementing error shown without --all) 2009-09-08 21:41:11 +02:00
Daniel Marjamäki 80bf406a97 Settings: Added an 'append' command line flag that allows the user to provide extra information about functions. See ticket #260 2009-09-08 19:49:05 +02: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
Reijo Tomperi 7af4ac4282 New command line argument added --template
Fix ticket #462 (Allow using template to customize output format)
http://sourceforge.net/apps/trac/cppcheck/ticket/462
2009-09-05 22:01:49 +03:00
Slava Semushin 195cc9aae9 Fixed #585 (Preprocessor: Don't check the same configuration twice)
http://sourceforge.net/apps/trac/cppcheck/ticket/585
2009-09-06 00:01:57 +07: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
Aleksey Palazhchenko d9d2f53df6 Added top-level 'check' target.
Also refactored all. pro files by the way. :)
2009-09-04 22:59:25 +04:00
Reijo Tomperi 23c07dd2b8 Merge branch 'master' of git@github.com:danmar/cppcheck 2009-09-03 23:36:42 +03:00
Reijo Tomperi 7408674017 Fix #601 (Poor var initialization assumption when can't find function definition)
http://sourceforge.net/apps/trac/cppcheck/ticket/601
Fix #641 ((style) Member variable not initialized in the constructor: False Positive)
http://sourceforge.net/apps/trac/cppcheck/ticket/641

This fix will also cause us not to detect several potential issues, but as there are so many
false positives, any unknown function call should stop the error for now. New
ticket is created to handle regression caused by this:
http://sourceforge.net/apps/trac/cppcheck/ticket/643
2009-09-03 23:28:00 +03:00
Daniel Marjamäki 7a9e4a7bd4 templates: remove typename tokens 2009-09-03 22:19:44 +02:00
Reijo Tomperi a4190bc590 Fix ticket #642 (txx (template implementation files) not recognized/checked.)
http://sourceforge.net/apps/trac/cppcheck/ticket/642
2009-09-03 23:04:38 +03: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
Reijo Tomperi 686ff425f9 Fix ticket #637 (False positive, Using 'memset' on struct that contains a 'std::string')
http://sourceforge.net/apps/trac/cppcheck/ticket/637
2009-09-02 23:51:07 +03:00
Reijo Tomperi 8ab26e85cf Don't warn about division by zero if zero if floating point number.
Fix bug from mathlib isInt() and add test case from which few are false positives
2009-09-01 22:06:46 +03:00
Daniel Marjamäki 93659bbe08 memory leaks: fixed a todo testcase to find more leaks 2009-09-01 20:12:53 +02:00
Daniel Marjamäki 9a47b7110e memory leaks: fixed todo testcases to find more memory leaks 2009-09-01 20:02:28 +02:00
Slava Semushin ca053bf8f9 CheckMemoryLeakInFunction: print simplified tokens only with --debug and --verbose.
Suggested by aggro80@ and approved by hyd_danmar@ in IRC.
2009-09-02 00:54:40 +07: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
Daniel Marjamäki 7ba244cf45 Memory leaks: fixed a todo testcase 2009-09-01 19:33:17 +02:00
Slava Semushin d8f2ec934b Tokenizer::syntaxError: show details about unlogged syntax error. 2009-09-01 23:58:36 +07:00
Slava Semushin eebe7457c9 Fixed #631 (False positive matching iterator which is dereferenced)
http://sourceforge.net/apps/trac/cppcheck/ticket/631
2009-09-01 23:49:17 +07:00
Reijo Tomperi 0d468d97c7 Fix #630 (Division by zero check only looks at first character of divisor)
http://sourceforge.net/apps/trac/cppcheck/ticket/630
Thanks to liam_routt for finding this and providing fix for it.
2009-09-01 17:00:26 +03: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 960fb861da Refactoring: Refactoring of the unit testing for the CheckMemoryLeakInFunction 2009-08-30 21:11:15 +02:00
Reijo Tomperi 6fb44e733b Fix ticket #612 (Division by zero not detected when zero has type suffix)
http://sourceforge.net/apps/trac/cppcheck/ticket/612
2009-08-30 22:02:09 +03:00
Daniel Marjamäki 9ede0e26ab Merge branch 'master' into aleksi/master 2009-08-30 16:03:40 +02:00
Slava Semushin c50f7787f9 Fixed #569 (Buffer overrun not detected when strcat() called few times)
http://sourceforge.net/apps/trac/cppcheck/ticket/569
2009-08-30 18:44:23 +07:00
Aleksey Palazhchenko 95356dfecd Fixes in src.pro
1) Binary shouldn't be in bundle (Mac OS X).
2) Binary doesn't use Qt at all.
2009-08-30 15:26:10 +04:00
Slava Semushin 1a982a2a19 CheckBufferOverrun::checkScope(): use Token::getStrLength().
No functional change.
2009-08-30 18:21:42 +07:00
Slava Semushin 843ede94f3 Token::getStrLength(): introduce new static method.
No functional change.
2009-08-30 18:07:10 +07:00
Slava Semushin 9b78c6dd32 Preprocessor::getcfgs(): use std::list::unique() for removing duplicates.
No functional change.
2009-08-30 15:47:24 +07:00
Daniel Marjamäki f9b84805d9 Refactoring: Use the Token::link 2009-08-30 10:27:26 +02:00
Reijo Tomperi e1cdbf3c5a Fix ticket #611 (Preprocessor: the configurations "A;B" and "B;A" are the same)
http://sourceforge.net/apps/trac/cppcheck/ticket/611
2009-08-30 00:00:54 +03: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
Daniel Marjamäki 9d7defad22 Fixed #615 (Memleak was detected in 1.32 but not in 1.33 and later) 2009-08-29 17:33:57 +02:00
Daniel Marjamäki 1dd2ec4757 Fixed #414 (memory leak in if-else construct not detected) 2009-08-29 16:55:43 +02:00
Daniel Marjamäki 270d2b2d4f memory leaks: improved the simplification of 'if* ;' 2009-08-29 16:27:16 +02:00
Daniel Marjamäki 8f1f89ae2b memory leaks: fixed todo test case. reduce exit better 2009-08-29 16:03:23 +02: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
Daniel Marjamäki b5c6d7ba49 memory leaks: fixed bug. return|else are not part of a variable declaration 2009-08-29 15:20:37 +02: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 78d44e67ef CheckMemoryLeakInFunction(getcode): don't call Token::Match() if varid equals to zero. 2009-08-29 16:27:56 +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
Daniel Marjamäki 6347d0e976 memory leaks: better handling of open/close 2009-08-29 09:18:21 +02:00
Daniel Marjamäki 88d0bd3908 astyle 2009-08-29 08:20:18 +02:00
Daniel Marjamäki ee5b2a43c7 Fixed #627 (False positive with --all, Resource leak with open()) 2009-08-29 07:43:44 +02:00
Daniel Marjamäki de9e62e90a Memory leaks: handling asprintf better 2009-08-29 07:26:32 +02:00
Daniel Marjamäki 406fdd3219 Memory leaks: Fixed two todo testcases (getcode handling of asprintf) 2009-08-29 07:02:36 +02:00
Daniel Marjamäki ab047c680c memory leaks: fixed a todo testcase 2009-08-29 06:42:24 +02:00
Daniel Marjamäki 74fd052fc0 Memory leaks: Testing that asprintf is handled correctly 2009-08-28 23:26:40 +02: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
danmar 465c450247 Borland C++: Fixed problem in FileLister 2009-08-28 11:00:42 +02:00
danmar 3b2744e04a borland c++: fixed compiler errors 2009-08-28 10:22:40 +02:00
Daniel Marjamäki 5d2c409e46 Fixed #623 (False positive: possible null pointer dereference when using the ?: operator) 2009-08-28 08:48:37 +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
Reijo Tomperi 929dbe92e4 Fix the last test case from ticket #613 (array members variables are not checked in constructor)
http://sourceforge.net/apps/trac/cppcheck/ticket/613
2009-08-26 23:33:23 +03:00
Daniel Marjamäki ff9ed1d7aa Preprocessor: better handling of pragma asm and pragma endasm 2009-08-26 21:54:43 +02:00
Slava Semushin 7c86a10a9d Fixed #617 (False positive "buffer overrun" when sprintf() doesn't have optional parameters)
http://sourceforge.net/apps/trac/cppcheck/ticket/617
2009-08-27 00:21:32 +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 8dcb846627 Fixed #614 (If you see this, there is a bug ###### Token::Match() - varid was 0)
http://sourceforge.net/apps/trac/cppcheck/ticket/614
2009-08-26 02:44:19 +07:00
Slava Semushin 311fb1a1f8 src/checkmemoryleak.{h,cpp}: minor improvements.
Corrections for commit 0d6b6e840d

No functional change.
2009-08-26 02:32:10 +07:00
Slava Semushin ff3d1db480 Replace "const unsigned int" to "unsigned int" in methods parameters.
No functional change.
2009-08-26 02:26:12 +07:00
Slava Semushin bb15efb928 src/checkclass.cpp: propagate Token::strAt().
No functional change.
2009-08-26 02:04:48 +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
Reijo Tomperi c581753040 Fix ticket #613 (array members variables are not checked in constructor)
http://sourceforge.net/apps/trac/cppcheck/ticket/613
Patch from micres
2009-08-23 22:54:41 +03:00
Daniel Marjamäki 522f4c18c8 astyle formatting 2009-08-23 17:17:57 +02:00
Daniel Marjamäki 9da2ecf4f4 Refactoring the unit testing. Wrote special tests for CheckMemoryLeakInFunction::findleak 2009-08-23 15:48:25 +02:00
Daniel Marjamäki 99938353b4 Merge commit 'd0k/master' 2009-08-23 12:45:49 +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 e6120a5725 Fixed #581 (Wrong usage of div-function)
http://sourceforge.net/apps/trac/cppcheck/ticket/581
2009-08-23 10:37:09 +07:00
Slava Semushin 703fd45f78 Tokenize: minimize createLinks() calls.
No functional change.
2009-08-23 10:36:34 +07:00
Benjamin Kramer 18696679e3 Token: inline some functions 2009-08-22 22:36:12 +02:00
Benjamin Kramer 0d6b6e840d Improve performance by using bsearch(3) instead of a std::set
The function name list is already in memory so we can avoid copying it into a std::set
if we sort the list alphabetically. This way no binary search tree has to be allocated.

Before (best of 5 runs):
./testrunner > /dev/null  0,21s user 0,00s system 95% cpu 0,221 total
After (best of 5 runs):
./testrunner > /dev/null  0,20s user 0,00s system 95% cpu 0,210 total
2009-08-22 20:24:26 +02: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
Daniel Marjamäki 724d6bf53a Fixed #507 (Preprocessor: Incorrect expanding of inner macros) 2009-08-22 13:03:52 +02: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
Daniel Marjamäki 7b3fdec5cf Refactoring: Use the MathLib::toString to stringify a number 2009-08-21 14:50:13 +02:00
Daniel Marjamäki 439ff8b144 Fixed #599 (False positive: null pointer dereference) 2009-08-21 12:42:40 +02:00
Daniel Marjamäki 88251f5ac0 astyle formatting 2009-08-21 11:11:21 +02: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 7d44ce7736 Fix ticket #598 (Preprocessor: Multiline comments add line change to wrong location)
http://sourceforge.net/apps/trac/cppcheck/ticket/598
2009-08-20 00:27:47 +03:00
Daniel Marjamäki 8b46172bcf Memory leaks: Use varid instead of varname 2009-08-19 19:42:07 +02:00
Daniel Marjamäki 85682ed429 Fixed #591 (False positive: Deallocating a deallocated pointer) 2009-08-18 20:49:08 +02:00
Daniel Marjamäki 2cdb0abb82 Refactoring: Use the Token::link instead of loop 2009-08-17 22:23:37 +02:00
Reijo Tomperi 40fc605e2b Fix ticket #597 (Compile error with Visual C++)
http://sourceforge.net/apps/trac/cppcheck/ticket/597
2009-08-17 22:24:17 +03:00
Kimmo Varis ec40b4c628 Don't force debug builds in qmake project files.
When creating makefiles with qmake one needs to give the target in command
line. E.g.
  $ qmake -config debug
or
  $ qmake -config release

For Visual studio projects both targets are generated by just running the
qmake command without switches.
2009-08-17 18:12:53 +03:00
Kimmo Varis d16d19e580 Add new header file to qmake project files. 2009-08-17 18:05:10 +03:00
Reijo Tomperi 8b4b618fc4 Use _str.length() == 1, instead of _str[1] == 0 2009-08-16 23:50:00 +03:00
Reijo Tomperi 36a8e8afba Fix ticket #543 (Possible buffer overrun in Token::Match())
http://sourceforge.net/apps/trac/cppcheck/ticket/543
Get rid of string copying in Token::Match(), also improves speed a little.
8.0s -> 7.7s
2009-08-16 23:28:17 +03:00
Slava Semushin 74bbe945f6 Fixed #272 ("The scope of the variable XXX can be limited" not detected when variable is initilialized during declaration)
http://sourceforge.net/apps/trac/cppcheck/ticket/272
2009-08-17 02:12:57 +07:00
Slava Semushin 32c8ba526b MathLib(isInt): formatted and get rid of tabs.
No functional change.
2009-08-17 00:43:45 +07:00
Slava Semushin 8659c4828c MathLib(isInt): use std::tolower().
No functional change.
2009-08-17 00:31:15 +07:00
Slava Semushin a11089cb50 MathLib(isInt): use isxdigit().
No functional change.
2009-08-17 00:27:14 +07:00
Daniel Marjamäki 52856fcbeb ettlmartin: improved the MathLib::IsInt 2009-08-16 18:45:26 +02:00
Slava Semushin 522f783ada CheckMemoryLeak: try to speed up call_func().
Using std::set::find() instead of sequence of Match() calls.
2009-08-16 22:02:11 +07:00
Reijo Tomperi fb85ee5356 Update version number to 1.35 2009-08-16 16:57:16 +03:00
Slava Semushin 4fa6c76c75 CheckAutoVariables(autoVariables): make code more readable.
- Reduce indentation
- Don't check bindent in many conditions
- Move inner if-s to outer condition

Should be no functional change.
2009-08-16 17:53:29 +07:00
Slava Semushin aa4bb4d218 CheckAutoVariables: const modifier propagation.
No functional change.
2009-08-16 16:46:13 +07:00
Slava Semushin 41e2668138 CheckAutoVariables: don't save and search for local variables with varId 0. 2009-08-16 16:43:04 +07:00
Slava Semushin fc5f4d366e CheckAutoVariables: added braces.
No functional change.
2009-08-16 16:36:07 +07:00
Slava Semushin 743d5331ee CheckAutoVariables(returnPointerToLocalArray): replace std::list to std::set
Use std::set and std::set::find() instead of std::list and
std::find(). First should be faster (runs in the logarithmic time) than
second (runs in linear time).

No functional change.
2009-08-16 16:31:44 +07:00
Slava Semushin 2dccf150ab CheckAutoVariables: change type of vp_list member to std::set.
Change type of vda_list from std::list to std::set. It allows to us
use find() method instead of self-written loop which may be slow.

No functional change.
2009-08-16 16:16:35 +07:00
Slava Semushin 053e6f8b9a CheckAutoVariables: change type of vd_list member to std::set.
Change type of vda_list from std::list to std::set. It allows to us
use find() method instead of self-written loop which may be slow.

No functional change.
2009-08-16 16:10:42 +07:00
Slava Semushin ec81080d0b CheckAutoVariables: change type of vda_list member to std::set.
Change type of vda_list from std::list to std::set. It allows to us
use find() method instead of self-written loop which may be slow.

No functional change.
2009-08-16 16:02:21 +07:00
Slava Semushin 475ef4213b CheckAutoVariables: use varId instead of variable names.
This change similar to be89be8c30 but
for vd_list member.
2009-08-16 15:46:52 +07:00
Slava Semushin be89be8c30 Fixed #590 (False positive: Invalid deallocation when variables have same name)
http://sourceforge.net/apps/trac/cppcheck/ticket/590
2009-08-16 15:27:40 +07:00
Reijo Tomperi f36f3bfae1 line change and encoding fixes 2009-08-15 22:39:57 +03:00
Slava Semushin 19e5fdb087 Fixed #588 (Preprocessor: Sort the configurations)
http://sourceforge.net/apps/trac/cppcheck/ticket/588
2009-08-15 09:35:54 +07:00
danmar dfa8a2e67c Visual C++: Fixed testrunner compilation problems 2009-08-14 12:46:55 +02:00
danmar e9f643f04c Borland C++ Builder: Fixed compilation problems when compiling cppcheck 2009-08-14 12:28:41 +02:00
Reijo Tomperi c8da301f83 fix ticket #586 (Preprocessor: Lines like "#error don't" can cause "no pair for character" errors)
http://sourceforge.net/apps/trac/cppcheck/ticket/586
2009-08-14 00:22:51 +03:00
Daniel Marjamäki 51365c4b9d mathlib: minor fix 2009-08-13 22:31:58 +02:00
danmar 3de825c290 Borland C++ Builder: Fixed compilation and testrunner problems 2009-08-13 22:13:52 +02:00
Reijo Tomperi 4f8a06ed0d Initial work for class and member function/variable list in tokenizer. 2009-08-12 23:50:03 +03:00
Daniel Marjamäki ad4ea01750 Fixed #583 (False positive: the nullpointer check doesn't handle goto properly) 2009-08-12 18:54:52 +02: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
Daniel Marjamäki e7feac506c Refactoring: updated the nullPointer message so it contains the name of the pointer 2009-08-11 17:18:01 +02:00
Daniel Marjamäki ecdbcbce3d Fixed #566 (False positive when assigning the return value of realloc(NULL,..) to a pointer variable holding a freed memory address) 2009-08-10 22:04:28 +02:00
Daniel Marjamäki 045b73c7ec Fixed #582 (Preprocessor: Remove assembler code inside pragmas) 2009-08-10 20:07:55 +02:00
Reijo Tomperi 93604dd344 Fixed ticket #578 (missing virtual destructor not detected)
http://sourceforge.net/apps/trac/cppcheck/ticket/578
2009-08-10 17:58:13 +03:00
Daniel Marjamäki 3331cb834f Hoangtuansu: Fixed #537 (false positive::operator= should return something) 2009-08-09 19:57:48 +02:00
Gianluca Scacco 741073cc21 Style check 2009-08-09 15:44:01 +02:00
Gianluca Scacco ab12b9923d Invalid deallocation check done 2009-08-09 15:40:04 +02: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 5f3baba178 Fixed ticket #573 (False positive of set range check when we dereferencing iterator)
http://sourceforge.net/apps/trac/cppcheck/ticket/573
2009-08-09 02:07:33 +07:00
Slava Semushin eebb1671a5 checkbufferoverrun.cpp: get rid of Match() usage with varid 0. 2009-08-09 01:09:45 +07:00
Slava Semushin 0f96299d87 Fixed ticket #570 (Buffer overrun not detected when sprintf() format string greater then buffer size)
http://sourceforge.net/apps/trac/cppcheck/ticket/570
2009-08-08 21:52:35 +07:00
Slava Semushin 92d4c086ce Fixed ticket #571 (Buffer overrun for sprintf() not detected after first ')' symbol)
http://sourceforge.net/apps/trac/cppcheck/ticket/571
2009-08-08 21:03:10 +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
Daniel Marjamäki a0a4008e17 Fixed #525 (false positive: vector range checking with <) 2009-08-07 16:23:28 +02: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
Daniel Marjamäki 5087dc6b46 Bail out if variable id is 0. This should be reverted when #563 has been fixed 2009-08-06 21:48:22 +02: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 ce8c5b0236 Fixed #555 (False positive: [CuTest.c:25]: (error) Memory leak: len) 2009-08-05 21:18:16 +02: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
Daniel Marjamäki cb57bd6678 Listing error messages in XML format 2009-08-04 21:36:55 +02:00
Daniel Marjamäki 9e348ca739 Fixed #554 (resource leak false positive) 2009-08-04 21:34:14 +02:00
Daniel Marjamäki 706ba34a6d Refactoring the unit testing 2009-08-04 21:32:14 +02:00
Reijo Tomperi 975e7778ab Fix ticket #531 (false positive about missing virtual destructor)
http://sourceforge.net/apps/trac/cppcheck/ticket/531
2009-08-04 22:23:22 +03:00
Reijo Tomperi 769119c725 Fix ticket #552 (False positive with --all when realloc is used with two variables.)
http://sourceforge.net/apps/trac/cppcheck/ticket/552
2009-08-02 23:30:43 +03:00
Reijo Tomperi 10f6678cf9 TODO test case realloc5 added and "Checkmemoryleak: simplifycode result for" debug info added. 2009-08-02 22:23:47 +03:00
Reijo Tomperi e0f416e52e astyle fix 2009-08-02 22:11:17 +03:00
Slava Semushin be82d09003 src/checkbufferoverrun.cpp: fixed regression. 2009-08-02 20:34:28 +07:00
Slava Semushin 13532cbff7 src/checkbufferoverrun.cpp: don't call Token::Match() for variables with varId 0. 2009-08-02 20:01:59 +07:00