Commit Graph

23485 Commits

Author SHA1 Message Date
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
IOBYTE 4e4108dc8b
fix daca insighttoolkit crash in template simplifier (#2826)
Don't count deleted instantiations in the recursive count.
I can't reduce the daca code because creduce requires a preprocessed
file to reduce and the problem doesn't show up when the file is
preprocessed with cppcheck.
There is no test because I couldn't reduce the problem files.

Co-authored-by: Robert Reif <reif@FX6840>
2020-09-28 22:51:13 +02:00
Daniel Marjamäki bf236e91d7 Fixed #9918 (False positive: autoVariable pointer is NULLed later) 2020-09-28 22:48:57 +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 4c9db17742 Tokenizer: replace all or none of the alternative tokens in a translation unit 2020-09-28 19:01:31 +02:00
Daniel Marjamäki fa42d8c49c Fixed #9920 (Tokenizer: The keyword is not replaced, leads to false positive) 2020-09-28 16:35:50 +02:00
Daniel Marjamäki 84b8f32fd4 daca: group warnings for prohibited functions 2020-09-27 21:42:07 +02:00
Daniel Marjamäki 2748201d73 Fixed #9782 (Segmentation fault due to broken AST) 2020-09-27 20:41:09 +02:00
Daniel Marjamäki ba84303501 Fixed #9680 (false positive: style: Variable 'x' is assigned a value that is never used with smart pointers) 2020-09-27 19:15:15 +02:00
Daniel Marjamäki 65ac94aa88 AUTHORS: Added jlguardi 2020-09-27 17:51:44 +02:00
Daniel Marjamäki 3b39433e21 Fixed Cppcheck warnings 2020-09-26 22:30:59 +02:00
Daniel Marjamäki 7bb82c5df7 Fixed #9901 (False positive: variable is assigned value that is not used 'if (--N == 0)') 2020-09-26 22:13:05 +02:00
Daniel Marjamäki 0ec77879ea Fix crash in createAST when checking wiggle in daca@home 2020-09-26 19:22:24 +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 d615dba638 Write 'inconclusive:' in daca2 warnings 2020-09-26 11:02:10 +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
Paul Fultz II acb4ed5eb8
Add emscripten cfg (#2824) 2020-09-26 10:29:17 +02:00
Georgy Komarov 3944e70e02
misra.py: Treat enum constants as constant known at compile time (#2823)
C89 standard defines enum members as enumeration contants at ch.
6.4.4.3, and they are always known at compile time.

This commit fix false positives for rule 18.8 (and possible other rules
that check "constentess") with enumeration members.

Fix Trac#9913
2020-09-25 21:02:34 +02:00
Daniel Marjamäki 5856fef83b Fixed #9914 (False positive: knownArgument for 'x && false') 2020-09-25 20:27:16 +02:00
jlguardi 82047ea282
cppcheck-htmlreport: Support for multiple input files and fixed stdin… (#2822) 2020-09-25 20:12:41 +02:00
Daniel Marjamäki 5b78c64420 Fixed testrunner 2020-09-25 20:04:07 +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 093ff58f5f Fix crash in cbmc detected with daca@home 2020-09-24 20:48:26 +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
Oliver Stöneberg dae37f1c9f
disabled precompiled headers in CMake as they currently do not emit any compiler warnings / adjusted check for precompiled header (#2820) 2020-09-23 07:51:21 +02:00
Paul Fultz II d9eacaecbb
Fix issue 9842: ValueFlow: wrong handling of ?, seems to think that the whole expression is a condition (#2821) 2020-09-23 07:45:03 +02:00
Oliver Stöneberg 2e24cc1434
checkother.h: added missing newline in classInfo - fixes tests (#2818) 2020-09-21 21:44:46 +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
Daniel Marjamäki bca3605f77 astyle formatting 2020-09-21 19:48:04 +02:00
Oliver Stöneberg 1077b0d2a6
small compileroptions.cmake cleanup (#2817)
* compileroptions.cmake: moved common warnings to proper scope and aligned them with other build systems / fixed some -Wrange-loop-construct clang warnings

* compileroptions.cmake: use check_cxx_compiler_flag() via add_compile_options_safe() helper to avoid compiler version checks
2020-09-21 19:41:28 +02:00
Oliver Stöneberg 7189b303ae
fixed some modernize-loop-convert clang-tidy warnings (#2815) 2020-09-21 19:30:47 +02:00
orbitcowboy 98b6238450 std.cfg: Added return values for 'wmemmove' and 'memmove' 2020-09-21 08:50:28 +02:00
Paul Fultz II 7b6d3f8061
Fix issue 9907: False positive: knownEmptyContainer after function call with :: (#2814) 2020-09-20 22:37:28 +02:00
Daniel Marjamäki 730b95331e Fixed #9905 (False positive: known argument 'header.length()') 2020-09-20 20:17:10 +02:00
Daniel Marjamäki c563944fdd astyle formatting 2020-09-20 20:14:30 +02:00
Paul Fultz II 857722f859
Fix issue 9711: FP knownConditionTrueFalse for variable modified via pointer (#2813) 2020-09-20 14:27:09 +02:00
Daniel Marjamäki 9f690fb478 Revert "Create CODE_OF_CONDUCT.md (#2812)"
This reverts commit 5dbad816f0.
2020-09-19 10:14:30 +02:00
matvii 5dbad816f0
Create CODE_OF_CONDUCT.md (#2812) 2020-09-19 07:19:36 +02:00
Paul Fultz II c2e8051196
Fix issue 9904: False positive: duplicateCondition when modifying variable in lambda (#2811) 2020-09-18 07:44:26 +02:00
Paul Fultz II e5d0ffdbe7
Fix issue 9900: False positive: Returning lambda that captures local variable 'x' that will be invalid when returning. (#2809) 2020-09-17 08:33:52 +02:00
Paul Fultz II 782684a7cc
Fix issue 9530: False positive: Reference to temporary returned when using initializer lists (#2796) 2020-09-17 08:33:16 +02:00
Paul Fultz II 11c99d7387
Fix issue 9880: False positive: danglingLifetime (#2810) 2020-09-17 07:23:38 +02:00
Daniel Marjamäki b827f8d92e Fixed #9715 (FP invalidFunctionArgBool for third argument to setenv) 2020-09-15 22:31:41 +02:00
Paul Fultz II ebbff08932
Fix issue 9899: False positive: Non-local variable will use object that points to local variable (#2808) 2020-09-15 07:11:52 +02:00
Daniel Marjamäki 3459f0da32 Fixed #9812 (False positive; syntax error 'using array_p = const array_t *;') 2020-09-14 21:59:58 +02:00