Commit Graph

515 Commits

Author SHA1 Message Date
Ettl Martin 7be01da8e9 fixed ticket 3693. Added modulus operator to Mathlib + unittests. Added a test to checkother to ensure the testcase of ticket 3693 does not trigger an error message. 2012-04-12 14:02:09 +02:00
Daniel Marjamäki 66227c4da0 Fixed #3609 (clarifyCondition delivers false positives when using Windows-Traits as a template) 2012-04-08 18:07:11 +02:00
PKEuS b0f571b25c Fixed #3383: If there is an empty line between subsequent break statements, only issue a message for inconclusive checking 2012-04-05 10:38:29 +02:00
PKEuS c1fc7a2218 Improved CheckOther::checkComparisonOfBoolWithInt and CheckOther::checkComparisonOfBoolExpressionWithInt:
- Added support for comparision of bool constant with number constant (-> fixed #1877) and integer variable with boolean expression
- Moved a check from checkComparisonOfBoolWithInt to checkComparisonOfBoolExpressionWithInt
- Generalized some patterns
- Made error message more accurate concnerning the "neither 0 nor 1" part.
- Reduced number of Token::Match calls
2012-04-02 15:45:51 +02:00
PKEuS 033e4a2c1f Fixed #3676. 2012-04-02 11:21:04 +02:00
PKEuS 4f1f6e1824 Improved simplification of calculations:
- Use more generic patterns
- Look on operator precedence more consequently
-> Made a TODO test case from a test case that worked previously, because the calculation is simplified so that the problem isn't detected any more.
Changed comment "Coding style checks" to "Checks", because it didn't fit
2012-03-27 21:29:50 +02:00
PKEuS 989ac449e4 Made invalidPointerCast message inconclusive for casting from floating point type* to char* (Fixed #3639) 2012-03-25 12:55:39 +02:00
Daniel Marjamäki ca6a93816b Merge pull request #89 from HeisSpiter/master
Merged two checks to get a better one regarding sizeof
2012-03-25 02:38:04 -07:00
PKEuS e4d92055e7 Improved sizeofCalculation check:
- Bailout on expanded macros for conclusive checking
- Support for more operators
- Removed indendation counter
Improved checkSignOfUnsignedVariable:
- Made the patterns more generic
- Improved verbose error message (-> Fixed #3080)
2012-03-25 11:32:00 +02:00
Pierre Schweitzer 2b5ddb7858 Merge the strncmp & malloc sizeof checks into a more generic test that handles several cases where sizeof is misused, or could be misused 2012-03-23 21:47:13 +01:00
Pierre Schweitzer ec44967e13 Add a new test to check improper sizeof usage. It's for the moment limited to malloc calls. 2012-03-21 21:13:09 +01:00
PKEuS b6057a1148 Improved CheckOther::checkIncorrectLogicOperator:
- Added a lot of additional pattern
- Rewrote error messages to make them more understandable and better fitting to the situation. (Fixed #3664)
- Cleanup in unit tests
Improved message of static string comparision check
2012-03-15 20:38:28 +01:00
PKEuS 7cfffc9c9d Improved CheckOther::checkIncorrectLogicOperator:
- Implemented automatic swapping of conditions and operands
- Added several patterns
- Added support for conditions outside of if/while
2012-03-12 19:06:30 +01:00
PKEuS 6f164de609 Improved static string comparision check: Implemented #3214
Fixed false negative on argument count of fnprintf/snprintf when first variable argument is a string. (#3655)
Uncommented call of virtualDestructorError in getErrorMessages in checkclass.h
Refactorizations:
- Rearranged code in checkother.h to make ordering more consistent and to increase encapsulation of private data
- Replaced some single-token-patterns
2012-03-11 11:01:39 +01:00
PKEuS ef6e381d47 Improved bitwise on boolean check to make it working on more code patterns
Refactorizations in checkother.cpp:
- Make use of symboldabase instead of: indentation counters, manual detection of variable declarations
- Removed some indexing variables to reduce calls to tokAt and the numbers given to this function
- Use tok->nextArgument() to jump to a specific argument
2012-03-03 21:14:20 +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 0e791929b5 Ticket #3598 - Added a missing ASSERT_EQUALS() statement to the end of checkDoubleFree() 2012-02-18 12:13:21 -08:00
PKEuS 8ea5df62c4 - Improved support for numbers in code:
-- Use MathLib::toLongNumber for conversion in tokenizer (Fix #3610)
-- Handle octal numbers in tokenizer
- Refactorizations in MathLib::toLongNumber and Settings
2012-02-17 15:47:08 +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 69567515ce Ticket #3581 - added missing newlines to the test code 2012-02-04 11:39:29 -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
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
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
PKEuS 461565c50a Fixed #3517 and #3513 2012-01-15 12:32:02 +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
Daniel Marjamäki 94d220e370 Refactoring: Made Preprocessor::getcode nonstatic 2012-01-06 08:01:50 +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
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 0a588496a0 Fix astyle and test failures. 2011-12-28 22:05:10 +02: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 f8181df340 Fixed #3410 (Comparing bool against bool produces false positive) 2011-12-20 06:38:05 +01:00
PKEuS 0205582161 Fixed #3327 (printf with std::string as parameter) 2011-12-18 19:41:21 +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 9b685ba3c3 Code cleanup 2011-12-09 21:00:57 +01: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 1f438b0505 Fixed #3375 (Improve check: Detect unreachable code) 2011-12-03 11:43:23 +01:00
Daniel Marjamäki 9a84c5845a Fixed #3373 (False posititive: incorrect %* handling in sscanf) 2011-12-02 17:09:32 +01:00
Richard Quirk b2ea78543b Fix false positive with non-const function calls 2011-12-01 19:57:04 +01:00