Commit Graph

27086 Commits

Author SHA1 Message Date
chrchr-github 7696bd1357
Fix #11225 FN constParameter with cast (#5100)
* Fix #11225 FN constParameter with cast

* Add const
2023-05-31 16:51:03 +02:00
Daniel Marjamäki 8324b75ee0
GUI: Do not throw exception when platform is not set (#5099) 2023-05-30 19:44:32 +02:00
Daniel Marjamäki 9d6449cc44
dump file: fix xml format error in <macro> (#5095) 2023-05-30 14:51:11 +02:00
chrchr-github ec2f00d7c2
Fix #1175 uninitialized data: casted to 'int *' and dereferenced (#5008) 2023-05-29 15:29:53 +02:00
chrchr-github cf4334904c
Fix #11626 FN functionConst with non-dereferenceable pointer access (#5074)
* Partial fix for #11626 FN functionConst with non-dereferenceable pointer access

* Fix #11626 FN functionConst with non-dereferenceable pointer access

* Fix test
2023-05-28 19:42:47 +02:00
chrchr-github 4c1e06a84b
Fix #8174 Regression: false negative autovarInvalidDeallocation since 1.79 (#5045) 2023-05-28 14:34:07 +02:00
chrchr-github 774123d28d
Remove hardcoded lists of functions/templates/types (#5069)
* 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 #11729 danglingLifetime of static variable (#5080) 2023-05-28 14:33:12 +02:00
chrchr-github 163fb79de1
Fix #11732 FP autoVariables when reassigning argv (#5084) 2023-05-28 13:51:41 +02:00
chrchr-github 647432580f
Fix #11720 FN functionConst when using base class members (#5068)
* Fix #11720 FN functionConst when using base class members

* Format

* Add const

* Add const

* Improve const check for arguments, comments, tests

* Add test for #11573

* Add test for #11501

* Fix merge

* Add tests

* Use ASSERT_EQUALS

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

* Add suppression

* Use emplace()
2023-05-28 01:11:11 +02:00
Daniel Marjamäki 6b9fac41f4
Fixed #11734 (stylistic warnings from addons are not filtered when style is not enabled) (#5091) 2023-05-27 10:24:00 +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 10b55cc0cf
Fix #11654 FN functionConst if only non-const member usage is call to itself (#5092)
* Fix #11654 FN functionConst if only non-const member usage is call to itself

* Format

* Add const
2023-05-26 17:24:13 +02:00
Daniel Marjamäki c039d232d0 AUTHORS: Add mptre 2023-05-26 12:00:58 +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 fb850a844b
Use path to executable when trying to load library (#5082)
* 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
#11733 FP unusedFunction with templates and --cppcheck-build-dir (#5085)
* #11733 FP unusedFunction with templates and --cppcheck-build-dir

* Add test
2023-05-26 06:13:48 +02:00
chrchr-github beea1a2345
Fix #11689 FP constStatement with nested typedefs (#5090)
* Fix #11689 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. (#5081) 2023-05-24 10:33:53 +02:00
chrchr-github 94b6c87049
Fix #11728 FP unreadVariable with brace-init (#5075) 2023-05-23 20:21:02 +02:00
Daniel Marjamäki 211ab3dd63 AUTHORS: Add rwiesenfarth 2023-05-23 12:45:54 +02:00
Rainer Wiesenfarth d1781a8cfb
Fix #11727 Limit check to selected VS configurations does not work (#5072)
Fix #11727 Limit check to selected VS configurations does not work
2023-05-23 12:44:03 +02:00
Daniel Marjamäki 956bb3ce8c
test-my-pr: use --packages-path if you want to check packages in a path (#5077) 2023-05-23 09:51:51 +02:00
chrchr-github 6d2662b8a2
Fix #4400 FN (error) Memory leak - assignment to reference of a pointer (#5048)
* Fix #4400 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] (#5071)
Single character fix removing extra semi colon.
2023-05-23 06:27:25 +02:00
chrchr-github 33f728df14
Fix #11725 Hang in simplifyTypedef() with extra parentheses (#5078)
* Fix  #11725 Hang in simplifyTypedef() with extra parentheses

* Amend test
2023-05-23 06:26:22 +02:00
chrchr-github 00733893e0
Fix #11726 "this->" confuses non void return check (#5073) 2023-05-22 20:23:09 +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 8eabf5c211
Fix #8433 FN unused variable not detected when there is lambda (#5060)
* Fix #8433 FN unused variable not detected when there is lambda

* Format

* Fix tests

* Check lambda return

* Add test

* Undo, add test

* simpleMatch()

* Rename test
2023-05-22 07:39:57 +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 d30f8e18f7
Partial fix for #11626 FN functionConst with non-dereferenceable pointer access (#5070) 2023-05-21 14:00:24 +02:00
chrchr-github ba57e15cb2
Fix #11717 Warn when C++ code is scanned as C (prevent FPs) (#5064)
* Fix #11717 Warn when C++ code is scanned as C (prevent FPs)

* Don't throw for operators

* Detect reference variables

* Fix tests

* Fix compilation

* Fix test

* Fix another test

* Use strAt()
2023-05-21 13:59:49 +02:00
Daniel Marjamäki f72db74817
Fixed #11013 (FP overlappingWriteUnion with anonymous struct in union) (#5067) 2023-05-20 10:34:42 +02:00
chrchr-github e6576dd949
Fix #11708 internal error: converting '1f' to integer failed (#5066)
* Fix #11708 "internal error: converting '1f' to integer failed - not an integer" with width in printf format string

* Format
2023-05-18 23:26:56 +02:00
chrchr-github 518b6a27ab
Fix #11719 Handle lambdas in global scope (#5065)
* Fix #11719 Handle lambdas in global scope

* Capture list
2023-05-17 14:37:56 +02:00
chrchr-github 1999bc68bf
Set values when assigning init list (#5057)
* Assign values to pointers with C++11 init

* Handle assigning empty init list

* Fix #10596 FN uninitdata with value initialization

* Fix test

* Set values when assigning init list
2023-05-14 17:01:07 +02:00
Daniel Marjamäki d475591665
Tokenizer: simplification of typedefs in _Generic arguments (#5059) 2023-05-14 15:14:52 +02:00
Daniel Marjamäki 793d6aef01
Tokenizer: do not report unknownMacro for alignas (#5058) 2023-05-14 15:14:41 +02:00
chrchr-github cf4d59a835
Partial fix for #9602 False positives with function pointers (#5042)
* Partial fix for #9602 False positives with function pointers

* Add test for #9222
2023-05-14 12:16:17 +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 6a8c70c1b9
Fix #10976 false negative: autoVariables [inconclusive] (regression) (#5044)
* Fix #10976 false negative: autoVariables [inconclusive] (regression)

* Use link()

* Use linkAt()

* Skip over [][]
2023-05-13 14:11:01 +02:00
chrchr-github dc7550ed9f
Assign values to pointers with C++11 init (#5055)
* Assign values to pointers with C++11 init

* Handle assigning empty init list
2023-05-13 14:09:47 +02:00
Daniel Marjamäki 2b74a2084e
Fixed #11716 (simplifyTypedef: function with const should be handled better) (#5054) 2023-05-12 20:39:08 +02:00
Jedrzej Klocek aa6df06f43
Don't ignore build*, accidently it ignored all files starts with buil… (#5051) 2023-05-12 16:08:58 +02:00
Stefan Hagen 2abd9dcf79
nit: removed stray semicolon in checkother.cpp (#5053)
This fixed nit removes a compiler warning.
2023-05-12 11:27:21 +02:00
chrchr-github 2a0143c8e1
Fix #10358 Bad ValueFlow depending on initialization (#5052) 2023-05-12 07:19:44 +02:00
chrchr-github 59b955e014
Suppress deprecation warning with -E (#5050) 2023-05-11 14:35:56 +02:00
chrchr-github f5b1537ed1
Fix internalASTError with decltype() (#5047) 2023-05-11 14:35:23 +02:00
Daniel Marjamäki e1d5d9988d
Fixed #11715 (Add --showtime=file-total option to show checking time of each file) (#5049) 2023-05-11 14:04:22 +02:00