From a5eeb0310db04aa661dec37f7cc1073e058f3acf Mon Sep 17 00:00:00 2001 From: Regina Pfeifer Date: Mon, 18 Mar 2019 22:25:50 +0100 Subject: cmCTest: Cleanup typedefs --- Source/CTest/cmCTestSubmitCommand.cxx | 10 ++-------- Source/CTest/cmCTestSubmitCommand.h | 2 +- Source/CTest/cmCTestSubmitHandler.cxx | 2 +- Source/CTest/cmCTestSubmitHandler.h | 4 ++-- Source/CTest/cmCTestUploadCommand.h | 6 ++---- Source/CTest/cmCTestUploadHandler.cxx | 3 ++- Source/CTest/cmCTestUploadHandler.h | 9 +++++---- Source/cmCTest.cxx | 36 +++++++++++------------------------ Source/cmCTest.h | 11 ++++------- 9 files changed, 30 insertions(+), 53 deletions(-) diff --git a/Source/CTest/cmCTestSubmitCommand.cxx b/Source/CTest/cmCTestSubmitCommand.cxx index a3aa7aa..e31d982 100644 --- a/Source/CTest/cmCTestSubmitCommand.cxx +++ b/Source/CTest/cmCTestSubmitCommand.cxx @@ -41,22 +41,16 @@ cmCTestGenericHandler* cmCTestSubmitCommand::InitializeHandler() this->Makefile->GetDefinition("CTEST_NOTES_FILES"); if (notesFilesVariable) { std::vector notesFiles; - cmCTest::VectorOfStrings newNotesFiles; cmSystemTools::ExpandListArgument(notesFilesVariable, notesFiles); - newNotesFiles.insert(newNotesFiles.end(), notesFiles.begin(), - notesFiles.end()); - this->CTest->GenerateNotesFile(newNotesFiles); + this->CTest->GenerateNotesFile(notesFiles); } const char* extraFilesVariable = this->Makefile->GetDefinition("CTEST_EXTRA_SUBMIT_FILES"); if (extraFilesVariable) { std::vector extraFiles; - cmCTest::VectorOfStrings newExtraFiles; cmSystemTools::ExpandListArgument(extraFilesVariable, extraFiles); - newExtraFiles.insert(newExtraFiles.end(), extraFiles.begin(), - extraFiles.end()); - if (!this->CTest->SubmitExtraFiles(newExtraFiles)) { + if (!this->CTest->SubmitExtraFiles(extraFiles)) { this->SetError("problem submitting extra files."); return nullptr; } diff --git a/Source/CTest/cmCTestSubmitCommand.h b/Source/CTest/cmCTestSubmitCommand.h index 0caccd6..4b1bb26 100644 --- a/Source/CTest/cmCTestSubmitCommand.h +++ b/Source/CTest/cmCTestSubmitCommand.h @@ -79,7 +79,7 @@ protected: std::set Parts; bool FilesMentioned; bool InternalTest; - cmCTest::SetOfStrings Files; + std::set Files; std::string RetryCount; std::string RetryDelay; bool CDashUpload; diff --git a/Source/CTest/cmCTestSubmitHandler.cxx b/Source/CTest/cmCTestSubmitHandler.cxx index c3f7fb4..2b54365 100644 --- a/Source/CTest/cmCTestSubmitHandler.cxx +++ b/Source/CTest/cmCTestSubmitHandler.cxx @@ -900,7 +900,7 @@ void cmCTestSubmitHandler::SelectParts(std::set const& parts) } } -void cmCTestSubmitHandler::SelectFiles(cmCTest::SetOfStrings const& files) +void cmCTestSubmitHandler::SelectFiles(std::set const& files) { this->Files.insert(files.begin(), files.end()); } diff --git a/Source/CTest/cmCTestSubmitHandler.h b/Source/CTest/cmCTestSubmitHandler.h index 58f4f97..e0fed10 100644 --- a/Source/CTest/cmCTestSubmitHandler.h +++ b/Source/CTest/cmCTestSubmitHandler.h @@ -38,7 +38,7 @@ public: void SelectParts(std::set const& parts); /** Specify a set of files to submit. */ - void SelectFiles(cmCTest::SetOfStrings const& files); + void SelectFiles(std::set const& files); // handle the cdash file upload protocol int HandleCDashUploadFile(std::string const& file, std::string const& type); @@ -74,7 +74,7 @@ private: bool SubmitPart[cmCTest::PartCount]; bool HasWarnings; bool HasErrors; - cmCTest::SetOfStrings Files; + std::set Files; std::vector HttpHeaders; }; diff --git a/Source/CTest/cmCTestUploadCommand.h b/Source/CTest/cmCTestUploadCommand.h index 61bf1cc..0d3b06e 100644 --- a/Source/CTest/cmCTestUploadCommand.h +++ b/Source/CTest/cmCTestUploadCommand.h @@ -5,9 +5,9 @@ #include "cmConfigure.h" // IWYU pragma: keep -#include "cmCTest.h" #include "cmCTestHandlerCommand.h" +#include #include class cmCTestGenericHandler; @@ -22,8 +22,6 @@ class cmCommand; class cmCTestUploadCommand : public cmCTestHandlerCommand { public: - cmCTestUploadCommand() {} - /** * This is a virtual constructor for the command. */ @@ -55,7 +53,7 @@ protected: ArgumentDoingLast2 }; - cmCTest::SetOfStrings Files; + std::set Files; }; #endif diff --git a/Source/CTest/cmCTestUploadHandler.cxx b/Source/CTest/cmCTestUploadHandler.cxx index 261ecab..ee9ee91 100644 --- a/Source/CTest/cmCTestUploadHandler.cxx +++ b/Source/CTest/cmCTestUploadHandler.cxx @@ -2,6 +2,7 @@ file Copyright.txt or https://cmake.org/licensing for details. */ #include "cmCTestUploadHandler.h" +#include "cmCTest.h" #include "cmGeneratedFileStream.h" #include "cmVersion.h" #include "cmXMLWriter.h" @@ -20,7 +21,7 @@ void cmCTestUploadHandler::Initialize() this->Files.clear(); } -void cmCTestUploadHandler::SetFiles(const cmCTest::SetOfStrings& files) +void cmCTestUploadHandler::SetFiles(std::set const& files) { this->Files = files; } diff --git a/Source/CTest/cmCTestUploadHandler.h b/Source/CTest/cmCTestUploadHandler.h index ff50574..4d8fab4 100644 --- a/Source/CTest/cmCTestUploadHandler.h +++ b/Source/CTest/cmCTestUploadHandler.h @@ -5,9 +5,11 @@ #include "cmConfigure.h" // IWYU pragma: keep -#include "cmCTest.h" #include "cmCTestGenericHandler.h" +#include +#include + /** \class cmCTestUploadHandler * \brief Helper class for CTest * @@ -20,7 +22,6 @@ public: typedef cmCTestGenericHandler Superclass; cmCTestUploadHandler(); - ~cmCTestUploadHandler() override {} /* * The main entry point for this class @@ -30,10 +31,10 @@ public: void Initialize() override; /** Specify a set of files to submit. */ - void SetFiles(cmCTest::SetOfStrings const& files); + void SetFiles(std::set const& files); private: - cmCTest::SetOfStrings Files; + std::set Files; }; #endif diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx index 91219d0..569e6dd 100644 --- a/Source/cmCTest.cxx +++ b/Source/cmCTest.cxx @@ -62,13 +62,6 @@ # include /* disable_debugger() API. */ #endif -#define DEBUGOUT \ - std::cout << __LINE__ << " "; \ - std::cout -#define DEBUGERR \ - std::cerr << __LINE__ << " "; \ - std::cerr - struct cmCTest::Private { /** Representation of one part. */ @@ -147,18 +140,15 @@ struct cmCTest::Private bool OutputAsJson = false; int OutputAsJsonVersion = 1; - /** Map of configuration properties */ - typedef std::map CTestConfigurationMap; - // TODO: The ctest configuration should be a hierarchy of // configuration option sources: command-line, script, ini file. // Then the ini file can get re-loaded whenever it changes without // affecting any higher-precedence settings. - CTestConfigurationMap CTestConfiguration; - CTestConfigurationMap CTestConfigurationOverwrites; + std::map CTestConfiguration; + std::map CTestConfigurationOverwrites; + PartInfo Parts[PartCount]; - typedef std::map PartMapType; - PartMapType PartMap; + std::map PartMap; std::string CurrentTag; bool TomorrowTag = false; @@ -1601,7 +1591,7 @@ void cmCTest::EndXML(cmXMLWriter& xml) } int cmCTest::GenerateCTestNotesOutput(cmXMLWriter& xml, - const cmCTest::VectorOfStrings& files) + std::vector const& files) { std::string buildname = cmCTest::SafeBuildIdField(this->GetCTestConfiguration("BuildName")); @@ -1651,7 +1641,7 @@ int cmCTest::GenerateCTestNotesOutput(cmXMLWriter& xml, return 1; } -int cmCTest::GenerateNotesFile(const VectorOfStrings& files) +int cmCTest::GenerateNotesFile(std::vector const& files) { cmGeneratedFileStream ofs; if (!this->OpenOutputFile(this->Impl->CurrentTag, "Notes.xml", ofs)) { @@ -1669,11 +1659,10 @@ int cmCTest::GenerateNotesFile(const char* cfiles) return 1; } - VectorOfStrings files; - cmCTestLog(this, OUTPUT, "Create notes file" << std::endl); - files = cmSystemTools::SplitString(cfiles, ';'); + std::vector const files = + cmSystemTools::SplitString(cfiles, ';'); if (files.empty()) { return 1; } @@ -1740,7 +1729,7 @@ std::string cmCTest::Base64EncodeFile(std::string const& file) return std::string(&encoded_buffer[0], rlen); } -bool cmCTest::SubmitExtraFiles(const VectorOfStrings& files) +bool cmCTest::SubmitExtraFiles(std::vector const& files) { for (std::string const& file : files) { if (!cmSystemTools::FileExists(file)) { @@ -1760,11 +1749,10 @@ bool cmCTest::SubmitExtraFiles(const char* cfiles) return true; } - VectorOfStrings files; - cmCTestLog(this, OUTPUT, "Submit extra files" << std::endl); - files = cmSystemTools::SplitString(cfiles, ';'); + std::vector const files = + cmSystemTools::SplitString(cfiles, ';'); if (files.empty()) { return true; } @@ -2594,8 +2582,6 @@ void cmCTest::SetScheduleType(std::string const& type) int cmCTest::ReadCustomConfigurationFileTree(const char* dir, cmMakefile* mf) { bool found = false; - VectorOfStrings dirs; - VectorOfStrings ndirs; cmCTestLog(this, DEBUG, "* Read custom CTest configuration directory: " << dir << std::endl); diff --git a/Source/cmCTest.h b/Source/cmCTest.h index d9f7ee0..5f49cbc 100644 --- a/Source/cmCTest.h +++ b/Source/cmCTest.h @@ -11,7 +11,6 @@ #include #include #include // IWYU pragma: keep -#include #include #include #include @@ -81,9 +80,6 @@ public: if the string does not name a valid part. */ Part GetPartFromName(const char* name); - typedef std::vector VectorOfStrings; - typedef std::set SetOfStrings; - /** Process Command line arguments */ int Run(std::vector&, std::string* output = nullptr); @@ -365,14 +361,14 @@ public: void AddCTestConfigurationOverwrite(const std::string& encstr); /** Create XML file that contains all the notes specified */ - int GenerateNotesFile(const VectorOfStrings& files); + int GenerateNotesFile(std::vector const& files); /** Create XML file to indicate that build is complete */ int GenerateDoneFile(); /** Submit extra files to the server */ bool SubmitExtraFiles(const char* files); - bool SubmitExtraFiles(const VectorOfStrings& files); + bool SubmitExtraFiles(std::vector const& files); /** Set the output log file name */ void SetOutputLogFileName(const char* name); @@ -511,7 +507,8 @@ private: bool UpdateCTestConfiguration(); /** Create note from files. */ - int GenerateCTestNotesOutput(cmXMLWriter& xml, const VectorOfStrings& files); + int GenerateCTestNotesOutput(cmXMLWriter& xml, + std::vector const& files); /** Check if the argument is the one specified */ bool CheckArgument(const std::string& arg, const char* varg1, -- cgit v0.12