Commit Graph

27010 Commits

Author SHA1 Message Date
Rainer Wiesenfarth f4f58bf020
Fix #11081 GUI: Windows release build crashes (#5083)
* Fix #11081 GUI: Windows release build crashes

Use generator expressions rather than if statements when adding compiler
options or definitions.

* Fix #11081 GUI: Windows CMake debug build fails with default options

When DISABLE_CRTDBG_MAP_ALLOC is using the default value (OFF), the
debug build of cppcheck-gui fails, as the "realloc" method names in some
of the Qt headers are replaced by the macro defined by the compiler.
Thus DISABLE_CRTDBG_MAP_ALLOC is explicitely set when compiling
cppcheck-gui in Debug mode using MSVC.
2023-06-07 11:33:55 +02:00
chrchr-github ac86eda6b3
Revert "Revert "Skip forwarding values for unique expressions (#5103)"" (#5124) 2023-06-07 11:11:48 +02:00
Daniel Marjamäki 7d4472616b Revert "Skip forwarding values for unique expressions (#5103)"
This reverts commit 26ed052e8d.
2023-06-06 17:31:24 +02:00
Paul Fultz II 26ed052e8d
Skip forwarding values for unique expressions (#5103) 2023-06-05 20:49:19 +02:00
SChernykh 93595aeff0
Fixed `std::vector::data` return type (#5116)
This caused many `arithOperationsOnVoidPointer` false positives in my project which uses `std::vector<uint8_t>` in many places.
2023-06-05 20:47:42 +02:00
Haowei Hsu 34cecf2336
GUI: Update zh_TW translation (#5115) 2023-06-05 20:45:52 +02:00
Daniel Marjamäki 5976faaaf5
Fixed #11745 (Fix AST for 'new type..[..]{..}') (#5118) 2023-06-05 20:43:17 +02:00
Daniel Marjamäki f4cfed674c AUTHORS: Add hwhsu1231 2023-06-04 07:53:17 +02:00
Haowei Hsu bf8b3188a3
GUI: Add zh_TW translation (#5108) 2023-06-04 07:51:48 +02:00
chrchr-github 18b60d2f2b
Fix #11670 FP constStatement (inconclusive) triggered by namespace (#5114) 2023-06-03 15:13:15 +02:00
chrchr-github f2976e5bb5
std.cfg: add support for smartptr member functions (#5113)
* std.cfg: add support for smartptr member functions

* Fix test

* Fix
2023-06-03 14:36:30 +02:00
chrchr-github 1b98be458d
Fix #11739 Assert failure in valueflow.cpp / setSymbolic() (#5104) 2023-06-03 11:08:06 +02:00
chrchr-github 82e9c076da
Fix #11744 FN functionConst/functionStatic with recursion (#5105)
* Fix FN functionStatic

* Fix FN functionConst, add test

* Fix build
2023-06-02 23:33:42 +02:00
chrchr-github 055489df5a
Fix #11742 Can't reduce scope as variable references itself (#5112) 2023-06-02 23:33:17 +02:00
Daniel Marjamäki 36af9b6450
simplecpp: Bump latest changes. Fixes #9754 (#5111) 2023-06-02 17:52:13 +02:00
chrchr-github 7c56514bd5
Fix #9104 reopened Improve check: missing virtual destructor (#5110)
* Fix #9104 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 (#5106) 2023-06-02 13:01:55 +02:00
orbitcowboy 9810bad869
#9708 (doublefree) - Added a regression test (#5109) 2023-06-02 10:32:33 +02:00
chrchr-github c636641e67
Remove hardcoded whitelist (#5063) 2023-06-01 14:45:41 +02:00
chrchr-github a32fb63443
Fix hang on huge array (followup to #11649) (#5094)
* Fix hang on huge array

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

* Fix #11732 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 (#5101) 2023-05-31 20:55:39 +02:00
chrchr-github a91222fad8
Partial fix for #11637 FN functionConst (#5102)
* Partial fix for #11637 FN functionConst

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

* Add suppression

* Use emplace()

* Fix #11547 FN stlcstrConstructor, stlcstrAssignment with std::string_view
2023-05-31 16:51:37 +02:00
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