From 1381aab4b7c3f6149d87a673e2bd754e7eed4ac5 Mon Sep 17 00:00:00 2001 From: Brad King Date: Wed, 30 Apr 2008 13:42:40 -0400 Subject: BUG: Remove check for files written by file(WRITE) being loaded. - CMake 1.8 and below did not do the check but could get in infinite loops due to the local generate step. - CMake 2.0 added the check but failed to perform it in directories with no targets (see bug #678). - CMake 2.2 removed the local generate which fixed the problem but did not remove the check. - Between CMake 2.4 and 2.6.0rc6 the check was fixed to work even when no targets appear in a directory (see bug #6923). - Bottom line: the check is no longer needed. --- Source/cmFileCommand.cxx | 1 - Source/cmFileCommand.h | 4 ---- Source/cmGlobalGenerator.cxx | 1 - Source/cmMakefile.cxx | 27 --------------------------- Source/cmMakefile.h | 12 ------------ Source/cmWriteFileCommand.cxx | 1 - Source/cmake.cxx | 17 ----------------- Source/cmake.h | 6 ------ 8 files changed, 69 deletions(-) diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx index 3cf6c0b..d6c6f56 100644 --- a/Source/cmFileCommand.cxx +++ b/Source/cmFileCommand.cxx @@ -213,7 +213,6 @@ bool cmFileCommand::HandleWriteCommand(std::vector const& args, file << message; file.close(); cmSystemTools::SetPermissions(fileName.c_str(), mode); - this->Makefile->AddWrittenFile(fileName.c_str()); return true; } diff --git a/Source/cmFileCommand.h b/Source/cmFileCommand.h index 3f72cd2..4173859 100644 --- a/Source/cmFileCommand.h +++ b/Source/cmFileCommand.h @@ -90,10 +90,6 @@ public: "if it does not exist.\n" "APPEND will write a message into a file same as WRITE, except " "it will append it to the end of the file\n" - "NOTE: When using file WRITE and file APPEND, the produced file " - "cannot be used as an input to CMake (configure_file, source file ...) " - "because it will lead to an infinite loop. Use configure_file if you " - "want to generate input files to CMake.\n" "READ will read the content of a file and store it into the " "variable. It will start at the given offset and read up to numBytes. " "If the argument HEX is given, the binary data will be converted to " diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index cf9d0a9..b589332 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -912,7 +912,6 @@ void cmGlobalGenerator::CheckLocalGenerators() } this->CMakeInstance->UpdateProgress ("Configuring", 0.9f+0.1f*(i+1.0f)/this->LocalGenerators.size()); - this->LocalGenerators[i]->GetMakefile()->CheckInfiniteLoops(); } if(notFoundMap.size()) diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 4cd9d0a..bc60955 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -2796,33 +2796,6 @@ int cmMakefile::ConfigureFile(const char* infile, const char* outfile, return res; } -void cmMakefile::AddWrittenFile(const char* file) -{ this->GetCMakeInstance()->AddWrittenFile(file); } - -bool cmMakefile::HasWrittenFile(const char* file) -{ return this->GetCMakeInstance()->HasWrittenFile(file); } - -bool cmMakefile::CheckInfiniteLoops() -{ - std::vector::iterator it; - for ( it = this->ListFiles.begin(); - it != this->ListFiles.end(); - ++ it ) - { - if ( this->HasWrittenFile(it->c_str()) ) - { - cmOStringStream str; - str << "File " << it->c_str() << - " is written by WRITE_FILE (or FILE WRITE) command and should " - "not be used as input to CMake. Please use CONFIGURE_FILE to " - "be safe. Refer to the note next to FILE WRITE command."; - cmSystemTools::Error(str.str().c_str()); - return false; - } - } - return true; -} - void cmMakefile::SetProperty(const char* prop, const char* value) { if (!prop) diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index d8873f4..4f54f71 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -94,18 +94,6 @@ public: void RemoveFunctionBlocker(const cmListFileFunction& lff); /** - * Add file to the written file list. These file should not be in the list - * of dependencies because they cause infinite loops. - */ - void AddWrittenFile(const char* file); - bool HasWrittenFile(const char* file); - - /** - * Check if there are any infinite loops - */ - bool CheckInfiniteLoops(); - - /** * Try running cmake and building a file. This is used for dynalically * loaded commands, not as part of the usual build process. */ diff --git a/Source/cmWriteFileCommand.cxx b/Source/cmWriteFileCommand.cxx index 8afd758..2fba508 100644 --- a/Source/cmWriteFileCommand.cxx +++ b/Source/cmWriteFileCommand.cxx @@ -97,7 +97,6 @@ bool cmWriteFileCommand file << message << std::endl; file.close(); cmSystemTools::SetPermissions(fileName.c_str(), mode); - this->Makefile->AddWrittenFile(fileName.c_str()); return true; } diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 5e5859b..08fbe9d 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -2081,8 +2081,6 @@ int cmake::ActualConfigure() this->GlobalGenerator->ClearEnabledLanguages(); } - this->CleanupWrittenFiles(); - // Truncate log files if (!this->InTryCompile) { @@ -2533,21 +2531,6 @@ void cmake::GetGeneratorDocumentation(std::vector& v) } } -void cmake::AddWrittenFile(const char* file) -{ - this->WrittenFiles.insert(file); -} - -bool cmake::HasWrittenFile(const char* file) -{ - return this->WrittenFiles.find(file) != this->WrittenFiles.end(); -} - -void cmake::CleanupWrittenFiles() -{ - this->WrittenFiles.clear(); -} - void cmake::UpdateConversionPathTable() { // Update the path conversion table with any specified file: diff --git a/Source/cmake.h b/Source/cmake.h index c1e9a72..8dd5ad1 100644 --- a/Source/cmake.h +++ b/Source/cmake.h @@ -294,11 +294,6 @@ class cmake bool GetDebugTryCompile(){return this->DebugTryCompile;} void DebugTryCompileOn(){this->DebugTryCompile = true;} - ///! Get the list of files written by CMake using FILE(WRITE / WRITE_FILE - void AddWrittenFile(const char* file); - bool HasWrittenFile(const char* file); - void CleanupWrittenFiles(); - /** * Generate CMAKE_ROOT and CMAKE_COMMAND cache entries */ @@ -389,7 +384,6 @@ protected: std::string StartOutputDirectory; bool SuppressDevWarnings; bool DoSuppressDevWarnings; - std::set WrittenFiles; ///! return true if the same cmake was used to make the cache. bool CacheVersionMatches(); -- cgit v0.12