Commit Graph

971 Commits

Author SHA1 Message Date
PKEuS 5d302716e7 Refactorized Variable::isIntegralType() and Variable::isFloatType():
- Cached property
- Make use of it in several checks
- float* is flagged as floating point type
2014-08-09 11:45:13 +02:00
PKEuS c3577bc8dd Fixed crash, simplified code in testassert.cpp 2014-08-06 12:24:21 +02:00
PKEuS d3a567bf96 Fixed false positive #5824: Variables that might be used for va_start() must not be passed by reference. 2014-08-06 12:06:36 +02:00
PKEuS 4a3d719386 Fixed recently introduced FP when C-Style casting nullpointers 2014-08-04 11:42:14 +02:00
PKEuS 4c80ca4e8e Improved cstyleCast check:
- Detect casting of literals
- Check initializer lists (#3630)
2014-08-04 11:21:25 +02:00
Daniel Marjamäki 8a1c5d6fce Fixed #6011 (crash: libreoffice/binfilter svt_enhwmf.cxx) 2014-07-28 16:33:42 +02:00
Daniel Marjamäki fdfea717c6 Suspicious string comparison: Refactoring using AST. Fixed FP in Lac. 2014-07-28 14:27:35 +02:00
Daniel Marjamäki 76020d2ad0 astIsFloat: expression 'floatvar ? 0x40 : 0' is not float 2014-07-26 09:09:58 +02:00
Dmitry-Me 07c120f1af Cache option flags and check them first. 2014-07-23 17:06:27 +04:00
Daniel Marjamäki 2cc31acabb Fixed #5922 (FP: passedByValue for std::string::value_type) 2014-07-18 15:51:59 +02:00
Daniel Marjamäki bf5b4d9ece astyle formatting
[ci skip]
2014-07-14 14:38:40 +02:00
Dmitry-Me 9829e0b48a Clearer variable names, fix typo in comment. 2014-07-11 11:33:09 +04:00
Dmitry-Me ba3757dfd3 Bring variables decalaration to where they are really needed. 2014-07-10 11:23:14 +04:00
Daniel Marjamäki d40b77dce2 Removed special 'else if' handling. this is redundant since these are simplified. 2014-07-02 16:16:19 +02:00
Daniel Marjamäki 5e9e90b1c1 Fixed Token::Match pattern. In x|y|.. patterns, all %cmd% should be placed before plain-text operands. 2014-07-01 15:55:29 +02:00
Daniel Marjamäki 41baffdda1 Fixed #5850 (Wrong Message on self assignment) 2014-06-28 15:26:22 +02:00
orbitcowboy 16352ca674 Reverted fix 6d0f490138, but keeping the testcase in the testsuite. 2014-06-06 14:44:22 +02:00
orbitcowboy 6d0f490138 #5895 - Fixed potential signed integer overflow in Checkother:getvalue. Added regression test. 2014-06-05 16:41:10 +02:00
orbitcowboy e9144d1a78 Fixed #5890 - crash: wesnoth desktop_util.cpp / unicode.hpp. 2014-05-29 02:58:18 +02:00
Daniel Marjamäki 66ad3c97b9 Fixed #5857 (strPlusChar: Crash on invalid code 'int+;') 2014-05-31 10:34:00 +02:00
Daniel Marjamäki 70b4c945de Fixed #5874 (False positive: 'opposite conditions in nested if' with arrays) 2014-05-30 19:19:24 +02:00
Daniel Marjamäki bc2ba1706b cleanup redundant valueflow check. if there are no values the getValue will return NULL. 2014-05-28 21:03:16 +02:00
PKEuS 8f79dc3ff8 Cleaned up includes and forward declarations in checkers:
- Removed definitely unnecessary forward declarations (e.g. "class Token"; token.h is already included by check.h, so a definition is unnecessary)
 - Removed unused includes
2014-05-24 12:50:03 +02:00
PKEuS b78131cfcf Improved cast detection in AST:
-> Make use of it in checkother.cpp

Use tokenizer simplification instead of reimplementation for test suite
2014-05-24 11:29:32 +02:00
orbitcowboy 85496cfadc Fixed CID 1192595: Dereference null return value in checkother. 2014-05-23 18:11:44 +02:00
PKEuS bc0682d1e9 Enhancements related to duplicate expression checking:
- Fixed astIsFloat() for complex expressions
- Enhanced support for commutative operators (#5260)
2014-05-22 21:46:48 +02:00
PKEuS 9dd4ac68c0 Refactorization in CheckNullPointer:
- Use AST to detect dereferences
- Added more unit tests
- Removed handling of unknown constructs in CheckNullPointer::isPointerDeRef()

Added link to verbose message cstyleCast.
2014-05-22 19:48:00 +02:00
PKEuS f1c303d399 Fixed recently introduced verbose message for cstyleCast
[ci skip]
2014-05-22 15:46:28 +02:00
PKEuS 35528ca708 Added verbose message for "C-style pointer casting" (#4140) 2014-05-22 08:57:45 +02:00
PKEuS 4cad064c3c Fixed false positive on C code introduced by last commit 2014-05-21 20:36:19 +02:00
PKEuS d19eabde42 New Check: Compare pointer with '\0' (#4070) 2014-05-21 19:12:07 +02:00
PKEuS cdfed32500 Merged checkSelfAssignment() into checkDuplicateExpression():
- Fixed false negatives on self assignments of more complex expressions like "a.b"
- New false negative on self assignment in initialization
- Support this->... pattern in isSameExpression()
- Fixed #5819: Check type of operands
2014-05-21 18:19:42 +02:00
PKEuS 48c3d02fc3 Fixed false positives and false negatives in 'oppositeInnerCondition' (among others: #5808) 2014-05-21 14:38:41 +02:00
PKEuS 5fbd58d98d Fixed messages of CheckInternal, fixed a false positive. 2014-05-18 20:39:52 +02:00
PKEuS e713ad45cb Refactorizations:
- Simplified pattern ".|->" to "."
- Use nextArgument() where appropriate
2014-05-18 17:07:21 +02:00
PKEuS 780719665f Fixed crash when checking tinyxml introduced by previous commit 2014-05-18 13:40:49 +02:00
PKEuS 20753f4697 Refactorization: Use AST in CheckOther::checkRedundantCopy(), CheckOther::clarifyStatement() and CheckPostfixOperator::postfixOperator(). 2014-05-18 13:00:58 +02:00
Daniel Marjamäki 7ecdb30308 Fixed #5771 (false positive: (warning) When using 'char' variables in bit operations, sign extension can generate unexpected results.) 2014-05-13 15:53:31 +02:00
PKEuS 70dfb55f21 Simplified some Token::Match patterns 2014-05-11 17:50:58 +02:00
Daniel Marjamäki 827cfac91e Refactoring of CheckOther::checkModuloAlwaysTrueFalse using AST 2014-05-10 20:49:29 +02:00
PKEuS c0fc47643f Fixed false positive #5772: Use AST to check if modulo operation is preceded by an arithmetical operation. 2014-05-09 21:58:28 +02:00
Daniel Marjamäki cb43bee10d Same expression: don't warn for same expressions when there is assignment 2014-05-09 06:16:27 +02:00
Daniel Marjamäki b354de6b23 Fixed #5750 (FP:Opposite conditions in nested 'if' blocks lead to a dead code block) 2014-05-06 16:15:12 +02:00
Alexander Mai d3e8bbdc51 #5618 False positive: (performance) Use const reference for 'temp' to avoid unnecessary data copying. - redundantCopyLocalConst/CheckOther::checkRedundantCopy() is prone to false positives. As a quick fix that check becomes inconclusive. 2014-05-02 20:09:38 +02:00
orbitcowboy a6af8f5dcf #5748: Fixed FP (wrongmathcall) do not warn if an object calls a function foo.log(0). 2014-04-23 01:23:38 +02:00
Daniel Marjamäki fc24d491cc Fixed #5560 (false positive: C-style pointer casting) 2014-04-29 06:21:30 +02:00
PKEuS 866ab1ce14 Fixed false positive #5689: Care about usage of return values of memory functions 2014-04-27 12:18:33 +02:00
Daniel Marjamäki bde6698bcd Fixed #5731 (False positive with opposite conditions) 2014-04-27 10:21:20 +02:00
Daniel Marjamäki 7317785e32 astyle formatting
[ci skip]
2014-04-27 10:20:21 +02:00
Alexander Mai 17ec0af6a7 #5734 A FP literalWithCharPtrCompare was issued upon comparison with a char referenced within a string literal 2014-04-27 09:40:13 +02:00