Commit Graph

339 Commits

Author SHA1 Message Date
Oleksandr Redko a8700f5622 Remove redundant parts of conditional expressions (#988)
All issues were found with PVS-Studio:
V560 A part of conditional expression is always true: tok. astutils.cpp 407
V560 A part of conditional expression is always true: size > 0. checkbufferoverrun.cpp 709
V547 Expression 'secondTrue' is always true. checkcondition.cpp 1013
V547 Expression 'firstTrue' is always true. checkcondition.cpp 1020
V560 A part of conditional expression is always true: !scan. checkio.cpp 1036
V560 A part of conditional expression is always true: scope->function. checknullpointer.cpp 395
V560 A part of conditional expression is always true: tok2. checkstl.cpp 268
V560 A part of conditional expression is always true: par. tokenize.cpp 9440
V547 Expression '!erased' is always true. symboldatabase.cpp 3990
2017-11-03 10:39:57 +01:00
Daniel Marjamäki 9d27917fea c++98 compatibility 2017-10-08 14:16:18 +02:00
Daniel Marjamäki ba8222de1c ValueFlow: Put 'inconclusive' state in the ValueKind. A value can't be both known and inconclusive. 2017-09-20 22:41:36 +02:00
Daniel Marjamäki d79762cfc3 Fixed #7449 (reademptycontainer (inconclusive) when variable changed in function ) 2017-09-15 10:49:58 +02:00
Daniel Marjamäki 97125acabd Fixed #7365 (False positive: Use of erased iterator) 2017-09-08 09:45:30 +02:00
Daniel Marjamäki 1ecefa045a Fixed #8194 (False positive reademptycontainer - range based loop) 2017-09-02 22:22:32 +02:00
Daniel Marjamäki b7f9e7ed1d negativeContainerIndex: avoid crash when AST is wrong 2017-08-22 12:30:43 +02:00
Daniel Marjamäki 2679b576c2 Fixed #1693 (false negative: std::vector, negative index) 2017-08-22 11:04:02 +02:00
Daniel Marjamäki e977cea04c Fix issue detected by Coverity, either null pointer check is useless or there is null pointer dereference 2017-08-02 08:24:16 +02:00
Daniel Marjamäki abf525e46d Fix Cppcheck warning 2017-07-29 11:58:00 +02:00
Daniel Marjamäki a4dd8f0aa4 modernize, use nullptr 2017-07-27 18:36:33 +02:00
Daniel Marjamäki 5ae962194d revert mode change for lib/checkstl.cpp 2017-07-26 23:51:30 +02:00
Daniel Marjamäki 27af3edc5b CheckStl: Safer use of AST 2017-07-26 23:43:39 +02:00
Daniel Marjamäki eb288ec2a1 CheckStl: Use AST to handle iterator comparisons better 2017-07-26 23:13:01 +02:00
Daniel Marjamäki 32940c023a Refactoring: Use continue in loop 2017-07-26 20:32:14 +02:00
Daniel Marjamäki 2d4f64027a Refactoring: Use continue in loop 2017-07-26 20:29:13 +02:00
Daniel Marjamäki 2f38d3d80e CheckStl: Use ValueType 2017-07-26 20:19:36 +02:00
uburuntu f4ce49d883 ENH: perfomance: using clear() and empty() more faster for stl containers 2017-06-02 22:38:00 +04:00
Ayaz Salikhov 28aa939d69 iwyu - include what you use 2017-05-27 04:33:47 +02:00
PKEuS b345c430fe CheckStl::readingEmptyStlContainer(): Skip over lambdas (#8055) 2017-05-07 08:15:58 +02:00
PKEuS b1f4bd7504 Refactorization: Reimplemented Settings::_enabled as a bitfeld instead of std::set (#7995) 2017-04-11 11:49:26 +02:00
Daniel Marjamäki 279425499e Fixed #7930 (Improve check: Missing stlcstr warning for reference variable) 2017-03-01 02:03:08 +01:00
Daniel Marjamäki d840005f06 Fixed #7656 (stlcstr - false positive) 2017-02-26 17:25:32 +01:00
PKEuS cfac3b457d Several small refactorizations 2016-12-06 22:12:02 +01:00
Daniel Marjamäki 0e9810b7f6 CheckStl: validation of iterators returned from functions 2016-11-01 14:08:42 +01:00
Daniel Marjamäki 9c1a08ca84 move std function information from checkstl to std.cfg 2016-10-27 19:24:24 +02:00
Daniel Marjamäki 0b76aa0f24 checkstl: refactoring. make data static instead of anonymous. 2016-10-27 18:54:15 +02:00
Daniel Marjamäki 892596681b Try to make Travis happy 2016-10-27 11:53:37 +02:00
Daniel Marjamäki f6a5f6bb61 CheckStl::mismatchingContainers: Refactoring, use Library instead of hardcoding 2016-10-27 10:25:45 +02:00
Roberto Martelloni 28f1222dc2 CWE mapping of useAutoPointerMalloc, uselessCallsCompare, uselessCallsSwap, uselessCallsSubstr, uselessCallsEmpty, uselessCallsRemove, derefInvalidIterator, reademptycontainer, multiplySizeof, divideSizeof, stringLiteralWrite, incorrectStringCompare, literalWithCharPtrCompare, charLiteralWithCharPtrCompare, incorrectStringBooleanError, staticStringCompare, stringCompare, signConversion, truncLongCastAssignment, truncLongCastReturn, unusedFunction, unusedVariable, unusedAllocatedMemory, unreadVariable, unassignedVariable, unusedStructMember, postfixOperator, va_start_wrongParameter (#824)
Add an optional extended description…
2016-09-03 00:31:35 +02:00
orbitcowboy 87409ea6b3 Running astyle; Improved testing of std::find; std.cfg: Added support for istream::read and ifstream::read. 2016-08-25 19:17:07 +02:00
Roberto Martelloni 1db24ee070 CWE mapping of signedCharArrayIndex, unknownSignCharArrayIndex, suspiciousCase, suspiciousEqualityComparison, duplicateBranch, duplicateExpressionTernary, suspiciousSemicolon, incompleteArrayFill, redundantPointerOp, unusedLabelSwitch, unusedLabel, unknownEvaluationOrder, stlIfFind, useAutoPointerCopy 2016-08-25 15:40:23 +01:00
Daniel Marjamäki c8667096e0 Fixed #7658 (False positive: Same iterator is used with different containers) 2016-08-14 10:49:48 +02:00
Daniel Marjamäki a8df08f22b Fixed #7659 (crash: Token::varId() : vxl: brdb_selection.cxx) 2016-08-06 18:07:41 +02:00
Daniel Marjamäki 2566fd09da Fixed #5803 (False positive: Same iterator is used with different containers - insert() from range of different container) 2016-08-04 09:35:16 +02:00
PKEuS f869f7ebde Fixed false positive reademptycontainer when end() is called (#7560) 2016-07-10 10:48:21 +02:00
PKEuS 53e2cabdbb Properly support "break" in CheckVaarg::va_list_usage() (#7533)
Ran AStyle
2016-06-07 19:28:32 +02:00
Roberto Martelloni f1c39dbda7 CWE mapping of stlIfStrFind, stlcstrReturn, stlcstrParam, stlSize, (#801)
StlMissingComparison, redundantIfRemove.
2016-06-05 18:24:06 +02:00
PKEuS 64d2fd2f57 Added new attribute "arg" to <alloc> and <dealloc> to specify the argument that is allocated/deallocated.
This fixes several issues with allocation functions in windows.cfg, such as HeapAlloc() and VirtualAllocEx() (#7503)
2016-05-22 17:19:14 +02:00
PKEuS 896582ce56 Fixes for CheckStl::string_c_str():
- Fixed false positive #7480
- Fixed false negative: Show performance message also for non-local objects
2016-05-06 17:25:00 +02:00
PKEuS b7d8cd69f6 Fixed false negatives in CheckStl::string_c_str():
- Support more complex patterns (#7385)
- Use same logic for string_c_strReturn() as for string_c_strError()
2016-05-04 11:10:12 +02:00
Roberto Martelloni 50fc784550 Mapped error ids stlBoundaries, stlcstr, useAutoPointerContainer, useAutoPointerArray, sprintfOverlappingData, strPlusChar, shiftTooManyBits, integerOverflow, uninitstring, uninitdata, uninitvar, uninitStructMember, deadpointer, va_start_referencePassed, va_end_missing, va_list_usedBeforeStarted, va_start_subsequentCalls to their CWEs. 2016-02-03 12:53:23 +00:00
Alexander Mai d12197ce1a Minor refactoring, removing a redundant condition introduced in the previous changeset 2016-02-03 12:54:44 +01:00
Alexander Mai ca2e3b9abb #7370 False positive uselessCallsCompare on unknown type. Ensure related warnings are only issued on STL types 2016-02-02 20:26:02 +01:00
Daniel Marjamäki fa31ebf88e Fixed #7349 (checker 'inefficient find()' unintentionally used for find_first_of()) 2016-01-29 08:55:46 +01:00
Daniel Marjamäki 5e10e680da CWE: refactoring. use constants instead of magic numbers. 2016-01-25 20:01:48 +01:00
Roberto Martelloni 5ce69da02d Mapped 26 errors to their CWEs ID. 2016-01-24 20:53:05 +00:00
Lauri Nurmi 996c9244d8 Update copyright year to 2007-2016. 2016-01-01 15:34:45 +02:00
PKEuS 940d569980 Refactorization: Removed redundant %any% patterns. 2015-12-24 14:40:48 +01:00
Alexander Mai f762affea0 Small refactoring: replace NULL by nullptr, remove redundant static keyword, Tokenizer::setVarId() uses const variable 'notstart' 2015-11-30 22:13:49 +01:00