chrchr-github
62dfa8877c
Merge pull request #5147 from chrchr-github/chr_astregr
...
Fix AST regression
2023-06-16 22:47:47 +02:00
chrchr-github
3f0f9e4476
Merge pull request #5158 from chrchr-github/chr_Fix11770
...
Partial fix for #11770 cppcheckError with unknown macro
2023-06-16 22:40:56 +02:00
chrchr-github
75e0bdfdd9
Merge pull request #5164 from chrchr-github/chr_Fix11768
...
Fix #11768 FP autovarInvalidDeallocation
2023-06-16 22:40:27 +02:00
chrchr-github
1ffff8dc06
Fix #11772 top() on empty stack in TypedefSimplifier::replace() ( #5161 )
2023-06-16 19:35:01 +02:00
Daniel Marjamäki
aca6c47024
Fix #11774 (False positive: passing struct pointer to function that initialize it) ( #5162 )
2023-06-16 18:43:32 +02:00
chrchr
b41f9af2c5
Fix #11768 FP autovarInvalidDeallocation
2023-06-16 17:21:37 +02:00
chrchr
c02a9f403a
Fix tests
2023-06-15 19:22:19 +02:00
chrchr
39d60ca63e
Add test
2023-06-15 18:53:42 +02:00
chrchr
19d4ab7d31
Fix test
2023-06-15 18:52:52 +02:00
chrchr
9579b4509d
Partial fix for #11770 cppcheckError with unknown macro
2023-06-15 18:36:21 +02:00
Daniel Marjamäki
f934d6e5d0
Fix #11767 (False positive: uninitialized member after assignment) ( #5157 )
2023-06-15 14:42:58 +02:00
Daniel Marjamäki
d75331d00d
Fix #11435 (FP ctuOneDefinitionRuleViolation for template specialization) ( #5156 )
2023-06-15 11:43:07 +02:00
Daniel Marjamäki
9339802be3
Fix #11740 (FP syntaxError from switch in C code) ( #5153 )
2023-06-14 10:41:37 +02:00
chrchr-github
457e0ce0c8
Partial fix for #11189 checkLibraryNoReturn with std::function parameter
2023-06-13 21:48:16 +02:00
chrchr
0afc5aba78
Fix #11764 checkLibraryFunction/NoReturn when inheriting from container
2023-06-13 15:04:25 +02:00
chrchr
fad1f6b559
Fix AST regression
2023-06-13 14:32:31 +02:00
Anton Lindqvist
09cd3a8269
Fix FP deallocuse regression ( #5144 )
...
Introduced in commit 69116c838
("Fix #11758 Regression: memleak / Fix #11746 FN:
deallocuse (#5139 )").
2023-06-11 14:11:41 +02:00
Daniel Marjamäki
f6a65afdee
Fix FP uninitStructMember when other variable is only nonzero if struct member is initialized ( #5143 )
2023-06-10 21:35:17 +02:00
Daniel Marjamäki
7840bc4c63
Execute runformat
2023-06-10 17:37:32 +02:00
chrchr-github
24b0d08753
Fix FP autoVariables ( #5107 )
...
* Fix #11732 FP autoVariables when reassigning argv
* Fix #11732 FN autoVariables with array and std::string
* Add test
* Format
* Format
* Simplify check, fix inconclusive
* Fix merge, add test
* Fix FPs
* Format
* Format
* Undo move
* Format
2023-06-10 16:28:29 +02:00
Daniel Marjamäki
1c28457d2c
ValueFlow: Fix uninitvar false positive after initialization '*((int*)&x) = ..' ( #5142 )
2023-06-10 15:22:17 +02:00
Daniel Marjamäki
3c8caac772
Fix #11688 (FP uninitvar in for loop iteration expression) ( #5140 )
2023-06-10 09:58:08 +02:00
chrchr-github
7e0f64688f
Fix #11275 internalAstError on C++20 templated lambda / Fix #11400 internalAstError on nested lambda ( #5134 )
...
* Fix #11275 internalAstError on C++20 templated lambda
* Fix #11400 internalAstError on nested lambda passed as argument
2023-06-10 07:42:10 +02:00
chrchr-github
d4705ca8ab
Fix #10809 cppcheckError Cyclic reverse analysis ( #5137 )
...
* Fix #10809 cppcheckError Cyclic reverse analysis
* Handle fixed AST in ValueFlow, fix FN
* Remove
2023-06-10 07:41:52 +02:00
chrchr-github
69116c8386
Fix #11758 Regression: memleak / Fix #11746 FN: deallocuse ( #5139 )
...
* Fix #11758 Regression: memleak
* Format
* Fix #11746 FN: deallocuse
* Complete the trifecta
2023-06-10 00:24:36 +02:00
Daniel Marjamäki
22e67d3534
Fixed #10442 (AST: wrong ast of ({}) in struct initialization) ( #5135 )
2023-06-09 22:31:14 +02:00
orbitcowboy
6ea88c2758
Added test case from #8302 ( #5138 )
...
* Added test case from #8302 and a TODO
* Check with in C++ mode to get rid of TODO.
* Updated expected error message text
* Updated expected error message text
2023-06-09 21:46:45 +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
Carl Morgan
6741f774b1
Support integer Z suffix and user defined literals with _ suffix ( #10807 , #11438 ) ( #5130 )
...
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 ( #5121 )
...
* 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 ( #5119 )
...
* 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 #11753 FN: invalidLifetime ( #5128 )
...
* Fix #11753 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 ( #10199 , #10492 , #11103 ) ( #5125 )
...
* Fix AST for parameter pack (#10199 , #10492 , #11103 )
* Skip ... after )
2023-06-07 20:46:14 +02:00
chrchr-github
ec4267a2bd
Don't suggest const for smartptr::get() ( #5126 )
...
* 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 #11063 FP unreadVariable with extra parentheses and scope operator ( #5122 )
2023-06-07 20:45:27 +02:00
chrchr-github
39f958bcfb
Fix #11596 FP uninitvar with array of function pointers ( #5098 )
2023-06-07 11:41:22 +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
Daniel Marjamäki
5976faaaf5
Fixed #11745 (Fix AST for 'new type..[..]{..}') ( #5118 )
2023-06-05 20:43:17 +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
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
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
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
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
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
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
chrchr-github
2a0143c8e1
Fix #10358 Bad ValueFlow depending on initialization ( #5052 )
2023-05-12 07:19:44 +02:00
chrchr-github
f5b1537ed1
Fix internalASTError with decltype() ( #5047 )
2023-05-11 14:35:23 +02:00
Daniel Marjamäki
d5951fa2b9
Tokenizer: Add attribute for exported symbols ( #5043 )
2023-05-09 20:15:00 +02:00
Daniel Marjamäki
d24a1342a6
Fixed #11711 (Tokenizer: varId not set properly in function call) ( #5041 )
2023-05-08 12:11:30 +02:00
Daniel Marjamäki
e8233ceb67
runformat
2023-05-08 10:30:20 +02:00
Paul Fultz II
543b4adc8a
Fix 11682: False positive: constParameterReference with overloaded method ( #5038 )
...
* Fix 11682: False positive: constParameterReference with overloaded method
* Format
2023-05-05 11:27:15 +02:00
chrchr-github
1db510b9fd
Add test for #10796 ( #5036 )
2023-05-04 22:23:36 +02:00
chrchr-github
a31c996a70
Add tests for #11075 , #11382 ( #5035 )
2023-05-04 20:35:56 +02:00
Oliver Stöneberg
a77ab9759c
Suppressions: some cleanups ( #4980 )
...
* Suppressions: merged `isSuppressedLocal()` into `isSuppressed()`
* avoid some unnecessary copies when adding suppressions
* TestSuppressions: improved readability of multiple line string literals
* supressions.h: got rid of unnecessary copy and assignment operators for `Suppressions::Suppression` - fixes `performance-move-const-arg` clang-tidy warning
* TestSuppressions: cleaned up a variable construction
2023-05-04 18:15:18 +02:00
chrchr-github
d3bdb84650
Fix #11701 performance regression (hang) in 2.11dev ( #5032 )
2023-05-04 11:59:03 +02:00