Paul Fultz II
6736ac7e3a
Revert "Formatted the code [ci skip]" ( #3380 )
...
This reverts commit 7a6d7f7c2d
.
2021-08-03 17:53:30 +02:00
orbitcowboy
7a6d7f7c2d
Formatted the code [ci skip]
2021-08-03 06:33:54 +02:00
Paul Fultz II
08041e3a0b
Refactor: Assert an expression has an id and fix assertion failures ( #3377 )
...
* Fix 10390: FP: knownConditionTrueFalse
* Assert expression has an ID
* Fix assertion errors
* Format
2021-08-03 06:31:52 +02:00
Paul Fultz II
7be9b217e6
Fix 7843 and 7844: ValueFlow for abs ( #3373 )
...
* Refactor: Use valueFlowForward to forward values in condition expression
* Formattting
* Make known when using bools as well
* Set abs function as always positive
* Add test
* Add valueFlowSymbolicAbs
* Set impossible values
* Fix test case
* Fix error messages
* Merge
2021-08-03 06:31:28 +02:00
Paul Fultz II
3d19b33c3e
Fix 9948 and 10234: false negative: knownConditionTrueFalse and stlOutOfBounds ( #3372 )
2021-08-02 10:51:34 +02:00
Paul Fultz II
61ceff39f5
Fix 10390: FP: knownConditionTrueFalse ( #3374 )
2021-08-02 10:49:39 +02:00
Daniel Marjamäki
0f0d042ee2
Refactoring; Use range for in SymbolDatabase
2021-08-01 21:51:37 +02:00
Daniel Marjamäki
1ec7397c21
astyle formatting
...
[ci skip]
2021-08-01 14:05:30 +02:00
Robert Reif
94dc6c2c3f
fix #10332 (cppcheck crashes) ( #3371 )
2021-08-01 10:31:36 +02:00
Paul Fultz II
2f6a6e4b45
Refactor: Use valueFlowForward to forward values in condition expression ( #3369 )
2021-08-01 10:13:14 +02:00
Paul Fultz II
7d9fdf582b
Fix 10121: False positive: Condition 'ab->a!=123' is always false when modifying an alias ( #3293 )
2021-08-01 10:10:11 +02:00
Paul Fultz II
6767b57d4c
Fix FP for symbolic values when the expression is not const ( #3370 )
2021-07-31 14:19:37 +02:00
Paul Fultz II
3a7ba3cd29
Add symbolic values to ValueFlow ( #3367 )
2021-07-30 21:29:35 +02:00
Paul Fultz II
6a81b4c17c
Fix 10264: FP invalidContainer when address of container is passed inside struct ( #3368 )
2021-07-30 15:52:00 +02:00
Paul Fultz II
737b6199ba
Refactor: Allow parse to return multiple values for a condition ( #3361 )
2021-07-26 22:23:19 +02:00
Paul Fultz II
c34691ff56
Fix 10354: FP knownConditionTrueFalse after bitwise and/xor ( #3360 )
2021-07-26 22:22:50 +02:00
Paul Fultz II
0d3afbb954
Evaluate casts in programmemory ( #3359 )
2021-07-26 22:22:23 +02:00
Paul Fultz II
14802b932e
Fix 10362: ValueFlow: global variable might be modified by function call ( #3358 )
2021-07-26 22:21:56 +02:00
orbitcowboy
c14bb9cd2e
Running astyle [ci skip]
2021-07-26 16:32:00 +02:00
Paul Fultz II
84ea0a2295
Refactor: Remove extra analysis of container sizes in conditions ( #3357 )
2021-07-25 18:14:51 +02:00
Paul Fultz II
5be3f700bb
Fix 10373: ValueFlow: container in struct assumed empty ( #3355 )
2021-07-25 18:13:55 +02:00
Paul Fultz II
8e416a7255
Fix issue 10379: FP knownConditionTrueFalse with mod operator ( #3354 )
2021-07-25 18:13:14 +02:00
Paul Fultz II
f9516cf1c6
Fix issue 10378: FP derefInvalidIteratorRedundantCheck ( #3353 )
2021-07-24 22:44:18 +02:00
Georgiy Komarov
48031ffb3b
lib: Fix clang -Wrange-loop-construct warning ( #3347 )
2021-07-22 18:53:44 +02:00
Daniel Marjamäki
74ab8f1a48
misra; implemented rule 20.8
2021-07-22 08:46:28 +02:00
Paul Fultz II
00eb71fd49
Remove constexpr -> const simplification ( #3346 )
2021-07-22 07:22:26 +02:00
Daniel Marjamäki
b1547a387e
astyle formatting
...
[ci skip]
2021-07-21 20:13:38 +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
Paul Fultz II
8efe1d4ab4
Find reference to dangling unique ptr ( #3344 )
2021-07-20 21:30:27 +02:00
Daniel Marjamäki
524e4b8c96
CI; Fix self check warning, pointer can be const
2021-07-20 12:21:01 +02:00
Daniel Marjamäki
dd34d1c123
CI; Fix Cppcheck self-check, pointer can be const
2021-07-20 11:21:47 +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
d1fe34e167
misra; implement rule 8.10
2021-07-18 21:18:07 +02:00
Daniel Marjamäki
f6efd8c6be
CI; Fix self check false positive
2021-07-18 20:00:20 +02:00
Daniel Marjamäki
ae79b4759d
CI; Fix self check false positives
2021-07-18 19:31:19 +02:00
Daniel Marjamäki
9362c1fc6c
missing return; write inconclusive error if function ends with unknown function-like macro
2021-07-18 16:00:42 +02:00
Daniel Marjamäki
02682ab17d
missing return; Fixed FP when function ends with assert(0)
2021-07-18 14:54:25 +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
1be5bb8bbc
Running astyle [ci skip]
2021-07-18 10:01:22 +02:00
Paul Fultz II
0b079937e0
Fix 10364: Performance regression ( #3340 )
2021-07-18 07:48:21 +02:00
Paul Fultz II
59a1c1a9d8
Refactor: Remove variable analyzer ( #3339 )
2021-07-18 07:46:31 +02:00
orbitcowboy
3f1e937ea1
Running astyle [ci skip]
2021-07-17 08:19:04 +02:00
chrchr-github
8cd8b9c64e
Fix MSVC build and some warnings ( #3334 )
2021-07-16 21:55:12 +02:00
Daniel Marjamäki
797de4ef92
Fixed #10363 (FP: compareValueOutOfTypeRangeError)
2021-07-16 19:08:08 +02:00
Pavel Šimovec
c71e2da5a8
Remove a false positive - main function has no return value ( #3335 )
2021-07-16 18:50:16 +02:00
Paul Fultz II
942202aede
Evaluate container sizes in forward analysis ( #3338 )
2021-07-16 18:49:07 +02:00
Paul Fultz II
f5fac96670
Add include directives to 'define' tokenlist ( #3337 )
2021-07-16 18:47:35 +02:00
Daniel Marjamäki
cbb07b6247
misra; implement rule 14.3
2021-07-15 09:43:38 +02:00
Daniel Marjamäki
24c17916af
missingReturn; ensure Function::returnsVoid returns true when there is unknown macro 'void STDCALL foo() {}'
2021-07-12 20:29:20 +02:00
Daniel Marjamäki
e4ecfd7be8
missingReturn; Fixed false positive when if condition is always true
2021-07-12 17:53:32 +02:00
Daniel Marjamäki
a336c07663
missing return; False positive when goto jumps back
2021-07-12 15:31:21 +02:00
Daniel Marjamäki
9fb33e6a3c
Try to solve self check warning to make CI happy
2021-07-11 11:37:41 +02:00
Daniel Marjamäki
d9dacc97e4
virtual call in constructor; warn when function is explicitly virtual
2021-07-11 11:03:31 +02:00
Daniel Marjamäki
9841e0ed96
new check; file can not be opened for read and write access at the same time on different streams (misra rule 22.3)
2021-07-10 13:59:47 +02:00
Daniel Marjamäki
a8fb0309fd
missingReturn; Improved handling of noreturn function
2021-07-10 08:59:01 +02:00
Daniel Marjamäki
53955b48d2
missingReturn; Fixed false negative for goto-label
2021-07-10 08:49:48 +02:00
Daniel Marjamäki
c6f7a78ebb
missingReturn; Fixed false positives
2021-07-10 08:37:10 +02:00
Paul Fultz II
9fc5b9472d
Fix 10353: FP knownConditionTrueFalse with conditional assignment ( #3333 )
2021-07-10 07:35:16 +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
orbitcowboy
1c60dc090a
Formatted the code [ci skip
2021-07-09 09:47:15 +02:00
Daniel Marjamäki
db58952a33
Addons CTU; pass all filenames for whole program analysis in file instead of through command line
2021-07-09 08:33:07 +02:00
Paul Fultz II
2300a773e1
Fix 10336: AST cyclic dependency on valid C++ code ( #3331 )
2021-07-09 07:22:24 +02:00
orbitcowboy
7e2ba803f4
Running astyle [ci skip]
2021-07-08 22:18:58 +02:00
Paul Fultz II
8dc1fa7a59
Add colors to CLI reporting ( #3304 )
2021-07-08 21:21:35 +02:00
Paul Fultz II
7e70a91613
Improve AST cyclic detection performance ( #3330 )
2021-07-08 21:13:51 +02:00
Daniel Marjamäki
56924643be
Fixed #10347 (ValueFlow: No known value set for sizeof(a[0]))
2021-07-08 18:18:44 +02:00
Daniel Marjamäki
140aa6afb4
Preprocessor; do not write macro usage in dump output if it is empty
2021-07-08 16:53:25 +02:00
Daniel Marjamäki
447bea5c18
Preprocessor; write macrousage in dump output
2021-07-08 14:36:28 +02:00
Daniel Marjamäki
7cb66d56f3
missingReturn; fixed false positive with trailing return type
2021-07-08 13:50:26 +02:00
Daniel Marjamäki
ef0af26d9f
missingReturn; Fixed FP when function is declared in macro
2021-07-08 13:14:11 +02:00
Daniel Marjamäki
13d55c7060
misra; implement rule 2.3
2021-07-07 15:16:53 +02:00
Daniel Marjamäki
00a9671f46
misra: implement 8.1
2021-07-07 13:34:55 +02:00
Daniel Marjamäki
9172f2ab3b
addons; add CTU infrastructure
2021-07-07 10:58:13 +02:00
Paul Fultz II
5825a35566
Check for cycles in AST when adding nodes to prevent hangs from cyclic ASTs ( #3329 )
2021-07-07 08:21:35 +02:00
Paul Fultz II
3b9c399f72
Fix 10338: Hang/Crash in valueflow ( #3328 )
2021-07-07 08:20:32 +02:00
Daniel Marjamäki
f3365a874f
Clarify Settings::buildDir
2021-07-06 12:18:03 +02:00
Maksim Derbasov
6b8d0be431
New check: [perf] Copy elision optimization can't be applied for `return std::move(local)` ( #3281 )
2021-07-06 08:07:46 +02:00
Daniel Marjamäki
6234b5438e
New check: Writing overlapping data, detect undefined behavior
2021-07-05 22:07:41 +02:00
yyny
3e6681e2b3
Fix assertion failure in errorlogger.cpp ( #3318 )
2021-07-05 08:08:15 +02:00
Daniel Marjamäki
6cb8f87798
missing return; fixed false positive for 'return {};'
2021-07-04 19:59:22 +02:00
Daniel Marjamäki
036c71d967
Fixed #5462 (non-void function does not return a value)
2021-07-04 11:27:57 +02:00
Daniel Marjamäki
803eea912c
Set debug version
2021-07-04 11:19:08 +02:00
Daniel Marjamäki
3e3e9d8c50
2.5; Update versions
2021-07-04 08:40:41 +02:00
Daniel Marjamäki
c489626167
updated copyright year
2021-07-04 08:09:11 +02:00
Daniel Marjamäki
0bb334c102
astyle formatting
2021-07-03 09:12:51 +02:00
Paul Fultz II
fb9d659e25
Fix 10326: Regression: ValueFlow; Wrong Uninit value after do while ( #3312 )
2021-07-03 09:12:26 +02:00
Armin Müller
fc90598077
Typos found by running "codespell" ( #3324 )
2021-07-02 17:41:51 +02:00
Robert Reif
68898e2be0
fix #10335 (Type alias remains unknown with using) ( #3323 )
...
Co-authored-by: Robert Reif <reif@FX6840>
2021-07-02 06:19:26 +02:00
Daniel Marjamäki
1a5449cbeb
Fixed #10327 (ValueFlow; Wrong Uninit value in called function)
2021-07-01 22:08:00 +02:00
Daniel Marjamäki
e1cff1d1ef
Fixed #10334 (AST: hang with c++ initializer and emplace_back)
2021-06-30 21:40:45 +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
Georgiy Komarov
b89f5fbeff
misra: Fix 8.2 false positives ( #3309 )
...
* misra: Fix 8.2 false positives
Fix false positives in rule 8.2 that occurred in cases when we have a
function definition and declaration in the same file.
For example, the following code generated false positives before this
commit:
```
void f(uint8_t * const x);
void f(uint8_t * const x)
{ (void)x; }
```
We need to distinguish the declaration and the definition, so the dump
file generation routine was extended to keep token where the definition
of the function. The analysis in the addon also been improved.
Closes Trac issue: https://trac.cppcheck.net/ticket/10219
2021-06-27 10:51:32 +02:00
Daniel Marjamäki
2a2e071a85
Tokenizer::simplifyAttribute; Set function attribute for function pointer
2021-06-26 14:23:39 +02:00
Paul Fultz II
66956ed959
Fix 10323: Wrong known value. x!=0 does not mean that x==1 ( #3308 )
2021-06-26 09:16:45 +02:00
Paul Fultz II
508188df2b
Fix 10297: Regression; ValueFlow known value, sign conversion ( #3307 )
2021-06-26 09:16:04 +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
769b20b426
ValueFlow: Clarify note when impossible value is assigned ( #10297 )
2021-06-24 17:10:06 +02:00