Commit Graph

3426 Commits

Author SHA1 Message Date
Daniel Marjamäki 680883a6a7 fixed #3649 (False Positive: Uninitialized variable using operator assignment) 2012-03-06 18:51:50 +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
Stefan Weil 2ce5b80599 Fix compilation with HAVE_RULES=yes
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2012-03-01 20:07:00 +01:00
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
PKEuS c61762f454 Refactorized doAssignement:
- Enhanced performance by directly iterating through the token list instead of index access
- Added more allocation functions
- Simplified code
Replaced avoidable strlen call in cppcheckexecutor.cpp
2012-02-29 20:57:48 +01:00
Daniel Marjamäki db1205cdb3 Preprocessor: better handling of '#if A==1' 2012-02-29 19:08:01 +01:00
Daniel Marjamäki 527d3791e6 Fixed #3596 (memory leak false positive on libedit sources) 2012-02-27 18:55:36 +01:00
Ettl Martin 2ac907b40a fixed compiler warning (gcc-4.6.1) 2012-02-27 14:13:34 +01:00
Ettl Martin 013ef6157d fixed regression 2012-02-26 13:35:35 +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
Daniel Marjamäki 385c9d341d Fixed #3633 (False positive: struct array not assigned a value) 2012-02-26 08:29:02 +01:00
Edoardo Prezioso 4d3013d43d Improve 'Tokenizer::elseif' code in order to not touch 'else if' inside a macro parenthesis. 2012-02-26 02:50:48 +01:00
Daniel Marjamäki bbfae8e3ae Fixed #3583 (False positive Variable X is assigned a value that is never used) 2012-02-25 12:56:33 +01:00
PKEuS 9431fb1b7e Improved STL checks:
- Added performance checking for .c_str() for return values and function parameters (#1079)
- Added more containers (basic_string, C++11 containers) and more functions to checking (.at, .resize, .reserve, ...)
- Make use of symboldatabase in missingComparision check
2012-02-25 12:43:27 +01:00
PKEuS 9a5f66030c Improved unused private function check:
- Fixed #3628
- Added support for friend
Improved symbol database:
- friend scopes are now set
- Added findScopeByName function
Refactorizations:
- Removed some unnecessary "virtual" keywords
- Removed unnecessary _filename member variable, pass it as argument instead
- Made CppCheck::replaceAll static, since it is independant from a specific CppCheck instance, Pass string to be modified by reference
2012-02-24 20:45:56 +01:00
PKEuS 9f42ce91a1 Refactored STL container usage in CLI.
Pathmatcher masks are converted to lowercase only once when instance is created
2012-02-19 17:22:59 +01:00
Daniel Marjamäki 39b0f1ba95 Fixed #3608 (unreadVariable when variable used in inline assembly) 2012-02-19 16:04:35 +01:00
Daniel Marjamäki 69d03bac34 Fixed #3603 (False Positive: Variable is assigned a value that is never used) 2012-02-19 15:25:46 +01:00
PKEuS b1ff900aaa Some refactorizations 2012-02-18 23:43:51 +01:00
Edoardo Prezioso d7a918e549 Fixed ticket #3616 (segmentation fault of cppcheck). 2012-02-18 17:58:50 +01:00
Daniel Marjamäki a118f82ca7 Tokenizer::simplifyVarDecl: Don't simplify inside parenhteses 2012-02-18 15:05:29 +01:00
PKEuS 4b52df675a Some refactorizations 2012-02-18 14:44:04 +01:00
Daniel Marjamäki 0705dbd34a Tokenizer::simplifyCasts: don't simplify 'f((double)(v1)*v2)' to 'f(*v2)' 2012-02-18 14:26:00 +01:00
PKEuS 2ba2a4e6ae Some refactorizations 2012-02-18 11:55:05 +01:00
Daniel Marjamäki bfb4dd6425 Fixed #3529 (False 'Boolean result is used in bitwise operation' in a template) 2012-02-18 08:51:09 +01:00
Edoardo Prezioso a08dab3776 Fixed warning about order of variable initialisations in Settings constructor. 2012-02-17 21:22:42 +01:00
Edoardo Prezioso 17cd5ec906 Fixed ticket #3604 (cppcheck(1.53) crash). 2012-02-17 21:14:38 +01:00
PKEuS 485e836535 Refactorizations in MathLib.
Fixed recently introduced bug on floating point numbers with multiple preceding zeros (for example 004.123)
2012-02-17 19:54:53 +01: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
Ettl Martin d8c24c3afc fixed wrong spelled word. 2012-02-15 22:57:20 +01:00
Daniel Marjamäki 04e4b5d14d lib: fix for my previous commit. If there are no dependencies then don't insert dependencies 2012-02-15 08:13:42 +01:00
Daniel Marjamäki 8f3d511871 lib: allow that file dependencies are taken from Cppcheck after a check 2012-02-15 08:08:28 +01:00
PKEuS 2e13a51d08 Fixed #3591 2012-02-13 19:46:45 +01:00
PKEuS df0cb89a40 Fixed compiler error 2012-02-13 18:48:44 +01:00
PKEuS bb319c1c96 Improved Tokens and Tokenizer:
- Better handling of deleteThis() as last element of token list
- Code simplified
2012-02-13 17:44:08 +01:00
Daniel Marjamäki da8abeb63c Fixed #3584 (2 internal errors : Token::Match called with varid 0) 2012-02-12 17:30:47 +01:00
Erik Lax f1dbd1a89a Fixed #3518 (False negative: Possible null pointer dereference (in the same condition)) 2012-02-11 16:15:38 +01:00
PKEuS 42f418db54 - Improved nullpointer check: Fixed #1171
- Improved accuracy of function analysis in symboldatabase
- Code cleanups
2012-02-11 12:26:48 +01:00
Daniel Marjamäki c33dbb80fb 1.53: Updated version info 2012-02-11 08:17:07 +01:00
Daniel Marjamäki 4511d0fe5f fixed cppcheck inconclusive warning, possible null pointer dereference otherwise condition is redundant 2012-02-11 08:07:19 +01:00
Daniel Marjamäki bbb707c460 Fixed #3587 (Wrong tokenizer simplification - variable assigned by operator>>) 2012-02-07 08:05:50 +01:00
Daniel Marjamäki 47c7e346aa Uninitialized variables: Another fix for false positives when it's known that inner conditions are true 2012-02-06 19:26:28 +01:00
Daniel Marjamäki d6a887e1f9 Uninitialized variables: Fixed false positives when goto is simplified and inner condition is known to be true/false 2012-02-06 07:32:29 +01:00
Daniel Marjamaki fbb5ebe3c6 Fixed #3577 (Preprocessor: Defines given on command line are not used in the code) 2012-02-05 20:48:28 +01: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
Daniel Marjamäki 2be85e9d37 Fixed #3538 (false positive caused by bad tokenizer simplification) 2012-02-01 21:13:26 +01:00
Daniel Marjamäki 036b2a84bf Fixed #3570 (False Postive for 'nullPointer' check) 2012-02-01 20:38:47 +01:00
Edoardo Prezioso f9ade9562c Fixed ticket #3572 (segmentation fault). 2012-01-31 22:32:28 +01:00