Commit Graph

154 Commits

Author SHA1 Message Date
Oliver Stöneberg fe8730cf0f
MathLib: renamed `to{U}LongNumber()` to `toBig{U}Number()` (#5503)
The name was misleading as it was actually a `long long` and also if we
ever move to an (optional) 128-bit value it wouldn't even less fitting.
We should name it to match our alias type.
2023-10-05 19:21:42 +02:00
Daniel Marjamäki 276f017fbe
Partial fix for #11897 (Safety: show what checks are enabled/disabled) (#5372)
Example output on stdout:
```
$ ./cppcheck m1.cpp 
Checking m1.cpp ...
Active checkers: 59/177
```
2023-08-29 12:00:52 +02:00
chrchr-github 725c431ecc
Fix #11881 FP returnStdMoveLocal / Fix FP incorrectStringBooleanError / Support std::string::starts/ends_with() (#5347) 2023-08-21 10:43:54 +02:00
chrchr-github bd6c5318ad
Detect container action and yield functions (#5117)
* Detect container action and yield functions

* Fix test

* Adapt getUseRetValType() to handle container yield functions
Add TODO

* Handle combined action/yield

* Add Yield::BUFFER

* Remove redundant functions

* Revert "Remove redundant functions"

This reverts commit 4f124a57de5c761ac757ebed83d9f047ef4a1328.

* Add Yield::AT_INDEX

* Add Yield::ITERATOR

* Simplify
2023-06-09 16:03:47 +02:00
chrchr-github 00733893e0
Fix #11726 "this->" confuses non void return check (#5073) 2023-05-22 20:23:09 +02:00
Oliver Stöneberg 5be8eee943
iwyu.yml: use a distro which has the latest `include-what-you-use` / enabled Qt mappings / cleaned up includes (#4885) 2023-04-08 16:08:47 +02:00
chrchr-github 319baf8d0f
No WRONG_DATA for function pointer with unknown return type (#4893) 2023-03-18 14:52:29 +01:00
chrchr-github a75392307f
Partial fix for #11604: no DacaWrongData for function pointer (#4867) 2023-03-12 15:49:37 +01:00
Oliver Stöneberg 5af6ca6637
made `Platform` a member of `Settings` instead of inheriting from it / cleanups (#4791) 2023-03-03 18:36:27 +01:00
Oliver Stöneberg bd1ae69b00
cleaned up includes based on `include-what-you-use` (#4599) 2023-03-02 21:50:14 +01:00
chrchr-github 2379239aed
Fix FP ignoredReturnValue (#4783) 2023-02-11 10:46:04 +01:00
chrchr-github 132ae52428
Don't show checkLibraryFunction warning for types with unusedvar configuration (#4765) 2023-02-07 21:58:44 +01:00
Daniel Marjamäki 464fbe8d53 Update copyright year 2023-01-28 10:16:34 +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
Oliver Stöneberg bea6aec2b2
extracted `ValueFlow::Value` to `vfvalue.{cpp|h}` (#4642) 2023-01-26 22:23:22 +01:00
chrchr-github b1abaf8809
Fix FP useStlAlgorithm (don't suggest std::accumulate when nothing is accumulated) (#4647) 2022-12-18 16:52:04 +01:00
Razvan Ioan Alexe 1da37461e3
Typo found in Summary of CWE: 758 (#4553) 2022-10-20 19:11:15 +02:00
chrchr-github 56e2af5dec
Fix #9653 FP leakReturnValNotUsed although (void) is specified (#4431) 2022-09-27 20:09:04 +02:00
Paul Fultz II fc39a4d1bb
Fix 11171: False positive: missing return statement when std::enable_if_t is used (#4504)
* Fix 11171: False positive: missing return statement when std::enable_if_t is used

* Format

* Return false

* Workaround bug in cppcheck
2022-09-26 18:20:42 +02:00
chrchr-github f274d499a1
Fix #11171 FP missing return statement when std::enable_if_t is used (#4480)
* Fix #11171 FP missing return statement when std::enable_if_t is used

* Add check
2022-09-19 12:47:58 +02:00
Oliver Stöneberg b3ec225480
iwyu.yml: use `debian:unstable` to always get latest include-what-you-use / cleaned up includes (#4466)
* iwyu.yml: use debian:unstable to always get latest include-what-you-use

* cleaned up includes based on include-what-you-use

* mitigated include-what-you-use false positives
2022-09-16 07:15:49 +02:00
Maksim Derbasov f93b588603
New check: use memcpy/memset instead of loop (#4257) 2022-09-03 23:29:06 +02:00
chrchr-github cf52ee098a
Fix checkLibraryFunction FPs (#4423)
* Fix checkLibraryFunction FPs

* Fix FP with fclose()

* Format

* Fix FP with reinterpret_cast
2022-09-02 07:51:10 +02:00
Oliver Stöneberg 16f598c409
added missing `sstream` includes (#4381) 2022-08-19 10:16:23 +02:00
chrchr-github b16d12b5fb
Improve check for wchar_t (#4285) 2022-07-16 23:46:10 +02:00
chrchr-github 49117f5aeb
Fix #7375 static_assert shouldn't be reported by --check-library (#4276)
* No need to check smart pointers, since they take template arguments

* Fix #7375 static_assert shouldn't be reported by --check-library
2022-07-13 21:08:43 +02:00
Oliver Stöneberg 22be5f29aa
fixed #11183 (checkLibraryFunction with parameter to "std::string()") / added rudimentary tests for `CheckFunctions::checkLibraryMatchFunctions()` / added test for #10105 (#4265) 2022-07-12 17:39:01 +02:00
chrchr-github 8fc75402a1
Fix #11179 FP invalidFunctionArgStr (#4264) 2022-07-11 22:58:19 +02:00
chrchr-github 27578e9c4c
Fix FP returnStdMoveLocal (#4244) 2022-06-30 13:50:31 +02:00
chrchr-github 0d4b4394bb
Fix FP with embedded zeros (#4226)
* Partial fix for #11137 FN: invalidFunctionArgStr printf argument

* Typo

* Remove <strz>, suppressions

* Add suppresion, remove <strz>

* Add suppressions

* Fix FP with embedded zeros

* Merge
2022-06-21 13:33:45 +02:00
chrchr-github de2509f1ac
Fix FP with complex array size expression (#4225)
* Partial fix for #11137 FN: invalidFunctionArgStr printf argument

* Typo

* Remove <strz>, suppressions

* Add suppresion, remove <strz>

* Add suppressions

* Fix FP with complex array size expression
2022-06-21 00:12:11 +02:00
chrchr-github 5b9fa9657d
Partial fix for #11137 FN: invalidFunctionArgStr printf argument (#4224)
* Partial fix for #11137 FN: invalidFunctionArgStr printf argument

* Typo

* Remove <strz>, suppressions

* Add suppresion, remove <strz>

* Add suppressions
2022-06-20 20:02:22 +02:00
orbitcowboy 433ce58fe6 Fixed FP found with daca@home: ftp://ftp.de.debian.org/debian/pool/main/libs/libslirp/libslirp_4.7.0.orig.tar.bz2; head libslirp-v4.7.0/src/tftp.c:336:20: error: Invalid strcasecmp() argument nr 1. A nul-terminated string is required. [invalidFunctionArgStr] 2022-06-04 12:00:54 +02:00
orbitcowboy 1c1c72058f Fixed FP found with daca@home: ftp://ftp.de.debian.org/debian/pool/main/libs/libslirp/libslirp_4.7.0.orig.tar.bz2; head libslirp-v4.7.0/src/tftp.c:336:20: error: Invalid strcasecmp() argument nr 1. A nul-terminated string is required. [invalidFunctionArgStr] 2022-06-04 07:46:28 +02:00
orbitcowboy 00abf21d40 Format 2022-06-03 18:59:43 +02:00
orbitcowboy a74bb485b0 Fixed TODO_ASSERT 2022-06-03 18:59:09 +02:00
orbitcowboy 6680bf9790 Fixed TODO_ASSERT 2022-06-03 18:35:11 +02:00
orbitcowboy 1a4bd0a7b3 Fixed FP, found with daca@home: ftp://ftp.de.debian.org/debian/pool/main/k/knot/knot_3.1.8.orig.tar.xz; knot-3.1.8/tests/knot/test_confio.c:301:18: error: Invalid strcmp() argument nr 2. A nul-terminated string is required. [invalidFunctionArgStr] 2022-06-03 13:10:45 +02:00
orbitcowboy 67795cdfcf
Fixed FPs from Ticket 11119 - invalidFunctionArgStr with null-terminated strings (#4164)
* Fixed first FP from #11119 - invalidFunctionArgStr with null-terminated strings

* Fixed second test case from #11119.

* Fixed another FP, found on daca@home ftp://ftp.de.debian.org/debian/pool/main/g/glhack/glhack_1.2.orig.tar.gz.

* Format
2022-06-02 19:30:29 +02:00
orbitcowboy 58460edaf8 Fixed crash due to missing null pointer check. 2022-06-02 11:32:55 +02:00
orbitcowboy 7275350f3e Combined consecutive Token::simpleMatch() calls 2022-06-02 07:27:19 +02:00
orbitcowboy 3b2509c9cc Fixed failing self-check: style: Call to 'Token::previous()' followed by 'Token::tokAt()' can be simplified. [redundantNextPrevious] 2022-06-02 07:16:09 +02:00
orbitcowboy 886b5d1039 Improved invalidFunctionArgStr checking and detect more cases where a NON-null-terminated string is used to call functions, configured with <strz/>. 2022-06-02 01:09:09 +02:00
Daniel Marjamäki 3989408738 Update copyright year 2022-02-05 11:45:17 +01:00
Oliver Stöneberg 171da2e6f9
avoid dependency on transitive includes - based on include-what-you-use (#3757) 2022-01-27 19:03:20 +01:00
chrchr-github ea81ce933e
Fix #10754 FP invalidFunctionArg with resize() (#3737) 2022-01-25 12:13:49 +01:00
Daniel Marjamäki 3e6540c4b3 Fixed #10523 (FP: missingReturn with nested switch statements) 2021-10-31 14:48:29 +01:00
Daniel Marjamäki 47f5e5d145 Fixed #10461 (FP missingReturn with empty initializer list) 2021-09-06 21:20:19 +02:00
Daniel Marjamäki dccebb98ea Removed missingReturn inconclusive warnings, that was too noisy 2021-09-01 19:50:17 +02:00
Daniel Marjamäki f6efd8c6be CI; Fix self check false positive 2021-07-18 20:00:20 +02:00