Commit Graph

14446 Commits

Author SHA1 Message Date
chrchr-github bd6c5318ad
Detect container action and yield functions ()
* 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
Daniel Marjamäki b086873599
Cppcheck: change severity from information to error for internalError () 2023-06-08 23:31:36 +02:00
Carl Morgan 6741f774b1
Support integer Z suffix and user defined literals with _ suffix (, ) ()
Co-authored-by: Carl Morgan <no-reply@crown.com>
2023-06-08 20:03:41 +02:00
chrchr-github be2824b003
Fix FN deallocuse with array access ()
* Fix FN deallocuse with array access

* Fix another FN

* Undo
2023-06-08 07:55:49 +02:00
chrchr-github 901b775471
Fix scope for function returning rvalue reference, insert std:: in return statement ()
* Fix scope for function returning rvalue reference

* Insert std:: in return statement

* Fix failing test
2023-06-08 07:47:21 +02:00
chrchr-github 4dbbae62a7
Fix FN: invalidLifetime ()
* Fix  FN: invalidLifetime

* Format

* Format

* Only forward for local variables

* Format

* Format
2023-06-08 07:45:59 +02:00
chrchr-github 3ff8ce316c
Fix AST for parameter pack (, , ) ()
* Fix AST for parameter pack (, , )

* Skip ... after )
2023-06-07 20:46:14 +02:00
chrchr-github ec4267a2bd
Don't suggest const for smartptr::get() ()
* Don't suggest const for smartptr::get()

* Fix test

* Fix merge

* get() doesn't change a smartpointer

* Parentheses
2023-06-07 20:45:48 +02:00
chrchr-github 12fe652321
Fix FP unreadVariable with extra parentheses and scope operator () 2023-06-07 20:45:27 +02:00
chrchr-github 39f958bcfb
Fix FP uninitvar with array of function pointers () 2023-06-07 11:41:22 +02:00
chrchr-github ac86eda6b3
Revert "Revert "Skip forwarding values for unique expressions ()"" () 2023-06-07 11:11:48 +02:00
Daniel Marjamäki 7d4472616b Revert "Skip forwarding values for unique expressions ()"
This reverts commit 26ed052e8d.
2023-06-06 17:31:24 +02:00
Paul Fultz II 26ed052e8d
Skip forwarding values for unique expressions () 2023-06-05 20:49:19 +02:00
Daniel Marjamäki 5976faaaf5
Fixed (Fix AST for 'new type..[..]{..}') () 2023-06-05 20:43:17 +02:00
chrchr-github 18b60d2f2b
Fix FP constStatement (inconclusive) triggered by namespace () 2023-06-03 15:13:15 +02:00
chrchr-github 1b98be458d
Fix Assert failure in valueflow.cpp / setSymbolic() () 2023-06-03 11:08:06 +02:00
chrchr-github 82e9c076da
Fix FN functionConst/functionStatic with recursion ()
* Fix FN functionStatic

* Fix FN functionConst, add test

* Fix build
2023-06-02 23:33:42 +02:00
chrchr-github 055489df5a
Fix Can't reduce scope as variable references itself () 2023-06-02 23:33:17 +02:00
chrchr-github 7c56514bd5
Fix reopened Improve check: missing virtual destructor ()
* Fix  reopened Improve check: missing virtual destructor

* Add support for missing container members

* Add more stuff

* Improve qt.cfg

* Improve wxwidgets.cfg, qt.cfg
2023-06-02 15:24:18 +02:00
chrchr-github 52c0f10fa1
Fix FP mismatchAllocDealloc, uninitdata for new with initializer () 2023-06-02 13:01:55 +02:00
chrchr-github c636641e67
Remove hardcoded whitelist () 2023-06-01 14:45:41 +02:00
chrchr-github a32fb63443
Fix hang on huge array (followup to ) ()
* Fix hang on huge array

* Fix another hang
2023-05-31 20:56:12 +02:00
chrchr-github 238cf75f6f
Fix FN autoVariables with array and std::string ()
* Fix  FP autoVariables when reassigning argv

* Fix  FN autoVariables with array and std::string

* Add test

* Format

* Format
2023-05-31 20:55:55 +02:00
chrchr-github 0b44429a7c
Fix spurious lambda detection () 2023-05-31 20:55:39 +02:00
chrchr-github a91222fad8
Partial fix for FN functionConst ()
* Partial fix for  FN functionConst

* Redundant check
2023-05-31 20:55:12 +02:00
chrchr-github 0ecf101fe3
Fix FN stlcstrConstructor, stlcstrAssignment with std::stringview ()
* Fix  FN stlcstrParam with std::string_view

* Add suppression

* Use emplace()

* Fix  FN stlcstrConstructor, stlcstrAssignment with std::string_view
2023-05-31 16:51:37 +02:00
chrchr-github 7696bd1357
Fix FN constParameter with cast ()
* Fix  FN constParameter with cast

