From b86b6aaa4a27009af4e1457458cf35185be00dc5 Mon Sep 17 00:00:00 2001 From: Rose <83477269+AtariDreams@users.noreply.github.com> Date: Wed, 27 Oct 2021 14:01:25 -0400 Subject: Source: Cleanup and simplify some code --- Source/CPack/IFW/cmCPackIFWGenerator.h | 10 ++++----- Source/CPack/IFW/cmCPackIFWPackage.h | 2 +- Source/CPack/cmCPackComponentGroup.h | 13 ++++++----- Source/CPack/cmCPackCygwinBinaryGenerator.cxx | 6 ++---- Source/CPack/cmCPackCygwinBinaryGenerator.h | 6 +++--- Source/CPack/cmCPackCygwinSourceGenerator.cxx | 6 ++---- Source/CPack/cmCPackCygwinSourceGenerator.h | 8 +++---- Source/CPack/cmCPackDebGenerator.cxx | 4 ++-- Source/CPack/cmCPackDebGenerator.h | 6 +++--- Source/CPack/cmCPackDragNDropGenerator.h | 2 +- Source/CPack/cmCPackFreeBSDGenerator.cxx | 2 +- Source/CPack/cmCPackGeneratorFactory.h | 2 +- Source/CPack/cmCPackLog.h | 2 +- Source/CPack/cmCPackNSISGenerator.cxx | 6 +++--- Source/CPack/cmCPackOSXX11Generator.cxx | 31 ++++++++++----------------- Source/CPack/cmCPackOSXX11Generator.h | 4 ++-- Source/CPack/cmCPackPKGGenerator.h | 3 ++- Source/CPack/cmCPackRPMGenerator.cxx | 5 +++-- Source/CPack/cmCPackRPMGenerator.h | 6 +++--- Source/CPack/cpack.cxx | 2 +- Source/CTest/cmCTestGIT.cxx | 2 +- Source/CTest/cmCTestLaunch.h | 6 +++--- Source/CTest/cmCTestP4.h | 8 ------- Source/CTest/cmCTestVC.cxx | 2 +- Source/CTest/cmCTestVC.h | 13 ++++------- Source/CTest/cmProcess.h | 14 +++++------- Source/cmMessenger.cxx | 17 ++++++--------- Source/cmXCOFF.cxx | 20 ++++++++--------- Source/cmXCOFF.h | 4 ++-- 29 files changed, 90 insertions(+), 122 deletions(-) diff --git a/Source/CPack/IFW/cmCPackIFWGenerator.h b/Source/CPack/IFW/cmCPackIFWGenerator.h index b853e18..86b4993 100644 --- a/Source/CPack/IFW/cmCPackIFWGenerator.h +++ b/Source/CPack/IFW/cmCPackIFWGenerator.h @@ -9,13 +9,15 @@ #include #include -#include "cmCPackComponentGroup.h" #include "cmCPackGenerator.h" #include "cmCPackIFWCommon.h" #include "cmCPackIFWInstaller.h" #include "cmCPackIFWPackage.h" #include "cmCPackIFWRepository.h" +class cmCPackComponent; +class cmCPackComponentGroup; + /** \class cmCPackIFWGenerator * \brief A generator for Qt Installer Framework tools * @@ -30,8 +32,6 @@ public: using PackagesMap = std::map; using RepositoriesMap = std::map; - using ComponentsMap = std::map; - using ComponentGoupsMap = std::map; using DependenceMap = std::map; @@ -154,8 +154,8 @@ private: std::string ArchiveFormat; std::string ArchiveCompression; - bool OnlineOnly; - bool ResolveDuplicateNames; + bool OnlineOnly{}; + bool ResolveDuplicateNames{}; std::vector PkgsDirsVector; std::vector RepoDirsVector; }; diff --git a/Source/CPack/IFW/cmCPackIFWPackage.h b/Source/CPack/IFW/cmCPackIFWPackage.h index 0cc6f2f..350f6b2 100644 --- a/Source/CPack/IFW/cmCPackIFWPackage.h +++ b/Source/CPack/IFW/cmCPackIFWPackage.h @@ -44,7 +44,7 @@ public: struct DependenceStruct { DependenceStruct(); - DependenceStruct(const std::string& dependence); + explicit DependenceStruct(const std::string& dependence); std::string Name; CompareStruct Compare; diff --git a/Source/CPack/cmCPackComponentGroup.h b/Source/CPack/cmCPackComponentGroup.h index 58377d4..6a47b6d 100644 --- a/Source/CPack/cmCPackComponentGroup.h +++ b/Source/CPack/cmCPackComponentGroup.h @@ -35,12 +35,10 @@ class cmCPackComponent { public: cmCPackComponent() - : Group(nullptr) - , IsRequired(true) + : IsRequired(true) , IsHidden(false) , IsDisabledByDefault(false) , IsDownloaded(false) - , TotalSize(0) { } @@ -51,7 +49,7 @@ public: std::string DisplayName; /// The component group that contains this component (if any). - cmCPackComponentGroup* Group; + cmCPackComponentGroup* Group = nullptr; /// Whether this component group must always be installed. bool IsRequired : 1; @@ -103,7 +101,7 @@ public: unsigned long GetInstalledSizeInKbytes(const std::string& installDir) const; private: - mutable unsigned long TotalSize; + mutable unsigned long TotalSize = 0; }; /** \class cmCPackComponentGroup @@ -113,7 +111,8 @@ class cmCPackComponentGroup { public: cmCPackComponentGroup() - : ParentGroup(nullptr) + : IsBold(false) + , IsExpandedByDefault(false) { } @@ -136,7 +135,7 @@ public: std::vector Components; /// The parent group of this component group (if any). - cmCPackComponentGroup* ParentGroup; + cmCPackComponentGroup* ParentGroup = nullptr; /// The subgroups of this group. std::vector Subgroups; diff --git a/Source/CPack/cmCPackCygwinBinaryGenerator.cxx b/Source/CPack/cmCPackCygwinBinaryGenerator.cxx index 484db00..fabf4c5 100644 --- a/Source/CPack/cmCPackCygwinBinaryGenerator.cxx +++ b/Source/CPack/cmCPackCygwinBinaryGenerator.cxx @@ -17,9 +17,7 @@ cmCPackCygwinBinaryGenerator::cmCPackCygwinBinaryGenerator() { } -cmCPackCygwinBinaryGenerator::~cmCPackCygwinBinaryGenerator() -{ -} +cmCPackCygwinBinaryGenerator::~cmCPackCygwinBinaryGenerator() = default; int cmCPackCygwinBinaryGenerator::InitializeInternal() { @@ -43,7 +41,7 @@ int cmCPackCygwinBinaryGenerator::PackageFiles() // create an extra scope to force the stream // to create the file before the super class is called { - cmGeneratedFileStream ofs(manifestFile.c_str()); + cmGeneratedFileStream ofs(manifestFile); for (std::string const& file : files) { // remove the temp dir and replace with /usr ofs << file.substr(tempdir.size()) << "\n"; diff --git a/Source/CPack/cmCPackCygwinBinaryGenerator.h b/Source/CPack/cmCPackCygwinBinaryGenerator.h index f5f7700..ca8e0b5 100644 --- a/Source/CPack/cmCPackCygwinBinaryGenerator.h +++ b/Source/CPack/cmCPackCygwinBinaryGenerator.h @@ -19,8 +19,8 @@ public: ~cmCPackCygwinBinaryGenerator() override; protected: - virtual int InitializeInternal(); - int PackageFiles(); - virtual const char* GetOutputExtension(); + int InitializeInternal() override; + int PackageFiles() override; + const char* GetOutputExtension() override; std::string OutputExtension; }; diff --git a/Source/CPack/cmCPackCygwinSourceGenerator.cxx b/Source/CPack/cmCPackCygwinSourceGenerator.cxx index 59df380..a5863ff 100644 --- a/Source/CPack/cmCPackCygwinSourceGenerator.cxx +++ b/Source/CPack/cmCPackCygwinSourceGenerator.cxx @@ -26,9 +26,7 @@ cmCPackCygwinSourceGenerator::cmCPackCygwinSourceGenerator() { } -cmCPackCygwinSourceGenerator::~cmCPackCygwinSourceGenerator() -{ -} +cmCPackCygwinSourceGenerator::~cmCPackCygwinSourceGenerator() = default; int cmCPackCygwinSourceGenerator::InitializeInternal() { @@ -50,7 +48,7 @@ int cmCPackCygwinSourceGenerator::PackageFiles() // Now create a tar file that contains the above .tar.bz2 file // and the CPACK_CYGWIN_PATCH_FILE and CPACK_TOPLEVEL_DIRECTORY // files - std::string compressOutFile = packageDirFileName; + const std::string& compressOutFile = packageDirFileName; // at this point compressOutFile is the full path to // _CPack_Package/.../package-2.5.0.tar.bz2 // we want to create a tar _CPack_Package/.../package-2.5.0-1-src.tar.bz2 diff --git a/Source/CPack/cmCPackCygwinSourceGenerator.h b/Source/CPack/cmCPackCygwinSourceGenerator.h index 964a4d4..2207bde 100644 --- a/Source/CPack/cmCPackCygwinSourceGenerator.h +++ b/Source/CPack/cmCPackCygwinSourceGenerator.h @@ -19,10 +19,10 @@ public: ~cmCPackCygwinSourceGenerator() override; protected: - const char* GetPackagingInstallPrefix(); - virtual int InitializeInternal(); - int PackageFiles(); - virtual const char* GetOutputExtension(); + const char* GetPackagingInstallPrefix() override; + int InitializeInternal() override; + int PackageFiles() override; + const char* GetOutputExtension() override; std::string InstallPrefix; std::string OutputExtension; }; diff --git a/Source/CPack/cmCPackDebGenerator.cxx b/Source/CPack/cmCPackDebGenerator.cxx index d7aa287..8e5e637 100644 --- a/Source/CPack/cmCPackDebGenerator.cxx +++ b/Source/CPack/cmCPackDebGenerator.cxx @@ -203,7 +203,7 @@ bool DebGenerator::generateDataTar() const // uid/gid should be the one of the root user, and this root user has // always uid/gid equal to 0. - data_tar.SetUIDAndGID(0u, 0u); + data_tar.SetUIDAndGID(0U, 0U); data_tar.SetUNAMEAndGNAME("root", "root"); // now add all directories which have to be compressed @@ -902,7 +902,7 @@ std::string cmCPackDebGenerator::GetComponentInstallDirNameSuffix( } if (this->componentPackageMethod == ONE_PACKAGE) { - return std::string("ALL_COMPONENTS_IN_ONE"); + return { "ALL_COMPONENTS_IN_ONE" }; } // We have to find the name of the COMPONENT GROUP // the current COMPONENT belongs to. diff --git a/Source/CPack/cmCPackDebGenerator.h b/Source/CPack/cmCPackDebGenerator.h index 61a6616..11561a4 100644 --- a/Source/CPack/cmCPackDebGenerator.h +++ b/Source/CPack/cmCPackDebGenerator.h @@ -29,9 +29,9 @@ public: #ifdef __APPLE__ // on MacOS enable CPackDeb iff dpkg is found std::vector locations; - locations.push_back("/sw/bin"); // Fink - locations.push_back("/opt/local/bin"); // MacPorts - return cmSystemTools::FindProgram("dpkg", locations) != "" ? true : false; + locations.emplace_back("/sw/bin"); // Fink + locations.emplace_back("/opt/local/bin"); // MacPorts + return !cmSystemTools::FindProgram("dpkg", locations).empty(); #else // legacy behavior on other systems return true; diff --git a/Source/CPack/cmCPackDragNDropGenerator.h b/Source/CPack/cmCPackDragNDropGenerator.h index c96d035..6d1267b 100644 --- a/Source/CPack/cmCPackDragNDropGenerator.h +++ b/Source/CPack/cmCPackDragNDropGenerator.h @@ -33,7 +33,7 @@ protected: bool CopyFile(std::ostringstream& source, std::ostringstream& target); bool CreateEmptyFile(std::ostringstream& target, size_t size); - bool RunCommand(std::ostringstream& command, std::string* output = 0); + bool RunCommand(std::ostringstream& command, std::string* output = nullptr); std::string GetComponentInstallDirNameSuffix( const std::string& componentName) override; diff --git a/Source/CPack/cmCPackFreeBSDGenerator.cxx b/Source/CPack/cmCPackFreeBSDGenerator.cxx index 30b6b0d..fcd5753 100644 --- a/Source/CPack/cmCPackFreeBSDGenerator.cxx +++ b/Source/CPack/cmCPackFreeBSDGenerator.cxx @@ -205,7 +205,7 @@ std::string cmCPackFreeBSDGenerator::var_lookup(const char* var_name) { cmValue pv = this->GetOption(var_name); if (!pv) { - return std::string(); + return {}; } return *pv; } diff --git a/Source/CPack/cmCPackGeneratorFactory.h b/Source/CPack/cmCPackGeneratorFactory.h index 0846573..f3e25a6 100644 --- a/Source/CPack/cmCPackGeneratorFactory.h +++ b/Source/CPack/cmCPackGeneratorFactory.h @@ -41,5 +41,5 @@ private: using t_GeneratorCreatorsMap = std::map; t_GeneratorCreatorsMap GeneratorCreators; DescriptionsMap GeneratorDescriptions; - cmCPackLog* Logger; + cmCPackLog* Logger{}; }; diff --git a/Source/CPack/cmCPackLog.h b/Source/CPack/cmCPackLog.h index aa9a17f..2ab2f8e 100644 --- a/Source/CPack/cmCPackLog.h +++ b/Source/CPack/cmCPackLog.h @@ -128,7 +128,7 @@ public: } const char* Data; - size_t Length; + std::streamsize Length; }; inline std::ostream& operator<<(std::ostream& os, const cmCPackLogWrite& c) diff --git a/Source/CPack/cmCPackNSISGenerator.cxx b/Source/CPack/cmCPackNSISGenerator.cxx index ecc5e08..217f716 100644 --- a/Source/CPack/cmCPackNSISGenerator.cxx +++ b/Source/CPack/cmCPackNSISGenerator.cxx @@ -883,7 +883,7 @@ std::string cmCPackNSISGenerator::CreateSelectionDependenciesDescription( { // Don't visit a component twice if (visited.count(component)) { - return std::string(); + return {}; } visited.insert(component); @@ -907,7 +907,7 @@ std::string cmCPackNSISGenerator::CreateDeselectionDependenciesDescription( { // Don't visit a component twice if (visited.count(component)) { - return std::string(); + return {}; } visited.insert(component); @@ -933,7 +933,7 @@ std::string cmCPackNSISGenerator::CreateComponentGroupDescription( { if (group->Components.empty() && group->Subgroups.empty()) { // Silently skip empty groups. NSIS doesn't support them. - return std::string(); + return {}; } std::string code = "SectionGroup "; diff --git a/Source/CPack/cmCPackOSXX11Generator.cxx b/Source/CPack/cmCPackOSXX11Generator.cxx index 7bf1dc7..563cba0 100644 --- a/Source/CPack/cmCPackOSXX11Generator.cxx +++ b/Source/CPack/cmCPackOSXX11Generator.cxx @@ -20,8 +20,6 @@ cmCPackOSXX11Generator::~cmCPackOSXX11Generator() = default; int cmCPackOSXX11Generator::PackageFiles() { - // TODO: Use toplevel ? - // It is used! Is this an obsolete comment? cmValue cpackPackageExecutables = this->GetOption("CPACK_PACKAGE_EXECUTABLES"); @@ -147,33 +145,26 @@ int cmCPackOSXX11Generator::PackageFiles() // since we get random dashboard failures with this one // try running it more than once int retVal = 1; - int numTries = 10; bool res = false; - while (numTries > 0) { + for (unsigned numTries = 10; numTries > 0; numTries--) { res = cmSystemTools::RunSingleCommand( dmgCmd.str(), &output, &output, &retVal, nullptr, this->GeneratorVerbose, cmDuration::zero()); if (res && !retVal) { - numTries = -1; - break; + return 1; } cmSystemTools::Delay(500); - numTries--; - } - if (!res || retVal) { - cmGeneratedFileStream ofs(tmpFile); - ofs << "# Run command: " << dmgCmd.str() << std::endl - << "# Output:" << std::endl - << output << std::endl; - cmCPackLogger(cmCPackLog::LOG_ERROR, - "Problem running hdiutil command: " - << dmgCmd.str() << std::endl - << "Please check " << tmpFile << " for errors" - << std::endl); - return 0; } - return 1; + cmGeneratedFileStream ofs(tmpFile); + ofs << "# Run command: " << dmgCmd.str() << std::endl + << "# Output:" << std::endl + << output << std::endl; + cmCPackLogger(cmCPackLog::LOG_ERROR, + "Problem running hdiutil command: " + << dmgCmd.str() << std::endl + << "Please check " << tmpFile << " for errors" << std::endl); + return 0; } int cmCPackOSXX11Generator::InitializeInternal() diff --git a/Source/CPack/cmCPackOSXX11Generator.h b/Source/CPack/cmCPackOSXX11Generator.h index 8fae136..6f69af8 100644 --- a/Source/CPack/cmCPackOSXX11Generator.h +++ b/Source/CPack/cmCPackOSXX11Generator.h @@ -25,7 +25,7 @@ public: ~cmCPackOSXX11Generator() override; protected: - virtual int InitializeInternal() override; + int InitializeInternal() override; int PackageFiles() override; const char* GetPackagingInstallPrefix() override; const char* GetOutputExtension() override { return ".dmg"; } @@ -33,7 +33,7 @@ protected: // bool CopyCreateResourceFile(const std::string& name, // const std::string& dir); bool CopyResourcePlistFile(const std::string& name, const std::string& dir, - const char* outputFileName = 0, + const char* outputFileName = nullptr, bool copyOnly = false); std::string InstallPrefix; }; diff --git a/Source/CPack/cmCPackPKGGenerator.h b/Source/CPack/cmCPackPKGGenerator.h index 17cdcdf..5d97d16 100644 --- a/Source/CPack/cmCPackPKGGenerator.h +++ b/Source/CPack/cmCPackPKGGenerator.h @@ -43,7 +43,8 @@ protected: // which will be configured via ConfigureFile. bool CopyCreateResourceFile(const std::string& name, const std::string& dirName); - bool CopyResourcePlistFile(const std::string& name, const char* outName = 0); + bool CopyResourcePlistFile(const std::string& name, + const char* outName = nullptr); int CopyInstallScript(const std::string& resdir, const std::string& script, const std::string& name); diff --git a/Source/CPack/cmCPackRPMGenerator.cxx b/Source/CPack/cmCPackRPMGenerator.cxx index 9e50700..3d4d05e 100644 --- a/Source/CPack/cmCPackRPMGenerator.cxx +++ b/Source/CPack/cmCPackRPMGenerator.cxx @@ -329,9 +329,10 @@ int cmCPackRPMGenerator::PackageComponents(bool ignoreGroup) if (retval) { this->AddGeneratedPackageNames(); + return retval; } - return retval; + return 0; } int cmCPackRPMGenerator::PackageComponentsAllInOne( @@ -424,7 +425,7 @@ std::string cmCPackRPMGenerator::GetComponentInstallDirNameSuffix( } if (this->componentPackageMethod == ONE_PACKAGE) { - return std::string("ALL_COMPONENTS_IN_ONE"); + return { "ALL_COMPONENTS_IN_ONE" }; } // We have to find the name of the COMPONENT GROUP // the current COMPONENT belongs to. diff --git a/Source/CPack/cmCPackRPMGenerator.h b/Source/CPack/cmCPackRPMGenerator.h index 0288f2f..886afb1 100644 --- a/Source/CPack/cmCPackRPMGenerator.h +++ b/Source/CPack/cmCPackRPMGenerator.h @@ -32,9 +32,9 @@ public: #ifdef __APPLE__ // on MacOS enable CPackRPM iff rpmbuild is found std::vector locations; - locations.push_back("/sw/bin"); // Fink - locations.push_back("/opt/local/bin"); // MacPorts - return cmSystemTools::FindProgram("rpmbuild") != "" ? true : false; + locations.emplace_back("/sw/bin"); // Fink + locations.emplace_back("/opt/local/bin"); // MacPorts + return !cmSystemTools::FindProgram("rpmbuild").empty(); #else // legacy behavior on other systems return true; diff --git a/Source/CPack/cpack.cxx b/Source/CPack/cpack.cxx index 54fd358..f43642f 100644 --- a/Source/CPack/cpack.cxx +++ b/Source/CPack/cpack.cxx @@ -67,7 +67,7 @@ struct cpackDefinitions { using MapType = std::map; MapType Map; - cmCPackLog* Log; + cmCPackLog* Log{}; }; int cpackDefinitionArgument(const char* argument, const char* cValue, diff --git a/Source/CTest/cmCTestGIT.cxx b/Source/CTest/cmCTestGIT.cxx index da94754..56f805c 100644 --- a/Source/CTest/cmCTestGIT.cxx +++ b/Source/CTest/cmCTestGIT.cxx @@ -24,7 +24,7 @@ static unsigned int cmCTestGITVersion(unsigned int epic, unsigned int major, unsigned int minor, unsigned int fix) { // 1.6.5.0 maps to 10605000 - return fix + minor * 1000 + major * 100000 + epic * 10000000; + return epic * 10000000 + major * 100000 + minor * 1000 + fix; } cmCTestGIT::cmCTestGIT(cmCTest* ct, std::ostream& log) diff --git a/Source/CTest/cmCTestLaunch.h b/Source/CTest/cmCTestLaunch.h index eabb608..c5a6476 100644 --- a/Source/CTest/cmCTestLaunch.h +++ b/Source/CTest/cmCTestLaunch.h @@ -24,14 +24,14 @@ public: /** Entry point from ctest executable main(). */ static int Main(int argc, const char* const argv[]); + cmCTestLaunch(const cmCTestLaunch&) = delete; + cmCTestLaunch& operator=(const cmCTestLaunch&) = delete; + private: // Initialize the launcher from its command line. cmCTestLaunch(int argc, const char* const* argv); ~cmCTestLaunch(); - cmCTestLaunch(const cmCTestLaunch&) = delete; - cmCTestLaunch& operator=(const cmCTestLaunch&) = delete; - // Run the real command. int Run(); void RunChild(); diff --git a/Source/CTest/cmCTestP4.h b/Source/CTest/cmCTestP4.h index d03f9cb..1889520 100644 --- a/Source/CTest/cmCTestP4.h +++ b/Source/CTest/cmCTestP4.h @@ -34,14 +34,6 @@ private: std::string Name; std::string EMail; std::string AccessTime; - - User() - : UserName() - , Name() - , EMail() - , AccessTime() - { - } }; std::map Users; std::vector P4Options; diff --git a/Source/CTest/cmCTestVC.cxx b/Source/CTest/cmCTestVC.cxx index 9ba6456..d5711c5 100644 --- a/Source/CTest/cmCTestVC.cxx +++ b/Source/CTest/cmCTestVC.cxx @@ -126,7 +126,7 @@ std::string cmCTestVC::GetNightlyTime() snprintf(current_time, sizeof(current_time), "%04d-%02d-%02d %02d:%02d:%02d", t->tm_year + 1900, t->tm_mon + 1, t->tm_mday, t->tm_hour, t->tm_min, t->tm_sec); - return std::string(current_time); + return { current_time }; } void cmCTestVC::Cleanup() diff --git a/Source/CTest/cmCTestVC.h b/Source/CTest/cmCTestVC.h index 9bd7229..7b03d10 100644 --- a/Source/CTest/cmCTestVC.h +++ b/Source/CTest/cmCTestVC.h @@ -95,15 +95,10 @@ protected: /** Represent change to one file. */ struct File { - PathStatus Status; - Revision const* Rev; - Revision const* PriorRev; - File() - : Status(PathUpdated) - , Rev(nullptr) - , PriorRev(nullptr) - { - } + PathStatus Status = PathUpdated; + Revision const* Rev = nullptr; + Revision const* PriorRev = nullptr; + File() = default; File(PathStatus status, Revision const* rev, Revision const* priorRev) : Status(status) , Rev(rev) diff --git a/Source/CTest/cmProcess.h b/Source/CTest/cmProcess.h index 64475c2..be030e4 100644 --- a/Source/CTest/cmProcess.h +++ b/Source/CTest/cmProcess.h @@ -52,9 +52,9 @@ public: }; State GetProcessStatus(); - int GetId() { return this->Id; } + int GetId() const { return this->Id; } void SetId(int id) { this->Id = id; } - int64_t GetExitValue() { return this->ExitValue; } + int64_t GetExitValue() const { return this->ExitValue; } cmDuration GetTotalTime() { return this->TotalTime; } enum class Exception @@ -111,15 +111,11 @@ private: class Buffer : public std::vector { // Half-open index range of partial line already scanned. - size_type First; - size_type Last; + size_type First = 0; + size_type Last = 0; public: - Buffer() - : First(0) - , Last(0) - { - } + Buffer() = default; bool GetLine(std::string& line); bool GetLast(std::string& line); }; diff --git a/Source/cmMessenger.cxx b/Source/cmMessenger.cxx index b898d22..2eead6b 100644 --- a/Source/cmMessenger.cxx +++ b/Source/cmMessenger.cxx @@ -155,19 +155,16 @@ void cmMessenger::IssueMessage(MessageType t, const std::string& text, const cmListFileBacktrace& backtrace) const { bool force = false; - if (!force) { - // override the message type, if needed, for warnings and errors - MessageType override = this->ConvertMessageType(t); - if (override != t) { - t = override; - force = true; - } + // override the message type, if needed, for warnings and errors + MessageType override = this->ConvertMessageType(t); + if (override != t) { + t = override; + force = true; } - if (!force && !this->IsMessageTypeVisible(t)) { - return; + if (force || this->IsMessageTypeVisible(t)) { + this->DisplayMessage(t, text, backtrace); } - this->DisplayMessage(t, text, backtrace); } void cmMessenger::DisplayMessage(MessageType t, const std::string& text, diff --git a/Source/cmXCOFF.cxx b/Source/cmXCOFF.cxx index 890636e..a6d278d 100644 --- a/Source/cmXCOFF.cxx +++ b/Source/cmXCOFF.cxx @@ -61,20 +61,20 @@ namespace { struct XCOFF32 { - typedef struct filehdr filehdr; - typedef struct aouthdr aouthdr; - typedef struct scnhdr scnhdr; - typedef struct ldhdr ldhdr; + using filehdr = struct filehdr; + using aouthdr = struct aouthdr; + using scnhdr = struct scnhdr; + using ldhdr = struct ldhdr; static const std::size_t aouthdr_size = _AOUTHSZ_EXEC; }; const unsigned char xcoff32_magic[] = { 0x01, 0xDF }; struct XCOFF64 { - typedef struct filehdr_64 filehdr; - typedef struct aouthdr_64 aouthdr; - typedef struct scnhdr_64 scnhdr; - typedef struct ldhdr_64 ldhdr; + using filehdr = struct filehdr_64; + using aouthdr = struct aouthdr_64; + using scnhdr = struct scnhdr_64; + using ldhdr = struct ldhdr_64; static const std::size_t aouthdr_size = _AOUTHSZ_EXEC_64; }; const unsigned char xcoff64_magic[] = { 0x01, 0xF7 }; @@ -326,8 +326,8 @@ cmXCOFF::cmXCOFF(const char* fname, Mode mode) cmXCOFF::~cmXCOFF() = default; -cmXCOFF::cmXCOFF(cmXCOFF&&) = default; -cmXCOFF& cmXCOFF::operator=(cmXCOFF&&) = default; +cmXCOFF::cmXCOFF(cmXCOFF&&) noexcept = default; +cmXCOFF& cmXCOFF::operator=(cmXCOFF&&) noexcept = default; bool cmXCOFF::Valid() const { diff --git a/Source/cmXCOFF.h b/Source/cmXCOFF.h index 16cda9d..f6d9d94 100644 --- a/Source/cmXCOFF.h +++ b/Source/cmXCOFF.h @@ -35,9 +35,9 @@ public: /** Destruct. */ ~cmXCOFF(); - cmXCOFF(cmXCOFF&&); + cmXCOFF(cmXCOFF&&) noexcept; cmXCOFF(cmXCOFF const&) = delete; - cmXCOFF& operator=(cmXCOFF&&); + cmXCOFF& operator=(cmXCOFF&&) noexcept; cmXCOFF& operator=(cmXCOFF const&) = delete; /** Get the error message if any. */ -- cgit v0.12