cmMakefile: Remove always-null first parameter to ReadListFile.

This commit is contained in:
Stephen Kelly 2015-04-18 14:50:37 +02:00
parent d21ebcb244
commit 6e23a4bddd
13 changed files with 39 additions and 50 deletions

View File

@ -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())

View File

@ -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: \""

View File

@ -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);

View File

@ -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

View File

@ -1617,7 +1617,7 @@ void cmCTestTestHandler::GetListOfTests()
return;
}
if ( !mf->ReadListFile(0, testFilename) )
if ( !mf->ReadListFile(testFilename) )
{
return;
}

View File

@ -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,

View File

@ -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::vector<std::string>const& 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::vector<std::string>const& 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::vector<std::string>const& 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::vector<std::string>const& 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::vector<std::string>const& 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::vector<std::string>const& 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::vector<std::string>const& 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::vector<std::string>const& 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::vector<std::string>const& 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::vector<std::string>const& 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)

View File

@ -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);

View File

@ -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;

View File

@ -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");

View File

@ -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);

View File

@ -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");

View File

@ -388,7 +388,7 @@ void cmake::ReadListFile(const std::vector<std::string>& 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<std::string>& 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<cmLocalGenerator> 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)