Commit Graph

626 Commits

Author SHA1 Message Date
chrchr-github 09f426d980
Fix #12082 FP uninitvar for assignment to array member in conditional (#5570) 2023-10-18 18:50:49 +02:00
chrchr-github 285ef96b5b
Report unknownMacro in string concatenation (refs #11378) (#5558) 2023-10-18 18:46:47 +02:00
chrchr-github 8ef4da475a
Add test for #2456, #12011 (#5544) 2023-10-12 16:27:10 +02:00
Daniel Marjamäki 9d4e3829c2
Partial fix #12030 (False positive: uninitialized variable, conditional modification, flag) (#5543) 2023-10-12 13:56:47 +02:00
Paul Fultz II d48df980b4
Fix 12030: False positive: uninitialized variable, conditional modification, flag (#5520) 2023-10-07 14:01:06 +02:00
Daniel Marjamäki a52d2a23a0
Fix #12018 (False positive: null pointer, multiple arguments) (#5509) 2023-10-05 15:08:25 +02:00
Paul Fultz II 58a7519cbb
Fix 11992: FN (regression): uninitvar (#5465) 2023-09-20 06:43:58 +02:00
Paul Fultz II e6632d93e3
Fix 11983: False positive: uninitialized variable (#5443) 2023-09-13 23:27:08 +02:00
Oliver Stöneberg e7dd490fed
adjusted tests to reduce the amount of `friend` declarations necessary (#5435)
We were calling several interface functions through their inherited
classes instead of using the base classes requiring us to add `friend`
declarations to make the implementations accessible. This adjusts
several of those cases.
2023-09-11 20:26:22 +02:00
chrchr-github 4654b6561b
Fix #11890 FP uninitvar for address taken in init list (#5360) 2023-08-24 10:35:33 +02:00
Paul Fultz II 52081ef08f
Add special function to match lifetimes (#5320)
This also removes the termination checking in `valueFlowUninit` as this
causes a lot of FNs.
2023-08-14 10:27:00 +02:00
chrchr-github d4d77edeae
Fix FP uninitStructMember / cleanup from #5311 (#5315) 2023-08-12 23:46:31 +02:00
chrchr-github 720ae01898
Fix #11353 FP uninitvar for struct member set via pointer (#5314) 2023-08-11 18:46:51 +02:00
chrchr-github a7d487f6db
Fix #11805 FP uninitvar for stringstream into deref pointer to uninit var / #11804 FP uninitvar for array in struct in struct (#5311) 2023-08-11 18:45:58 +02:00
Oliver Stöneberg 45de338f1b
cleaned up includes based on include-what-you-use / iwyu.yml: updated to yet another distro to get the latest version and updated the Chaotic-AUR key (#5267)
This is a mess. The version is AUR is still outdated and also doesn't
install anymore. Fedora 38 carries the latest version of it so use that
now. Keep the old steps in case we need to switch again in the future.
2023-08-02 10:36:17 +02:00
Paul Fultz II 92caa835b6
Fix 11806: FP uninitvar for reference to unitvar in ternary ?: operator (#5247) 2023-07-17 10:34:54 +02:00
chrchr-github 72212331fb
Fix #11832 False positive: uninitialized variable '*(&var) = 0' (#5241) 2023-07-14 19:14:33 +02:00
chrchr-github 4eebf2e733
Fix uninitdata regression (#5179) 2023-06-21 21:19:22 +02:00
chrchr-github f96e3c9d84
Fix #11766 FP uninitdata with cast (#5170) 2023-06-20 18:06:57 +02:00
orbitcowboy fd3befe60a
Added a regression test for FP #10681 uninitvar. (#5168)
Test case is from: https://trac.cppcheck.net/ticket/10681#comment:10
2023-06-17 15:45:28 +02:00
Daniel Marjamäki 9a290c959f
Fix #11776 (False positive: uninitialized variable, struct array member initialized in function) (#5165) 2023-06-17 10:20:20 +02:00
Daniel Marjamäki f6a65afdee
Fix FP uninitStructMember when other variable is only nonzero if struct member is initialized (#5143) 2023-06-10 21:35:17 +02:00
chrchr-github ec2f00d7c2
Fix #1175 uninitialized data: casted to 'int *' and dereferenced (#5008) 2023-05-29 15:29:53 +02:00
Anton Lindqvist 3d6c453058
Fix uninitvar false positive in designed initializers (#5079)
Stop interpreting struct fields in designed initializers as usage of local
variables which can happen if they share the same name.

```
$ cat test.c
struct a { int b; };
int main() {
  char *b;
  extern int foo(struct a *);
  return foo(&(struct a){.b = 0});
}
$ cppcheck --quiet test.c
test.c:5:27: error: Uninitialized variable: b [legacyUninitvar]
  return foo(&(struct a){.b = 0});
```
2023-05-26 11:59:10 +02:00
chrchr-github 096d3a78b0
Fix #10596 FN uninitdata with value initialization (#5056)
* Assign values to pointers with C++11 init

* Handle assigning empty init list

* Fix #10596 FN uninitdata with value initialization

* Fix test
2023-05-13 22:07:09 +02:00
chrchr-github a31c996a70
Add tests for #11075, #11382 (#5035) 2023-05-04 20:35:56 +02:00
Oliver Stöneberg 5833fc3c19
testrunner: even more `SettingsBuilder` usage and `const` cleanups (#5030)
* moved some of the test-only `Library::loadxmldata()` calls into `test`

* testrunner: reduced need for backup/restore of settings
2023-05-04 10:31:05 +02:00
Paul Fultz II 9770dd7e0b
Fix 11673: FP uninitvar when capturing by reference (#4984)
* Fix 11673: FP uninitvar when capturing by reference

* Format

* Fix tests
2023-05-04 06:03:47 +02:00
chrchr-github f04d47ac61
Fix remaining example from #11131 (#5029) 2023-05-03 16:24:56 +02:00
Oliver Stöneberg 25183ff484
testrunner: more `SettingsBuilder` usage and `const` cleanups (#5026) 2023-05-02 15:54:19 +02:00
Oliver Stöneberg 2935c855c3
reduced usage of mutable `Settings` objects in tests (#4798) 2023-05-02 11:48:24 +02:00
chrchr-github 023e79b6c2
Fix #11459 uninitvar false positive (#5011)
* Fix #11459 uninitvar false positive

* Format
2023-04-25 21:01:44 +02:00
chrchr-github 6e5375f7b7
Add tests for #8075, #11608, #11635 (#4995)
* Add tests for #6925, #11042, #11494

* Format

* Add tests for # 6561, #6619, #7475,

* Add tests for #8075, #11608, #11635
2023-04-21 16:09:52 +02:00
chrchr-github 67a8ff0b27
Add tests for # 6561, #6619, #7475 (#4988)
* Add tests for #6925, #11042, #11494

* Format

* Add tests for # 6561, #6619, #7475,
2023-04-20 12:58:50 +02:00
chrchr-github ab24e3a3c8
Fix remaining example from #11599, FN #11646, fix crash (#4929)
* Fix remainig example from #11599

* Fix FP, new warnings

* More warnings

* Use getTokenArgumentFunction()

* Fix crash

* Fix #11646 constParameter not reported with "const * const" parameter

* Fix test

* Fix new warnings

* Add suppression

* Add const, fix suppression
2023-04-06 18:46:45 +02:00
Paul Fultz II 115f17cfe6
ValueFlow: Improve the starting point for uninitialized variables to find more uninitialized usages after many conditionals (#4930) 2023-04-04 21:55:09 +02:00
chrchr-github a336048d14
Fix #11599 false negative: constParameter (#4902)
* Partial fix for #11599 false negative: constParameter

* Adjust test

* Update testother.cpp

* Update testother.cpp

* Fix #11599 false negative: constParameter

* Fix new warnings

* Format

* Add difference_type

* Remove isAliased()

* Undo

* Adjust test

* Add test

* Improve const check

* Tweak constness, add tests

* Add tests

* Use new helper function, fixtest

* Remove bailout, fix check for cast

* Prevent FP

* Fix constVariable check, add tests

* Format

* Format

* Add test for #11632
2023-04-02 20:36:23 +02:00
Paul Fultz II fd8a7b9537
ValueFlow: Evaluate if statement for function returns (#4908) 2023-03-24 13:31:26 +01:00
chrchr-github 0d02c0a1a7
Fix #11624 FP uninitvar with array passed to function (#4903) 2023-03-20 19:54:31 +01:00
Daniel Marjamäki a4d2178f3c Fix ctuuninitvar false positive for struct that is partly initialized 2023-03-13 20:55:11 +01:00
Oliver Stöneberg e2f38fdaf3
removed `experimental` and `safe` from `Certainty` (#4819) 2023-03-12 14:15:29 +01:00
chrchr-github b4c90f8b2a
Fix #11597 FP uninitvar with nested enum (#4847) 2023-03-04 11:57:12 +01:00
Daniel Marjamäki 464fbe8d53 Update copyright year 2023-01-28 10:16:34 +01:00
Oliver Stöneberg 1d3955bd92
renamed some files in the `test` folder (#4705) 2023-01-27 08:18:32 +01:00
Oliver Stöneberg fd15811215
de-coupled `--check-library` from `information` severity and other dependencies (#3861) 2023-01-26 22:28:04 +01:00
chrchr-github a79dff15ab
Fix #11492 FP uninitvar with try/catch (#4711) 2023-01-14 20:14:38 +01:00
chrchr-github f793b7dd35
Fix #11460 unintvar false positive (#4674)
* Fix #11460 unintvar false positive

* Format
2023-01-02 17:44:52 +01:00
Paul Fultz II 7acbb656f3
Fix 11412: False positive: uninitvar (#4624)
* Dont remove modified variables from dead code

* Add test for 11412

* Format
2022-12-09 07:15:47 +01:00
chrchr-github 89dba226dd
Fix #11305 FP uninitvar with unseen typedef (#4612) 2022-12-07 09:14:22 +01:00
chrchr-github 6c24d2b865
Fix #11321 FP uninitvar for in-class member initialization (#4547) 2022-10-14 19:48:27 +02:00