Always use the auto_ptr from cmsys.

This is for consistency throughout cmake. The cmsys version exists
becaues uses of auto_ptr types as return types does not work with
some implementations in ancient compilers.
This commit is contained in:
Stephen Kelly 2012-11-21 00:56:36 +01:00
parent 8faf4e9380
commit ddc052052b
8 changed files with 12 additions and 23 deletions

View File

@ -23,7 +23,6 @@
#include <cmsys/SystemTools.hxx> #include <cmsys/SystemTools.hxx>
#include <cmsys/Glob.hxx> #include <cmsys/Glob.hxx>
#include <memory> // auto_ptr
#include <algorithm> #include <algorithm>
#if defined(__HAIKU__) #if defined(__HAIKU__)
@ -696,7 +695,7 @@ int cmCPackGenerator::InstallProjectViaInstallCMakeProjects(
cm.SetProgressCallback(cmCPackGeneratorProgress, this); cm.SetProgressCallback(cmCPackGeneratorProgress, this);
cmGlobalGenerator gg; cmGlobalGenerator gg;
gg.SetCMakeInstance(&cm); gg.SetCMakeInstance(&cm);
std::auto_ptr<cmLocalGenerator> lg(gg.CreateLocalGenerator()); cmsys::auto_ptr<cmLocalGenerator> lg(gg.CreateLocalGenerator());
cmMakefile *mf = lg->GetMakefile(); cmMakefile *mf = lg->GetMakefile();
std::string realInstallDirectory = tempInstallDirectory; std::string realInstallDirectory = tempInstallDirectory;
if ( !installSubDirectory.empty() && installSubDirectory != "/" ) if ( !installSubDirectory.empty() && installSubDirectory != "/" )

View File

@ -27,7 +27,6 @@
#include <cmsys/CommandLineArguments.hxx> #include <cmsys/CommandLineArguments.hxx>
#include <cmsys/SystemTools.hxx> #include <cmsys/SystemTools.hxx>
#include <memory> // auto_ptr
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
static const char * cmDocumentationName[][3] = static const char * cmDocumentationName[][3] =
@ -276,7 +275,7 @@ int main (int argc, char *argv[])
cminst.RemoveUnscriptableCommands(); cminst.RemoveUnscriptableCommands();
cmGlobalGenerator cmgg; cmGlobalGenerator cmgg;
cmgg.SetCMakeInstance(&cminst); cmgg.SetCMakeInstance(&cminst);
std::auto_ptr<cmLocalGenerator> cmlg(cmgg.CreateLocalGenerator()); cmsys::auto_ptr<cmLocalGenerator> cmlg(cmgg.CreateLocalGenerator());
cmMakefile* globalMF = cmlg->GetMakefile(); cmMakefile* globalMF = cmlg->GetMakefile();
bool cpackConfigFileSpecified = true; bool cpackConfigFileSpecified = true;

View File

@ -32,7 +32,6 @@
#include <math.h> #include <math.h>
#include <float.h> #include <float.h>
#include <memory> // auto_ptr
#include <set> #include <set>
//---------------------------------------------------------------------- //----------------------------------------------------------------------
@ -1547,7 +1546,7 @@ void cmCTestTestHandler::GetListOfTests()
cmake cm; cmake cm;
cmGlobalGenerator gg; cmGlobalGenerator gg;
gg.SetCMakeInstance(&cm); gg.SetCMakeInstance(&cm);
std::auto_ptr<cmLocalGenerator> lg(gg.CreateLocalGenerator()); cmsys::auto_ptr<cmLocalGenerator> lg(gg.CreateLocalGenerator());
cmMakefile *mf = lg->GetMakefile(); cmMakefile *mf = lg->GetMakefile();
mf->AddDefinition("CTEST_CONFIGURATION_TYPE", mf->AddDefinition("CTEST_CONFIGURATION_TYPE",
this->CTest->GetConfigType().c_str()); this->CTest->GetConfigType().c_str());

View File

@ -15,8 +15,6 @@
#include "cmGlobalGenerator.h" #include "cmGlobalGenerator.h"
#include "cmGeneratedFileStream.h" #include "cmGeneratedFileStream.h"
#include <memory>
static const char* getShapeForTarget(const cmTarget* target) static const char* getShapeForTarget(const cmTarget* target)
@ -67,7 +65,7 @@ void cmGraphVizWriter::ReadSettings(const char* settingsFileName,
cmake cm; cmake cm;
cmGlobalGenerator ggi; cmGlobalGenerator ggi;
ggi.SetCMakeInstance(&cm); ggi.SetCMakeInstance(&cm);
std::auto_ptr<cmLocalGenerator> lg(ggi.CreateLocalGenerator()); cmsys::auto_ptr<cmLocalGenerator> lg(ggi.CreateLocalGenerator());
cmMakefile *mf = lg->GetMakefile(); cmMakefile *mf = lg->GetMakefile();
const char* inFileName = settingsFileName; const char* inFileName = settingsFileName;

View File

@ -32,7 +32,6 @@
#include <cmsys/auto_ptr.hxx> #include <cmsys/auto_ptr.hxx>
#include <memory> // auto_ptr
#include <queue> #include <queue>
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------

View File

@ -19,8 +19,6 @@
#include "cmTarget.h" #include "cmTarget.h"
#include "cmake.h" #include "cmake.h"
#include <memory> // auto_ptr
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
cmMakefileLibraryTargetGenerator cmMakefileLibraryTargetGenerator
::cmMakefileLibraryTargetGenerator(cmTarget* target): ::cmMakefileLibraryTargetGenerator(cmTarget* target):

View File

@ -52,7 +52,6 @@
#endif #endif
#if defined(CMAKE_BUILD_WITH_CMAKE) #if defined(CMAKE_BUILD_WITH_CMAKE)
# include <memory> // auto_ptr
# include <fcntl.h> # include <fcntl.h>
# include "cmCryptoHash.h" # include "cmCryptoHash.h"
#endif #endif

View File

@ -110,8 +110,6 @@
#include <sys/stat.h> // struct stat #include <sys/stat.h> // struct stat
#include <memory> // auto_ptr
static bool cmakeCheckStampFile(const char* stampName); static bool cmakeCheckStampFile(const char* stampName);
static bool cmakeCheckStampList(const char* stampName); static bool cmakeCheckStampList(const char* stampName);
@ -519,7 +517,7 @@ void cmake::ReadListFile(const std::vector<std::string>& args,
// read in the list file to fill the cache // read in the list file to fill the cache
if(path) if(path)
{ {
std::auto_ptr<cmLocalGenerator> lg(gg->CreateLocalGenerator()); cmsys::auto_ptr<cmLocalGenerator> lg(gg->CreateLocalGenerator());
lg->GetMakefile()->SetHomeOutputDirectory lg->GetMakefile()->SetHomeOutputDirectory
(cmSystemTools::GetCurrentWorkingDirectory().c_str()); (cmSystemTools::GetCurrentWorkingDirectory().c_str());
lg->GetMakefile()->SetStartOutputDirectory lg->GetMakefile()->SetStartOutputDirectory
@ -558,7 +556,7 @@ bool cmake::FindPackage(const std::vector<std::string>& args)
this->SetGlobalGenerator(gg); this->SetGlobalGenerator(gg);
// read in the list file to fill the cache // read in the list file to fill the cache
std::auto_ptr<cmLocalGenerator> lg(gg->CreateLocalGenerator()); cmsys::auto_ptr<cmLocalGenerator> lg(gg->CreateLocalGenerator());
cmMakefile* mf = lg->GetMakefile(); cmMakefile* mf = lg->GetMakefile();
mf->SetHomeOutputDirectory mf->SetHomeOutputDirectory
(cmSystemTools::GetCurrentWorkingDirectory().c_str()); (cmSystemTools::GetCurrentWorkingDirectory().c_str());
@ -1654,7 +1652,7 @@ int cmake::ExecuteCMakeCommand(std::vector<std::string>& args)
if(cmGlobalGenerator* ggd = cm.CreateGlobalGenerator(gen.c_str())) if(cmGlobalGenerator* ggd = cm.CreateGlobalGenerator(gen.c_str()))
{ {
cm.SetGlobalGenerator(ggd); cm.SetGlobalGenerator(ggd);
std::auto_ptr<cmLocalGenerator> lgd(ggd->CreateLocalGenerator()); cmsys::auto_ptr<cmLocalGenerator> lgd(ggd->CreateLocalGenerator());
lgd->GetMakefile()->SetStartDirectory(startDir.c_str()); lgd->GetMakefile()->SetStartDirectory(startDir.c_str());
lgd->GetMakefile()->SetStartOutputDirectory(startOutDir.c_str()); lgd->GetMakefile()->SetStartOutputDirectory(startOutDir.c_str());
lgd->GetMakefile()->MakeStartDirectoriesCurrent(); lgd->GetMakefile()->MakeStartDirectoriesCurrent();
@ -2794,7 +2792,7 @@ int cmake::CheckBuildSystem()
cmake cm; cmake cm;
cmGlobalGenerator gg; cmGlobalGenerator gg;
gg.SetCMakeInstance(&cm); gg.SetCMakeInstance(&cm);
std::auto_ptr<cmLocalGenerator> lg(gg.CreateLocalGenerator()); cmsys::auto_ptr<cmLocalGenerator> lg(gg.CreateLocalGenerator());
cmMakefile* mf = lg->GetMakefile(); cmMakefile* mf = lg->GetMakefile();
if(!mf->ReadListFile(0, this->CheckBuildSystemArgument.c_str()) || if(!mf->ReadListFile(0, this->CheckBuildSystemArgument.c_str()) ||
cmSystemTools::GetErrorOccuredFlag()) cmSystemTools::GetErrorOccuredFlag())
@ -2820,11 +2818,11 @@ int cmake::CheckBuildSystem()
} }
// Create the generator and use it to clear the dependencies. // Create the generator and use it to clear the dependencies.
std::auto_ptr<cmGlobalGenerator> cmsys::auto_ptr<cmGlobalGenerator>
ggd(this->CreateGlobalGenerator(genName)); ggd(this->CreateGlobalGenerator(genName));
if(ggd.get()) if(ggd.get())
{ {
std::auto_ptr<cmLocalGenerator> lgd(ggd->CreateLocalGenerator()); cmsys::auto_ptr<cmLocalGenerator> lgd(ggd->CreateLocalGenerator());
lgd->ClearDependencies(mf, verbose); lgd->ClearDependencies(mf, verbose);
} }
} }
@ -3067,7 +3065,7 @@ void cmake::MarkCliAsUsed(const std::string& variable)
void cmake::GenerateGraphViz(const char* fileName) const void cmake::GenerateGraphViz(const char* fileName) const
{ {
#ifdef CMAKE_BUILD_WITH_CMAKE #ifdef CMAKE_BUILD_WITH_CMAKE
std::auto_ptr<cmGraphVizWriter> gvWriter( cmsys::auto_ptr<cmGraphVizWriter> gvWriter(
new cmGraphVizWriter(this->GetGlobalGenerator()->GetLocalGenerators())); new cmGraphVizWriter(this->GetGlobalGenerator()->GetLocalGenerators()));
std::string settingsFile = this->GetHomeOutputDirectory(); std::string settingsFile = this->GetHomeOutputDirectory();
@ -4466,7 +4464,7 @@ int cmake::Build(const std::string& dir,
std::cerr << "Error: could find generator in Cache\n"; std::cerr << "Error: could find generator in Cache\n";
return 1; return 1;
} }
std::auto_ptr<cmGlobalGenerator> gen( cmsys::auto_ptr<cmGlobalGenerator> gen(
this->CreateGlobalGenerator(it.GetValue())); this->CreateGlobalGenerator(it.GetValue()));
std::string output; std::string output;
std::string projName; std::string projName;