chrchr-github
52c0f10fa1
Fix FP mismatchAllocDealloc, uninitdata for new with initializer ( #5106 )
2023-06-02 13:01:55 +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
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
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
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
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
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
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
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
527b6fbb45
Revert "ValueFlow: Set max iterations to 2 in normal analysis ( #4951 )"
...
This reverts commit 02a3d03a05
.
2023-05-07 18:28:01 +02:00
Paul Fultz II
02a3d03a05
ValueFlow: Set max iterations to 2 in normal analysis ( #4951 )
2023-05-07 11:03:27 +02:00
chrchr-github
580eb8eb83
Remove dead URL ( #5039 )
2023-05-06 08:14:43 +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
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
chrchr-github
100d17df4f
Fix #11681 FN constParameterPointer with std::vector ( #5000 )
2023-05-04 11:10:58 +02:00
Oliver Stöneberg
e6ae312a0b
moved more code into `HAVE_RULES` ( #4956 )
...
* moved more code into `HAVE_RULES`
* properly enable all internal and rules code in selfcheck
* updated TODOs in selfcheck
* testrunner.vcxproj.filters: updated
* added missing `Debug-PCRE` and `Release-PCRE` configurations for `testrunner` Visual Studio project
* cppcheck.cpp: fixed `useStlAlgorithm` selfcheck warning
2023-05-04 10:54:19 +02:00
Paul Fultz II
9770dd7e0b
Fix 11673: FP uninitvar when capturing by reference ( #4984 )
...
* Fix 11673: FP uninitvar when capturing by reference
* Format
* Fix tests
2023-05-04 06:03:47 +02:00
Oliver Stöneberg
b5ce2c708b
SingleExecutor: process markup files after code when scanning projects ( #4972 )
...
* SingleExecutor: added TODOs
* test `SingleExecutor` with files and project
* SingleExecutor: process markup files after code when scanning project
* TestSingleExecutor: generate scoped files before calling executor
* CI-unixish.yml: added `--output-on-failure` to CTest call
* helpers.cpp: improved error reporting in `~ScopedFile()`
* use unique filenames in executor tests to avoid collisions
* fixed `functionStatic` selfcheck warnings
2023-05-03 17:32:28 +02:00
chrchr-github
f04d47ac61
Fix remaining example from #11131 ( #5029 )
2023-05-03 16:24:56 +02:00
Daniel Marjamäki
46b9d4ec61
Fixed #11700 (Markup support is broken, unused function false positives) ( #5025 )
2023-05-03 11:19:13 +02:00
chrchr-github
ec2a2ad41f
Partial fix for #11131 FN variableScope with const member functions ( #5027 )
2023-05-03 10:02:16 +02:00
chrchr-github
7e0ddd3669
Set function pointer for ::f ( #5028 )
2023-05-02 22:53:21 +02:00
Oliver Stöneberg
05d72b806d
Token: added non-cost overload for `templateSimplifierPointers()` ( #4760 )
2023-05-02 15:44:16 +02:00
Paul Fultz II
9d21379c7d
Add non-const overloads for next(), previous(), and link() ( #5002 )
...
* Add non-const overloads for next(), previous(), and link()
* Format
* Add CPPCHECKLIB
2023-05-02 06:55:31 +02:00
Paul Fultz II
86757de4d5
ValueFlow: Add pass runner to check timeout and report time ( #4952 )
2023-04-30 20:39:05 +02:00
chrchr-github
269850a62d
Fix autoNoType with multiple auto variables ( #5012 )
2023-04-30 20:36:27 +02:00
Oliver Stöneberg
2bc4ee925e
parse files with `simplecpp` without providing a stream ( #4955 )
2023-04-30 20:16:51 +02:00
Oliver Stöneberg
8cf6a22ea3
cleaned up includes based on `include-what-you-use` ( #5021 )
2023-04-30 07:33:19 +02:00
chrchr-github
51cba8162b
Fix #11489 Crash in TemplateSimplifier ( #5020 )
...
* Add test for #11489
* Fix #11489 Crash in TemplateSimplifier
2023-04-30 07:33:04 +02:00
chrchr-github
043f4fa621
Fix #11693 performance regression (hang) in 2.11dev ( #5022 )
2023-04-29 15:17:55 +02:00
Oliver Stöneberg
b3016f01a1
fixed some CLion inspection warnings ( #4688 )
...
* fixed some CLion "Unused global declaration" warnings
* fixed some CLion "Not implemented function" warnings
* fixed some CLion "Unused struct" warnings
* added TODO
* removed unused parameter reported by CLion
* fixed some CLion "Unused macro" warnings
* fixed some CLion "Condition is always true" warnings and a CLion "The value is never used" warning
2023-04-28 16:02:41 +02:00
Oliver Stöneberg
c249cc9098
avoid redundant `simplecpp::Output::type` switch blocks ( #5005 )
...
* avoid redundant `simplecpp::Output::type` switch blocks
* fixed `useStlAlgorithm` warnings
2023-04-28 15:37:59 +02:00
Oliver Stöneberg
1cd1cbabe9
avoid some unnecessary code execution ( #4962 )
2023-04-28 12:42:51 +02:00
Oliver Stöneberg
5658319976
CppCheck: removed changing of `debugwarnings` for non-accepted files ( #4965 )
2023-04-28 12:30:01 +02:00
Oliver Stöneberg
0924e6616e
made some member functions static ( #4966 )
2023-04-28 12:29:40 +02:00
chrchr-github
2b92351b49
Fix #11679 FP knownArgument with known return value ( #5007 )
...
* Fix #11679 FP knownArgument with known return value
* Add test for #11051
2023-04-28 08:27:48 +02:00
chrchr-github
5b4c95f229
Fix varid assigned to function ( #4991 ) ( #5013 )
2023-04-28 08:27:07 +02:00
chrchr-github
9c184462ad
Fix #10720 Hang/Crash with big variadic template ( #5018 )
...
* Fix #10720 Hang/Crash with big variadic template
* Fix CI
2023-04-28 08:26:35 +02:00
chrchr-github
77717f73fd
Fix #11418 Crash in TemplateSimplifier::expandTemplate() ( #5019 )
2023-04-28 08:25:52 +02:00
chrchr-github
96cf2b34fd
Optimize createSymbolDatabaseExprIds() ( #5017 )
2023-04-27 22:06:06 +02:00
chrchr-github
4fdcb0c784
Fix #11649 Hang in setTokenValue() on huge array ( #5010 )
...
* Fix #11649 Hang in setTokenValue() on huge array
* Fix function call
2023-04-25 21:02:49 +02:00
chrchr-github
023e79b6c2
Fix #11459 uninitvar false positive ( #5011 )
...
* Fix #11459 uninitvar false positive
* Format
2023-04-25 21:01:44 +02:00
chrchr-github
9ea223b367
Fix #11309 debug: Scope::checkVariable found variable 'v' with varid 0 ( #5006 )
...
* Fix #11309 debug: Scope::checkVariable found variable 'v' with varid 0
* Format
2023-04-24 20:27:10 +02:00
Paul Fultz II
6820b70dd1
Fix 11636: FP nullPointer with uninstantiated template ( #5004 )
...
* Fix 11636: FP nullPointer with uninstantiated template
* Format
2023-04-23 14:40:03 +02:00
Paul Fultz II
1b9369b78b
Fix 11666: FP returnDanglingLifetime with specializations and ptr to member ( #5003 )
...
* Fix 11666: FP returnDanglingLifetime with specializations and ptr to member
* Format
2023-04-23 14:38:28 +02:00
chrchr-github
c5310fe8a2
Fix #8592 SymbolDatabase: better handling of 'using namespace' ( #4974 )
2023-04-22 10:23:12 +02:00
Oliver Stöneberg
db955a13a9
moved test-only `Preprocessor::getcode()` out of `lib` ( #4993 )
2023-04-22 10:22:00 +02:00
chrchr-github
5c7914aaa6
Fix FN constParameterReference with std::array ( #4999 )
2023-04-21 20:33:06 +02:00
chrchr-github
bda9f707cc
Fix typedef in enum class ( #4998 )
2023-04-21 18:58:44 +02:00
chrchr-github
5a4e43760e
Handle auto * const ( #4994 )
...
* Handle auto as first token
* Set varid when initialized by function
* Fix TODO from #11444
* Fix function parsing
* Add parentheses
* Format
* Handle auto * const
* Fix test on different platforms
* simpleMatch
* simpleMatch
2023-04-21 14:19:28 +02:00
Oliver Stöneberg
ad464c4feb
Preprocessor: relaxed dependency on `Suppressions` ( #4983 )
...
* Preprocessor: cleaned up `missingInclude()`
* Preprocessor: relaxed dependency on `Suppressions` / adjusted `TestPreProcessor::inline_suppression_for_missing_include()` which was not testing production behavior
* test/cli/test-other.py: added test for `missingInclude` and `missingIncludeSystem` inline suppressions
* fixed `constParameterReference` selfcheck warning
2023-04-21 10:14:34 +02:00
chrchr-github
a4e224b65c
Handle auto as first token, set varid ( #4991 )
...
* Handle auto as first token
* Set varid when initialized by function
* Fix TODO from #11444
* Fix function parsing
* Add parentheses
* Format
2023-04-21 10:13:25 +02:00
chrchr-github
e17af6d2d8
Report unknown macro ( #4990 )
2023-04-20 17:55:16 +02:00
chrchr-github
bf3be95046
Fix #11453 , #11490 internalAstError with templates ( #4986 )
...
* Fix #11490 internalAstError with unknown template in index expression
* Comment
* Fix #11490
2023-04-19 21:20:57 +02:00
chrchr-github
31e714cded
Fix incorrect function assignment ( #4977 )
2023-04-19 06:53:47 +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
e70a888833
Fix constPointer FP #11674 , TODOs ( #4976 )
...
* Fix constPointer TODOs
* Fix #11674 FP constParameterPointer when function signature is fixed
* Format
2023-04-18 20:36:14 +02:00
chrchr-github
29e2a7ed34
Fix #11640 internalAstError with typedef matching member function [regression] ( #4981 )
2023-04-18 18:38:16 +02:00
Paul Fultz II
6031bed5a2
Fix 11669: Assert failure in infer.cpp ( #4982 )
...
* Fix 11669: Assert failure in infer.cpp
* Format
2023-04-18 18:35:25 +02:00
tsteven4
4183336dc1
fix skipping of cpp attributes. ( #4971 )
...
* fix skipping of cpp attributes.
* fix simplifyCPPAttribute loop.
When the first token was the start of a c++ attribute on a function,
so that tok->previous() was nullptr at the bottom of the loop,
an extra token would be skipped. This could result in the corresponding
function being omitted from the symbol table.
* fix alignas test failure, enhance cpp attr test.
* uncrustify.
* fix redundantNextPrevious
* delete redundant code.
* add some tokenizer tests for simplifyCPPAttribute.
* enhance noreturn symbol test.
The order of a noreturn attribute and another attribute used to
matter. Test both orders.
2023-04-17 20:36:25 +02:00
chrchr-github
c3002f1230
Fix #551 Detect unused Private member variables ( #4973 )
2023-04-17 20:34:39 +02:00
Daniel Marjamäki
785f32465f
dump: fix xml in TokenAndName element
2023-04-16 18:17:05 +02:00
Oliver Stöneberg
9ad26f51e8
removed `CppCheck` dependency from `CppCheckExecutor::parseFromArgs()` ( #4967 )
...
* made `CppCheck::getErrorMessages()` static
* removed `CppCheck` dependency from `CppCheckExecutor::parseFromArgs()`
2023-04-16 13:54:21 +02:00
chrchr-github
87755e3bae
Fix autoNoType with function returning container, rvalue reference ( #4926 )
2023-04-12 22:10:10 +02:00
Paul Fultz II
1f0376b32d
ValueFlow: Limit the combinations of arguments passed to subfunctions in normal analysis ( #4950 )
2023-04-12 22:09:48 +02:00
Daniel Marjamäki
afb9e43f2a
dump: write container information
2023-04-12 21:57:37 +02:00
Daniel Marjamäki
e59e34c0eb
showtime: separate items properly
2023-04-11 19:52:55 +02:00
chrchr-github
a0b59ff56a
Fix FN constVariableReference ( #4949 )
2023-04-11 14:00:40 +02:00
Paul Fultz II
ac14fd218b
ValueFlow: Infer possible symbolic values ( #4947 )
2023-04-10 19:27:29 +02:00
chrchr-github
63151f3291
Fix crash in constPointer() ( #4945 )
2023-04-09 16:38:09 +02:00
Daniel Marjamäki
7726a5b5b3
Add a --check-level option ( #4942 )
2023-04-09 13:48:13 +02:00
Daniel Marjamäki
3eeeaeffd2
Tokenizer::simplifyTypedef: ensure externC flag is preserved when simplifying typedefs
2023-04-09 09:38:12 +02:00
Oliver Stöneberg
f5e51eace7
do not use string-to-integer conversions without error handling ( #4906 )
2023-04-08 22:29:09 +02:00
Oliver Stöneberg
cfca3a69a2
optimized template string substitutions a bit ( #4840 )
2023-04-08 22:19:52 +02:00
Oliver Stöneberg
1f2b49142e
extracted single job execution into `SingleExecutor` / improved testing / do not unconditionally apply colors to output ( #4882 )
...
* added `Settings::useSingleJob()` and use it instead of checking `jobs` or `jointSuppressionReport`
* extracted single job execution into `SingleExecutor`
* moved `reportStatus()` from `CppCheckExecutor` to Èxecutor
* TestSingleExecutor: improved tests
* added testing of markup extension handling in executors
* cleaned up includes based on `include-what-you-use`
* testsingleexecutor.cpp: suppress `performance-unnecessary-value-param` clang-tidy warnings
* ProcessExecutor: send color via pipe instead of applying it beforehand
* do not unconditionally apply colors to output / disable all colors in tests / adjusted tests for changed output behavior
* fixed precision loss in `Executor::reportStatus()`
* fixed `naming-varname` selfcheck warnings
2023-04-08 18:06:38 +02:00
Oliver Stöneberg
ba168474f2
split `templateInstantiation` from `debug` warnings ( #4933 )
2023-04-08 16:50:11 +02:00
Oliver Stöneberg
5be8eee943
iwyu.yml: use a distro which has the latest `include-what-you-use` / enabled Qt mappings / cleaned up includes ( #4885 )
2023-04-08 16:08:47 +02:00
Daniel Marjamäki
89a95ddc8f
--performance-valueflow-max-if-count: review comments
2023-04-08 13:07:28 +02:00
Oliver Stöneberg
39f94f32f9
valueflow.cpp: fixed selfcheck suppression ( #4940 )
2023-04-08 12:15:16 +02:00
Paul Fultz II
93b4de36cd
Update constVariable IDs for references and pointers ( #4904 )
2023-04-07 20:14:53 +02:00
chrchr-github
5524bb4e58
Fix #11634 Crash in TypedefSimplifier ( #4938 )
...
* Fix #11634 Crash in TypedefSimplifier
* Call function
* Format
2023-04-07 11:09:13 +02:00
Daniel Marjamäki
1ac6c3e2ea
remove dump files in cppcheck build dir after usage
2023-04-07 11:07:43 +02:00
Daniel Marjamäki
aa73427699
cleanup ctu-info when project import is used
2023-04-06 20:17:19 +02:00
chrchr-github
ab24e3a3c8
Fix remaining example from #11599 , FN #11646 , fix crash ( #4929 )
...
* Fix remainig example from #11599
* Fix FP, new warnings
* More warnings
* Use getTokenArgumentFunction()
* Fix crash
* Fix #11646 constParameter not reported with "const * const" parameter
* Fix test
* Fix new warnings
* Add suppression
* Add const, fix suppression
2023-04-06 18:46:45 +02:00
chrchr-github
8043930a0f
Fix FN uninitMemberVar with std::array ( #4935 )
2023-04-06 18:45:12 +02:00
chrchr-github
1b00a0f06a
Fix #9279 Missing --check-library warning when memory leaks check assumes function is noreturn ( #4937 )
...
* Fix #9279 Missing --check-library warning when memory leaks check assumes function is noreturn
* Format
* Fix check, add tests
* Format
2023-04-06 18:44:03 +02:00
Paul Fultz II
e22a740f0c
Fix 11647: FN knownConditionTrueFalse with strings of same length ( #4936 )
...
* Fix 11647: FN knownConditionTrueFalse with strings of same length
* Format
* Remove extra size
* Use simpleMatch
2023-04-06 18:42:24 +02:00
Paul Fultz II
edfdfe658a
Fix 11651: FP negativeIndex with for loop ( #4934 )
2023-04-05 11:05:29 +02:00
chrchr-github
0f47948bf4
Fix #11577 FN unusedStructMember when casting address (regression) ( #4816 )
2023-04-04 21:57:09 +02:00
Paul Fultz II
115f17cfe6
ValueFlow: Improve the starting point for uninitialized variables to find more uninitialized usages after many conditionals ( #4930 )
2023-04-04 21:55:09 +02:00
Paul Fultz II
d5e2ee411e
Fix 11578: FP accessMoved with range-based for loop ( #4931 )
...
* Fix 11578: FP accessMoved with range-based for loop
* Format
2023-04-03 19:44:47 +02:00
chrchr-github
86efca28a3
Fix crash in constPointer() ( #4932 )
...
* Fix crash in constPointer()
* Format
2023-04-03 19:44:08 +02:00
chrchr-github
b2b0962067
Fix #11629 debug: Scope::checkVariable found variable 'np' with varid 0. ( #4915 )
2023-04-03 15:41:19 +02:00
chrchr-github
a336048d14
Fix #11599 false negative: constParameter ( #4902 )
...
* Partial fix for #11599 false negative: constParameter
* Adjust test
* Update testother.cpp
* Update testother.cpp
* Fix #11599 false negative: constParameter
* Fix new warnings
* Format
* Add difference_type
* Remove isAliased()
* Undo
* Adjust test
* Add test
* Improve const check
* Tweak constness, add tests
* Add tests
* Use new helper function, fixtest
* Remove bailout, fix check for cast
* Prevent FP
* Fix constVariable check, add tests
* Format
* Format
* Add test for #11632
2023-04-02 20:36:23 +02:00
Paul Fultz II
634f5e254f
Fix 11512: FN containerOutOfBounds when empty vector is returned ( #4928 )
2023-04-02 11:58:04 +02:00
Daniel Marjamäki
2359b9ff82
valueflow: limit valueflow in functions that have many ifs
2023-04-01 20:58:15 +02:00
chrchr-github
7503aca0e2
Fix #11621 FP functionConst when assigning init list ( #4895 )
...
* Fix #11621 FP functionConst when assigning init list
* Add comment
* Merge
2023-04-01 18:54:26 +02:00
chrchr-github
01a22159b8
Fix autoNoType with std::begin() / function returning smart ptr ( #4919 )
...
* Fix autoNoType with std::begin()
* Suppress warning for const lambda
* Fix autoNoType with function returning smart ptr
* Handle more complex expression
* Fix scope with auto and smart ptr
* Handle smart pointers and iterators first
2023-04-01 09:38:40 +02:00
chrchr-github
89ec148199
Partial fix for #11638 Library::getFunctionName: SIGSEGV ( #4920 )
...
* Partial fix for #11638 Library::getFunctionName: SIGSEGV
* Fix test
* simpleMatch()
2023-03-30 07:25:26 +02:00
chrchr-github
4d72e0f5b5
Fix #11625 FP constVariable when returning by reference ( #4921 )
2023-03-30 07:24:36 +02:00
chrchr-github
3836367d95
Fix FN passedByValue with array access, range-based for ( #4922 )
...
* Fix FN passedByValue with array access, range-based for
* Format
* Fix/suppress new warnings
2023-03-30 07:24:23 +02:00
chrchr-github
fc24f760cc
Fix #11627 Infinite loop in ReverseTraversal ( #4916 )
2023-03-30 07:22:41 +02:00
chrchr-github
13e12da08f
Fix #11639 findGarbageCode(): SIGSEGV ( #4917 )
2023-03-28 11:24:52 +02:00
chrchr-github
7bf6b359b1
Fix #11616 false negative: functionConst ( #4887 )
2023-03-27 17:54:19 +02:00
chrchr-github
5791561a45
Partial fix for #11543 checkLibraryFunction warning for smartpointer in container ( #4900 )
2023-03-27 17:50:33 +02:00
Daniel Marjamäki
c79d859f8b
Tokenizer::simplifyTypedef: new faster simplification.
...
It performs a more "lightweight" simplification of global typedefs that are not shadowed.
If a "heavy" simplification is needed that will be executed afterwards.
2023-03-26 17:16:45 +02:00
Paul Fultz II
7231d1cece
Update the isVariableChanged to correctly check the const bit ( #4912 )
2023-03-26 15:12:49 +02:00
Paul Fultz II
fd8a7b9537
ValueFlow: Evaluate if statement for function returns ( #4908 )
2023-03-24 13:31:26 +01:00
Paul Fultz II
cd21f55cdf
Fix 11630 and 11620 lifetime issues ( #4913 )
2023-03-24 13:29:43 +01:00
Paul Fultz II
e1a4a18528
Fix 11609: False positive: Returning iterator to local container 'k' that will be invalid when returning where 'k' is an iterator. ( #4907 )
2023-03-21 23:18:01 +01:00
Paul Fultz II
d4b030694b
Move some checks for variable changed from constVariable check to isVariableChanged ( #4905 )
2023-03-21 18:16:40 +01:00
chrchr-github
0d02c0a1a7
Fix #11624 FP uninitvar with array passed to function ( #4903 )
2023-03-20 19:54:31 +01:00
chrchr-github
6316479782
Fix FP unusedStructMember with std::map ( #4899 )
2023-03-20 19:40:57 +01:00
chrchr-github
3d965b5b81
Fix #11618 FP functionConst with call to static function ( #4898 )
2023-03-20 19:29:49 +01:00
chrchr-github
19eef2c584
Partial fix for #11599 false negative: constParameter ( #4901 )
2023-03-19 17:43:23 +01:00
chrchr-github
3b61ecd973
Fix FP missingOverride ( #4894 )
2023-03-18 16:39:45 +01:00
chrchr-github
716fcc5e96
Fix crash in valueFlowForwardLifetime() ( #4891 )
2023-03-18 14:53:49 +01:00
chrchr-github
319baf8d0f
No WRONG_DATA for function pointer with unknown return type ( #4893 )
2023-03-18 14:52:29 +01:00
chrchr-github
3ccd0505cd
Enable and mitigate readability-simplify-boolean-expr ( #4897 )
2023-03-17 13:51:55 +01:00
Paul Fultz II
8324caf8b9
Fix 11557: FP derefInvalidIteratorRedundantCheck in and/or condition ( #4892 )
2023-03-16 15:00:27 +01:00
Daniel Marjamäki
a4d2178f3c
Fix ctuuninitvar false positive for struct that is partly initialized
2023-03-13 20:55:11 +01:00
chrchr-github
322a1a5e8c
Partial fix for #11378 internalAstError regressions (iscpp11init) ( #4889 )
2023-03-13 16:30:27 +01:00
chrchr-github
a6c5bb28c1
Fix crash in LoopAnalyzer ( #4888 )
2023-03-13 15:44:34 +01:00
Paul Fultz II
61e8b84578
Fix 11610: false negative: knownConditionTrueFalse with address of variable ( #4883 )
2023-03-12 19:57:11 +01:00
chrchr-github
a75392307f
Partial fix for #11604 : no DacaWrongData for function pointer ( #4867 )
2023-03-12 15:49:37 +01:00
chrchr-github
e2b2fc2684
Fix #10946 Debug warning: autoNoType with lambda ( #4824 )
2023-03-12 15:48:20 +01:00
chrchr-github
980c92d19d
Partial fix for #11378 internalAstError regressions (iscpp11init) ( #4884 )
2023-03-12 15:39:02 +01:00
Oliver Stöneberg
e2f38fdaf3
removed `experimental` and `safe` from `Certainty` ( #4819 )
2023-03-12 14:15:29 +01:00
chrchr-github
9ed21fb917
Fix #11513 FN functionConst with comparison as argument ( #4738 )
2023-03-12 11:39:18 +01:00
chrchr-github
809430631f
Partial fix for #11611 FP constStatement with typedef and unknown macro ( #4881 )
2023-03-12 11:13:58 +01:00
chrchr-github
7881b99547
Fix #10259 debug: SymbolDatabase couldn't resolve all user defined types ( #4879 )
2023-03-10 19:04:46 +01:00
Daniel Marjamäki
f4b32d74c7
dump: update <TemplateSimplifier> info in dump file
2023-03-09 21:58:33 +01:00
Oliver Stöneberg
901b2ab838
Preprocessor: provide suppressions separately from settings ( #4878 )
2023-03-09 20:15:53 +01:00
chrchr-github
a5b0fd38fd
Fix FP functionConst with ternary ( #4874 )
2023-03-09 20:07:44 +01:00
chrchr-github
3db05cf3a4
Pass settings to isVariableChanged() ( #4871 )
2023-03-09 20:05:44 +01:00
chrchr-github
49c5a5aabd
Fix #11602 "debug: Executable scope 'x' with unknown function" ( #4869 )
2023-03-09 20:04:55 +01:00
Oliver Stöneberg
30131837b5
refs #11603 - deprecated `--enable=information` implicitly enabling `missingInclude` ( #4865 )
2023-03-09 20:04:20 +01:00
chrchr-github
c76b05ad75
Fix #11607 FP constVariable with auto and std::map ( #4877 )
2023-03-09 20:01:50 +01:00
chrchr-github
6e1cc11eff
Fix #11606 internalAstError with empty initializer list ( #4875 )
2023-03-09 20:01:06 +01:00
Mateusz Michalak
2d5cabed4b
Add std::*begin and std::*end cfg ( #4796 )
2023-03-09 17:06:53 +01:00
Paul Fultz II
9351eddbca
Fix 11605: FN useStlAlgo with multiple conditions ( #4873 )
2023-03-09 17:06:27 +01:00
Daniel Marjamäki
b0e8ed3117
dump: add more template info to dumpfile
2023-03-08 18:59:34 +01:00
chrchr-github
f2238e717b
Fix crash in isTemporary() ( #4866 )
2023-03-07 12:44:54 +01:00
Oliver Stöneberg
00fd3d92c6
made `ForwardTraversal::mSettings` and `ReverseTraversal::mSettings` references / adjusted some calling code to use references as well ( #4858 )
2023-03-07 12:26:17 +01:00
Oliver Stöneberg
63f439dc1e
enabled and fixed `performance-noexcept-move-constructor` clang-tidy warnings ( #4864 )
2023-03-07 12:24:01 +01:00
Oliver Stöneberg
20db3ff368
SymbolDatabase: made `mTokenizer` and `mSettings` references ( #4857 )
2023-03-07 12:22:06 +01:00
Oliver Stöneberg
a3cacf1ba1
TemplateSimplifier: made `mTokenizer` and `mSettings` references ( #4856 )
2023-03-07 12:12:31 +01:00
Daniel Marjamäki
e8e00d8fdf
Unused Var: Fix FP when initialization is made in macro
2023-03-05 15:31:53 +01:00
Oliver Stöneberg
ad6c5d80ff
removed unused `ErrorLogger::reportInfo()` / small `*Executor` cleanup ( #4852 )
2023-03-04 17:29:34 +01:00
Oliver Stöneberg
a00b6e1f8a
simplified `ThreadExecutor` class by moving some code out of it / fixed some thread safety issues ( #4849 )
2023-03-04 12:05:17 +01:00
chrchr-github
9291421840
Fix #11595 FN useStlAlgorithm with complex condition ( #4848 )
2023-03-04 11:58:12 +01:00
chrchr-github
b4c90f8b2a
Fix #11597 FP uninitvar with nested enum ( #4847 )
2023-03-04 11:57:12 +01:00
Daniel Marjamäki
350a1f2dfc
AST: do not produce AST for function pointer declaration 'void *(*var[2])(int)'
2023-03-04 11:09:55 +01:00
Daniel Marjamäki
f4e0ae3b84
Tokenizer: Improved removing of function pointer arguments to avoid false positives
2023-03-04 11:09:55 +01:00
Oliver Stöneberg
7fd4118d60
Fix #10039 (integrate `--check-config` include findings with normal analysis) / also fixes #11283 ( #3229 )
2023-03-04 09:02:35 +01:00
Oliver Stöneberg
50eb0641b9
iwyu.yml: added `clang-include-cleaner` job / cleaned up includes based on `include-what-you-use` ( #4844 )
2023-03-04 08:53:19 +01:00
Oliver Stöneberg
0ec2d84f1a
optimized suppression lookups a bit when no suppressions exist ( #4839 )
2023-03-03 18:37:09 +01:00
Oliver Stöneberg
5af6ca6637
made `Platform` a member of `Settings` instead of inheriting from it / cleanups ( #4791 )
2023-03-03 18:36:27 +01:00
Oliver Stöneberg
8023eff7c0
removed `TokenList::getSettings()` and replaced usage in ValueFlow with provided settings ( #4843 )
2023-03-03 18:31:38 +01:00
Oliver Stöneberg
f9c67ef907
fixed `functionConst` selfcheck warnings ( #4846 )
2023-03-03 11:02:51 +01:00
Oliver Stöneberg
b70e1d5461
avoid some unchecked pointer dereferences ( #4811 )
2023-03-02 22:05:41 +01:00
chrchr-github
215124461e
Fix #11499 FN functionConst with operator usage ( #4722 )
2023-03-02 21:51:58 +01:00
Oliver Stöneberg
381361629e
Preprocessor: removed unreachable `ConfigurationNotChecked` finding ( #4790 )
2023-03-02 21:50:57 +01:00
Oliver Stöneberg
bd1ae69b00
cleaned up includes based on `include-what-you-use` ( #4599 )
2023-03-02 21:50:14 +01:00
Oliver Stöneberg
8f5f06add7
some `Tokenizer` construction and related other cleanups ( #4799 )
2023-03-02 21:48:14 +01:00
Oliver Stöneberg
dac578e8b9
ValueFlow: avoid unnecessary `Value` copies ( #4835 )
2023-03-02 21:46:23 +01:00
chrchr-github
491299048b
Amend fix for #11449 Function call not recognized ( #4838 )
2023-03-02 21:45:15 +01:00
Oliver Stöneberg
75619db1d5
symboldatabase.cpp: use `Keywords` / added TODOs ( #4828 )
2023-03-02 21:20:56 +01:00
chrchr-github
51c5a79150
Fix #11586 FP ctuArrayIndex with unknown typedef ( #4831 )
2023-03-02 21:19:53 +01:00
chrchr-github
7f62d8ff98
Fix #11594 internalAstError with immediately instantiated enum ( #4841 )
2023-03-02 21:17:39 +01:00
Oliver Stöneberg
3ec4da0f8a
improved library loading in tests ( #4806 )
2023-03-02 21:10:51 +01:00
Oliver Stöneberg
e99d7c6531
fixed some `-Wdeprecated-copy-dtor` Clang compiler warnings ( #4836 )
2023-03-02 21:02:29 +01:00
chrchr-github
072e822020
Set ValueType for free function returning iterator ( #4837 )
2023-03-02 21:01:20 +01:00
Daniel Marjamäki
cfba046408
Fixed #11593 (function pointer => false negatives (ast? valueflow?))
2023-03-02 20:08:22 +01:00
chrchr-github
17e776861e
Get type from auto with index operator ( #4826 )
2023-02-28 15:05:45 +01:00
Daniel Marjamäki
80050b11dd
SymbolDatabase: Fix handling of function pointer arguments
2023-02-27 15:10:25 +01:00
Daniel Marjamäki
65fc31cba9
Tokenizer: tweaked simplification of function pointers. Argument types are kept.
2023-02-26 18:03:24 +01:00
chrchr-github
a0cc35e3fa
Remove simplifyQtSignalsSlots(), update qt.cfg ( #4807 )
2023-02-25 15:58:57 +01:00
chrchr-github
29b651f264
Partial fix for #11543 checkLibraryFunction warning for smartpointer in container ( #4781 )
2023-02-25 15:47:02 +01:00
Oliver Stöneberg
5d9c157f5e
keywords.cpp: fixed accidental omissions in C++03 keywords / added missing keywords in latest standards ( #4825 )
2023-02-25 00:19:04 +01:00
Oliver Stöneberg
a250e6b569
enabled and mitigated `-Wunreachable-code` Clang warnings ( #4818 )
2023-02-24 21:57:44 +01:00
chrchr-github
92b42255da
Fix #11559 FN functionConst ( #4795 )
2023-02-24 21:44:57 +01:00
Oliver Stöneberg
674231ae52
added clean C/C++ keyword lists and use them in `TokenList` ( #3774 )
2023-02-24 21:43:27 +01:00
Oliver Stöneberg
da09a92b0a
test/cfg: enabled `information` and `--inconclusive` in all cases / some cleanups ( #4784 )
2023-02-24 21:37:56 +01:00
Oliver Stöneberg
8583fcf96e
avoid more cases of returning non-const pointers from `const` objects ( #4821 )
2023-02-24 21:22:08 +01:00
chrchr-github
d65cc696b0
Get type from auto with scope ( #4822 )
2023-02-24 21:05:26 +01:00
chrchr-github
a030970160
Fix #11531 FP constParameter with const/non-const overload / #8700 FP functionConst ( #4802 )
2023-02-24 07:05:18 +01:00
chrchr-github
d1e1f951df
Don't show checkLibraryNoReturn for functions with visible declaration ( #11523 , #11190 ) ( #4809 )
2023-02-24 06:49:28 +01:00
chrchr-github
103ff907b6
Fix #11572 Broken AST with brace-init and bitwise and ( #4812 )
2023-02-24 06:31:20 +01:00
Daniel Marjamäki
e5a22e3436
Revert "improved `Path` handling of mixed separators ( #4808 )"
...
This reverts commit 0797867758
.
2023-02-24 06:21:02 +01:00
chrchr-github
50c8a0dbe1
Fix #11553 pop_back on empty container is UB ( #4789 )
2023-02-24 01:10:19 +01:00
Oliver Stöneberg
ce3ba5c015
token.cpp: removed unreachable cases from `multiComparePercent()` ( #4814 )
2023-02-23 22:58:10 +01:00
chrchr-github
96887c8130
Fix #11561 FN nullPointer with unnamed parameter ( #4805 )
2023-02-23 22:56:03 +01:00
Oliver Stöneberg
0797867758
improved `Path` handling of mixed separators ( #4808 )
2023-02-23 22:34:05 +01:00
Paul Fultz II
346ecdb53a
Improve valueflow after pushing to container ( #4803 )
2023-02-23 18:05:31 +01:00
Paul Fultz II
91d2526c41
Fix reverse analysis when modifying variable with function ( #4800 )
2023-02-23 18:04:16 +01:00
chrchr-github
fb88883813
Fix #11576 FP comparePointers / FN cstyleCast when taking address ( #4817 )
...
* Fix FN cstyleCast when taking address
* Fix #11576 FP comparePointers with member variable
* Use getParentLifetime()
* Fix test case number
2023-02-23 17:27:47 +01:00
Mateusz Michalak
9b62caf0ef
Fix FP#11508 ( #4774 )
...
* Add tests to cover the issue
* Set lifetime of pointer to data passed as view to SubFunction
* Move isContainerOfPointers to separate function
* Revert "Set lifetime of pointer to data passed as view to SubFunction"
This reverts commit 30dafe23e40354606776d2573653608025cae754.
* Skip propagating lifetime of iterators/pointers for views
* Add indents to test cases
* Skip all non-local values in container view lifetime
2023-02-18 17:38:51 +01:00
chrchr-github
ff0eee4d77
Fix #11558 FP knownConditionTrueFalse when checking for zero character ( #4794 )
...
* Fix #11558 FP knownConditionTrueFalse when checking for zero characte
* Fix test
* Set impossible value only for non-Boolean conditions, rename
* Fix condition
2023-02-18 17:35:12 +01:00
chrchr-github
1c11d3039d
Fix FP returnTempReference ( #4793 )
...
* Fix FP returnTempReference
* Fix mismatch between token and variable ValueType
* Format, clang-tidy
* Add test
* Format
2023-02-17 07:17:37 +01:00
chrchr-github
33a03f2c35
Don't throw internalAstError for parameter pack in template argument list ( #4773 )
2023-02-15 19:43:18 +01:00
chrchr-github
4f8329b2df
Fix #11545 FP unreadVariable with std::span ( #4792 )
2023-02-14 06:11:24 +01:00
Michael Drake
d651b6baf1
dump: Fix concurrency problem with dump files ( #4757 )
...
* dump: Fix concurrency problem with dump files
This adds the process ID for the cppcheck process to the filenames
of the .dump and .ctu-info files that the process generates.
So
lib/cppcheck.cpp.dump
becomes
lib/cppcheck.cpp.<PID>.dump
For example:
lib/cppcheck.cpp.2637871.dump
The reason for this change is that if there is a buildsystem which
supports concurrency, multiple instances of cppcheck may be run for
the same file. For example, if the same file is compiled in multiple
build variants, or for multiple targets.
If running the MISRA plugin over such a project with concurrency
enabled in the buildsystem, the plugin ends up crashing as multiple
jobs attempt to create/trample/delete the same files while other
jobs are using them.
For more information see:
https://sourceforge.net/p/cppcheck/discussion/general/thread/02c757b4af/
* dump: Include pid in filename if dump not explicit
Only change the dump and ctu-info filenames to include the PID if
they are being generated due to an addon.
This means that existing scripts that use `--dump` will still work
if they depend on the previous naming behaviour. The more robust
filenames containing the pid will be used when the dump files are
used as an internal implementation detail for passing data to addons.
However this means that anything that does explicitly use `--dump`
will be susceptible to concurrency problems.
* test: Update addon dump file test to account for pid
This test causes a dump file to be created by enabling the misra
addon. Since the dump files now include the cppcheck process pid
this test had to be updated to account for the change.
2023-02-13 20:54:21 +01:00
chrchr-github
2379239aed
Fix FP ignoredReturnValue ( #4783 )
2023-02-11 10:46:04 +01:00
Oliver Stöneberg
132a5a31cf
improved setting of platform in tests / also improved platform tests ( #4787 )
...
* fixture.h: added TODO
* TestPlatform: improved tests for built-in platforms
* TestPlatform: changed tests to TODO asserts
* testfilelister.cpp: added TODO
* fixture.h: added `PLATFORM` macro to load platform / use `PLATFORM` in tests
* platform.h: corrected capitalization in `Platform::platformString(PlatformType)` and bail on unknown type
* fixture.h: fixed `readability-redundant-string-cstr` clang-tidy warning
* testplatform.cpp: fixed `functionConst` selfcheck warnings
2023-02-11 10:44:56 +01:00