Commit Graph

1452 Commits

Author SHA1 Message Date
Paul Fultz II 7f358b2bed
Format with uncrustify (#3388) 2021-08-07 20:51:18 +02:00
Paul Fultz II 41c94b656a
Fix FP const pointer with class variable and add more tests (#3345) 2021-07-21 07:36:13 +02:00
Daniel Marjamäki fb5ab5e439 constPointer; Improved checking dereferenced pointer is used in calculation/comparison 2021-07-20 10:38:38 +02:00
Daniel Marjamäki 4d23c02320 constPointer; Improved checking when pointer is not dereferenced 2021-07-20 10:28:35 +02:00
Daniel Marjamäki eb9a251a4c const variables/parameters; Improved check to handle pointers also (misra 8.13) 2021-07-18 10:59:52 +02:00
orbitcowboy 0d96772304 Running astyle [ci skip] 2021-07-09 16:32:19 +02:00
Daniel Marjamäki 86f1acc223 overlapping data; use the size value given by size-arg 2021-07-09 13:43:29 +02:00
Daniel Marjamäki ce58748690 library: add attribute strlen-arg for <not-overlapping-data> 2021-07-09 13:25:01 +02:00
Daniel Marjamäki 6234b5438e New check: Writing overlapping data, detect undefined behavior 2021-07-05 22:07:41 +02:00
Daniel Marjamäki 1783fd1bba duplicateBreak; Allow extra return that clarifies for tool(s) that function does not continue 2021-06-29 11:17:12 +02:00
Daniel Marjamäki 9769afe434 knownConditionTrueFalse; avoid several warnings when nonzero expression is compared to see if it is positive or negative 2021-06-25 16:25:25 +02:00
Daniel Marjamäki 87554bed7a Redundant pointer op; Fixed false positives when macro is used 2021-05-22 14:18:29 +02:00
Daniel Marjamäki 32b28d568f Refactoring; Check structured binding in isVariableChanged() 2021-05-08 20:46:46 +02:00
Daniel Marjamäki a197e94573 Fixed #10266 (False positive; parameter can be const) 2021-05-08 13:40:52 +02:00
Daniel Marjamäki 07c1f28035 astyle formatting 2021-05-01 07:35:03 +02:00
Paul Fultz II 31e3e4d87b
Fix issue 10086: false positive: (style) constVariable: Variable 'x' can be declared with const (#3219) 2021-04-30 17:47:08 +02:00
Daniel Marjamäki d2d2124238 Revert "Clang import; This experimental feature didn't "take off" much. After a lot of work we are still far fram the goal. I remove it now but don't rule out completely that it could ever be added again."
This reverts commit 207361b174.
2021-04-30 16:47:02 +02:00
Daniel Marjamäki 207361b174 Clang import; This experimental feature didn't "take off" much. After a lot of work we are still far fram the goal. I remove it now but don't rule out completely that it could ever be added again. 2021-04-21 18:59:48 +02:00
Daniel Marjamäki cf8a423636 Unreachable code; better handling of throw in C code 2021-04-05 04:53:07 +02:00
Daniel Marjamäki 084bc74080 Fixed #8223 (false negative: Statements following return, break, continue, goto or throw will never be executed.) 2021-04-04 19:43:51 +02:00
Oliver Stöneberg 6397e29f84
cleaned up includes based on include-what-you-use (#3141) 2021-04-03 21:30:50 +02:00
Daniel Marjamäki 42437277dc Update Copyright year 2021-03-21 20:58:32 +01:00
PKEuS 141d2ac215 Refactorization: Improved internal implementation of severity and certainty levels
Backported from LCppC.
2021-02-24 22:00:06 +01:00
PKEuS c25b4f1ad6 Fixed false negatives incompleteArrayFill on user defined types (estimate size to determine if it is larger than one byte)
Merged from LCppC.
2021-02-24 21:48:26 +01:00
Oliver Stöneberg 96704c9971
fixed and enabled some more clang-tidy warnings (#3007) 2021-01-05 17:51:32 +01:00
Daniel Marjamäki 8bd783f820 Refactoring; Added findBreakScope and Scope::isLoopScope() 2020-12-24 22:58:31 +01:00
Daniel Marjamäki 809cec2b58 Fix crashes when Variable::valueType is nullptr, this can happen when decltype(unknown type) is used. 2020-11-27 12:07:15 +01:00
Paul Fultz II 4a8a78a925
Fix issue 10002: False positive: constParameter with reference to pointer (#2918) 2020-11-22 08:47:24 +01:00
Daniel Marjamäki 6236beeb3f Fixed #9950 (Wrong severity for redundantAssignInSwitch) 2020-11-15 13:09:28 +01:00
fwingerter-Ocient d7473cab8c
Handle static_assert if standard is at least C++11 (#2842)
Previously it was being handled only if the standard was *exactly* C++11.
2020-11-10 18:22:08 +01:00
Oliver Stöneberg 488813d00f
added validateCFG and checkcfg targets to CMake / some refactorings (#2687) 2020-11-02 20:16:15 +01:00
Daniel Marjamäki f1ce5a9101 Fixed #9929 (False positive: suspicious semicolon after macro) 2020-10-09 20:34:20 +02:00
Daniel Marjamäki a39e5835d4 Fixed #9925 (False positive: Redundant pointer operation in macro) 2020-09-29 18:27:07 +02:00
Daniel Marjamäki 67b1698752 daca: suppress variableScope warnings in C code as that is usually suppressed in real world. It should make the daca output more relevant. 2020-09-29 17:20:19 +02:00
Daniel Marjamäki bf3833dad5 Avoid constStatement false positives for 'foo() || x=5'. Found in daca@home. 2020-09-29 13:35:39 +02:00
Daniel Marjamäki 31c800e19e Fixed false positive: suspicious operator ',' seen in daca@home 2020-09-29 11:32:48 +02:00
Daniel Marjamäki d901edd4af Avoid clarifyCalculation warning for 'x % 16 ? 1 : 0' expression. Fixes FP seen in daca@home. It seems likely that the order is understood otherwise the ternary calculation could easily be simplified away. 2020-09-29 08:39:21 +02:00
Daniel Marjamäki e32ccb591b Fixed clarifyCalculation fp for 'a % b ? "a" : "b"'. seen in daca@home. 2020-09-29 08:29:23 +02:00
Daniel Marjamäki 8395522390 Fixed #9919 (False positive: clarifyCalculation for code: flags & ZRL_EOL_NUL ? '\0' : '\n') 2020-09-28 19:18:34 +02:00
Daniel Marjamäki 3b39433e21 Fixed Cppcheck warnings 2020-09-26 22:30:59 +02:00
Daniel Marjamäki 5578b09452 More fixing for #9914. New warning id and warning message when variable expression is explicitly hidden. 2020-09-26 13:49:47 +02:00
Daniel Marjamäki 05b0a0f970 Make duplicateAssignExpression warnings inconclusive for 'x&&false' etc. (#9914) 2020-09-26 10:50:58 +02:00
Paul Fultz II 887b40e08b
Fix issue 9916: False positive: duplicateAssignExpression when it's checked if variables have initial value later (#2825) 2020-09-26 10:31:40 +02:00
Daniel Marjamäki 5856fef83b Fixed #9914 (False positive: knownArgument for 'x && false') 2020-09-25 20:27:16 +02:00
Daniel Marjamäki bbd3a992b8 Fix output when note contains 2020-09-25 19:04:22 +02:00
Daniel Marjamäki 485153c930 Limit variableScope check. Do not check C code if all local variables are declared at function level. 2020-09-25 08:34:47 +02:00
Daniel Marjamäki 801cc8d331 Fixed knownArgument false positive for pointer 2020-09-24 19:48:20 +02:00
Daniel Marjamäki c08e1a9a94 Fix knownArgument false positive when sizeof is used 2020-09-24 19:43:39 +02:00
Daniel Marjamäki 514b7f4da4 Fixed #9906 (False positive: constParameter (function pointer)) 2020-09-23 22:10:47 +02:00
Daniel Marjamäki 107ee57e7a Fixed #9909 (False positive: knownArgument for calculation 'self->maxsize * sizeof(intptr_t)') 2020-09-21 20:02:55 +02:00