From 6e23a4bdddd2bfee668c682a9ab4081b5e6fcfa2 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sat, 18 Apr 2015 14:50:37 +0200 Subject: cmMakefile: Remove always-null first parameter to ReadListFile. --- Source/CPack/cmCPackGenerator.cxx | 8 ++++---- Source/CPack/cpack.cxx | 6 +++--- Source/CTest/cmCTestLaunch.cxx | 2 +- Source/CTest/cmCTestScriptHandler.cxx | 4 ++-- Source/CTest/cmCTestTestHandler.cxx | 2 +- Source/cmCTest.cxx | 4 ++-- Source/cmGlobalGenerator.cxx | 24 ++++++++++++------------ Source/cmGraphVizWriter.cxx | 2 +- Source/cmLocalUnixMakefileGenerator3.cxx | 4 ++-- Source/cmMakefile.cxx | 22 ++++++---------------- Source/cmMakefile.h | 1 - Source/cmQtAutoGenerators.cxx | 4 ++-- Source/cmake.cxx | 6 +++--- 13 files changed, 39 insertions(+), 50 deletions(-) diff --git a/Source/CPack/cmCPackGenerator.cxx b/Source/CPack/cmCPackGenerator.cxx index a2edab5..2b18c41 100644 --- a/Source/CPack/cmCPackGenerator.cxx +++ b/Source/CPack/cmCPackGenerator.cxx @@ -525,7 +525,7 @@ int cmCPackGenerator::InstallProjectViaInstallScript( tempInstallDirectory.c_str()); this->SetOptionIfNotSet("CMAKE_CURRENT_SOURCE_DIR", tempInstallDirectory.c_str()); - int res = this->MakefileMap->ReadListFile(0, installScript.c_str()); + int res = this->MakefileMap->ReadListFile(installScript.c_str()); if ( cmSystemTools::GetErrorOccuredFlag() || !res ) { return 0; @@ -888,7 +888,7 @@ int cmCPackGenerator::InstallProjectViaInstallCMakeProjects( "1"); } // do installation - int res = mf->ReadListFile(0, installFile.c_str()); + int res = mf->ReadListFile(installFile.c_str()); // forward definition of CMAKE_ABSOLUTE_DESTINATION_FILES // to CPack (may be used by generators like CPack RPM or DEB) // in order to transparently handle ABSOLUTE PATH @@ -980,7 +980,7 @@ bool cmCPackGenerator::ReadListFile(const char* moduleName) { bool retval; std::string fullPath = this->MakefileMap->GetModulesFile(moduleName); - retval = this->MakefileMap->ReadListFile(0, fullPath.c_str()); + retval = this->MakefileMap->ReadListFile(fullPath.c_str()); // include FATAL_ERROR and ERROR in the return status retval = retval && (! cmSystemTools::GetErrorOccuredFlag()); return retval; @@ -1163,7 +1163,7 @@ int cmCPackGenerator::Initialize(const std::string& name, cmMakefile* mf) this->GetOption("CPACK_PROJECT_CONFIG_FILE"); if(config) { - mf->ReadListFile(0, config); + mf->ReadListFile(config); } int result = this->InitializeInternal(); if (cmSystemTools::GetErrorOccuredFlag()) diff --git a/Source/CPack/cpack.cxx b/Source/CPack/cpack.cxx index a9cabf1..2752270 100644 --- a/Source/CPack/cpack.cxx +++ b/Source/CPack/cpack.cxx @@ -244,7 +244,7 @@ int main (int argc, char const* const* argv) // paths, so FIND_XXX() commands can be used in scripts std::string systemFile = globalMF->GetModulesFile("CMakeDetermineSystem.cmake"); - if (!globalMF->ReadListFile(0, systemFile.c_str())) + if (!globalMF->ReadListFile(systemFile.c_str())) { cmCPack_Log(&log, cmCPackLog::LOG_ERROR, "Error reading CMakeDetermineSystem.cmake" << std::endl); @@ -253,7 +253,7 @@ int main (int argc, char const* const* argv) systemFile = globalMF->GetModulesFile("CMakeSystemSpecificInformation.cmake"); - if (!globalMF->ReadListFile(0, systemFile.c_str())) + if (!globalMF->ReadListFile(systemFile.c_str())) { cmCPack_Log(&log, cmCPackLog::LOG_ERROR, "Error reading CMakeSystemSpecificInformation.cmake" << std::endl); @@ -272,7 +272,7 @@ int main (int argc, char const* const* argv) cmCPack_Log(&log, cmCPackLog::LOG_VERBOSE, "Read CPack configuration file: " << cpackConfigFile << std::endl); - if ( !globalMF->ReadListFile(0, cpackConfigFile.c_str()) ) + if ( !globalMF->ReadListFile(cpackConfigFile.c_str()) ) { cmCPack_Log(&log, cmCPackLog::LOG_ERROR, "Problem reading CPack config file: \"" diff --git a/Source/CTest/cmCTestLaunch.cxx b/Source/CTest/cmCTestLaunch.cxx index 62fa2be..de6ecde 100644 --- a/Source/CTest/cmCTestLaunch.cxx +++ b/Source/CTest/cmCTestLaunch.cxx @@ -757,7 +757,7 @@ void cmCTestLaunch::LoadConfig() std::string fname = this->LogDir; fname += "CTestLaunchConfig.cmake"; if(cmSystemTools::FileExists(fname.c_str()) && - mf->ReadListFile(0, fname.c_str())) + mf->ReadListFile(fname.c_str())) { this->SourceDir = mf->GetSafeDefinition("CTEST_SOURCE_DIRECTORY"); cmSystemTools::ConvertToUnixSlashes(this->SourceDir); diff --git a/Source/CTest/cmCTestScriptHandler.cxx b/Source/CTest/cmCTestScriptHandler.cxx index 783941b..7f9825c 100644 --- a/Source/CTest/cmCTestScriptHandler.cxx +++ b/Source/CTest/cmCTestScriptHandler.cxx @@ -433,7 +433,7 @@ int cmCTestScriptHandler::ReadInScript(const std::string& total_script_arg) ctest scripting easier. */ std::string systemFile = this->Makefile->GetModulesFile("CTestScriptMode.cmake"); - if (!this->Makefile->ReadListFile(0, systemFile.c_str()) || + if (!this->Makefile->ReadListFile(systemFile.c_str()) || cmSystemTools::GetErrorOccuredFlag()) { cmCTestLog(this->CTest, ERROR_MESSAGE, "Error in read:" @@ -451,7 +451,7 @@ int cmCTestScriptHandler::ReadInScript(const std::string& total_script_arg) } // finally read in the script - if (!this->Makefile->ReadListFile(0, script.c_str()) || + if (!this->Makefile->ReadListFile(script.c_str()) || cmSystemTools::GetErrorOccuredFlag()) { // Reset the error flag so that it can run more than diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx index 59c5e92..d778253 100644 --- a/Source/CTest/cmCTestTestHandler.cxx +++ b/Source/CTest/cmCTestTestHandler.cxx @@ -1617,7 +1617,7 @@ void cmCTestTestHandler::GetListOfTests() return; } - if ( !mf->ReadListFile(0, testFilename) ) + if ( !mf->ReadListFile(testFilename) ) { return; } diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx index 91ae889..3697aa4 100644 --- a/Source/cmCTest.cxx +++ b/Source/cmCTest.cxx @@ -2576,7 +2576,7 @@ int cmCTest::ReadCustomConfigurationFileTree(const char* dir, cmMakefile* mf) bool erroroc = cmSystemTools::GetErrorOccuredFlag(); cmSystemTools::ResetErrorOccuredFlag(); - if ( !mf->ReadListFile(0, fname.c_str()) || + if ( !mf->ReadListFile(fname.c_str()) || cmSystemTools::GetErrorOccuredFlag() ) { cmCTestLog(this, ERROR_MESSAGE, @@ -2606,7 +2606,7 @@ int cmCTest::ReadCustomConfigurationFileTree(const char* dir, cmMakefile* mf) { cmCTestLog(this, DEBUG, "* Read custom CTest configuration file: " << *fileIt << std::endl); - if ( !mf->ReadListFile(0, fileIt->c_str()) || + if ( !mf->ReadListFile(fileIt->c_str()) || cmSystemTools::GetErrorOccuredFlag() ) { cmCTestLog(this, ERROR_MESSAGE, diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index ab044c1..4a9f628 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -278,7 +278,7 @@ void cmGlobalGenerator::FindMakeProgram(cmMakefile* mf) mf->GetModulesFile(this->FindMakeProgramFile.c_str()); if(!setMakeProgram.empty()) { - mf->ReadListFile(0, setMakeProgram.c_str()); + mf->ReadListFile(setMakeProgram.c_str()); } } if(!mf->GetDefinition("CMAKE_MAKE_PROGRAM") @@ -428,7 +428,7 @@ cmGlobalGenerator::EnableLanguage(std::vectorconst& languages, fpath += "/CMakeSystem.cmake"; if(cmSystemTools::FileExists(fpath.c_str())) { - mf->ReadListFile(0,fpath.c_str()); + mf->ReadListFile(fpath.c_str()); } } // Load the CMakeDetermineSystem.cmake file and find out @@ -456,12 +456,12 @@ cmGlobalGenerator::EnableLanguage(std::vectorconst& languages, #endif // Read the DetermineSystem file std::string systemFile = mf->GetModulesFile("CMakeDetermineSystem.cmake"); - mf->ReadListFile(0, systemFile.c_str()); + mf->ReadListFile(systemFile.c_str()); // load the CMakeSystem.cmake from the binary directory // this file is configured by the CMakeDetermineSystem.cmake file fpath = rootBin; fpath += "/CMakeSystem.cmake"; - mf->ReadListFile(0,fpath.c_str()); + mf->ReadListFile(fpath.c_str()); } if(readCMakeSystem) @@ -495,7 +495,7 @@ cmGlobalGenerator::EnableLanguage(std::vectorconst& languages, if (!mf->GetDefinition("CMAKE_SYSTEM_SPECIFIC_INITIALIZE_LOADED")) { fpath = mf->GetModulesFile("CMakeSystemSpecificInitialize.cmake"); - if(!mf->ReadListFile(0,fpath.c_str())) + if(!mf->ReadListFile(fpath.c_str())) { cmSystemTools::Error("Could not find cmake module file: " "CMakeSystemSpecificInitialize.cmake"); @@ -533,7 +533,7 @@ cmGlobalGenerator::EnableLanguage(std::vectorconst& languages, // to avoid duplicate compiler tests. if(cmSystemTools::FileExists(fpath.c_str())) { - if(!mf->ReadListFile(0,fpath.c_str())) + if(!mf->ReadListFile(fpath.c_str())) { cmSystemTools::Error("Could not find cmake module file: ", fpath.c_str()); @@ -563,7 +563,7 @@ cmGlobalGenerator::EnableLanguage(std::vectorconst& languages, determineCompiler += "Compiler.cmake"; std::string determineFile = mf->GetModulesFile(determineCompiler.c_str()); - if(!mf->ReadListFile(0,determineFile.c_str())) + if(!mf->ReadListFile(determineFile.c_str())) { cmSystemTools::Error("Could not find cmake module file: ", determineCompiler.c_str()); @@ -597,7 +597,7 @@ cmGlobalGenerator::EnableLanguage(std::vectorconst& languages, fpath += "/CMake"; fpath += lang; fpath += "Compiler.cmake"; - if(!mf->ReadListFile(0,fpath.c_str())) + if(!mf->ReadListFile(fpath.c_str())) { cmSystemTools::Error("Could not find cmake module file: ", fpath.c_str()); @@ -616,7 +616,7 @@ cmGlobalGenerator::EnableLanguage(std::vectorconst& languages, if (!mf->GetDefinition("CMAKE_SYSTEM_SPECIFIC_INFORMATION_LOADED")) { fpath = mf->GetModulesFile("CMakeSystemSpecificInformation.cmake"); - if(!mf->ReadListFile(0,fpath.c_str())) + if(!mf->ReadListFile(fpath.c_str())) { cmSystemTools::Error("Could not find cmake module file: " "CMakeSystemSpecificInformation.cmake"); @@ -707,7 +707,7 @@ cmGlobalGenerator::EnableLanguage(std::vectorconst& languages, cmSystemTools::Error("Could not find cmake module file: ", fpath.c_str()); } - else if(!mf->ReadListFile(0, informationFile.c_str())) + else if(!mf->ReadListFile(informationFile.c_str())) { cmSystemTools::Error("Could not process cmake module file: ", informationFile.c_str()); @@ -732,7 +732,7 @@ cmGlobalGenerator::EnableLanguage(std::vectorconst& languages, testLang += lang; testLang += "Compiler.cmake"; std::string ifpath = mf->GetModulesFile(testLang.c_str()); - if(!mf->ReadListFile(0,ifpath.c_str())) + if(!mf->ReadListFile(ifpath.c_str())) { cmSystemTools::Error("Could not find cmake module file: ", testLang.c_str()); @@ -777,7 +777,7 @@ cmGlobalGenerator::EnableLanguage(std::vectorconst& languages, projectCompatibility += "Compatibility.cmake"; if(cmSystemTools::FileExists(projectCompatibility.c_str())) { - mf->ReadListFile(0,projectCompatibility.c_str()); + mf->ReadListFile(projectCompatibility.c_str()); } // Inform any extra generator of the new language. if (this->ExtraGenerator) diff --git a/Source/cmGraphVizWriter.cxx b/Source/cmGraphVizWriter.cxx index af88d1c..99542a9 100644 --- a/Source/cmGraphVizWriter.cxx +++ b/Source/cmGraphVizWriter.cxx @@ -81,7 +81,7 @@ void cmGraphVizWriter::ReadSettings(const char* settingsFileName, } } - if ( !mf->ReadListFile(0, inFileName) ) + if ( !mf->ReadListFile(inFileName) ) { cmSystemTools::Error("Problem opening GraphViz options file: ", inFileName); diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index 8938e67..153ed09 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -1475,7 +1475,7 @@ bool cmLocalUnixMakefileGenerator3::UpdateDependencies(const char* tgtInfo, bool color) { // read in the target info file - if(!this->Makefile->ReadListFile(0, tgtInfo) || + if(!this->Makefile->ReadListFile(tgtInfo) || cmSystemTools::GetErrorOccuredFlag()) { cmSystemTools::Error("Target DependInfo.cmake file not found"); @@ -1592,7 +1592,7 @@ cmLocalUnixMakefileGenerator3 std::string dirInfoFile = this->Makefile->GetStartOutputDirectory(); dirInfoFile += cmake::GetCMakeFilesDirectory(); dirInfoFile += "/CMakeDirectoryInformation.cmake"; - if(mf->ReadListFile(0, dirInfoFile.c_str()) && + if(mf->ReadListFile(dirInfoFile.c_str()) && !cmSystemTools::GetErrorOccuredFlag()) { haveDirectoryInfo = true; diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 51f9a57..7790b8a 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -526,7 +526,7 @@ bool cmMakefile::ProcessBuildsystemFile(const char* listfile) { this->AddDefinition("CMAKE_PARENT_LIST_FILE", listfile); this->cmCurrentListFile = listfile; - return this->ReadListFile(0, listfile, true, + return this->ReadListFile(listfile, true, this->cmStartDirectory == this->cmHomeDirectory); } @@ -536,30 +536,20 @@ bool cmMakefile::ReadDependentFile(const char* listfile, bool noPolicyScope) this->cmCurrentListFile = cmSystemTools::CollapseFullPath(listfile, this->cmStartDirectory.c_str()); - return this->ReadListFile(0, this->cmCurrentListFile.c_str(), + return this->ReadListFile(this->cmCurrentListFile.c_str(), noPolicyScope); } //---------------------------------------------------------------------------- // Parse the given CMakeLists.txt file executing all commands // -bool cmMakefile::ReadListFile(const char* filename_in, - const char *external_in, +bool cmMakefile::ReadListFile(const char* listfile, bool noPolicyScope, bool requireProjectCommand) { - std::string filenametoread; - if (filename_in) - { - filenametoread = filename_in; - } - - if (external_in) - { - filenametoread = - cmSystemTools::CollapseFullPath(external_in, - this->cmStartDirectory.c_str()); - } + std::string filenametoread = + cmSystemTools::CollapseFullPath(listfile, + this->cmStartDirectory.c_str()); std::string currentParentFile = this->GetSafeDefinition("CMAKE_PARENT_LIST_FILE"); diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index 2664d8e..73d6910 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -86,7 +86,6 @@ public: * Read and parse a CMakeLists.txt file. */ bool ReadListFile(const char* listfile, - const char* external= 0, bool noPolicyScope = true, bool requireProjectCommand = false); diff --git a/Source/cmQtAutoGenerators.cxx b/Source/cmQtAutoGenerators.cxx index d49e997..3d5103f 100644 --- a/Source/cmQtAutoGenerators.cxx +++ b/Source/cmQtAutoGenerators.cxx @@ -1243,7 +1243,7 @@ bool cmQtAutoGenerators::ReadAutogenInfoFile(cmMakefile* makefile, cmSystemTools::ConvertToUnixSlashes(filename); filename += "/AutogenInfo.cmake"; - if (!makefile->ReadListFile(0, filename.c_str())) + if (!makefile->ReadListFile(filename.c_str())) { cmSystemTools::Error("Error processing file: ", filename.c_str()); return false; @@ -1413,7 +1413,7 @@ bool cmQtAutoGenerators::ReadOldMocDefinitionsFile(cmMakefile* makefile, cmSystemTools::ConvertToUnixSlashes(filename); filename += "/AutomocOldMocDefinitions.cmake"; - if (makefile->ReadListFile(0, filename.c_str())) + if (makefile->ReadListFile(filename.c_str())) { this->OldCompileSettingsStr = makefile->GetSafeDefinition("AM_OLD_COMPILE_SETTINGS"); diff --git a/Source/cmake.cxx b/Source/cmake.cxx index a542a24..c4f7c4e 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -388,7 +388,7 @@ void cmake::ReadListFile(const std::vector& args, lg->GetMakefile()->SetArgcArgv(args); } - if (!lg->GetMakefile()->ReadListFile(0, path)) + if (!lg->GetMakefile()->ReadListFile(path)) { cmSystemTools::Error("Error processing file: ", path); } @@ -424,7 +424,7 @@ bool cmake::FindPackage(const std::vector& args) mf->SetArgcArgv(args); std::string systemFile = mf->GetModulesFile("CMakeFindPackageMode.cmake"); - mf->ReadListFile(0, systemFile.c_str()); + mf->ReadListFile(systemFile.c_str()); std::string language = mf->GetSafeDefinition("LANGUAGE"); std::string mode = mf->GetSafeDefinition("MODE"); @@ -1965,7 +1965,7 @@ int cmake::CheckBuildSystem() gg.SetCMakeInstance(&cm); cmsys::auto_ptr lg(gg.CreateLocalGenerator()); cmMakefile* mf = lg->GetMakefile(); - if(!mf->ReadListFile(0, this->CheckBuildSystemArgument.c_str()) || + if(!mf->ReadListFile(this->CheckBuildSystemArgument.c_str()) || cmSystemTools::GetErrorOccuredFlag()) { if(verbose) -- cgit v0.12