Commit Graph

118 Commits

Author SHA1 Message Date
Daniel Marjamäki 79ffe1d4fc Rename _tokenizer, _settings, _errorLogger 2018-06-16 16:10:28 +02:00
Daniel Marjamäki b9c1308a81 Fixed #8575 (false positive: longCastAssign) 2018-06-04 22:51:21 +02:00
Daniel Marjamäki f336c2efe7 Refactoring; Renamed Scope::classStart and Scope::classEnd 2018-04-27 22:36:30 +02:00
Daniel Marjamäki a0906140a6 Suppressions: New extensible Suppressions xml format that allow more attributes. To start with it also allows symbolName. 2018-04-09 06:43:48 +02:00
Daniel Marjamäki 7e4dba6a7e Updated copyright year 2018-03-31 20:59:09 +02:00
orbitcowboy b7b376d901 checkTypes: Take into account type promotion to integer. 2018-02-19 23:55:38 +01:00
orbitcowboy b1b3164259 checktype: Added handling of 'short'-type and added test cases. 2018-02-18 21:09:19 +01:00
orbitcowboy 50844aa7fc checkType: Take into account the size of char. 2018-02-18 14:28:48 +01:00
Daniel Marjamäki 85d8bbacb8 integerOverflow: Separate id for conditional integer overflows 2018-02-07 12:49:56 +01:00
Daniel Marjamäki c4caee6b18 Updated copyright year 2018-01-14 15:37:52 +01:00
Daniel Marjamäki c4c76aa1ad Use MathLib::bigint_bits 2017-10-21 22:08:34 +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 840c7eb258 checkFloatToIntegerOverflow: check all calculations, not only in function bodies 2017-09-19 19:30:24 +02:00
Daniel Marjamäki 9268c2034a checkSignConversion: check all calculations, not only in function bodies 2017-09-19 19:25:33 +02:00
Daniel Marjamäki f6e30eee19 checkIntegerOverflow: handle long and long long also 2017-09-19 19:14:29 +02:00
Daniel Marjamäki cac7146cac checkIntegerOverflow: check all calculations, not only in function bodies 2017-09-19 14:43:48 +02:00
Daniel Marjamäki 6bc0df2908 checkTooBigBitwiseShift: Separate id for signed shift overflow 2017-09-19 09:21:20 +02:00
Daniel Marjamäki be0ad20a04 checkTooBigBitwiseShift: bitshift overflow when lhs is signed 2017-09-19 09:08:44 +02:00
Daniel Marjamäki 0cf551351b tooBigBitwiseShift: check all calculations, not only in function bodies 2017-09-19 08:50:19 +02:00
Daniel Marjamäki 71b0370389 Fixed #1793 (CheckType::checkFloatToIntegerOverflow: assignments) 2017-08-23 05:34:47 +02:00
Ayaz Salikhov 28aa939d69 iwyu - include what you use 2017-05-27 04:33:47 +02:00
Daniel Marjamäki f7cda81c0c Refactoring: ValueFlow::Value::errorSeverity() will have the logic if value is 'error' or 'warning' 2017-05-23 11:43:56 +02:00
Daniel Marjamäki 8ef9ab26b1 Clarify floatConversionOverflow 2017-05-22 11:04:24 +02:00
Daniel Marjamäki 0cb1c4f221 Clarify integerOverflow messages 2017-05-22 10:10:56 +02:00
Daniel Marjamäki 9374055238 ErrorPath: clarify the 'shiftTooManyBits' error message 2017-05-22 07:58:56 +02:00
PKEuS b1f4bd7504 Refactorization: Reimplemented Settings::_enabled as a bitfeld instead of std::set (#7995) 2017-04-11 11:49:26 +02:00
PKEuS 3c8f5b85ae Refactorization: Allocate Token::_values (ValueFlow information) dynamically, reducing size of each token by around 10% 2017-03-27 18:48:34 +02:00
Daniel Marjamäki 28af5c0379 Integer Overflow: Don't warn about left-shift expressions with negative result like '1<<31'. That is common practice. 2016-12-21 18:19:59 +01:00
Daniel Marjamäki 87abe1174f floatConversionOverflow: Avoid warnings when 255.5 is converted to unsigned char etc. 2016-12-10 23:14:40 +01:00
Daniel Marjamäki a198422f0e Fixed Coverity warning. Coverity assumes that 'bits < 64' means that bits can be 63. That is not true here but anyway I think the code needed to be fixed. 2016-11-25 15:19:18 +01:00
Daniel Marjamäki 0b3751520b Add a check for float conversion overflows 2016-11-22 22:37:13 +01:00
Daniel Marjamäki 4de5dc75aa Fixed #7807 (false positive: (error) Signed integer overflow for expression 'int32_max-1'.) 2016-11-07 22:29:40 +01:00
Daniel Marjamäki f280061ff8 signed int overflow: warn about intmax+1 2016-11-05 09:29:52 +01: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
Daniel Marjamäki 920ac5a3f6 astyle formatting
[ci skip]
2016-07-16 21:21:24 +02:00
Roberto Martelloni 25525e38a7 CWE mapping of incorrectStringCompare, literalWithCharPtrCompare, charLiteralWithCharPtrCompare, incorrectStringBooleanError, staticStringCompare, stringCompare, signConversion, unusedFunction, unusedVariable 2016-07-16 10:07:06 +01:00
Daniel Marjamäki c24a4b9189 Removed enum mismatch checker. Ticket #6960. 2016-05-29 18:00:37 +02:00
Daniel Marjamäki 613311cc57 Fixed #7493 (enumMismatch on Enum declaration) 2016-05-12 11:46:08 +02:00
Daniel Marjamäki bf8471e109 Fixed #7491 (Questionable enumMismatch) 2016-05-11 15:33:59 +02:00
Daniel Marjamäki fb5e6d8a7d Fixed #6960 (New check: enum variable is assigned mismatching value) 2016-05-10 20:22:35 +02:00
PKEuS 4b3feebbcd Refactorization: Reordered some conditions in checktype.cpp 2016-02-05 20:28:43 +01: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
Daniel Marjamäki 5e10e680da CWE: refactoring. use constants instead of magic numbers. 2016-01-25 20:01:48 +01:00
Daniel Marjamäki 760d5ab7f9 Try to fix travis. use Token::simpleMatch instead of Token::Match. 2016-01-10 21:00:42 +01:00
Daniel Marjamäki 4269702755 Fixed #7266 (False positive shiftTooManyBits with macros) 2016-01-10 20:44:52 +01:00
Daniel Marjamäki 125d2f7a36 Some initial support for platforms that doesn't have 8-bit char 2016-01-05 13:16:00 +01:00
Alexander Mai 1d3e39df7e Adjust message text for signConversion for constant negative epxressions 2016-01-02 22:56:15 +01:00
Lauri Nurmi 996c9244d8 Update copyright year to 2007-2016. 2016-01-01 15:34:45 +02:00
Daniel Marjamäki 17ab0a4e9a Fixed #7246 (crash: CheckType::checkLongCast()) 2015-12-31 14:07:38 +01:00
Daniel Marjamäki 9f6890512c Refactoring CheckType checkers. Use ValueType. 2015-12-31 12:05:23 +01:00
Daniel Marjamäki 67435af06a Refactor CheckType::checkTooBigBitwiseShift. Use ValueType. 2015-12-31 01:51:21 +01:00
Daniel Marjamäki 0f9d90d2be Changed Copyrights. Removed my name. 2015-11-18 20:04:50 +01:00
PKEuS 1627b19dd6 Refactorizations:
- Call std::string::find() with char instead of char* where possible
- Avoid string copying
- Optimized several Token::tokAt/strAt calls
2015-08-16 10:33:51 +02:00
Daniel Marjamäki 4bde4d5a4a updated style messages 2015-06-01 21:22:47 +02:00
Daniel Marjamäki a8d7897471 Fixed travis failure 2015-05-25 18:19:40 +02:00
Daniel Marjamäki a9db06c641 longCast: Only warn when original name is 'long'. avoids some FPs when typedef types are used. 2015-05-25 18:06:20 +02:00
Daniel Marjamäki c0b33d2fef Fixed #6707 (new check: possible truncation when assigning int result to long) 2015-05-25 10:02:17 +02:00
Daniel Marjamäki 88f59ad7e8 Partial fix for #6656 (Allow that CWE is mapped for error message) 2015-04-25 17:48:11 +02:00
Matthias Krüger 42f0955e3f Move more setting checks out of loops and use const bools instead. Reorder a few related checks.
Follow up to eedcb6abcb .
2015-04-10 14:31:19 +02:00
Matthias Krüger eedcb6abcb move setting flags checks out of for loops, make them const. 2015-04-07 07:23:28 +02:00
Daniel Marjamäki ff11ba9847 Updated copyright year to 2015 2015-01-03 12:14:58 +01:00
Daniel Marjamäki 4483c3e820 Fixed #6234 (FP : shift by too many bits is undefined on a QT container) 2014-10-23 06:52:19 +02:00
Daniel Marjamäki d354cdc02c Fixed #6168 (False positive: sign conversion for inner calculation) 2014-09-14 10:29:58 +02:00
Daniel Marjamäki 8cbd013d7f checkSignConversion: dont warn for + and - 2014-09-12 18:58:31 +02:00
Daniel Marjamäki d60cf16eb8 Sign conversion: Improved check. When its not explicit that 'int' variable is signed but it can have negative values, assume its signed 2014-09-12 16:18:42 +02:00
PKEuS fb0d145b34 Don't show inconclusive message redundantCopyLocalConst if --inconclusive is not set.
Ran AStyle
2014-09-11 19:45:52 +02:00
PKEuS 87e6a3501a Added checktype.cpp to VS solution; Fixed MSVC warning about signed/unsigned mismatch 2014-09-11 18:47:28 +02:00
Daniel Marjamäki 7847263451 Fixed #6158 (New check: dangerous sign conversion) 2014-09-11 18:10:19 +02:00