From 9fe40b33e0eab44d4b25677ea843481f128b16c7 Mon Sep 17 00:00:00 2001 From: Daniel Pfeifer Date: Thu, 24 Oct 2024 23:30:46 +0200 Subject: [PATCH] cmCTest*Handler: Use default member initialization --- Source/CTest/cmCTestBuildHandler.cxx | 21 +------------------- Source/CTest/cmCTestBuildHandler.h | 26 ++++++++++++------------- Source/CTest/cmCTestGenericHandler.cxx | 6 ------ Source/CTest/cmCTestGenericHandler.h | 10 +++++----- Source/CTest/cmCTestMemCheckHandler.cxx | 3 --- Source/CTest/cmCTestMemCheckHandler.h | 6 +++--- Source/CTest/cmCTestSubmitHandler.cxx | 4 ---- Source/CTest/cmCTestSubmitHandler.h | 8 ++++---- Source/CTest/cmCTestTestHandler.cxx | 10 ---------- Source/CTest/cmCTestTestHandler.h | 10 +++++----- Source/CTest/cmCTestUpdateHandler.cxx | 1 - Source/CTest/cmCTestUpdateHandler.h | 2 +- 12 files changed, 32 insertions(+), 75 deletions(-) diff --git a/Source/CTest/cmCTestBuildHandler.cxx b/Source/CTest/cmCTestBuildHandler.cxx index ea38802ab3..d5d269e7cc 100644 --- a/Source/CTest/cmCTestBuildHandler.cxx +++ b/Source/CTest/cmCTestBuildHandler.cxx @@ -178,27 +178,8 @@ static cmCTestBuildCompileErrorWarningRex cmCTestWarningErrorFileLine[] = { cmCTestBuildHandler::cmCTestBuildHandler(cmCTest* ctest) : Superclass(ctest) + , LastErrorOrWarning(this->ErrorsAndWarnings.end()) { - this->MaxPreContext = 10; - this->MaxPostContext = 10; - - this->MaxErrors = 50; - this->MaxWarnings = 50; - - this->LastErrorOrWarning = this->ErrorsAndWarnings.end(); - - this->UseCTestLaunch = false; - - this->BuildOutputLogSize = 0; - this->OutputLineCounter = 0; - this->PostContextCount = 0; - - this->TotalErrors = 0; - this->TotalWarnings = 0; - this->LastTickChar = 0; - - this->ErrorQuotaReached = false; - this->WarningQuotaReached = false; } void cmCTestBuildHandler::PopulateCustomVectors(cmMakefile* mf) diff --git a/Source/CTest/cmCTestBuildHandler.h b/Source/CTest/cmCTestBuildHandler.h index f4d61c4bd9..98fe2da611 100644 --- a/Source/CTest/cmCTestBuildHandler.h +++ b/Source/CTest/cmCTestBuildHandler.h @@ -116,34 +116,34 @@ private: t_BuildProcessingQueueType BuildProcessingQueue; t_BuildProcessingQueueType BuildProcessingErrorQueue; - size_t BuildOutputLogSize; + size_t BuildOutputLogSize = 0; std::vector CurrentProcessingLine; std::string SimplifySourceDir; std::string SimplifyBuildDir; - size_t OutputLineCounter; + size_t OutputLineCounter = 0; using t_ErrorsAndWarningsVector = std::vector; t_ErrorsAndWarningsVector ErrorsAndWarnings; t_ErrorsAndWarningsVector::iterator LastErrorOrWarning; - size_t PostContextCount; - size_t MaxPreContext; - size_t MaxPostContext; + size_t PostContextCount = 0; + size_t MaxPreContext = 10; + size_t MaxPostContext = 10; std::deque PreContext; - int TotalErrors; - int TotalWarnings; - char LastTickChar; + int TotalErrors = 0; + int TotalWarnings = 0; + char LastTickChar = '\0'; - bool ErrorQuotaReached; - bool WarningQuotaReached; + bool ErrorQuotaReached = false; + bool WarningQuotaReached = false; - int MaxErrors; - int MaxWarnings; + int MaxErrors = 50; + int MaxWarnings = 50; // Used to remove ANSI color codes before checking for errors and warnings. cmStringReplaceHelper* ColorRemover; - bool UseCTestLaunch; + bool UseCTestLaunch = false; std::string CTestLaunchDir; class LaunchHelper; diff --git a/Source/CTest/cmCTestGenericHandler.cxx b/Source/CTest/cmCTestGenericHandler.cxx index ec047d24bb..e4acbef77a 100644 --- a/Source/CTest/cmCTestGenericHandler.cxx +++ b/Source/CTest/cmCTestGenericHandler.cxx @@ -11,12 +11,6 @@ cmCTestGenericHandler::cmCTestGenericHandler(cmCTest* ctest) : CTest(ctest) { - this->HandlerVerbose = cmSystemTools::OUTPUT_NONE; - this->SubmitIndex = 0; - this->AppendXML = false; - this->Quiet = false; - this->TestLoad = 0; - this->SetVerbose(ctest->GetExtraVerbose()); this->SetSubmitIndex(ctest->GetSubmitIndex()); } diff --git a/Source/CTest/cmCTestGenericHandler.h b/Source/CTest/cmCTestGenericHandler.h index 2990a0b7df..24251c0802 100644 --- a/Source/CTest/cmCTestGenericHandler.h +++ b/Source/CTest/cmCTestGenericHandler.h @@ -70,13 +70,13 @@ protected: cmGeneratedFileStream& xofs); bool StartLogFile(const char* name, cmGeneratedFileStream& xofs); - bool AppendXML; - bool Quiet; - unsigned long TestLoad; - cmSystemTools::OutputOption HandlerVerbose; + bool AppendXML = false; + bool Quiet = false; + unsigned long TestLoad = 0; + cmSystemTools::OutputOption HandlerVerbose = cmSystemTools::OUTPUT_NONE; cmCTest* CTest; t_StringToString LogFileNames; cmake* CMake = nullptr; - int SubmitIndex; + int SubmitIndex = 0; }; diff --git a/Source/CTest/cmCTestMemCheckHandler.cxx b/Source/CTest/cmCTestMemCheckHandler.cxx index acfe47e8cc..e49416352b 100644 --- a/Source/CTest/cmCTestMemCheckHandler.cxx +++ b/Source/CTest/cmCTestMemCheckHandler.cxx @@ -124,9 +124,6 @@ cmCTestMemCheckHandler::cmCTestMemCheckHandler(cmCTest* ctest) this->MemCheck = true; this->TestOptions.OutputSizePassed = 0; this->TestOptions.OutputSizeFailed = 0; - this->LogWithPID = false; - this->MemoryTesterStyle = UNKNOWN; - this->DefectCount = 0; } int cmCTestMemCheckHandler::PreProcessHandler() diff --git a/Source/CTest/cmCTestMemCheckHandler.h b/Source/CTest/cmCTestMemCheckHandler.h index 97c4ed5943..197133035e 100644 --- a/Source/CTest/cmCTestMemCheckHandler.h +++ b/Source/CTest/cmCTestMemCheckHandler.h @@ -99,15 +99,15 @@ private: std::string MemoryTester; std::vector MemoryTesterDynamicOptions; std::vector MemoryTesterOptions; - int MemoryTesterStyle; + int MemoryTesterStyle = UNKNOWN; std::string MemoryTesterOutputFile; std::string MemoryTesterEnvironmentVariable; // these are used to store the types of errors that can show up std::vector ResultStrings; std::vector ResultStringsLong; std::vector GlobalResults; - bool LogWithPID; // does log file add pid - int DefectCount; + bool LogWithPID = false; // does log file add pid + int DefectCount = 0; std::vector::size_type FindOrAddWarning(const std::string& warning); // initialize the ResultStrings and ResultStringsLong for diff --git a/Source/CTest/cmCTestSubmitHandler.cxx b/Source/CTest/cmCTestSubmitHandler.cxx index 4823c946c7..ffd6dd8d6c 100644 --- a/Source/CTest/cmCTestSubmitHandler.cxx +++ b/Source/CTest/cmCTestSubmitHandler.cxx @@ -125,10 +125,6 @@ cmCTestSubmitHandler::cmCTestSubmitHandler(cmCTest* ctest) p = static_cast(p + 1)) { this->SubmitPart[p] = true; } - this->HasWarnings = false; - this->HasErrors = false; - this->HTTPProxyType = 0; - this->LogFile = nullptr; } bool cmCTestSubmitHandler::SubmitUsingHTTP( diff --git a/Source/CTest/cmCTestSubmitHandler.h b/Source/CTest/cmCTestSubmitHandler.h index a4a7c94f1a..86067f6bbf 100644 --- a/Source/CTest/cmCTestSubmitHandler.h +++ b/Source/CTest/cmCTestSubmitHandler.h @@ -66,12 +66,12 @@ private: class ResponseParser; std::string HTTPProxy; - int HTTPProxyType; + int HTTPProxyType = 0; std::string HTTPProxyAuth; - std::ostream* LogFile; + std::ostream* LogFile = nullptr; bool SubmitPart[cmCTest::PartCount]; - bool HasWarnings; - bool HasErrors; + bool HasWarnings = false; + bool HasErrors = false; std::set Files; std::vector HttpHeaders; diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx index 34a6491649..7c4e2eacb3 100644 --- a/Source/CTest/cmCTestTestHandler.cxx +++ b/Source/CTest/cmCTestTestHandler.cxx @@ -278,14 +278,6 @@ cmCTestTestHandler::cmCTestTestHandler(cmCTest* ctest) : Superclass(ctest) , TestOptions(ctest->GetTestOptions()) { - this->UseIncludeRegExpFlag = false; - this->UseExcludeRegExpFlag = false; - this->UseExcludeRegExpFirst = false; - - this->MemCheck = false; - - this->LogFile = nullptr; - // Regular expressions to scan test output for custom measurements. // Capture the whole section of test output from the first opening @@ -304,8 +296,6 @@ cmCTestTestHandler::cmCTestTestHandler(cmCTest* ctest) // Capture content from ... this->CustomLabelRegex.compile("(.*)"); - - this->ElapsedTestingTime = cmDuration(); } void cmCTestTestHandler::PopulateCustomVectors(cmMakefile* mf) diff --git a/Source/CTest/cmCTestTestHandler.h b/Source/CTest/cmCTestTestHandler.h index bbb6af922b..a9e2d67208 100644 --- a/Source/CTest/cmCTestTestHandler.h +++ b/Source/CTest/cmCTestTestHandler.h @@ -271,7 +271,7 @@ protected: std::string EndTest; std::chrono::system_clock::time_point StartTestTime; std::chrono::system_clock::time_point EndTestTime; - bool MemCheck; + bool MemCheck = false; int MaxIndex; public: @@ -348,9 +348,9 @@ private: std::vector TestsToRun; - bool UseIncludeRegExpFlag; - bool UseExcludeRegExpFlag; - bool UseExcludeRegExpFirst; + bool UseIncludeRegExpFlag = false; + bool UseExcludeRegExpFlag = false; + bool UseExcludeRegExpFirst = false; std::vector IncludeLabelRegularExpressions; std::vector ExcludeLabelRegularExpressions; cmsys::RegularExpression IncludeTestsRegularExpression; @@ -373,7 +373,7 @@ private: cmsys::RegularExpression CustomCompletionStatusRegex; cmsys::RegularExpression CustomLabelRegex; - std::ostream* LogFile; + std::ostream* LogFile = nullptr; cmCTest::Repeat RepeatMode = cmCTest::Repeat::Never; int RepeatCount = 1; diff --git a/Source/CTest/cmCTestUpdateHandler.cxx b/Source/CTest/cmCTestUpdateHandler.cxx index 2e0363121b..8bf71ccee8 100644 --- a/Source/CTest/cmCTestUpdateHandler.cxx +++ b/Source/CTest/cmCTestUpdateHandler.cxx @@ -38,7 +38,6 @@ static const char* cmCTestUpdateHandlerUpdateToString(int type) cmCTestUpdateHandler::cmCTestUpdateHandler(cmCTest* ctest) : Superclass(ctest) { - this->UpdateType = e_CVS; } int cmCTestUpdateHandler::DetermineType(const char* cmd, const char* type) diff --git a/Source/CTest/cmCTestUpdateHandler.h b/Source/CTest/cmCTestUpdateHandler.h index 2a0b14ab79..7797228959 100644 --- a/Source/CTest/cmCTestUpdateHandler.h +++ b/Source/CTest/cmCTestUpdateHandler.h @@ -55,7 +55,7 @@ private: // The VCS command to update the working tree. std::string UpdateCommand; std::string SourceDirectory; - int UpdateType; + int UpdateType = e_CVS; int DetectVCS(const std::string& dir); bool SelectVCS();