Commit Graph

325 Commits

Author SHA1 Message Date
olabetskyi 61127950b0
Fixed #12260 (false positive: unusedVariable with side effects in member initialization) (#5762)
revert old changes
2023-12-14 15:16:30 +01:00
chrchr-github d09a6514cd
Fix #11012 FP unassignedVariable when passed in init list (#5684) 2023-11-20 19:43:29 +01:00
chrchr-github 3bd5a034bd
Fix #12176 false positive: unassignedVariable (#5656) 2023-11-14 12:26:12 +01:00
Oliver Stöneberg bfe19af6b2
fixed some "Declaration and assignment can be joined" Rider warnings (#5569) 2023-10-18 10:06:17 +02:00
Oliver Stöneberg a22c181553
fixed "Redundant elaborated type specifier" Rider warnings (#5517) 2023-10-08 09:10:17 +02:00
Oliver Stöneberg 91070ca794
utils.h: added `startsWith()` and started using it (#5381)
This makes the code much more readable. It also makes it less prone to
errors because we do not need to specify the length of the string to
match and the returnvalue is clear.

The code with the bad returnvalue check was never executed and I added a
test to show that.
2023-09-08 19:30:25 +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 3281fc91db
Fix #11879 FN unreadVariable (regression) (#5345) 2023-08-21 10:44:17 +02:00
chrchr-github 63811b2993
Fix #11872 FN unusedVariable with multidimensional array (#5334) 2023-08-20 11:08:17 +02:00
chrchr-github eee1221738
Use in-class initializers, default constructors, class -> struct (#4842) 2023-08-08 11:05:02 +02:00
chrchr-github 838b6b86e3
Fix #11862 FN constParameterPointer with increment (#5291) 2023-08-08 10:38:03 +02:00
chrchr-github 72212331fb
Fix #11832 False positive: uninitialized variable '*(&var) = 0' (#5241) 2023-07-14 19:14:33 +02:00
chrchr-github e063656173
checkLibraryCheckType: handle global scope operator / Fix FN unreadVariable (#5199) 2023-06-27 14:28:14 +02:00
chrchr-github b26bfc9b4f
Use getAllocFuncInfo() (#5176) 2023-06-21 17:35:15 +02:00
Daniel Marjamäki f2510228cb
Fix #10847 (FP: unusedStructMember) (#5177) 2023-06-20 22:34:54 +02:00
chrchr-github bb962e2bc3
Enable and mitigate readability-else-after-return (#5175) 2023-06-20 18:43:21 +02:00
Anton Lindqvist 96c6276ce7
Suppress unused struct members from types expanded from macros (#5087) 2023-05-26 17:48:49 +02:00
chrchr-github 78182d4773
Fix FN constVariablePointer (#5076)
* Fix FN constVariablePointer

* Fix FP

* Add const

* Fix tests

* Add const
2023-05-22 19:53:51 +02:00
chrchr-github e621f721fc
Use library to get deallocation function (#5061)
* Use library to get deallocation function

* Add suppressions

* Amend

* Remove suppression

* More getDeallocFuncInfo()

* Fix suppressions

* Fix suppression
2023-05-21 14:01:14 +02:00
chrchr-github 35a46dfd00
Fix FN unusedStructMember with member functions, inheritance (#4978)
* Fix #551 Detect unused Private member variables

* Fix FN unusedStructMember when there are member functions

* Unused member

* Warn for unused private variables in base class

* Warn for private inheritance, add test
2023-04-18 22:30:08 +02:00
chrchr-github c3002f1230
Fix #551 Detect unused Private member variables (#4973) 2023-04-17 20:34:39 +02:00
chrchr-github 0f47948bf4
Fix #11577 FN unusedStructMember when casting address (regression) (#4816) 2023-04-04 21:57:09 +02:00
Daniel Marjamäki e8e00d8fdf Unused Var: Fix FP when initialization is made in macro 2023-03-05 15:31:53 +01:00
Daniel Marjamäki 65fc31cba9 Tokenizer: tweaked simplification of function pointers. Argument types are kept. 2023-02-26 18:03:24 +01:00
Oliver Stöneberg f7a415dbf3
Token: do not return non-`const` pointer from `const` methods - part 1 (#4761) 2023-02-08 21:07:16 +01:00
Oliver Stöneberg 8ef14dad98
fixed and enabled `performance-faster-string-find` clang-tidy warning (#4769) 2023-02-08 21:01:51 +01:00
Oliver Stöneberg afd13ea11d
ValueFlow: some interface and namespace cleanups (#4746) 2023-01-28 10:20:47 +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 1cfe49e340
use `const_iterator` where possible (#4662) 2022-12-30 15:13:47 +01:00
Oliver Stöneberg 3c68b9b29f
use `cbegin()` and `cend()` with `const_ierator` loops (#4658) 2022-12-20 20:32:16 +01:00
Oliver Stöneberg 29e0133cb5
extracted `FwdAnalysis` from `astutils.{cpp|h}` (#4637)
* added missing filtering offiles in Visual Studio project

* extracted `FwdAnalysis` from `astutils.{cpp|h}`
2022-12-13 22:29:23 +01:00
chrchr-github 3273e51fd5
Fix #10412 FN useStlAlgorithm with iterators (#4157) 2022-10-16 13:46:26 +02:00
Oliver Stöneberg cff1cd9cda
applied clang-tidy `misc-const-correctness` fixes for POD types, iterators and references (#4529)
* applied `misc-const-correctness` fixes for POD types and iterators

* applied `misc-const-correctness` fixes for references
2022-10-02 07:12:40 +02:00
chrchr-github 4d13266e99
Fix #10083 FN unusedScopedObject: temporary lock 'std::lock_guard<std::mutex>(m)' (#4522)
* Fix #10083 FN unusedScopedObject: temporary lock 'std::lock_guard<std::mutex>(m)'

* Format

* Fix cppcheck-cfg.rng

* Format
2022-09-30 07:25:33 +02:00
chrchr-github cb6f04a16c
Fix #11315 FP zerodivcond from enum definition / #11310 FP unassignedVariable with static variable (#4476)
* Fix #11315 FP zerodivcond from enum definition

* Simplify Boolean expression

* Fix #11310 FP unassignedVariable with static variable
2022-09-17 18:50:07 +02:00
Oliver Stöneberg 1d95d1908d
refs #10663 - sped up `Library::detectContainerOrIterator()` by iterating the containers only once (#4380) 2022-08-20 12:14:55 +02:00
Oliver Stöneberg e09f5f0db7
refs # 11106 (optimize CheckUnusedVar::checkStructMemberUsage()) - added missing loop breaks (#4376) 2022-08-18 23:36:21 +02:00
chrchr-github 15f8c71ec3
Fix #9946 FP: unassignedVariable when operator() is called subsequently (#4303) 2022-07-24 17:52:14 +02:00
chrchr-github 4894cdab8f
Fix #11108 FP unreadVariable with unique_ptr and unknown c'tor (#4284)
* Fix #11108 FP unreadVariable with unique_ptr and unknown c'tor

* Fix test
2022-07-16 23:46:55 +02:00
Oliver Stöneberg b51aea5531
separated process execution code into `ProcessExecutor` (#4249) 2022-07-08 16:42:57 +02:00
chrchr-github 6d22d6a8ae
Fix FP unusedVar with side effects in destructor (#4212) 2022-06-14 09:55:22 +02:00
chrchr-github 69834d537b
Fix #9997 False negative: variable is not used (#4104) 2022-06-07 21:20:33 +02:00
chrchr-github d5d6da0dd4
Fix #11094 FP unreadVariable with unique_ptr and unknown type (#4140) 2022-05-27 17:17:50 +02:00
chrchr-github 112b1573c5
Fix #11078 FN constructing string from nullptr / #11079 FN unread variables (#4112)
* Fix #11078 FN constructing string from nullptr / #11079 FN unread variables

* Format
2022-05-18 13:52:44 +02:00
Oliver Stöneberg 45158ec064
cleaned up includes based on include-what-you-use (#4007)
* cleaned up includes based on include-what-you-use

* updated translations
2022-04-13 12:24:00 +02:00
chrchr-github 0636018df3
Fix #10368 FP: unassignedVariable with structured binding (#3990) 2022-04-09 14:50:30 +02:00
Paul Fultz II 32ded1602b
Fix warnings in switch statements on clang (#3943) 2022-03-30 19:30:02 +02:00
chrchr-github 7b97230dd2
Fix #10505 FP unreadVariable for lock_guard variable (#3938) 2022-03-28 21:45:49 +02:00
chrchr-github c3506b5186
Fix #10691 regressions with static variables and multiple assignments (#3895)
* Fix regressions with static variables and multiple assignments

* Fix test

* Fix test cases
2022-03-13 06:26:21 +01:00