Commit Graph

1120 Commits

Author SHA1 Message Date
Daniel Marjamäki fb8cce647c invalidTestForOverflow: Refactor; move from checkother to checkcondition 2015-11-30 08:51:15 +01:00
Daniel Marjamäki f6f4f27636 CheckOther::checkInvalidTestForOverflow: minor fix, only warn when warnings are enabled. 2015-11-29 22:03:42 +01:00
Daniel Marjamäki 26a07265a8 Fixed #7184 (Invalid test for overflow 'p + x < p') 2015-11-29 20:59:50 +01:00
Daniel Marjamäki 4fa888ec44 Warn when shifting a negative value, it is UB. (#4931) 2015-11-29 16:28:55 +01:00
PKEuS e8522c7883 Small refactorizations:
- #include cleanup
- Use std::array instead of std::vector
- Do not create a stringstream to concatenate 4 strings
- Use std::cout instead of printf
2015-11-29 10:56:44 +01:00
PKEuS f516de8633 Moved a few checks from CheckOther to CheckFunctions 2015-11-22 13:49:10 +01:00
Daniel Marjamäki 0f9d90d2be Changed Copyrights. Removed my name. 2015-11-18 20:04:50 +01:00
Alexander Mai 65666a1ba4 Makefile: explicit list directories which should be used with ctags. Run astyle. 2015-11-15 19:03:18 +01:00
amai2012 f0bf749621 #7133 crash: Variable::declarationId(). 2015-11-15 19:01:29 +01:00
PKEuS 1589841cb6 Fixed crash in clang test suite with member variable pointers 2015-11-11 18:26:59 +01:00
PKEuS 36c5815ddb Fixed false positive about redundant variable assignment in try-scopes if the variable is read in catch block (#6555) 2015-11-11 17:21:55 +01:00
Simon Martin 1ec3175c99 Silence clang warning (-Wparentheses mode). 2015-11-10 08:12:36 +01:00
PKEuS f15f8514f6 Fixed crash on garbage code (#7120) 2015-11-09 17:25:20 +01:00
PKEuS c7987ad11a Refactorization: Removed redundant nullptr checks. The existence of the tokens is guaranteed by previous Token::Match() call 2015-11-09 11:12:32 +01:00
PKEuS ee58587706 Fixed false positive unreachableCode when ternary operator is used (#6664) 2015-10-26 08:29:43 +01:00
PKEuS f637b84192 Fixed various false positives with --check-library (#6545, #6630) 2015-10-26 08:16:50 +01:00
PKEuS 2eb8492993 Fixed crash on garbage code #7034 2015-10-09 13:49:17 +02:00
Daniel Marjamäki a500f6f703 Improved handling of 'long double' and address-of in ValueType. Removed Tokenizer::simplifyFloatCasts() to handle float casts better. 2015-10-08 19:50:10 +02:00
Daniel Marjamäki f5d9ba9cf3 Rewrote the charvar checker. It now uses valueflow also to limit false negatives. 2015-10-06 17:30:51 +02:00
Dmitry-Me 662e3c8b8c Omit unneeded match checks 2015-09-07 18:35:15 +03:00
Dmitry-Me cd4f3cf8db Treat checks as mutually exclusive 2015-09-04 10:42:26 +03:00
Dmitry-Me 7287b1a251 Avoid unneeded match checks 2015-09-03 18:30:05 +03:00
Dmitry-Me 0f073ad27e Quick check to omit useless heavy matches 2015-09-03 13:09:57 +03:00
PKEuS c5a8ecb6f9 New check: Detect unused 'goto' labels (#5124) 2015-08-30 16:45:47 +02:00
Simon Martin 6fb19b02d0 Properly differentiate arrays of pointers and pointers to arrays. 2015-08-25 21:19:19 +02:00
PKEuS ab8afec3eb Refactorizations:
- Avoid unnecessary loop iterations
- Avoid unnecessary condition checking
- Reduced code duplication in symboldatabase.cpp
2015-08-16 14:23:07 +02:00
PKEuS b77912a0b5 Support namespaces in CheckOther::checkIgnoredReturnValue() 2015-08-15 12:19:14 +02:00
PKEuS 4d80df2f4a Added pointer to Type to Token (similar to Token::Variable() and Token::function()):
- Accessible via Token::type()
- Renamed former Token::type() to Token::tokType()
- Removed SymbolDatabase::isClassOrStruct()
2015-08-15 11:19:21 +02:00
Matthias Krüger 391194579c CheckOther::checkComparisonFunctionIsAlwaysTrueOrFalseError: "evaluates always" -> "always evaluates" 2015-08-11 13:27:55 +02:00
Alexander Mai 66676b8e55 Warning selfAssignment was only issued if style was enabled. 2015-08-09 13:45:35 +02:00
Daniel Marjamäki c9e239afbf Fixed #6908 (False positive: Same expression on both sides of '+='.) 2015-08-07 20:28:25 +02:00
Daniel Marjamäki ec3d76be5e astyle formatting 2015-08-07 20:27:32 +02:00
amai2012 53feb88614 Merge pull request #630 from Dmitry-Me/detectRaceInInterlockedAccess
Prototype for detecting non-interlocked check after InterlockedDecrement()
2015-08-06 15:43:10 +02:00
Dmitry-Me 43800a9419 Detect non-interlocked check after InterlockedDecrement() 2015-08-05 12:20:28 +03:00
Daniel Marjamäki e598b07a6d Moved functions to astutils 2015-08-03 09:20:50 +02:00
Alexander Mai 96c3c111fc Refactoring: Move some AST related functions to distinct source file 2015-08-02 21:57:32 +02:00
Alexander Mai 965a034afd Fix some more false positives on zerodiv: error should be issued if type of epxression is known to be integral 2015-08-01 18:42:17 +02:00
Alexander Mai f91ad9bbf6 5402 false positive: (error) Division by zero -- with boost::format 2015-08-01 17:28:54 +02:00
Daniel Marjamäki 503fb485cf Removed hardcoding of functions from checkZeroDivision 2015-07-30 13:48:51 +02:00
Daniel Marjamäki 594d30f7ae Fix Cppcheck warning about unused variable 2015-07-29 20:26:00 +02:00
Daniel Marjamäki 6790d91fbb Improve error messages for conditional values. make valueFlowSwitchVariable values conditional that depend on the case. Partial fix for #6884. 2015-07-29 19:54:57 +02:00
PKEuS 738057229c Improved astIsFloat(): Handle function calls and sizeof, fixed ordering of checks
Handle sizeof in isSameExpression() (#6851)
2015-07-29 14:28:24 +02:00
Daniel Marjamäki 389aec51ae Fixed #6598 (False positive zerodivcond - cast to double ignored) 2015-07-26 22:08:36 +02:00
Daniel Marjamäki 75f922e799 cleanup checkother 2015-07-22 18:48:43 +02:00
Daniel Marjamäki 0dd008e068 Fixed Cppcheck warning about possible null pointer dereference 2015-07-08 16:06:35 +02:00
Daniel Marjamäki 5a9328f26a Fixed Cppcheck warning about possible null pointer dereference 2015-07-08 13:41:27 +02:00
Alexander Mai 56e90f95d9 Corrections for non-Microsoft compilers 2015-06-28 12:34:08 +02:00
amai2012 649a89d308 Refactoring: Expose some previously local functions to public and add Tokenizer as argument to distinguish between C and C++ code (e.g. in isSameExpression).
Refactoring: Improve type-safety for TestFixture::assertEquals to allow tests with types which were not handled correctly (e.g. unsigned long long)
2015-06-28 12:08:36 +02:00
amai2012 99524b1f59 #6780 segmentation fault (invalid code) in Token::multiCompare. Simple fix in CheckOther 2015-06-22 11:12:46 +02:00
Alexander Mai 4172011e78 Missing update for Makefile. CheckMemoryLeakInFunction::getcode(): skip some C++ token matching in C mode. Minor refactoring 2015-06-20 22:49:28 +02:00