* Add const
2023-05-31 16:51:03 +02:00
Daniel Marjamäki 9d6449cc44
dump file: fix xml format error in <macro> () 2023-05-30 14:51:11 +02:00
chrchr-github ec2f00d7c2
Fix uninitialized data: casted to 'int *' and dereferenced () 2023-05-29 15:29:53 +02:00
chrchr-github cf4334904c
Fix FN functionConst with non-dereferenceable pointer access ()
* Partial fix for  FN functionConst with non-dereferenceable pointer access

* Fix  FN functionConst with non-dereferenceable pointer access

* Fix test
2023-05-28 19:42:47 +02:00
chrchr-github 4c1e06a84b
Fix Regression: false negative autovarInvalidDeallocation since 1.79 () 2023-05-28 14:34:07 +02:00
chrchr-github 774123d28d
Remove hardcoded lists of functions/templates/types ()
* Remove hardcoded list of functions

* Remove hardcoded list of templates

* Remove hardcoded list of types

* Format

* Fix test

* Unused variable

* Add tests

* auto -> int
2023-05-28 14:33:41 +02:00
chrchr-github ac41b45a5f
Fix danglingLifetime of static variable () 2023-05-28 14:33:12 +02:00
chrchr-github 163fb79de1
Fix FP autoVariables when reassigning argv () 2023-05-28 13:51:41 +02:00
chrchr-github 647432580f
Fix FN functionConst when using base class members ()
* Fix  FN functionConst when using base class members

* Format

* Add const

* Add const

* Improve const check for arguments, comments, tests

* Add test for 

* Add test for 

* Fix merge

* Add tests

* Use ASSERT_EQUALS

* Redundant check
2023-05-28 01:11:59 +02:00
chrchr-github 17789778c9
Fix FN stlcstrParam with std::string_view ()
* Fix  FN stlcstrParam with std::string_view

* Add suppression

* Use emplace()
2023-05-28 01:11:11 +02:00
Daniel Marjamäki 6b9fac41f4
Fixed (stylistic warnings from addons are not filtered when style is not enabled) () 2023-05-27 10:24:00 +02:00
Anton Lindqvist 96c6276ce7
Suppress unused struct members from types expanded from macros () 2023-05-26 17:48:49 +02:00
chrchr-github 10b55cc0cf
Fix FN functionConst if only non-const member usage is call to itself ()
* Fix  FN functionConst if only non-const member usage is call to itself

* Format

* Add const
2023-05-26 17:24:13 +02:00
Anton Lindqvist 3d6c453058
Fix uninitvar false positive in designed initializers ()
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 fb850a844b
Use path to executable when trying to load library ()
* Use path to executable when trying to load library

* Fix function call, add support for more OS, add test

* Format

* Handle MacOS

* Amend

* Argument as fallback

* Use Path::getCurrentExecutablePath()

* Move to cmdlineparser.cpp

* Debug output

* Use argv[0] in Cygwin

* Revert "Debug output"

This reverts commit 5a68d71f1d27549c7b4a46363f3cd5cd912018e7.

* Use native python in Cygwin
2023-05-26 06:55:36 +02:00
chrchr-github bc03bed075
FP unusedFunction with templates and --cppcheck-build-dir ()
*  FP unusedFunction with templates and --cppcheck-build-dir

* Add test
2023-05-26 06:13:48 +02:00
chrchr-github beea1a2345
Fix FP constStatement with nested typedefs ()
* Fix  FP constStatement with nested typedefs

* Add test
2023-05-26 06:12:40 +02:00
Daniel Marjamäki 107eea236f
Improved handling of alignas. alignas will not be removed from now on so we don't loose this information. () 2023-05-24 10:33:53 +02:00
chrchr-github 94b6c87049
Fix FP unreadVariable with brace-init () 2023-05-23 20:21:02 +02:00
Rainer Wiesenfarth d1781a8cfb
Fix Limit check to selected VS configurations does not work ()
Fix  Limit check to selected VS configurations does not work
2023-05-23 12:44:03 +02:00
chrchr-github 6d2662b8a2
Fix FN (error) Memory leak - assignment to reference of a pointer ()
* Fix  false negative: (error) Memory leak - assignment to reference of a pointer

* Comment

* Run tests as C++

* Add TODOs

* Bail out for local references
2023-05-23 06:29:20 +02:00
Stefan Hagen 9e8cb6904a
[nit] Fixed lib/tokenize.cpp:2815:2: warning: extra ‘;’ [-Wpedantic] ()
Single character fix removing extra semi colon.
2023-05-23 06:27:25 +02:00
chrchr-github 33f728df14
Fix Hang in simplifyTypedef() with extra parentheses ()
* Fix   Hang in simplifyTypedef() with extra parentheses

* Amend test
2023-05-23 06:26:22 +02:00
chrchr-github 00733893e0
Fix "this->" confuses non void return check () 2023-05-22 20:23:09 +02:00