Oliver Stöneberg
25183ff484
testrunner: more `SettingsBuilder` usage and `const` cleanups ( #5026 )
2023-05-02 15:54:19 +02:00
Oliver Stöneberg
2935c855c3
reduced usage of mutable `Settings` objects in tests ( #4798 )
2023-05-02 11:48:24 +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
Oliver Stöneberg
5a2c31a41c
CmdLineParser: pass suppressions separately from settings ( #5023 )
2023-04-30 20:56:54 +02:00
chrchr-github
269850a62d
Fix autoNoType with multiple auto variables ( #5012 )
2023-04-30 20:36:27 +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
6eae4e71f6
make sure executors are only used in the intended context / `TestSuppressions` cleanups ( #4963 )
...
* added asserts to make sure executors are only used in the intended context
* TestSuppressions: specify proper job counts in `checkSuppression*()`
* TestSuppressions: enabled all asserts in `runChecks()`
* TestSuppressions: removed unnecessary setting from `checkSuppression()`
* TestSuppressions: small cleanup in the way tests are called
* TestSuppressions: use `SingleExecutor`
2023-04-28 12:41:53 +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
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
6e5375f7b7
Add tests for #8075 , #11608 , #11635 ( #4995 )
...
* Add tests for #6925 , #11042 , #11494
* Format
* Add tests for # 6561, #6619 , #7475 ,
* Add tests for #8075 , #11608 , #11635
2023-04-21 16:09:52 +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
67a8ff0b27
Add tests for # 6561, #6619 , #7475 ( #4988 )
...
* Add tests for #6925 , #11042 , #11494
* Format
* Add tests for # 6561, #6619 , #7475 ,
2023-04-20 12:58:50 +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
938ad990f5
Add tests for #6925 , #11042 , #11494 ( #4987 )
...
* Add tests for #6925 , #11042 , #11494
* Format
2023-04-19 21:19:45 +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
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
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
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
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
Paul Fultz II
93b4de36cd
Update constVariable IDs for references and pointers ( #4904 )
2023-04-07 20:14:53 +02:00
Daniel Marjamäki
f52c00c3a7
fixed CI. I remove dump files in cppcheck build dir after analysis.
2023-04-07 19:02:34 +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
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
Oliver Stöneberg
eb0998dc2c
testclass.cpp: fixed compilation ( #4927 )
2023-04-01 19:58:58 +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
ericLemanissier
cf280f84d4
qt: fix Q_UNUSED macro defintion ( #4925 )
2023-04-01 16:33:50 +02:00
Oliver Stöneberg
5ec0ad6bed
use `ccache` for sanitizer builds / do not use precompiled headers with `ccache` ( #4910 )
...
* added CMake option `DISABLE_DMAKE` to disable `run-dmake` dependencies
* tools/CMakeLists.txt: added TODO
* use `ccache` for sanitizer builds
* aligned selfcheck between sanitizer workflows and disabled some currently unnecessary steps
* CI-unixish.yml: do not use precompiled headers with `ccache`
2023-04-01 09:40:10 +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
Oliver Stöneberg
03214c6c08
testnullpointer.cpp: restored TODO assert in `nullpointerStdStream` ( #4914 )
2023-03-26 16:18:44 +02:00
Oliver Stöneberg
f002429a6b
testrunner: fail if `TODO_ASSERT_*` succeeds ( #4911 )
...
* testrunner: fail if TODO succeeds
* testnullpointer.cpp: removed TODO from assert in `nullpointerStdStream`
2023-03-26 15:13:07 +02:00
orbitcowboy
38f9c81dd2
Added regression test to #10602 : FN nullptr
2023-03-24 20:29:33 +01: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
orbitcowboy
b2263d9475
#8499 Added regression test: (style) Condition 'i==0||i==1' is always true (for loop index)
2023-03-17 19:06:17 +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
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