Daniel Marjamäki
6f4ce486a2
Fix FP in constVariable
2021-09-11 20:25:46 +02:00
Paul Fultz II
0335671b35
Fix 10450: regression, FP : Iterator 'iter' from different container 'l' are used together ( #3436 )
2021-09-05 07:35:33 +02:00
Ken-Patrick Lehrmann
4296859c1a
Remove usage of std::vector and getArguments from getTokenArgumentFunction ( #3435 )
...
getTokenArgumentFunction can be called many many times, and the vector
is not needed, but it can become quite costly.
This patch replaces getArguments with a function simply returning the
position of the token, if it is found in the arguments (thus saving the
cost of std::vector).
2021-09-01 10:51:44 +02:00
Daniel Marjamäki
6541efdb9a
fix selfcheck warning
2021-08-27 22:33:03 +02:00
Daniel Marjamäki
a55b0c332a
Fixed #10095 (False positive: unreadVariable)
2021-08-27 17:37:42 +02:00
Paul Fultz II
865163b2ba
Add library configurations for free functions like std::size, std::empty, etc ( #3410 )
2021-08-23 09:03:48 +02:00
Paul Fultz II
7f358b2bed
Format with uncrustify ( #3388 )
2021-08-07 20:51:18 +02:00
Paul Fultz II
8b8ae55490
Fix 10129: false negative: knownConditionTrueFalse ( #3382 )
...
* Add symbolic matching
* Check for truncated values
* Dont propagate uninit values
* Update errorpath test
* Add test case for 10129
* Add test case for FP
* Remove symbolic values that are the same as the token
* Fix test messages
* Fix cppcheck issue
* Format
2021-08-04 21:07:31 +02:00
chrchr-github
28c8b00e5c
Minor: fix MSVC shadow warning ( #3376 )
2021-08-04 08:16:02 +02:00
Paul Fultz II
3a7ba3cd29
Add symbolic values to ValueFlow ( #3367 )
2021-07-30 21:29:35 +02:00
Paul Fultz II
00eb71fd49
Remove constexpr -> const simplification ( #3346 )
2021-07-22 07:22:26 +02:00
orbitcowboy
1be5bb8bbc
Running astyle [ci skip]
2021-07-18 10:01:22 +02:00
Paul Fultz II
59a1c1a9d8
Refactor: Remove variable analyzer ( #3339 )
2021-07-18 07:46:31 +02:00
Paul Fultz II
3b9c399f72
Fix 10338: Hang/Crash in valueflow ( #3328 )
2021-07-07 08:20:32 +02:00
Paul Fultz II
dd178c3ad9
Fix 10314: Possible nullPointerRedundantCheck false positive ( #3298 )
2021-06-19 13:59:48 +02:00
Paul Fultz II
3e78e76fe8
Fix issue 10076: ValueFlow: False positive after address of var is taken 'T t = {{{&var}}};' ( #3283 )
2021-06-03 07:31:46 +02:00
Paul Fultz II
5f0fe1dfe7
Fix another FP with range for macro ( #3276 )
2021-05-26 04:52:55 +02:00
Paul Fultz II
e2d9aaf23b
Fix 10286: false positive: uninitvar ( #3271 )
...
* Fix 10286: false positive: uninitvar
* Remove header
2021-05-23 07:58:19 +02:00
Paul Fultz II
5409fa8afd
Fix disabled valueFlowUninit tests ( #3262 )
2021-05-21 07:28:34 +02:00
Daniel Marjamäki
f1fff5e904
Fixed #10279 (ValueFlow/TokenList: function pointer dereference and call)
2021-05-20 13:54:17 +02:00
Daniel Marjamäki
216918756b
Fixed #10276 (FP: (style) Variable '((uint8_t*)(uint16_t)0x1000)[0]' is assigned a value that is never used.)
2021-05-18 20:35:00 +02:00
Daniel Marjamäki
404b82fc21
unused var; fix todo test cases, redundant assignment of array in loop
2021-05-14 19:07:30 +02:00
Daniel Marjamäki
d549770b5b
updated extracttests.py. fix syntax errors in test cases.
2021-05-13 20:21:02 +02:00
Daniel Marjamäki
75311fba0f
Fixed #10218 (FP uninitvar with input from stringstream in for loop)
2021-05-10 19:48:07 +02:00
Daniel Marjamäki
271acf8aee
Refactoring; Use isUnaryOp instead of simpleMatch
2021-05-10 18:18:21 +02:00
Daniel Marjamäki
2e2d766e2b
Fixed #6766 (Improve check; struct member is assigned value that is never used)
2021-05-09 20:09:10 +02:00
Daniel Marjamäki
32b28d568f
Refactoring; Check structured binding in isVariableChanged()
2021-05-08 20:46:46 +02:00
Daniel Marjamäki
2f984b201a
AST; Fix wrong AST for initializer list
2021-05-04 19:02:29 +02:00
Daniel Marjamäki
08184f4681
Fixed #10070 (FP warning: Logical disjunction always evaluates to true)
2021-05-04 13:47:09 +02:00
Daniel Marjamäki
4907c7e3e4
Fix compiler warning, non-static function
2021-04-22 18:40:44 +02:00
Paul Fultz II
691f681d86
Fix issue 10235: Regression: oppositeInnerCondition ( #3223 )
2021-04-19 09:15:03 +02:00
Oliver Stöneberg
5de58c4ddd
added clang-tidy to CI ( #3218 )
2021-04-18 21:51:47 +02:00
Paul Fultz II
563c9dd9cc
Fix issue 10208: FP: knownConditionTrueFalse in for loop with function that assigns by ref ( #3198 )
2021-04-18 21:42:27 +02:00
Paul Fultz II
5077663684
Fix issue 9979: false positive: containerOutOfBounds with conditional resize ( #3136 )
2021-03-30 14:02:28 +02:00
Paul Fultz II
9de976b243
Fix issue 10194: hang with followAllReferences() ( #3189 )
...
* Decrease depth faster when there is multiple returns
2021-03-30 11:22:56 +02:00
Daniel Marjamäki
42437277dc
Update Copyright year
2021-03-21 20:58:32 +01:00
Daniel Marjamäki
fbf63b932e
astyle formatting
...
[ci skip]
2021-02-10 11:42:00 +01:00
Paul Fultz II
0e871c178f
Fix issue 10141: Errors with ref assignment (duplicateValueTenary and knownEmptyContainer) ( #3093 )
2021-02-09 15:27:46 +01:00
Paul Fultz II
a81427f97f
Fix issue 10022: Logical conjunction error between two completely unrelated members ( #3094 )
2021-01-29 10:26:57 +01:00
IOBYTE
4e1ff86bb2
use nonneg int for varid and exprid ( #3085 )
2021-01-27 19:49:13 +01:00
Ken-Patrick Lehrmann
00707455be
10110: Fix FP knownConditionTrueFalse ( #3053 )
2021-01-25 17:23:47 +01:00
Daniel Marjamäki
772b44d11a
Fixed compiler warnings
2021-01-23 18:04:28 +01:00
Paul Fultz II
c860de8565
Fix issue 8143: valueFlowCondition: before and inside while ( #3045 )
2021-01-23 17:52:01 +01:00
Paul Fultz II
a6f4fbae54
Fix issue 2741: False negative: redundant assignment of x to itself (ref = x) ( #3071 )
2021-01-22 11:00:57 +01:00
Oliver Stöneberg
b2ed372f75
various optimizations ( #3054 )
2021-01-16 19:05:51 +01:00
Paul Fultz II
b1c56d33ac
Fix issue 9133: Invalid iterator; vector::push_back, functions ( #3008 )
2021-01-11 18:47:38 +01:00
Paul Fultz II
678ee00fe9
Infer variables from conditions in valueFlowSubfunction ( #3037 )
2021-01-11 08:00:13 +01:00
Rikard Falkeborn
50cdb6cbfc
Astyle: sync windows and linux folders ( #3016 )
2021-01-06 17:13:44 +01:00
Paul Fultz II
a95c931da0
Fix issue 8501: false negative: (style) Opposite expression on both sides of ( #3012 )
2021-01-05 12:07:27 +01:00
Daniel Marjamäki
1d6c0976e5
astyle formatting
...
[ci skip]
2021-01-01 08:56:17 +01:00
miltolstoy
ee8d5b972a
checkunusedvar: handle array element change using pointer arithmetic ( #3000 )
2021-01-01 08:06:20 +01:00
Daniel Marjamäki
bcf6039558
Fixed #10058 (False positive: redundant assignment, there is break)
2020-12-25 09:08:15 +01:00
Daniel Marjamäki
b8f45a5c65
Replace and fix findBreakScope with findNextTokenFromBreak
2020-12-25 08:43:14 +01:00
Daniel Marjamäki
8bd783f820
Refactoring; Added findBreakScope and Scope::isLoopScope()
2020-12-24 22:58:31 +01:00
Paul Fultz II
e12a733ee9
Fix issue 10053: False positive: Same value on both branches of ternary operator ( #2962 )
2020-12-23 13:37:28 +01:00
Paul Fultz II
904d52acac
Fix issue 10004: ValueFlow: pointer value, wrongly set known value ( #2931 )
2020-12-03 07:15:31 +01:00
Daniel Marjamäki
4330a43acb
Fixed #9933 (FP: uninitvar when reading to struct)
2020-11-11 22:47:23 +01:00
Daniel Marjamäki
7182da5c8e
astyle formatting
2020-11-11 09:17:54 +01:00
Paul Fultz II
bd7e915c20
Add generic reverse valueflow ( #2878 )
2020-11-10 16:00:55 +01:00
Ken-Patrick Lehrmann
79bdd64689
Fix false positive memoryleak ( #2882 )
...
```
int *f() {
int *p = static_cast<int *>(realloc(nullptr, 10));
if (!!(!p)) {
return nullptr;
}
return p;
}
```
would give
```
memleak2.cpp:4:5: error: Memory leak: p [memleak]
return nullptr;
^
```
Because of the additional `!!̀ .
2020-11-10 15:59:51 +01:00
Armin Müller
08cef9e815
Typos found by running "codespell" ( #2846 )
2020-10-15 19:24:13 +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
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
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
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
94850fec3f
Fix issue 9897: False positive: nullPointerRedundantCheck ( #2805 )
2020-09-14 09:17:29 +02:00
Paul
c568e8ea78
Format
2020-09-10 22:59:19 -05:00
Paul
71bc79ac28
Fix issue 9889: False positive: Using reference to dangling temporary with function object
2020-09-10 22:58:17 -05:00
Daniel Marjamäki
f052d32e31
astyle formatting
2020-09-10 08:02:45 +02:00
Paul
5033fb4418
Fix issue 9869: False positive: knownEmptyContainer when passed to constructor
2020-09-09 22:23:42 -05:00
Paul Fultz II
bfe53fce04
Fix issue 9878: false positive: multiCondition ( #2787 )
2020-09-09 15:39:36 +02: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
0c6dc84cbb
astyle formatting
...
[ci skip]
2020-09-07 10:56:02 +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 Fultz II
cc2bc74084
Track lifetime for lambdas with explicit capture ( #2776 )
2020-09-05 07:56:01 +02:00
Paul Fultz II
32df807b22
Fix issue 9783: wrong lifetime analysis temporary assigned to object ( #2711 )
2020-09-02 07:13:15 +02:00
Paul Fultz II
3e99bff764
Same expression when comparing with zero ( #2762 )
2020-08-31 08:48:48 +02:00
Paul Fultz II
ac846b96d1
New check: Iterating a known empty container ( #2740 )
2020-08-22 09:16:26 +02:00
Paul Fultz II
becdf20310
Fix crash in isSameExpression ( #2748 )
2020-08-22 07:05:21 +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
25ad22c6af
astyle formatting
...
[ci skip]
2020-07-23 10:09:06 +02:00
Daniel Marjamäki
df99d8aa0a
Merge pull request #2719 from pfultz2/fp-unreachable-alias
...
Fix issue 9807: False positive: ValueFlow in unreachable code, || lhs is true
2020-07-23 09:52:54 +02:00
Daniel Marjamäki
f4a6f8ad07
Merge pull request #2720 from pfultz2/crash-type-scope
...
Fix crash when typeScope is missing
2020-07-23 09:31:59 +02:00
Paul
3480aba35b
Fix crash when typeScope is missing
2020-07-21 14:09:46 -05:00
Paul
dbb410cdae
Merge branch 'main' into condition-in-expr
2020-07-21 13:28:59 -05:00
Paul
e2a81a382f
Track reading aliases during valueflow forward
2020-07-19 23:25:35 -05:00
Daniel Marjamäki
e0be224f4e
Merge pull request #2709 from pfultz2/fp-duplicate-cond-this
...
Fix FP of duplicateCondition when modifying the this variable
2020-07-13 21:14:58 +02:00
Paul
519f2a537a
Format
2020-07-13 13:55:45 -05:00
Paul
450bdfedf3
Fix FP of duplicateCondition when modifying the this variable
2020-07-13 12:40:01 -05:00
Daniel Marjamäki
686a6c7862
Fixed compiler warning
2020-07-03 17:54:55 +02:00
Daniel Marjamäki
f34ff9325a
Fixed testrunner
2020-06-29 21:53:14 +02:00
Daniel Marjamäki
a0770f05e1
Reuse 'extractForLoopValues' in ValueFlow
2020-06-29 21:01:43 +02:00
Paul
d5b6d49d96
Fix issue 9578: false negative: (style) Condition '...' is always false
2020-06-28 15:28:08 -05:00
Daniel Marjamäki
c42c751d61
ExprEngine; Fixed testing
2020-06-28 13:41:27 +02:00
Daniel Marjamäki
262f44e76a
astyle formatting
...
[ci skip]
2020-06-26 12:56:56 +02:00
Paul
1bef6ed268
Another check for null
2020-06-25 19:12:01 -05:00
Paul
263a0364cc
Avoid null pointer dereference
2020-06-25 17:23:42 -05:00
Paul
720d882b69
Remove known arg
2020-06-25 17:20:20 -05:00
Paul
60c42b17a6
Fix known conditions
2020-06-25 15:46:30 -05:00