diff options
author | DongHun Kwak <dh0128.kwak@samsung.com> | 2021-10-08 09:13:08 +0900 |
---|---|---|
committer | DongHun Kwak <dh0128.kwak@samsung.com> | 2021-10-08 09:13:08 +0900 |
commit | 488e9638b71b8b9cdb3055835815d77720eae06b (patch) | |
tree | f023cbc75da671dd2b75d3143cde8a066d5a93aa /Source/cmLoadCommandCommand.cxx | |
parent | f152fd464ac355590a5bb95451d4cd1ca1079d3c (diff) | |
download | cmake-488e9638b71b8b9cdb3055835815d77720eae06b.tar.gz cmake-488e9638b71b8b9cdb3055835815d77720eae06b.tar.bz2 cmake-488e9638b71b8b9cdb3055835815d77720eae06b.zip |
Imported Upstream version 3.10.0upstream/3.10.0
Diffstat (limited to 'Source/cmLoadCommandCommand.cxx')
-rw-r--r-- | Source/cmLoadCommandCommand.cxx | 40 |
1 files changed, 19 insertions, 21 deletions
diff --git a/Source/cmLoadCommandCommand.cxx b/Source/cmLoadCommandCommand.cxx index 92a32a147..6bfac172f 100644 --- a/Source/cmLoadCommandCommand.cxx +++ b/Source/cmLoadCommandCommand.cxx @@ -34,12 +34,12 @@ public: } ///! clean up any memory allocated by the plugin - ~cmLoadedCommand() CM_OVERRIDE; + ~cmLoadedCommand() override; /** * This is a virtual constructor for the command. */ - cmCommand* Clone() CM_OVERRIDE + cmCommand* Clone() override { cmLoadedCommand* newC = new cmLoadedCommand; // we must copy when we clone @@ -52,7 +52,7 @@ public: * the CMakeLists.txt file. */ bool InitialPass(std::vector<std::string> const& args, - cmExecutionStatus&) CM_OVERRIDE; + cmExecutionStatus&) override; /** * This is called at the end after all the information @@ -60,10 +60,10 @@ public: * not implement this method. At this point, reading and * writing to the cache can be done. */ - void FinalPass() CM_OVERRIDE; - bool HasFinalPass() const CM_OVERRIDE + void FinalPass() override; + bool HasFinalPass() const override { - return this->info.FinalPass != CM_NULLPTR; + return this->info.FinalPass != nullptr; } static const char* LastName; @@ -86,11 +86,11 @@ public: #endif signal(SIGILL, TrapsForSignalsCFunction); } else { - signal(SIGSEGV, CM_NULLPTR); + signal(SIGSEGV, nullptr); #ifdef SIGBUS - signal(SIGBUS, CM_NULLPTR); + signal(SIGBUS, nullptr); #endif - signal(SIGILL, CM_NULLPTR); + signal(SIGILL, nullptr); } } @@ -102,7 +102,7 @@ extern "C" void TrapsForSignalsCFunction(int sig) cmLoadedCommand::TrapsForSignals(sig); } -const char* cmLoadedCommand::LastName = CM_NULLPTR; +const char* cmLoadedCommand::LastName = nullptr; bool cmLoadedCommand::InitialPass(std::vector<std::string> const& args, cmExecutionStatus&) @@ -118,17 +118,16 @@ bool cmLoadedCommand::InitialPass(std::vector<std::string> const& args, // create argc and argv and then invoke the command int argc = static_cast<int>(args.size()); - char** argv = CM_NULLPTR; + char** argv = nullptr; if (argc) { - argv = (char**)malloc(argc * sizeof(char*)); + argv = static_cast<char**>(malloc(argc * sizeof(char*))); } int i; for (i = 0; i < argc; ++i) { argv[i] = strdup(args[i].c_str()); } cmLoadedCommand::InstallSignalHandlers(info.Name); - int result = - info.InitialPass((void*)&info, (void*)this->Makefile, argc, argv); + int result = info.InitialPass(&info, this->Makefile, argc, argv); cmLoadedCommand::InstallSignalHandlers(info.Name, 1); cmFreeArguments(argc, argv); @@ -147,7 +146,7 @@ void cmLoadedCommand::FinalPass() { if (this->info.FinalPass) { cmLoadedCommand::InstallSignalHandlers(info.Name); - this->info.FinalPass((void*)&this->info, (void*)this->Makefile); + this->info.FinalPass(&this->info, this->Makefile); cmLoadedCommand::InstallSignalHandlers(info.Name, 1); } } @@ -156,7 +155,7 @@ cmLoadedCommand::~cmLoadedCommand() { if (this->info.Destructor) { cmLoadedCommand::InstallSignalHandlers(info.Name); - this->info.Destructor((void*)&this->info); + this->info.Destructor(&this->info); cmLoadedCommand::InstallSignalHandlers(info.Name, 1); } if (this->info.Error) { @@ -198,7 +197,7 @@ bool cmLoadCommandCommand::InitialPass(std::vector<std::string> const& args, // Try to find the program. std::string fullPath = cmSystemTools::FindFile(moduleName, path); - if (fullPath == "") { + if (fullPath.empty()) { std::ostringstream e; e << "Attempt to load command failed from file \"" << moduleName << "\""; this->SetError(e.str()); @@ -225,14 +224,13 @@ bool cmLoadCommandCommand::InitialPass(std::vector<std::string> const& args, // find the init function std::string initFuncName = args[0] + "Init"; - CM_INIT_FUNCTION initFunction = - (CM_INIT_FUNCTION)cmsys::DynamicLoader::GetSymbolAddress(lib, - initFuncName); + CM_INIT_FUNCTION initFunction = reinterpret_cast<CM_INIT_FUNCTION>( + cmsys::DynamicLoader::GetSymbolAddress(lib, initFuncName)); if (!initFunction) { initFuncName = "_"; initFuncName += args[0]; initFuncName += "Init"; - initFunction = (CM_INIT_FUNCTION)( + initFunction = reinterpret_cast<CM_INIT_FUNCTION>( cmsys::DynamicLoader::GetSymbolAddress(lib, initFuncName)); } // if the symbol is found call it to set the name on the |