From a5f8cbe8b149d4b3e1136aa4c07691397d693038 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Tue, 17 May 2022 12:49:23 -0400 Subject: clang-tidy: address `modernize-use-default-member-init` lints --- Source/CPack/IFW/cmCPackIFWRepository.cxx | 3 +-- Source/CTest/cmCTestBZR.cxx | 3 +-- Source/CTest/cmCTestCVS.cxx | 3 +-- Source/CTest/cmCTestGIT.cxx | 6 ++---- Source/CTest/cmCTestP4.cxx | 6 ++---- Source/QtDialog/QCMakeCacheView.cxx | 3 +-- Source/cmArchiveWrite.cxx | 1 - Source/cmArchiveWrite.h | 2 +- Source/cmCoreTryCompile.cxx | 14 +++++--------- Source/cmELF.cxx | 3 +-- Source/cmFileCopier.cxx | 10 ---------- Source/cmFileCopier.h | 23 ++++++++++++----------- Source/cmFileInstaller.cxx | 7 ------- Source/cmFileInstaller.h | 14 +++++++------- Source/cmFortranParser.h | 3 +-- Source/cmGeneratorExpression.cxx | 5 ----- Source/cmGeneratorExpression.h | 10 +++++----- Source/cmGeneratorExpressionContext.cxx | 4 ---- Source/cmGeneratorExpressionContext.h | 8 ++++---- Source/cmGeneratorExpressionParser.cxx | 1 - Source/cmGeneratorExpressionParser.h | 2 +- Source/cmGeneratorTarget.cxx | 19 ++----------------- Source/cmGeneratorTarget.h | 28 ++++++++++++++-------------- Source/cmGraphVizWriter.cxx | 12 ------------ Source/cmGraphVizWriter.h | 24 ++++++++++++------------ Source/cmInstallDirectoryGenerator.cxx | 1 - Source/cmInstallDirectoryGenerator.h | 2 +- Source/cmInstallExportGenerator.cxx | 1 - Source/cmInstallExportGenerator.h | 2 +- Source/cmInstallFilesGenerator.cxx | 1 - Source/cmInstallFilesGenerator.h | 2 +- Source/cmInstallScriptGenerator.cxx | 1 - Source/cmInstallScriptGenerator.h | 2 +- Source/cmInstallTargetGenerator.cxx | 1 - Source/cmInstallTargetGenerator.h | 2 +- Source/cmLinkLineComputer.cxx | 4 ---- Source/cmLinkLineComputer.h | 8 ++++---- Source/cmListFileCache.cxx | 3 +-- Source/cmMakefile.cxx | 14 ++++---------- Source/cmMakefile.h | 4 ++-- Source/cmOSXBundleGenerator.cxx | 1 - Source/cmOSXBundleGenerator.h | 2 +- Source/cmOutputConverter.cxx | 1 - Source/cmOutputConverter.h | 2 +- Source/cmRST.cxx | 5 ----- Source/cmRST.h | 10 +++++----- Source/cmScriptGenerator.cxx | 2 -- Source/cmScriptGenerator.h | 4 ++-- Source/cmTargetDepend.h | 9 +++------ Source/cmTest.cxx | 3 +-- Source/cmTest.h | 2 +- Source/cmXMLWriter.cxx | 4 ---- Source/cmXMLWriter.h | 8 ++++---- Source/cmcmd.cxx | 6 ++---- 54 files changed, 109 insertions(+), 212 deletions(-) (limited to 'Source') diff --git a/Source/CPack/IFW/cmCPackIFWRepository.cxx b/Source/CPack/IFW/cmCPackIFWRepository.cxx index f25d2d28c0..46fc57fd96 100644 --- a/Source/CPack/IFW/cmCPackIFWRepository.cxx +++ b/Source/CPack/IFW/cmCPackIFWRepository.cxx @@ -116,13 +116,12 @@ public: cmCPackeIFWUpdatesPatcher(cmCPackIFWRepository* r, cmXMLWriter& x) : repository(r) , xout(x) - , patched(false) { } cmCPackIFWRepository* repository; cmXMLWriter& xout; - bool patched; + bool patched = false; protected: void StartElement(const std::string& name, const char** atts) override diff --git a/Source/CTest/cmCTestBZR.cxx b/Source/CTest/cmCTestBZR.cxx index 0fe4ff45e2..eb8ee0a772 100644 --- a/Source/CTest/cmCTestBZR.cxx +++ b/Source/CTest/cmCTestBZR.cxx @@ -88,7 +88,6 @@ class cmCTestBZR::InfoParser : public cmCTestVC::LineParser public: InfoParser(cmCTestBZR* bzr, const char* prefix) : BZR(bzr) - , CheckOutFound(false) { this->SetLog(&bzr->Log, prefix); this->RegexCheckOut.compile("checkout of branch: *([^\t\r\n]+)$"); @@ -97,7 +96,7 @@ public: private: cmCTestBZR* BZR; - bool CheckOutFound; + bool CheckOutFound = false; cmsys::RegularExpression RegexCheckOut; cmsys::RegularExpression RegexParent; bool ProcessLine() override diff --git a/Source/CTest/cmCTestCVS.cxx b/Source/CTest/cmCTestCVS.cxx index 1209e06d07..8f5542e51d 100644 --- a/Source/CTest/cmCTestCVS.cxx +++ b/Source/CTest/cmCTestCVS.cxx @@ -111,7 +111,6 @@ public: LogParser(cmCTestCVS* cvs, const char* prefix, std::vector& revs) : CVS(cvs) , Revisions(revs) - , Section(SectionHeader) { this->SetLog(&cvs->Log, prefix); this->RegexRevision.compile("^revision +([^ ]*) *$"); @@ -131,7 +130,7 @@ private: SectionRevisions, SectionEnd }; - SectionType Section; + SectionType Section = SectionHeader; Revision Rev; bool ProcessLine() override diff --git a/Source/CTest/cmCTestGIT.cxx b/Source/CTest/cmCTestGIT.cxx index 56f805cb8a..a55f3e82af 100644 --- a/Source/CTest/cmCTestGIT.cxx +++ b/Source/CTest/cmCTestGIT.cxx @@ -332,7 +332,6 @@ public: DiffParser(cmCTestGIT* git, const char* prefix) : LineParser('\0', false) , GIT(git) - , DiffField(DiffFieldNone) { this->SetLog(&git->Log, prefix); } @@ -349,7 +348,7 @@ protected: DiffFieldSrc, DiffFieldDst }; - DiffFieldType DiffField; + DiffFieldType DiffField = DiffFieldNone; Change CurChange; void DiffReset() @@ -454,7 +453,6 @@ class cmCTestGIT::CommitParser : public cmCTestGIT::DiffParser public: CommitParser(cmCTestGIT* git, const char* prefix) : DiffParser(git, prefix) - , Section(SectionHeader) { this->Separator = SectionSep[this->Section]; } @@ -469,7 +467,7 @@ private: SectionCount }; static char const SectionSep[SectionCount]; - SectionType Section; + SectionType Section = SectionHeader; Revision Rev; struct Person diff --git a/Source/CTest/cmCTestP4.cxx b/Source/CTest/cmCTestP4.cxx index 50c9c16f87..2a7c3ad9a2 100644 --- a/Source/CTest/cmCTestP4.cxx +++ b/Source/CTest/cmCTestP4.cxx @@ -118,7 +118,6 @@ class cmCTestP4::DiffParser : public cmCTestVC::LineParser public: DiffParser(cmCTestP4* p4, const char* prefix) : P4(p4) - , AlreadyNotified(false) { this->SetLog(&this->P4->Log, prefix); this->RegexDiff.compile("^==== (.*)#[0-9]+ - (.*)"); @@ -126,7 +125,7 @@ public: private: cmCTestP4* P4; - bool AlreadyNotified; + bool AlreadyNotified = false; std::string CurrentPath; cmsys::RegularExpression RegexDiff; @@ -193,7 +192,6 @@ public: DescribeParser(cmCTestP4* p4, const char* prefix) : LineParser('\n', false) , P4(p4) - , Section(SectionHeader) { this->SetLog(&this->P4->Log, prefix); this->RegexHeader.compile("^Change ([0-9]+) by (.+)@(.+) on (.*)$"); @@ -216,7 +214,7 @@ private: SectionDiff, SectionCount }; - SectionType Section; + SectionType Section = SectionHeader; Revision Rev; bool ProcessLine() override diff --git a/Source/QtDialog/QCMakeCacheView.cxx b/Source/QtDialog/QCMakeCacheView.cxx index 994df78a80..964d967740 100644 --- a/Source/QtDialog/QCMakeCacheView.cxx +++ b/Source/QtDialog/QCMakeCacheView.cxx @@ -66,7 +66,6 @@ class QCMakeAdvancedFilter : public QSortFilterProxyModel public: QCMakeAdvancedFilter(QObject* o) : QSortFilterProxyModel(o) - , ShowAdvanced(false) { } @@ -78,7 +77,7 @@ public: bool showAdvanced() const { return this->ShowAdvanced; } protected: - bool ShowAdvanced; + bool ShowAdvanced = false; bool filterAcceptsRow(int row, const QModelIndex& p) const override { diff --git a/Source/cmArchiveWrite.cxx b/Source/cmArchiveWrite.cxx index cfde37c3ae..f29983c219 100644 --- a/Source/cmArchiveWrite.cxx +++ b/Source/cmArchiveWrite.cxx @@ -92,7 +92,6 @@ cmArchiveWrite::cmArchiveWrite(std::ostream& os, Compress c, : Stream(os) , Archive(archive_write_new()) , Disk(archive_read_disk_new()) - , Verbose(false) , Format(format) { // Upstream fixed an issue with their integer parsing in 3.4.0 diff --git a/Source/cmArchiveWrite.h b/Source/cmArchiveWrite.h index 260bd20caa..b9fa3d70df 100644 --- a/Source/cmArchiveWrite.h +++ b/Source/cmArchiveWrite.h @@ -156,7 +156,7 @@ private: std::ostream& Stream; struct archive* Archive; struct archive* Disk; - bool Verbose; + bool Verbose = false; std::string Format; std::string Error; std::string MTime; diff --git a/Source/cmCoreTryCompile.cxx b/Source/cmCoreTryCompile.cxx index caa413b9e5..1e84a0bafc 100644 --- a/Source/cmCoreTryCompile.cxx +++ b/Source/cmCoreTryCompile.cxx @@ -32,11 +32,7 @@ class LanguageStandardState { public: LanguageStandardState(std::string&& lang) - : IsEnabled(false) - , DidStandard(false) - , DidStandardRequired(false) - , DidExtensions(false) - , StandardFlag(lang + "_STANDARD") + : StandardFlag(lang + "_STANDARD") , RequiredFlag(lang + "_STANDARD_REQUIRED") , ExtensionFlag(lang + "_EXTENSIONS") { @@ -154,10 +150,10 @@ public: } private: - bool IsEnabled; - bool DidStandard; - bool DidStandardRequired; - bool DidExtensions; + bool IsEnabled = false; + bool DidStandard = false; + bool DidStandardRequired = false; + bool DidExtensions = false; std::string StandardFlag; std::string RequiredFlag; diff --git a/Source/cmELF.cxx b/Source/cmELF.cxx index 66f173329b..8aea7534a3 100644 --- a/Source/cmELF.cxx +++ b/Source/cmELF.cxx @@ -83,7 +83,6 @@ public: : External(external) , Stream(std::move(fin)) , ByteOrder(order) - , ELFType(cmELF::FileTypeInvalid) { // In most cases the processor-specific byte order will match that // of the target execution environment. If we choose wrong here @@ -150,7 +149,7 @@ protected: ByteOrderType ByteOrder; // The ELF file type. - cmELF::FileType ELFType; + cmELF::FileType ELFType = cmELF::FileTypeInvalid; // The ELF architecture. std::uint16_t Machine; diff --git a/Source/cmFileCopier.cxx b/Source/cmFileCopier.cxx index 63a4274c14..16678074c3 100644 --- a/Source/cmFileCopier.cxx +++ b/Source/cmFileCopier.cxx @@ -27,16 +27,6 @@ cmFileCopier::cmFileCopier(cmExecutionStatus& status, const char* name) : Status(status) , Makefile(&status.GetMakefile()) , Name(name) - , Always(false) - , MatchlessFiles(true) - , FilePermissions(0) - , DirPermissions(0) - , CurrentMatchRule(nullptr) - , UseGivenPermissionsFile(false) - , UseGivenPermissionsDir(false) - , UseSourcePermissions(true) - , FollowSymlinkChain(false) - , Doing(DoingNone) { } diff --git a/Source/cmFileCopier.h b/Source/cmFileCopier.h index ee9872d9d1..1fd2062ea3 100644 --- a/Source/cmFileCopier.h +++ b/Source/cmFileCopier.h @@ -28,15 +28,15 @@ protected: cmExecutionStatus& Status; cmMakefile* Makefile; const char* Name; - bool Always; + bool Always = false; cmFileTimeCache FileTimes; // Whether to install a file not matching any expression. - bool MatchlessFiles; + bool MatchlessFiles = true; // Permissions for files and directories installed by this object. - mode_t FilePermissions; - mode_t DirPermissions; + mode_t FilePermissions = 0; + mode_t DirPermissions = 0; // Properties set by pattern and regex match rules. struct MatchProperties @@ -85,17 +85,15 @@ protected: virtual void ReportCopy(const std::string&, Type, bool) {} virtual bool ReportMissing(const std::string& fromFile); - MatchRule* CurrentMatchRule; - bool UseGivenPermissionsFile; - bool UseGivenPermissionsDir; - bool UseSourcePermissions; - bool FollowSymlinkChain; + MatchRule* CurrentMatchRule = nullptr; + bool UseGivenPermissionsFile = false; + bool UseGivenPermissionsDir = false; + bool UseSourcePermissions = true; + bool FollowSymlinkChain = false; std::string Destination; std::string FilesFromDir; std::vector Files; - int Doing; - virtual bool Parse(std::vector const& args); enum { DoingNone, @@ -110,6 +108,9 @@ protected: DoingPermissionsMatch, DoingLast1 }; + int Doing = DoingNone; + + virtual bool Parse(std::vector const& args); virtual bool CheckKeyword(std::string const& arg); virtual bool CheckValue(std::string const& arg); diff --git a/Source/cmFileInstaller.cxx b/Source/cmFileInstaller.cxx index 9bfbd135c9..b0a9ecc324 100644 --- a/Source/cmFileInstaller.cxx +++ b/Source/cmFileInstaller.cxx @@ -23,13 +23,6 @@ using namespace cmFSPermissions; cmFileInstaller::cmFileInstaller(cmExecutionStatus& status) : cmFileCopier(status, "INSTALL") - , InstallType(cmInstallType_FILES) - , InstallMode(cmInstallMode::COPY) - , Optional(false) - , MessageAlways(false) - , MessageLazy(false) - , MessageNever(false) - , DestDirLength(0) { // Installation does not use source permissions by default. this->UseSourcePermissions = false; diff --git a/Source/cmFileInstaller.h b/Source/cmFileInstaller.h index 3f6bd45422..0b6f15dc25 100644 --- a/Source/cmFileInstaller.h +++ b/Source/cmFileInstaller.h @@ -19,13 +19,13 @@ struct cmFileInstaller : public cmFileCopier ~cmFileInstaller() override; protected: - cmInstallType InstallType; - cmInstallMode InstallMode; - bool Optional; - bool MessageAlways; - bool MessageLazy; - bool MessageNever; - int DestDirLength; + cmInstallType InstallType = cmInstallType_FILES; + cmInstallMode InstallMode = cmInstallMode::COPY; + bool Optional = false; + bool MessageAlways = false; + bool MessageLazy = false; + bool MessageNever = false; + int DestDirLength = 0; std::string Rename; std::string Manifest; diff --git a/Source/cmFortranParser.h b/Source/cmFortranParser.h index 70fe5374ce..542b98c2d4 100644 --- a/Source/cmFortranParser.h +++ b/Source/cmFortranParser.h @@ -123,13 +123,12 @@ struct cmFortranFile : File(file) , Buffer(buffer) , Directory(std::move(dir)) - , LastCharWasNewline(false) { } FILE* File; YY_BUFFER_STATE Buffer; std::string Directory; - bool LastCharWasNewline; + bool LastCharWasNewline = false; }; struct cmFortranCompiler diff --git a/Source/cmGeneratorExpression.cxx b/Source/cmGeneratorExpression.cxx index 840f5112d6..f988e54a19 100644 --- a/Source/cmGeneratorExpression.cxx +++ b/Source/cmGeneratorExpression.cxx @@ -100,11 +100,6 @@ cmCompiledGeneratorExpression::cmCompiledGeneratorExpression( cmListFileBacktrace backtrace, std::string input) : Backtrace(std::move(backtrace)) , Input(std::move(input)) - , EvaluateForBuildsystem(false) - , Quiet(false) - , HadContextSensitiveCondition(false) - , HadHeadSensitiveCondition(false) - , HadLinkLanguageSensitiveCondition(false) { cmGeneratorExpressionLexer l; std::vector tokens = l.Tokenize(this->Input); diff --git a/Source/cmGeneratorExpression.h b/Source/cmGeneratorExpression.h index 03be782caa..188993f212 100644 --- a/Source/cmGeneratorExpression.h +++ b/Source/cmGeneratorExpression.h @@ -161,8 +161,8 @@ private: std::vector> Evaluators; const std::string Input; bool NeedsEvaluation; - bool EvaluateForBuildsystem; - bool Quiet; + bool EvaluateForBuildsystem = false; + bool Quiet = false; mutable std::set DependTargets; mutable std::set AllTargetsSeen; @@ -171,9 +171,9 @@ private: std::map> MaxLanguageStandard; mutable std::string Output; - mutable bool HadContextSensitiveCondition; - mutable bool HadHeadSensitiveCondition; - mutable bool HadLinkLanguageSensitiveCondition; + mutable bool HadContextSensitiveCondition = false; + mutable bool HadHeadSensitiveCondition = false; + mutable bool HadLinkLanguageSensitiveCondition = false; mutable std::set SourceSensitiveTargets; }; diff --git a/Source/cmGeneratorExpressionContext.cxx b/Source/cmGeneratorExpressionContext.cxx index 42cbe2a4c6..80768872bf 100644 --- a/Source/cmGeneratorExpressionContext.cxx +++ b/Source/cmGeneratorExpressionContext.cxx @@ -16,10 +16,6 @@ cmGeneratorExpressionContext::cmGeneratorExpressionContext( , HeadTarget(headTarget) , CurrentTarget(currentTarget) , Quiet(quiet) - , HadError(false) - , HadContextSensitiveCondition(false) - , HadHeadSensitiveCondition(false) - , HadLinkLanguageSensitiveCondition(false) , EvaluateForBuildsystem(evaluateForBuildsystem) { } diff --git a/Source/cmGeneratorExpressionContext.h b/Source/cmGeneratorExpressionContext.h index 22e74630ef..21e396141d 100644 --- a/Source/cmGeneratorExpressionContext.h +++ b/Source/cmGeneratorExpressionContext.h @@ -36,9 +36,9 @@ struct cmGeneratorExpressionContext // directly or indirectly in the property. cmGeneratorTarget const* CurrentTarget; bool Quiet; - bool HadError; - bool HadContextSensitiveCondition; - bool HadHeadSensitiveCondition; - bool HadLinkLanguageSensitiveCondition; + bool HadError = false; + bool HadContextSensitiveCondition = false; + bool HadHeadSensitiveCondition = false; + bool HadLinkLanguageSensitiveCondition = false; bool EvaluateForBuildsystem; }; diff --git a/Source/cmGeneratorExpressionParser.cxx b/Source/cmGeneratorExpressionParser.cxx index 794c1a1fa0..bbee4d5c30 100644 --- a/Source/cmGeneratorExpressionParser.cxx +++ b/Source/cmGeneratorExpressionParser.cxx @@ -15,7 +15,6 @@ cmGeneratorExpressionParser::cmGeneratorExpressionParser( std::vector tokens) : Tokens(std::move(tokens)) - , NestingLevel(0) { } diff --git a/Source/cmGeneratorExpressionParser.h b/Source/cmGeneratorExpressionParser.h index efaef3e5e7..63273e4bf5 100644 --- a/Source/cmGeneratorExpressionParser.h +++ b/Source/cmGeneratorExpressionParser.h @@ -26,5 +26,5 @@ private: std::vector::const_iterator it; const std::vector Tokens; - unsigned int NestingLevel; + unsigned int NestingLevel = 0; }; diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index d852b4856f..8ed7f1046a 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -335,20 +335,6 @@ EvaluatedTargetPropertyEntries EvaluateTargetPropertyEntries( cmGeneratorTarget::cmGeneratorTarget(cmTarget* t, cmLocalGenerator* lg) : Target(t) - , FortranModuleDirectoryCreated(false) - , SourceFileFlagsConstructed(false) - , PolicyWarnedCMP0022(false) - , PolicyReportedCMP0069(false) - , DebugIncludesDone(false) - , DebugCompileOptionsDone(false) - , DebugCompileFeaturesDone(false) - , DebugCompileDefinitionsDone(false) - , DebugLinkOptionsDone(false) - , DebugLinkDirectoriesDone(false) - , DebugPrecompileHeadersDone(false) - , DebugSourcesDone(false) - , UtilityItemsDone(false) - , SourcesAreContextDependent(Tribool::Indeterminate) { this->Makefile = this->Target->GetMakefile(); this->LocalGenerator = lg; @@ -2775,15 +2761,14 @@ cmGeneratorTarget::LinkClosure const* cmGeneratorTarget::GetLinkClosure( class cmTargetSelectLinker { - int Preference; + int Preference = 0; cmGeneratorTarget const* Target; cmGlobalGenerator* GG; std::set Preferred; public: cmTargetSelectLinker(cmGeneratorTarget const* target) - : Preference(0) - , Target(target) + : Target(target) { this->GG = this->Target->GetLocalGenerator()->GetGlobalGenerator(); } diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h index b927848601..6bce7d2b2e 100644 --- a/Source/cmGeneratorTarget.h +++ b/Source/cmGeneratorTarget.h @@ -881,7 +881,7 @@ private: std::string CreateFortranModuleDirectory( std::string const& working_dir) const; - mutable bool FortranModuleDirectoryCreated; + mutable bool FortranModuleDirectoryCreated = false; mutable std::string FortranModuleDirectory; friend class cmTargetTraceDependencies; @@ -906,7 +906,7 @@ private: mutable std::string ExportMacro; void ConstructSourceFileFlags() const; - mutable bool SourceFileFlagsConstructed; + mutable bool SourceFileFlagsConstructed = false; mutable std::map SourceFlagsMap; mutable std::map DebugCompatiblePropertiesDone; @@ -1143,24 +1143,24 @@ private: mutable OutputNameMapType OutputNameMap; mutable std::set UtilityItems; cmPolicies::PolicyMap PolicyMap; - mutable bool PolicyWarnedCMP0022; - mutable bool PolicyReportedCMP0069; - mutable bool DebugIncludesDone; - mutable bool DebugCompileOptionsDone; - mutable bool DebugCompileFeaturesDone; - mutable bool DebugCompileDefinitionsDone; - mutable bool DebugLinkOptionsDone; - mutable bool DebugLinkDirectoriesDone; - mutable bool DebugPrecompileHeadersDone; - mutable bool DebugSourcesDone; - mutable bool UtilityItemsDone; + mutable bool PolicyWarnedCMP0022 = false; + mutable bool PolicyReportedCMP0069 = false; + mutable bool DebugIncludesDone = false; + mutable bool DebugCompileOptionsDone = false; + mutable bool DebugCompileFeaturesDone = false; + mutable bool DebugCompileDefinitionsDone = false; + mutable bool DebugLinkOptionsDone = false; + mutable bool DebugLinkDirectoriesDone = false; + mutable bool DebugPrecompileHeadersDone = false; + mutable bool DebugSourcesDone = false; + mutable bool UtilityItemsDone = false; enum class Tribool { False = 0x0, True = 0x1, Indeterminate = 0x2 }; - mutable Tribool SourcesAreContextDependent; + mutable Tribool SourcesAreContextDependent = Tribool::Indeterminate; bool ComputePDBOutputDir(const std::string& kind, const std::string& config, std::string& out) const; diff --git a/Source/cmGraphVizWriter.cxx b/Source/cmGraphVizWriter.cxx index ab18e2a661..2bb438d7d4 100644 --- a/Source/cmGraphVizWriter.cxx +++ b/Source/cmGraphVizWriter.cxx @@ -109,18 +109,6 @@ cmGraphVizWriter::cmGraphVizWriter(std::string const& fileName, , GraphHeader("node [\n fontsize = \"12\"\n];") , GraphNodePrefix("node") , GlobalGenerator(globalGenerator) - , NextNodeId(0) - , GenerateForExecutables(true) - , GenerateForStaticLibs(true) - , GenerateForSharedLibs(true) - , GenerateForModuleLibs(true) - , GenerateForInterfaceLibs(true) - , GenerateForObjectLibs(true) - , GenerateForUnknownLibs(true) - , GenerateForCustomTargets(false) - , GenerateForExternals(true) - , GeneratePerTarget(true) - , GenerateDependers(true) { } diff --git a/Source/cmGraphVizWriter.h b/Source/cmGraphVizWriter.h index 0912fc8b1d..24dbe5240c 100644 --- a/Source/cmGraphVizWriter.h +++ b/Source/cmGraphVizWriter.h @@ -119,19 +119,19 @@ private: cmGlobalGenerator const* GlobalGenerator; - int NextNodeId; + int NextNodeId = 0; // maps from the actual item names to node names in dot: std::map NodeNames; - bool GenerateForExecutables; - bool GenerateForStaticLibs; - bool GenerateForSharedLibs; - bool GenerateForModuleLibs; - bool GenerateForInterfaceLibs; - bool GenerateForObjectLibs; - bool GenerateForUnknownLibs; - bool GenerateForCustomTargets; - bool GenerateForExternals; - bool GeneratePerTarget; - bool GenerateDependers; + bool GenerateForExecutables = true; + bool GenerateForStaticLibs = true; + bool GenerateForSharedLibs = true; + bool GenerateForModuleLibs = true; + bool GenerateForInterfaceLibs = true; + bool GenerateForObjectLibs = true; + bool GenerateForUnknownLibs = true; + bool GenerateForCustomTargets = false; + bool GenerateForExternals = true; + bool GeneratePerTarget = true; + bool GenerateDependers = true; }; diff --git a/Source/cmInstallDirectoryGenerator.cxx b/Source/cmInstallDirectoryGenerator.cxx index 8462b99787..d358763c71 100644 --- a/Source/cmInstallDirectoryGenerator.cxx +++ b/Source/cmInstallDirectoryGenerator.cxx @@ -20,7 +20,6 @@ cmInstallDirectoryGenerator::cmInstallDirectoryGenerator( bool optional, cmListFileBacktrace backtrace) : cmInstallGenerator(dest, configurations, component, message, exclude_from_all, false, std::move(backtrace)) - , LocalGenerator(nullptr) , Directories(dirs) , FilePermissions(std::move(file_permissions)) , DirPermissions(std::move(dir_permissions)) diff --git a/Source/cmInstallDirectoryGenerator.h b/Source/cmInstallDirectoryGenerator.h index 419fd8c5f9..7deb9ba8ce 100644 --- a/Source/cmInstallDirectoryGenerator.h +++ b/Source/cmInstallDirectoryGenerator.h @@ -42,7 +42,7 @@ protected: void AddDirectoryInstallRule(std::ostream& os, const std::string& config, Indent indent, std::vector const& dirs); - cmLocalGenerator* LocalGenerator; + cmLocalGenerator* LocalGenerator = nullptr; std::vector const Directories; std::string const FilePermissions; std::string const DirPermissions; diff --git a/Source/cmInstallExportGenerator.cxx b/Source/cmInstallExportGenerator.cxx index f1ac6561e0..8a48aa2871 100644 --- a/Source/cmInstallExportGenerator.cxx +++ b/Source/cmInstallExportGenerator.cxx @@ -32,7 +32,6 @@ cmInstallExportGenerator::cmInstallExportGenerator( , FileName(std::move(filename)) , Namespace(std::move(name_space)) , ExportOld(exportOld) - , LocalGenerator(nullptr) { if (android) { #ifndef CMAKE_BOOTSTRAP diff --git a/Source/cmInstallExportGenerator.h b/Source/cmInstallExportGenerator.h index dc07d367a6..02fe1fa219 100644 --- a/Source/cmInstallExportGenerator.h +++ b/Source/cmInstallExportGenerator.h @@ -65,7 +65,7 @@ protected: std::string const FileName; std::string const Namespace; bool const ExportOld; - cmLocalGenerator* LocalGenerator; + cmLocalGenerator* LocalGenerator = nullptr; std::string TempDir; std::string MainImportFile; diff --git a/Source/cmInstallFilesGenerator.cxx b/Source/cmInstallFilesGenerator.cxx index 378b9fcb03..18a852b210 100644 --- a/Source/cmInstallFilesGenerator.cxx +++ b/Source/cmInstallFilesGenerator.cxx @@ -19,7 +19,6 @@ cmInstallFilesGenerator::cmInstallFilesGenerator( bool optional, cmListFileBacktrace backtrace) : cmInstallGenerator(dest, configurations, component, message, exclude_from_all, false, std::move(backtrace)) - , LocalGenerator(nullptr) , Files(files) , FilePermissions(std::move(file_permissions)) , Rename(std::move(rename)) diff --git a/Source/cmInstallFilesGenerator.h b/Source/cmInstallFilesGenerator.h index 2276ab8645..53076b3b34 100644 --- a/Source/cmInstallFilesGenerator.h +++ b/Source/cmInstallFilesGenerator.h @@ -44,7 +44,7 @@ protected: Indent indent, std::vector const& files); - cmLocalGenerator* LocalGenerator; + cmLocalGenerator* LocalGenerator = nullptr; std::vector const Files; std::string const FilePermissions; std::string const Rename; diff --git a/Source/cmInstallScriptGenerator.cxx b/Source/cmInstallScriptGenerator.cxx index bec98b6e91..a5625fe92f 100644 --- a/Source/cmInstallScriptGenerator.cxx +++ b/Source/cmInstallScriptGenerator.cxx @@ -20,7 +20,6 @@ cmInstallScriptGenerator::cmInstallScriptGenerator( std::move(backtrace)) , Script(std::move(script)) , Code(code) - , AllowGenex(false) { // We need per-config actions if the script has generator expressions. if (cmGeneratorExpression::Find(this->Script) != std::string::npos) { diff --git a/Source/cmInstallScriptGenerator.h b/Source/cmInstallScriptGenerator.h index 2cf6a4b6f4..c3a70580ee 100644 --- a/Source/cmInstallScriptGenerator.h +++ b/Source/cmInstallScriptGenerator.h @@ -41,5 +41,5 @@ protected: std::string const Script; bool const Code; cmLocalGenerator* LocalGenerator; - bool AllowGenex; + bool AllowGenex = false; }; diff --git a/Source/cmInstallTargetGenerator.cxx b/Source/cmInstallTargetGenerator.cxx index ae11afca9a..16c5002406 100644 --- a/Source/cmInstallTargetGenerator.cxx +++ b/Source/cmInstallTargetGenerator.cxx @@ -50,7 +50,6 @@ cmInstallTargetGenerator::cmInstallTargetGenerator( : cmInstallGenerator(dest, configurations, component, message, exclude_from_all, false, std::move(backtrace)) , TargetName(std::move(targetName)) - , Target(nullptr) , FilePermissions(std::move(file_permissions)) , ImportLibrary(implib) , Optional(optional) diff --git a/Source/cmInstallTargetGenerator.h b/Source/cmInstallTargetGenerator.h index 6173f2c3e3..3fc4b598ca 100644 --- a/Source/cmInstallTargetGenerator.h +++ b/Source/cmInstallTargetGenerator.h @@ -118,7 +118,7 @@ protected: void IssueCMP0095Warning(const std::string& unescapedRpath); std::string const TargetName; - cmGeneratorTarget* Target; + cmGeneratorTarget* Target = nullptr; std::string const FilePermissions; NamelinkModeType NamelinkMode; bool const ImportLibrary; diff --git a/Source/cmLinkLineComputer.cxx b/Source/cmLinkLineComputer.cxx index 290642bb1e..b1e9e568e2 100644 --- a/Source/cmLinkLineComputer.cxx +++ b/Source/cmLinkLineComputer.cxx @@ -18,10 +18,6 @@ cmLinkLineComputer::cmLinkLineComputer(cmOutputConverter* outputConverter, cmStateDirectory const& stateDir) : StateDir(stateDir) , OutputConverter(outputConverter) - , ForResponse(false) - , UseWatcomQuote(false) - , UseNinjaMulti(false) - , Relink(false) { } diff --git a/Source/cmLinkLineComputer.h b/Source/cmLinkLineComputer.h index a1dafc4c83..9fb222cfa3 100644 --- a/Source/cmLinkLineComputer.h +++ b/Source/cmLinkLineComputer.h @@ -67,8 +67,8 @@ protected: cmStateDirectory StateDir; cmOutputConverter* OutputConverter; - bool ForResponse; - bool UseWatcomQuote; - bool UseNinjaMulti; - bool Relink; + bool ForResponse = false; + bool UseWatcomQuote = false; + bool UseNinjaMulti = false; + bool Relink = false; }; diff --git a/Source/cmListFileCache.cxx b/Source/cmListFileCache.cxx index 5133521b8c..4485ac6721 100644 --- a/Source/cmListFileCache.cxx +++ b/Source/cmListFileCache.cxx @@ -36,7 +36,7 @@ struct cmListFileParser cmListFile* ListFile; cmListFileBacktrace Backtrace; cmMessenger* Messenger; - const char* FileName; + const char* FileName = nullptr; cmListFileLexer* Lexer; std::string FunctionName; long FunctionLine; @@ -55,7 +55,6 @@ cmListFileParser::cmListFileParser(cmListFile* lf, cmListFileBacktrace lfbt, : ListFile(lf) , Backtrace(std::move(lfbt)) , Messenger(messenger) - , FileName(nullptr) , Lexer(cmListFileLexer_New()) { } diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 91d7ac5256..4bc563f0c7 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -478,8 +478,8 @@ public: private: cmMakefile* Makefile; bool NoPolicyScope; - bool CheckCMP0011; - bool ReportError; + bool CheckCMP0011 = false; + bool ReportError = true; void EnforceCMP0011(); }; @@ -488,8 +488,6 @@ cmMakefile::IncludeScope::IncludeScope(cmMakefile* mf, bool noPolicyScope) : Makefile(mf) , NoPolicyScope(noPolicyScope) - , CheckCMP0011(false) - , ReportError(true) { this->Makefile->Backtrace = this->Makefile->Backtrace.Push( cmListFileContext::FromListFilePath(filenametoread)); @@ -623,7 +621,6 @@ class cmMakefile::ListFileScope public: ListFileScope(cmMakefile* mf, std::string const& filenametoread) : Makefile(mf) - , ReportError(true) { this->Makefile->Backtrace = this->Makefile->Backtrace.Push( cmListFileContext::FromListFilePath(filenametoread)); @@ -650,7 +647,7 @@ public: private: cmMakefile* Makefile; - bool ReportError; + bool ReportError = true; }; class cmMakefile::DeferScope @@ -1536,7 +1533,6 @@ class cmMakefile::BuildsystemFileScope public: BuildsystemFileScope(cmMakefile* mf) : Makefile(mf) - , ReportError(true) { std::string currentStart = cmStrCat(this->Makefile->StateSnapshot.GetDirectory().GetCurrentSource(), @@ -1578,7 +1574,7 @@ private: cmGlobalGenerator* GG; cmMakefile* CurrentMakefile; cmStateSnapshot Snapshot; - bool ReportError; + bool ReportError = true; }; void cmMakefile::Configure() @@ -4538,7 +4534,6 @@ cmMakefile::FunctionPushPop::FunctionPushPop(cmMakefile* mf, const std::string& fileName, cmPolicies::PolicyMap const& pm) : Makefile(mf) - , ReportError(true) { this->Makefile->PushFunctionScope(fileName, pm); } @@ -4552,7 +4547,6 @@ cmMakefile::MacroPushPop::MacroPushPop(cmMakefile* mf, const std::string& fileName, const cmPolicies::PolicyMap& pm) : Makefile(mf) - , ReportError(true) { this->Makefile->PushMacroScope(fileName, pm); } diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index c8e1e8356e..e7b9716dfb 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -833,7 +833,7 @@ public: private: cmMakefile* Makefile; - bool ReportError; + bool ReportError = true; }; class MacroPushPop @@ -850,7 +850,7 @@ public: private: cmMakefile* Makefile; - bool ReportError; + bool ReportError = true; }; void PushFunctionScope(std::string const& fileName, diff --git a/Source/cmOSXBundleGenerator.cxx b/Source/cmOSXBundleGenerator.cxx index 7eea4b2dff..674735b9c0 100644 --- a/Source/cmOSXBundleGenerator.cxx +++ b/Source/cmOSXBundleGenerator.cxx @@ -18,7 +18,6 @@ cmOSXBundleGenerator::cmOSXBundleGenerator(cmGeneratorTarget* target) : GT(target) , Makefile(target->Target->GetMakefile()) , LocalGenerator(target->GetLocalGenerator()) - , MacContentFolders(nullptr) { if (this->MustSkip()) { return; diff --git a/Source/cmOSXBundleGenerator.h b/Source/cmOSXBundleGenerator.h index a3b6f9883e..c33b08720f 100644 --- a/Source/cmOSXBundleGenerator.h +++ b/Source/cmOSXBundleGenerator.h @@ -65,5 +65,5 @@ private: cmGeneratorTarget* GT; cmMakefile* Makefile; cmLocalGenerator* LocalGenerator; - std::set* MacContentFolders; + std::set* MacContentFolders = nullptr; }; diff --git a/Source/cmOutputConverter.cxx b/Source/cmOutputConverter.cxx index e62e0cd328..688353577d 100644 --- a/Source/cmOutputConverter.cxx +++ b/Source/cmOutputConverter.cxx @@ -29,7 +29,6 @@ bool PathEqOrSubDir(std::string const& a, std::string const& b) cmOutputConverter::cmOutputConverter(cmStateSnapshot const& snapshot) : StateSnapshot(snapshot) - , LinkScriptShell(false) { assert(this->StateSnapshot.IsValid()); this->ComputeRelativePathTopSource(); diff --git a/Source/cmOutputConverter.h b/Source/cmOutputConverter.h index d19bccc186..6e1bfe3653 100644 --- a/Source/cmOutputConverter.h +++ b/Source/cmOutputConverter.h @@ -138,7 +138,7 @@ private: static bool Shell_ArgumentNeedsQuotes(cm::string_view in, int flags); static std::string Shell_GetArgument(cm::string_view in, int flags); - bool LinkScriptShell; + bool LinkScriptShell = false; // The top-most directories for relative path conversion. Both the // source and destination location of a relative path conversion diff --git a/Source/cmRST.cxx b/Source/cmRST.cxx index 1e4dedde36..fa9d4cc25a 100644 --- a/Source/cmRST.cxx +++ b/Source/cmRST.cxx @@ -19,11 +19,6 @@ cmRST::cmRST(std::ostream& os, std::string docroot) : OS(os) , DocRoot(std::move(docroot)) - , IncludeDepth(0) - , OutputLinePending(false) - , LastLineEndedInColonColon(false) - , Markup(MarkupNone) - , Directive(DirectiveNone) , CMakeDirective("^.. (cmake:)?(" "command|envvar|genex|variable" ")::[ \t]+([^ \t\n]+)$") diff --git a/Source/cmRST.h b/Source/cmRST.h index 156b20a1ba..ea4ef221da 100644 --- a/Source/cmRST.h +++ b/Source/cmRST.h @@ -69,11 +69,11 @@ private: std::ostream& OS; std::string DocRoot; - int IncludeDepth; - bool OutputLinePending; - bool LastLineEndedInColonColon; - MarkupType Markup; - DirectiveType Directive; + int IncludeDepth = 0; + bool OutputLinePending = false; + bool LastLineEndedInColonColon = false; + MarkupType Markup = MarkupNone; + DirectiveType Directive = DirectiveNone; cmsys::RegularExpression CMakeDirective; cmsys::RegularExpression CMakeModuleDirective; cmsys::RegularExpression ParsedLiteralDirective; diff --git a/Source/cmScriptGenerator.cxx b/Source/cmScriptGenerator.cxx index 437b93854f..166ee569b3 100644 --- a/Source/cmScriptGenerator.cxx +++ b/Source/cmScriptGenerator.cxx @@ -12,8 +12,6 @@ cmScriptGenerator::cmScriptGenerator(std::string config_var, std::vector configurations) : RuntimeConfigVariable(std::move(config_var)) , Configurations(std::move(configurations)) - , ConfigurationTypes(nullptr) - , ActionsPerConfig(false) { } diff --git a/Source/cmScriptGenerator.h b/Source/cmScriptGenerator.h index 46d794c49a..3d7b350ac5 100644 --- a/Source/cmScriptGenerator.h +++ b/Source/cmScriptGenerator.h @@ -78,12 +78,12 @@ protected: // Information used during generation. std::string ConfigurationName; - std::vector const* ConfigurationTypes; + std::vector const* ConfigurationTypes = nullptr; // True if the subclass needs to generate an explicit rule for each // configuration. False if the subclass only generates one rule for // all enabled configurations. - bool ActionsPerConfig; + bool ActionsPerConfig = false; private: void GenerateScriptActionsOnce(std::ostream& os, Indent indent); diff --git a/Source/cmTargetDepend.h b/Source/cmTargetDepend.h index 902740922f..4ff5eb4e68 100644 --- a/Source/cmTargetDepend.h +++ b/Source/cmTargetDepend.h @@ -18,17 +18,14 @@ class cmTargetDepend // The set order depends only on the Target, so we use // mutable members to achieve a map with set syntax. - mutable bool Link; - mutable bool Util; - mutable bool Cross; + mutable bool Link = false; + mutable bool Util = false; + mutable bool Cross = false; mutable cmListFileBacktrace Backtrace; public: cmTargetDepend(cmGeneratorTarget const* t) : Target(t) - , Link(false) - , Util(false) - , Cross(false) { } operator cmGeneratorTarget const*() const { return this->Target; } diff --git a/Source/cmTest.cxx b/Source/cmTest.cxx index 7c0f9e7222..e6ed01b5f3 100644 --- a/Source/cmTest.cxx +++ b/Source/cmTest.cxx @@ -8,8 +8,7 @@ #include "cmValue.h" cmTest::cmTest(cmMakefile* mf) - : CommandExpandLists(false) - , Backtrace(mf->GetBacktrace()) + : Backtrace(mf->GetBacktrace()) { this->Makefile = mf; this->OldStyle = true; diff --git a/Source/cmTest.h b/Source/cmTest.h index 85978dac28..1c1431069f 100644 --- a/Source/cmTest.h +++ b/Source/cmTest.h @@ -64,7 +64,7 @@ private: cmPropertyMap Properties; std::string Name; std::vector Command; - bool CommandExpandLists; + bool CommandExpandLists = false; bool OldStyle; diff --git a/Source/cmXMLWriter.cxx b/Source/cmXMLWriter.cxx index 0811bd0294..e4ad9b4d5f 100644 --- a/Source/cmXMLWriter.cxx +++ b/Source/cmXMLWriter.cxx @@ -10,10 +10,6 @@ cmXMLWriter::cmXMLWriter(std::ostream& output, std::size_t level) : Output(output) , IndentationElement(1, '\t') , Level(level) - , Indent(0) - , ElementOpen(false) - , BreakAttrib(false) - , IsContent(false) { } diff --git a/Source/cmXMLWriter.h b/Source/cmXMLWriter.h index 6e8eeb7300..49fc8646b2 100644 --- a/Source/cmXMLWriter.h +++ b/Source/cmXMLWriter.h @@ -124,10 +124,10 @@ private: std::stack> Elements; std::string IndentationElement; std::size_t Level; - std::size_t Indent; - bool ElementOpen; - bool BreakAttrib; - bool IsContent; + std::size_t Indent = 0; + bool ElementOpen = false; + bool BreakAttrib = false; + bool IsContent = false; }; class cmXMLElement; // IWYU pragma: keep diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx index df740c9c20..9ab39f1ebe 100644 --- a/Source/cmcmd.cxx +++ b/Source/cmcmd.cxx @@ -2069,8 +2069,8 @@ class cmVSLink { int Type; bool Verbose; - bool Incremental; - bool LinkGeneratesManifest; + bool Incremental = false; + bool LinkGeneratesManifest = true; std::vector LinkCommand; std::vector UserManifests; std::string LinkerManifestFile; @@ -2085,8 +2085,6 @@ public: cmVSLink(int type, bool verbose) : Type(type) , Verbose(verbose) - , Incremental(false) - , LinkGeneratesManifest(true) { } bool Parse(std::vector::const_iterator argBeg, -- cgit v1.2.1