Commit Graph

580 Commits

Author SHA1 Message Date
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
Ettl Martin 2ac907b40a fixed compiler warning (gcc-4.6.1) 2012-02-27 14:13:34 +01:00
PKEuS 1747813a8b Added check for invalid pointer casts (#1255)
Detect sign extension problems when variable is a reference (#3637)
Refactorizations:
- Tokenizer::getFiles returns a reference instead of a pointer, because its guaranteed that no nullpointer is returned
- Remove signed/unsigned in one step for "%type% signed|unsigned"
- Fixed recently introduced compiler warning in symboldatabase.cpp
2012-02-26 11:56:32 +01:00
Zachary Blair 9d75641ef8 Fixed #3598 (false positive: (error) Memory pointed to by 'a' is freed twice.) 2012-02-16 21:03:38 -08:00
Zachary Blair 8f827aa65f FIxed #3581 (double free false positive when exception rethrown) 2012-02-04 11:24:40 -08:00
PKEuS d5c2c7db88 - Moved checkCatchExceptionByValue from CheckOther to CheckExceptionSafety
- Fixed false positive: throw outerCatchVar; in inner catch is now correctly handled
- Added eTry and eCatch to Scope::isLocal -> Scopes inside catch are now detected by symbol database
2012-02-02 16:17:42 +01:00
PKEuS 22c1ce8a68 Fixes for #3480 and #3568. 2012-01-31 15:49:34 +01:00
Edoardo Prezioso bb703f4d0b Fixed: (warning) Found simple pattern inside Token::Match() call. 2012-01-28 20:31:12 +01:00
PKEuS 91a01a0a0d - checkUnsignedDivision checks for variable/variable (inconclusive). General bailout for if-statements.
- Make use of recently implemented symboldatabase functions (catch-support, reference-support)
- Other refactorizations
2012-01-28 12:32:28 +01:00
Zachary Blair 589a2461bd Fixed ticket #3550 (false positive: (error) Memory pointed to by 'pxpm' is freed twice) 2012-01-24 22:43:44 -08:00
PKEuS 36479499e7 - Solved FIXME: Made detection of code that is no pointer-dereference more robust, uncommented code (checknullpointer.cpp)
- Removed more indendation level counters
- Make use of symbol database more often
- Other refactorizations
2012-01-21 19:55:32 +01:00
PKEuS 96ae010e48 - Correctly set Scope::function variable in symboldatabase
- Refactorizations
- Fixed some cppcheck warnings
2012-01-21 10:08:09 +01:00
Zachary Blair 0415444e28 Merge branch 'master' of github.com:danmar/cppcheck 2012-01-19 23:02:33 -08:00
Zachary Blair b89adff9fd Fixed Ticket #3300 (false negative: doublefree of pointer) 2012-01-19 22:59:54 -08:00
Daniel Marjamäki 525e7fba20 Fixed #3490 (False positive: sscanf with %c) 2012-01-18 23:57:08 +01:00
Stefan Weil 7607e4c68d Fixed #3519 (Wrong line number in warning charBitOpError) 2012-01-18 13:09:46 +01:00
PKEuS c294b15360 Removed more indendation counters. 2012-01-15 12:31:49 +01:00
Reijo Tomperi dd18f595b1 Fix #3516 (inaccurate warning: "An unsigned variable will always be positive" (unsigned n; if (n >=0);))
http://sourceforge.net/apps/trac/cppcheck/ticket/3516
2012-01-14 12:50:09 +02:00
Daniel Marjamäki 65ce55e675 Fixed #3472 (false positive: (error) Passing value 0 to log() leads to undefined result) 2012-01-08 12:07:25 +01:00
PKEuS eabdc9082e Fixed false positives related to %*[] in scanf format string (#3468) 2012-01-04 11:22:42 +01:00
PKEuS 621d43e9e4 Fixed #3461: Support for %m* on scanf-functions 2012-01-02 14:05:58 +01:00
Reijo Tomperi 8cae17fda8 Update year to 2012 2012-01-01 01:05:37 +02:00
Erik Lax 3d0c1a3301 Fix #3457 (Statement following goto can be executed)
http://sourceforge.net/apps/trac/cppcheck/ticket/3457
2012-01-01 00:11:03 +02:00
Reijo Tomperi 65b58bcb99 Partial fix to #3452 (ErrorLogger: complain/raise assertion when error message has extra newlines etc)
http://sourceforge.net/apps/trac/cppcheck/ticket/3452
Add assert for newlines.
2011-12-30 01:22:16 +02:00
Marek Zmysłowski dd8316474a Fixed #3335 (new check: warn about potential missuse of isgraph-like functions) 2011-12-29 08:08:37 +01:00
Reijo Tomperi 90e1a397a2 Refactoring: Remove duplicate function from tokenizer: code_is_c() -> isC() 2011-12-29 00:36:16 +02:00
Edoardo Prezioso bbac4f1faf Fix ticket #3451 (A (style) type warning witout message text). 2011-12-28 17:15:04 +01:00
Daniel Marjamäki 8e94e2261b Comparing bool with int: Fixed false positives 2011-12-23 19:11:51 +01:00
PKEuS 8213a15b2a improving checkSizeofForStrncmpSize 2011-12-23 18:11:34 +01:00
Daniel Marjamäki e9d697b636 Fixed #3419 (false positive: (style) Same expression on both sides of '&'.) 2011-12-23 16:08:53 +01:00
PKEuS 409364747c Fixed #3441 (segmentation fault of cppcheck (%: return ; ())) 2011-12-23 12:46:59 +01:00
Daniel Marjamäki df8504f0ea Clarify calculation: Fixed false positives when there are various function calls 2011-12-23 12:13:39 +01:00
Daniel Marjamäki fd0d9c8694 CheckOther: Added line break to make the code more readable 2011-12-20 20:54:14 +01:00
Daniel Marjamäki f8181df340 Fixed #3410 (Comparing bool against bool produces false positive) 2011-12-20 06:38:05 +01:00
PKEuS 6dc2a6e7ab Refactorized CheckUnusedVar 2011-12-18 20:15:41 +01:00
PKEuS 0205582161 Fixed #3327 (printf with std::string as parameter) 2011-12-18 19:41:21 +01:00
PKEuS f306246c7f Improved support for references and pointers in SymbolDatabase
Replaced several isPointer functions by Variable::isPointer function
Refactorizations & Make use of symbolDatabase more often
2011-12-17 19:04:03 +01:00
PKEuS 4abee3a345 Refactorings. Use reportError instead of reportInconclusiveError. 2011-12-17 11:39:20 +01:00
PKEuS a311904a0f Patch that fixes some bailouts for isEnabled('style') in both directions. Improved checkSizeofForNumericParameter's error message, made it 'warning', made it non-experimental. 2011-12-16 19:21:14 +01:00
PKEuS c9f5117cf5 Fixed #3407 (False positive: (inconclusive) Found duplicate branches for if and else. (inline assembler)) 2011-12-13 21:42:38 +01:00
PKEuS 91a0a071d0 Take symbol database into use or improve its usage in some checks. 2011-12-09 23:28:10 +02:00
PKEuS 97eecb78a7 Fixed #3381 (false positive: (style) Statements following return, break, continue, goto or throw will never be executed) 2011-12-07 18:20:52 +01:00
PKEuS 501d7ccb2d Optimize checkother.cpp by taking symbolDatabase into use. 2011-12-04 20:49:01 +02:00
PKEuS 1f438b0505 Fixed #3375 (Improve check: Detect unreachable code) 2011-12-03 11:43:23 +01:00
Daniel Marjamäki 69d3d4a17d Fixed gcc compiler warnings 2011-12-03 09:57:56 +01:00
Daniel Marjamäki 9a84c5845a Fixed #3373 (False posititive: incorrect %* handling in sscanf) 2011-12-02 17:09:32 +01:00
Richard Quirk d2c8b9be56 Fix possible null pointer dereference 2011-12-01 19:57:04 +01:00
Richard Quirk b2ea78543b Fix false positive with non-const function calls 2011-12-01 19:57:04 +01:00
Richard Quirk a880469c5a Refactor the same expression check
Work out if a function is inconclusive when creating the entry in the
Expressions class instead of when checking the counts at the end. Store
the result in a new bool flag in the ExpressionTokens helper struct.

The pointer to symbol database and ref to list of const functions are
temporarily stored in  the Expressions helper class to avoid passing
them in too on every endExpr(tok) call.

Use a const reference to ExpressionTokens in the check loop to avoid
repeating the it->second several times, which clarifies what that code
does.
2011-12-01 19:57:04 +01:00
PKEuS 5017646488 Coding fixes and refactorings 2011-12-01 19:43:51 +01:00