Commit Graph

13071 Commits

Author SHA1 Message Date
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
Paul Fultz II b13e44fce5
Fix 10309 and 10034: internalAstError with init lists (#3303) 2021-06-24 08:25:13 +02:00
Paul Fultz II 6e74fc64b9
Fix 10317: Regression: internalAstError on valid C++ code (#3302) 2021-06-24 08:22:03 +02:00
Daniel Marjamäki 2d08564c8a astyle formatting 2021-06-19 14:47:35 +02:00
Paul Fultz II dd178c3ad9
Fix 10314: Possible nullPointerRedundantCheck false positive (#3298) 2021-06-19 13:59:48 +02:00
Paul Fultz II 5922d5178b
Fix 10321: Two flags confuse null pointer check (#3300) 2021-06-19 13:58:57 +02:00
Paul Fultz II eb7b225fc1
Fix 10119: ValueFlow; object member is not uninitialized. happens when there is static member also. (#3299) 2021-06-19 13:58:18 +02:00
Daniel Marjamäki a7707a457d astyle formatting 2021-06-14 07:39:41 +02:00
shane a5664c3e49 allow token iteration in range for 2021-06-14 07:39:01 +02:00
Daniel Marjamäki 03445c01c1 Fix false positives when class might inherit from VCL TObject class 2021-06-13 18:56:04 +02:00
Daniel Marjamäki 7dbca470f7 Suppressions; Fixed problem with cppcheck build dir is used 2021-06-12 18:19:00 +02:00
Daniel Marjamäki 83d406806f CI; Fixed problems in windows paths 2021-06-12 12:45:31 +02:00
Daniel Marjamäki 4a4808e0ff ImportProject; Try to use relative paths 2021-06-12 11:10:35 +02:00
Daniel Marjamäki ed05a5c3b3 astyle formatting 2021-06-12 11:09:15 +02:00
Paul Fultz II f55a4563f9
Fix 10308: danglingTemporaryLifetime confused by function parameter (#3292) 2021-06-09 09:21:03 +02:00
Paul Fultz II f3a33ea330
Fix 10294: ValueFlow: Wrong <Uninit> value below loop (#3291) 2021-06-09 09:20:43 +02:00
Daniel Marjamäki 3c3435dd10 Fix bug in Tokenizer::simplifyVarDecl 2021-06-06 08:13:40 +02:00
orbitcowboy 195d413986 Running astyle [ci skip] 2021-06-05 08:53:15 +02:00
Paul Fultz II f90b05ea7c
Show lifetime kind in output (#3285) 2021-06-04 21:41:30 +02:00
Paul Fultz II 668b88d7c0
Fix 10284: False positive; valueFlowBeforeCondition does not seem to care about increment (#3287) 2021-06-04 21:40:57 +02:00
Paul Fultz II a14922ed85
Fix 10238: FP knownConditionTrueFalse std::string from const char* assumed non-empty (#3288) 2021-06-04 17:22:05 +02:00
Paul Fultz II 537fb5bcd9
Fix 10264: FP invalidContainer when address of container is passed inside struct (#3286) 2021-06-04 17:20:47 +02:00
Paul Fultz II b23c5aa742
Fix 10023: ValueFlow; Wrong result of post-increment in reverse analysis (#3289) 2021-06-04 17:20:21 +02:00
Paul Fultz II 486e440c4a
Fix 10298: ValueFlow: Wrong known value, 'x == -1' implicit unsigned cast for rhs (#3277) 2021-06-04 17:17:41 +02:00
Paul Fultz II 95c872b1ec
Fix todo test for returning a dangling reference (#3284) 2021-06-04 17:15:39 +02:00