Daniel Marjamäki
6de91d6386
Fixed #9707 (False positive: unreadVariable, union)
2020-10-02 20:22:22 +02:00
Daniel Marjamäki
ea3a9d658a
Suppressions: Add special case for backwards compatibility. suppression comment after a {.
2020-10-02 18:56:26 +02:00
Daniel Marjamäki
1251d35ba4
Fix SymbolDatabase for 'extern const char ( * x [ 256 ] ) ;'
2020-10-02 08:25:43 +02:00
orbitcowboy
da6f10e369
Astyle formatting code [ci skip]
2020-10-01 08:33:16 +02:00
Daniel Marjamäki
1548bf2267
Fix googletest.cfg macros ASSERT_THROW and EXPECT_THROW to avoid syntax errors
2020-09-30 18:45:04 +02:00
orbitcowboy
63917bc3c3
Better fix for c4dd8536c1
2020-09-30 15:44:06 +02:00
Daniel Marjamäki
c4dd8536c1
Fixed make checkcfg
2020-09-30 12:36:31 +02:00
Daniel Marjamäki
fe2717fa37
Fixed testrunner
2020-09-29 17:43:53 +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
f956dee58a
Tokenizer: Fixed simplification of parentheses in expression 'a=(b,c);'
2020-09-29 12:06:30 +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
ad9b2741cd
varid: set varid for 'extern const char (*x[256]);'. This is a partial fix for #9922
2020-09-29 10:53:20 +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
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
fa42d8c49c
Fixed #9920 (Tokenizer: The keyword is not replaced, leads to false positive)
2020-09-28 16:35:50 +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
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
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
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
Daniel Marjamäki
107ee57e7a
Fixed #9909 (False positive: knownArgument for calculation 'self->maxsize * sizeof(intptr_t)')
2020-09-21 20:02:55 +02:00
Oliver Stöneberg
7189b303ae
fixed some modernize-loop-convert clang-tidy warnings ( #2815 )
2020-09-21 19:30:47 +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
Paul Fultz II
857722f859
Fix issue 9711: FP knownConditionTrueFalse for variable modified via pointer ( #2813 )
2020-09-20 14:27:09 +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
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
shaneasd
53a0760fdf
Improve ast generation for templated function parameters ( #2803 )
2020-09-14 18:44:50 +02:00
Paul Fultz II
a42976d656
Fix issue 9898: false positive: knownConditionTrueFalse ( #2806 )
2020-09-14 18:43:11 +02:00
Daniel Marjamäki
4dd85cfbe0
Merge pull request #2802 from rikardfalkeborn/9228-fix-fn-with-realloc-and-null-assignment
...
Improve memleakOnRealloc with assignment to NULL
2020-09-14 11:04:29 +02:00
Paul Fultz II
94850fec3f
Fix issue 9897: False positive: nullPointerRedundantCheck ( #2805 )
2020-09-14 09:17:29 +02:00
Paul Fultz II
bb7164171c
Fix issue 9894: ValueFlow: wrong known value below while with assignment ( #2804 )
...
* Fix issue 9894: ValueFlow: wrong known value below while with assignment
2020-09-14 08:03:25 +02:00
Rikard Falkeborn
791051ced0
Fix #9228 (FN common realloc mistake with assignment of NULL)
...
Do not match for assignments with NULL.
2020-09-13 21:49:49 +02:00
Rikard Falkeborn
da8ad9ce19
memleakOnRealloc: Don't warn if pointer is NULL in condition
2020-09-12 18:48:23 +02:00
Paul
be900873cc
FIx issue 9895: ValueFlow: Wrong known value below function call with reference parameter
2020-09-11 16:03:57 -05:00
Daniel Marjamäki
e03a8e1dc1
Fixed #9892 (Crash: endless recursion in Token::typeDecl for expression 'auto combo = widget->combo = new Combo{};')
2020-09-11 21:29:48 +02:00
Daniel Marjamäki
61145cf878
test/cli/test-inline-suppress.py: better testing
2020-09-11 18:29:42 +02:00
Daniel Marjamäki
600538a325
Merge pull request #2793 from Ken-Patrick/mixedoperators
...
Fix false positives with condition with || and &&
2020-09-11 10:11:31 +02:00
Daniel Marjamäki
d46b9cec5f
Merge pull request #2795 from pfultz2/fp-lifetime-temp-function-obj
...
Fix issue 9889: False positive: Using reference to dangling temporary with function object
2020-09-11 09:05:43 +02:00
Daniel Marjamäki
7e02789d3f
Merge pull request #2794 from pfultz2/lifetime-temp-ref-move
...
Fix issue 9888: False positive: Using reference to dangling temporary with std::move
2020-09-11 07:20:32 +02:00
Daniel Marjamäki
ac66f67bad
Merge pull request #2790 from pfultz2/forward-analyze-accumulate-actions
...
Fix issue 9833: False positive: Division by zero when using pointer to struct
2020-09-11 07:17:10 +02:00
Paul
71bc79ac28
Fix issue 9889: False positive: Using reference to dangling temporary with function object
2020-09-10 22:58:17 -05:00
Paul
b26c581556
Fix issue 9888: False positive: Using reference to dangling temporary with std::move
2020-09-10 22:38:31 -05:00
Paul
4d1b3e06c7
Fix FPs
2020-09-10 17:06:49 -05:00
Ken-Patrick Lehrmann
a114bf0293
Fix false positives with condition with || and &&
...
The value of something in the middle of a condition with mixed || and &&
gives no information on which branch will be taken.
For instance with:
```
int f(int a, int b, bool x) {\n"
if (a == 1 && (!(b == 2 && x))) {
} else {
if (x) {
}
}
return 0;
}
```
We can enter the if part whether x is true or false, and similarly,
enter the else part whether x is true or false. Same thing with the
value of b.
This fixes the following false positive with above code:
```
:4:13: style: Condition 'x' is always true [knownConditionTrueFalse]
if (x) {
^
:2:33: note: Assuming that condition 'x' is not redundant
if (a == 6 && (!(b == 21 && x))) {
^
```
2020-09-10 23:27:39 +02:00
Daniel Marjamäki
2b12ef653d
Merge pull request #2792 from IOBYTE/main
...
fix #9886 (Hang in TemplateSimplifier (gcc/gcc/testsuite/g++.dg/cpp0x…
2020-09-10 21:47:44 +02:00
Daniel Marjamäki
51f5f2c7d0
Fix inline suppressions problem
2020-09-10 21:46:15 +02:00
Robert Reif
a52ce7379a
fix #9886 (Hang in TemplateSimplifier (gcc/gcc/testsuite/g++.dg/cpp0x/decltype34.C))
2020-09-10 14:47:59 -04:00
Paul
5033fb4418
Fix issue 9869: False positive: knownEmptyContainer when passed to constructor
2020-09-09 22:23:42 -05: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
34d65e25d6
Merge branch 'main' into lifetime-subfunction
2020-09-09 12:02:02 -05:00
Daniel Marjamäki
7c8c0ef3a2
Bug hunting: Avoid uninit struct member false positives
2020-09-09 18:26:04 +02:00
Daniel Marjamäki
f95a53b0ca
Fixed #9821 (False positive: Delegating constructor and initialization list)
2020-09-09 18:04:21 +02:00
Paul Fultz II
bfe53fce04
Fix issue 9878: false positive: multiCondition ( #2787 )
2020-09-09 15:39:36 +02:00
Daniel Marjamäki
b1401c6536
Merge pull request #2789 from pfultz2/smart-ptr-constructor
...
Fix issue 9496: False negative: Dereferencing returned smart null-pointer
2020-09-09 08:16:30 +02:00
Daniel Marjamäki
1c37423f1b
Merge pull request #2788 from pfultz2/lifetime-dangling-temp-reference
...
Fix issue 9835: False negative: Return reference to temporary with const reference
2020-09-09 08:01:22 +02:00
Paul
965fea370f
Formatting
2020-09-08 21:55:53 -05:00
Paul
382408f59e
Fix issue 9496: False negative: Dereferencing returned smart null-pointer
2020-09-08 21:54:38 -05:00
Paul
8d7088aa24
Fix issue 9835: False negative: Return reference to temporary with const reference
2020-09-08 18:30:45 -05:00
Daniel Marjamäki
5376decbe7
Merge pull request #2783 from pfultz2/out-of-bounds-at-index
2020-09-08 20:30:31 +02:00
Paul
8c425790f4
Merge branch 'main' into lifetime-subfunction
2020-09-08 13:18:01 -05:00
Daniel Marjamäki
18e99176e5
Fix issue 9883: endless recursion in getLifetimeTokens ( #2786 )
2020-09-08 20:14:54 +02:00
Paul Fultz II
5099ca3c8b
Fix issue 9882: segfault in ForwardTraversal ( #2785 )
2020-09-08 20:14:10 +02:00
Paul
d5489fd1f0
Fix issue 9883: endless recursion in getLifetimeTokens
2020-09-08 11:33:29 -05:00
Paul
1be67ea008
Merge
2020-09-08 11:00:57 -05:00
Daniel Marjamäki
e802d85315
Fixed #9445 (Syntax error on typeof word in C)
2020-09-08 17:12:54 +02:00
Daniel Marjamäki
c0ef640304
Fixed #9881 ((Regression) Hang with operator() in function call)
2020-09-07 21:32:29 +02:00
Daniel Marjamäki
07f6876dc8
Bug hunting; avoid uninit var fp for struct variables
2020-09-07 21:19:07 +02:00
Daniel Marjamäki
cfd41fea83
Fixed #9879 (Tokenizer: Better handling of operator() '(*this)(...)')
2020-09-07 20:07:21 +02:00
IOBYTE
2106e30304
fix template namespace bug ( #2780 )
...
Co-authored-by: Robert Reif <reif@FX6840>
2020-09-07 17:45:19 +02:00
Daniel Marjamäki
acfff072ae
Bug hunting; avoid bughuntingUninitVar fp for template variable
2020-09-07 16:25:37 +02:00
Paul Fultz II
ac67049661
Fix issue 9858: Token::astOperand1() cyclic dependency on valid C++ code ( #2784 )
2020-09-07 10:54:32 +02:00
Paul Fultz II
362ab44c40
Fix issue 9646: False negative: Return reference to temporary with const reference ( #2782 )
2020-09-07 10:52:54 +02:00
Daniel Marjamäki
06c4b8897b
Bug hunting: Avoid uninitialized fp for smart pointer
2020-09-07 09:34:08 +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
Paul
7754449fd6
Format
2020-09-06 23:48:05 -05:00
Paul
04c85baf03
Fix issue 8869: false negative: (error) Invalid v.at() argument nr 1
2020-09-06 23:46:31 -05:00
Paul
786672e19d
Format
2020-09-06 21:59:21 -05:00
Paul
c7a5d3c5f1
Fix FPs
2020-09-06 21:58:36 -05:00
Daniel Marjamäki
136ac2c643
Fixed #9266 (handle operator() better)
2020-09-06 21:02:06 +02:00
Daniel Marjamäki
4bf411d63d
ImportProject: Add test case
2020-09-06 16:08:42 +02:00
Daniel Marjamäki
54b5e77548
TestImportProject: Use raw strings
2020-09-06 16:00:19 +02:00
Dan
7efd84ecaf
Fix false skipping of folder-seperator ( #2749 )
2020-09-06 15:35:14 +02:00