Commit Graph

1171 Commits

Author SHA1 Message Date
shaneasd a623168942
fix passedByValueError on enums (#2869) 2020-10-30 18:32:35 +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 c3517924d0 Clang import testing: Compare AST 2020-10-04 11:27:31 +02:00
Daniel Marjamäki fe2717fa37 Fixed testrunner 2020-09-29 17:43:53 +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 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 5b78c64420 Fixed testrunner 2020-09-25 20:04:07 +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
Daniel Marjamäki 730b95331e Fixed #9905 (False positive: known argument 'header.length()') 2020-09-20 20:17:10 +02:00
Paul 75b955b9c6 Fix issue 9833: False positive: Division by zero when using pointer to struct 2020-09-09 21:29:26 -05:00
Paul Fultz II bfe53fce04
Fix issue 9878: false positive: multiCondition (#2787) 2020-09-09 15:39:36 +02:00
Paul Fultz II a4f43fc2ad
Fix issue 8234: false negative: (warning) Opposite inner 'if' condition leads to a dead code block. (#2781) 2020-09-07 07:53:41 +02:00
Daniel Marjamäki 1daf1ec108 Fixed #9875 (Crash) 2020-09-04 19:15:48 +02:00
Daniel Marjamäki 5acd6fcdc8 astyle formatting 2020-09-03 18:55:40 +02:00
shaneasd 08ea6435ac
fix false positives in constParameter (#2758) 2020-09-03 18:44:44 +02:00
Paul Fultz II 3e99bff764
Same expression when comparing with zero (#2762) 2020-08-31 08:48:48 +02:00
Paul Fultz II 02287d9d34
Fix issue 7324: valueFlowForward : decrement (#2737) 2020-08-24 13:10:36 +02:00
Daniel Marjamäki 5372e93964 Fixed #9825 (redundantAssignment: Do not warn about volatile data) 2020-08-06 22:18:25 +02:00
Daniel Marjamäki 7a85b8e452 Do not ask that calculation is clarified when different order would be invalid 2020-08-05 13:20:18 +02:00
Ken-Patrick Lehrmann 61ccf888b3 Fix some false positives when the same expression at different places does not have the same value
Typically with
```
int F(int *f);
void F2(int *a, int *b) {
  int c = *a;
  F(a); // modifies *a
  if (b && c != *a) {}
}
```
we would get the following FP:
```
[test.cpp:3] -> [test.cpp:5]: (style) The comparison 'c != *a' is always false because 'c' and '*a' represent the same value.\n
```

I guess it boils down to isSameExpression only checking that the
expression is the same (in the above case, "*a" and "*a" are indeed the
same), but there's not real check on the values.
So the patch here is a bit hackish, and we still have false negatives in
cases with dereferenced pointers.
2020-07-11 14:13:18 +02:00
Daniel Marjamäki d2b2bae7bf Fixed #7733 (False positive: scope of the variable can be reduced (variable is used in hidden code)) 2020-07-01 08:24:52 +02:00
Paul cf475fab51 Fix issue 9778: False positive: constParameter when returning non-const reference cast 2020-06-26 15:47:59 -05:00
Paul 1676ad5f45 Fix issue 9710 and 9767: Use AST to get function from argument 2020-06-25 12:54:46 -05:00
Paul Fultz II 03b41ac987
Fix issue 9718: False positive: Parameter can be declared const when written to via stream extraction operator (#2677) 2020-06-13 09:20:40 +02:00
Paul Fultz II eb4754b7d9
Fix issue 9587: False positive: parameter can be declared with const (#2667) 2020-05-31 10:10:10 +02:00
Daniel Marjamäki c86cfdaa50 Fixed #9736 (False positive: knownArgument in assert calls) 2020-05-22 11:49:28 +02:00
miltolstoy a9d8b3495d
feat: add modulo of one check (#9528) (#2650) 2020-05-20 23:01:32 +02:00
PKEuS c9d8f607df Optimization: Reduced peak memory usage (30% in my test case) by immediately deleting simplecpp::TokenList while creating the cppcheck TokenList. 2020-05-19 12:08:17 +02:00
Daniel Marjamäki 330e634937 Revert "TestTrac: Add separate file for black box / integration tests in testrunner"
This reverts commit e895fa4c3f.
2020-05-19 07:53:54 +02:00
Daniel Marjamäki e895fa4c3f TestTrac: Add separate file for black box / integration tests in testrunner 2020-05-18 20:22:00 +02:00
shaneasd 7bfd686f04
Fix #9700 duplicateBranch false positive from missing scope operator :: in ast (#2646) 2020-05-18 19:31:13 +02:00
Daniel Marjamäki 08ddd84780 Update copyright year 2020-05-10 11:16:32 +02:00
Daniel Marjamäki 3e0218299b Revert "Update copyright year"
This reverts commit 6eec6c4bd5.
2020-05-10 11:13:05 +02:00
Daniel Marjamäki 6eec6c4bd5 Update copyright year 2020-05-10 11:11:34 +02:00
Daniel Marjamäki da6e0308c5 Fixed #9195 (False positive: shadowFunction when constructor is shadowed) 2020-04-20 18:02:10 +02:00
Daniel Marjamäki 54978847c5 Fixed #8916 (FP: followVar does not seem to handle non-const method call properly) 2020-04-18 19:54:55 +02:00
Daniel Marjamäki 5376ba1701 AST: Throw validation exception if ternary operator is missing operands 2020-03-07 21:46:38 +01:00
amai2012 b795d30db6 Enable another zeroDivCond test which got fixed recently 2020-03-06 17:15:54 +01:00
Rikard Falkeborn f6e7fb4bd9
Bugfix valuetype for some integer constants (#2545) 2020-02-19 07:51:39 +01:00
Daniel Marjamäki 320cb9008f minor tweaks of knownConditionTrueFalse 2020-02-15 20:21:13 +01:00
Rikard Falkeborn b1c6f2946a
Fix redundant FP assignment with unsigned zero (#2521)
* Refactor isNullOperand out of FwdAnalysis

* Improve isNullOperand

* Fix redundantAssignment FP with unsigned zero

* isNullValue check number

* Enhance isNullOperand to handle c++ casts

Also handle cast of NULL.
2020-02-09 11:16:08 +01:00