Avoid using KWSys auto_ptr by adopting it ourselves

Replace use of cmsys::auto_ptr with a CM_AUTO_PTR macro that maps to
our own implementation adopted from the KWSys auto_ptr implementation.
Later we may be able to map CM_AUTO_PTR to std::auto_ptr on compilers
that do not warn about it.

Automate the client site conversions:

    git grep -l auto_ptr -- Source/ | grep -v Source/kwsys/ | xargs sed -i \
      's|cmsys::auto_ptr|CM_AUTO_PTR|;s|cmsys/auto_ptr.hxx|cm_auto_ptr.hxx|'
This commit is contained in:
Brad King 2016-06-28 10:17:52 -04:00
parent 8d79375818
commit b5ec5b0901
50 changed files with 381 additions and 173 deletions

View File

@ -24,9 +24,10 @@ to build with such toolchains.
std::auto_ptr std::auto_ptr
------------- -------------
Some implementations have a ``std::auto_ptr`` which can not be used as a The ``std::auto_ptr`` template is deprecated in C++11. We want to use it
return value from a function. ``std::auto_ptr`` may not be used. Use so we can build on C++98 compilers but we do not want to turn off compiler
``cmsys::auto_ptr`` instead. warnings about deprecated interfaces in general. Use the ``CM_AUTO_PTR``
macro instead.
size_t size_t
------ ------

View File

@ -364,6 +364,7 @@ set(SRCS
cmake.cxx cmake.cxx
cmake.h cmake.h
cm_auto_ptr.hxx
cm_get_date.h cm_get_date.h
cm_get_date.c cm_get_date.c
cm_sha2.h cm_sha2.h

View File

@ -1044,7 +1044,7 @@ std::string cmCPackWIXGenerator::CreateNewIdForPath(std::string const& path)
std::string cmCPackWIXGenerator::CreateHashedId( std::string cmCPackWIXGenerator::CreateHashedId(
std::string const& path, std::string const& normalizedFilename) std::string const& path, std::string const& normalizedFilename)
{ {
cmsys::auto_ptr<cmCryptoHash> sha1 = cmCryptoHash::New("SHA1"); CM_AUTO_PTR<cmCryptoHash> sha1 = cmCryptoHash::New("SHA1");
std::string hash = sha1->HashString(path.c_str()); std::string hash = sha1->HashString(path.c_str());
std::string identifier; std::string identifier;

View File

@ -624,7 +624,7 @@ int cmCPackGenerator::InstallProjectViaInstallCMakeProjects(
cm.AddCMakePaths(); cm.AddCMakePaths();
cm.SetProgressCallback(cmCPackGeneratorProgress, this); cm.SetProgressCallback(cmCPackGeneratorProgress, this);
cmGlobalGenerator gg(&cm); cmGlobalGenerator gg(&cm);
cmsys::auto_ptr<cmMakefile> mf( CM_AUTO_PTR<cmMakefile> mf(
new cmMakefile(&gg, cm.GetCurrentSnapshot())); new cmMakefile(&gg, cm.GetCurrentSnapshot()));
if (!installSubDirectory.empty() && installSubDirectory != "/") { if (!installSubDirectory.empty() && installSubDirectory != "/") {
tempInstallDirectory += installSubDirectory; tempInstallDirectory += installSubDirectory;

View File

@ -185,7 +185,7 @@ int main(int argc, char const* const* argv)
cminst.GetCurrentSnapshot().SetDefaultDefinitions(); cminst.GetCurrentSnapshot().SetDefaultDefinitions();
cminst.GetState()->RemoveUnscriptableCommands(); cminst.GetState()->RemoveUnscriptableCommands();
cmGlobalGenerator cmgg(&cminst); cmGlobalGenerator cmgg(&cminst);
cmsys::auto_ptr<cmMakefile> globalMF( CM_AUTO_PTR<cmMakefile> globalMF(
new cmMakefile(&cmgg, cminst.GetCurrentSnapshot())); new cmMakefile(&cmgg, cminst.GetCurrentSnapshot()));
#if defined(__CYGWIN__) #if defined(__CYGWIN__)
globalMF->AddDefinition("CMAKE_LEGACY_CYGWIN_WIN32", "0"); globalMF->AddDefinition("CMAKE_LEGACY_CYGWIN_WIN32", "0");

View File

@ -612,7 +612,7 @@ int cmCTestLaunch::Main(int argc, const char* const argv[])
#include "cmGlobalGenerator.h" #include "cmGlobalGenerator.h"
#include "cmMakefile.h" #include "cmMakefile.h"
#include "cmake.h" #include "cmake.h"
#include <cmsys/auto_ptr.hxx> #include <cm_auto_ptr.hxx>
void cmCTestLaunch::LoadConfig() void cmCTestLaunch::LoadConfig()
{ {
cmake cm; cmake cm;
@ -620,7 +620,7 @@ void cmCTestLaunch::LoadConfig()
cm.SetHomeOutputDirectory(""); cm.SetHomeOutputDirectory("");
cm.GetCurrentSnapshot().SetDefaultDefinitions(); cm.GetCurrentSnapshot().SetDefaultDefinitions();
cmGlobalGenerator gg(&cm); cmGlobalGenerator gg(&cm);
cmsys::auto_ptr<cmMakefile> mf(new cmMakefile(&gg, cm.GetCurrentSnapshot())); CM_AUTO_PTR<cmMakefile> mf(new cmMakefile(&gg, cm.GetCurrentSnapshot()));
std::string fname = this->LogDir; std::string fname = this->LogDir;
fname += "CTestLaunchConfig.cmake"; fname += "CTestLaunchConfig.cmake";
if (cmSystemTools::FileExists(fname.c_str()) && if (cmSystemTools::FileExists(fname.c_str()) &&

View File

@ -1352,7 +1352,7 @@ void cmCTestTestHandler::GetListOfTests()
cm.SetHomeOutputDirectory(""); cm.SetHomeOutputDirectory("");
cm.GetCurrentSnapshot().SetDefaultDefinitions(); cm.GetCurrentSnapshot().SetDefaultDefinitions();
cmGlobalGenerator gg(&cm); cmGlobalGenerator gg(&cm);
cmsys::auto_ptr<cmMakefile> mf(new cmMakefile(&gg, cm.GetCurrentSnapshot())); CM_AUTO_PTR<cmMakefile> mf(new cmMakefile(&gg, cm.GetCurrentSnapshot()));
mf->AddDefinition("CTEST_CONFIGURATION_TYPE", mf->AddDefinition("CTEST_CONFIGURATION_TYPE",
this->CTest->GetConfigType().c_str()); this->CTest->GetConfigType().c_str());

View File

@ -30,7 +30,7 @@
#include "cmCTestSVN.h" #include "cmCTestSVN.h"
#include "cmCTestVC.h" #include "cmCTestVC.h"
#include <cmsys/auto_ptr.hxx> #include <cm_auto_ptr.hxx>
//#include <cmsys/RegularExpression.hxx> //#include <cmsys/RegularExpression.hxx>
#include <cmsys/Process.h> #include <cmsys/Process.h>
@ -159,7 +159,7 @@ int cmCTestUpdateHandler::ProcessHandler()
, this->Quiet); , this->Quiet);
// Create an object to interact with the VCS tool. // Create an object to interact with the VCS tool.
cmsys::auto_ptr<cmCTestVC> vc; CM_AUTO_PTR<cmCTestVC> vc;
switch (this->UpdateType) { switch (this->UpdateType) {
case e_CVS: case e_CVS:
vc.reset(new cmCTestCVS(this->CTest, ofs)); vc.reset(new cmCTestCVS(this->CTest, ofs));

View File

@ -51,7 +51,7 @@
#include <math.h> #include <math.h>
#include <stdlib.h> #include <stdlib.h>
#include <cmsys/auto_ptr.hxx> #include <cm_auto_ptr.hxx>
#include <cm_zlib.h> #include <cm_zlib.h>
#include <cmsys/Base64.h> #include <cmsys/Base64.h>
@ -474,7 +474,7 @@ int cmCTest::Initialize(const char* binary_dir, cmCTestStartCommand* command)
cm.SetHomeOutputDirectory(""); cm.SetHomeOutputDirectory("");
cm.GetCurrentSnapshot().SetDefaultDefinitions(); cm.GetCurrentSnapshot().SetDefaultDefinitions();
cmGlobalGenerator gg(&cm); cmGlobalGenerator gg(&cm);
cmsys::auto_ptr<cmMakefile> mf(new cmMakefile(&gg, cm.GetCurrentSnapshot())); CM_AUTO_PTR<cmMakefile> mf(new cmMakefile(&gg, cm.GetCurrentSnapshot()));
if (!this->ReadCustomConfigurationFileTree(this->BinaryDir.c_str(), if (!this->ReadCustomConfigurationFileTree(this->BinaryDir.c_str(),
mf.get())) { mf.get())) {
cmCTestOptionalLog( cmCTestOptionalLog(
@ -1165,7 +1165,7 @@ int cmCTest::RunTest(std::vector<const char*> argv, std::string* output,
} }
std::string oldpath = cmSystemTools::GetCurrentWorkingDirectory(); std::string oldpath = cmSystemTools::GetCurrentWorkingDirectory();
cmsys::auto_ptr<cmSystemTools::SaveRestoreEnvironment> saveEnv; CM_AUTO_PTR<cmSystemTools::SaveRestoreEnvironment> saveEnv;
if (modifyEnv) { if (modifyEnv) {
saveEnv.reset(new cmSystemTools::SaveRestoreEnvironment); saveEnv.reset(new cmSystemTools::SaveRestoreEnvironment);
cmSystemTools::AppendEnv(*environment); cmSystemTools::AppendEnv(*environment);
@ -1193,7 +1193,7 @@ int cmCTest::RunTest(std::vector<const char*> argv, std::string* output,
*output = ""; *output = "";
} }
cmsys::auto_ptr<cmSystemTools::SaveRestoreEnvironment> saveEnv; CM_AUTO_PTR<cmSystemTools::SaveRestoreEnvironment> saveEnv;
if (modifyEnv) { if (modifyEnv) {
saveEnv.reset(new cmSystemTools::SaveRestoreEnvironment); saveEnv.reset(new cmSystemTools::SaveRestoreEnvironment);
cmSystemTools::AppendEnv(*environment); cmSystemTools::AppendEnv(*environment);

View File

@ -15,22 +15,22 @@
#include <cmsys/FStream.hxx> #include <cmsys/FStream.hxx>
#include <cmsys/MD5.h> #include <cmsys/MD5.h>
cmsys::auto_ptr<cmCryptoHash> cmCryptoHash::New(const char* algo) CM_AUTO_PTR<cmCryptoHash> cmCryptoHash::New(const char* algo)
{ {
if (strcmp(algo, "MD5") == 0) { if (strcmp(algo, "MD5") == 0) {
return cmsys::auto_ptr<cmCryptoHash>(new cmCryptoHashMD5); return CM_AUTO_PTR<cmCryptoHash>(new cmCryptoHashMD5);
} else if (strcmp(algo, "SHA1") == 0) { } else if (strcmp(algo, "SHA1") == 0) {
return cmsys::auto_ptr<cmCryptoHash>(new cmCryptoHashSHA1); return CM_AUTO_PTR<cmCryptoHash>(new cmCryptoHashSHA1);
} else if (strcmp(algo, "SHA224") == 0) { } else if (strcmp(algo, "SHA224") == 0) {
return cmsys::auto_ptr<cmCryptoHash>(new cmCryptoHashSHA224); return CM_AUTO_PTR<cmCryptoHash>(new cmCryptoHashSHA224);
} else if (strcmp(algo, "SHA256") == 0) { } else if (strcmp(algo, "SHA256") == 0) {
return cmsys::auto_ptr<cmCryptoHash>(new cmCryptoHashSHA256); return CM_AUTO_PTR<cmCryptoHash>(new cmCryptoHashSHA256);
} else if (strcmp(algo, "SHA384") == 0) { } else if (strcmp(algo, "SHA384") == 0) {
return cmsys::auto_ptr<cmCryptoHash>(new cmCryptoHashSHA384); return CM_AUTO_PTR<cmCryptoHash>(new cmCryptoHashSHA384);
} else if (strcmp(algo, "SHA512") == 0) { } else if (strcmp(algo, "SHA512") == 0) {
return cmsys::auto_ptr<cmCryptoHash>(new cmCryptoHashSHA512); return CM_AUTO_PTR<cmCryptoHash>(new cmCryptoHashSHA512);
} else { } else {
return cmsys::auto_ptr<cmCryptoHash>(CM_NULLPTR); return CM_AUTO_PTR<cmCryptoHash>(CM_NULLPTR);
} }
} }

View File

@ -14,13 +14,13 @@
#include "cmStandardIncludes.h" #include "cmStandardIncludes.h"
#include <cmsys/auto_ptr.hxx> #include <cm_auto_ptr.hxx>
class cmCryptoHash class cmCryptoHash
{ {
public: public:
virtual ~cmCryptoHash() {} virtual ~cmCryptoHash() {}
static cmsys::auto_ptr<cmCryptoHash> New(const char* algo); static CM_AUTO_PTR<cmCryptoHash> New(const char* algo);
std::string HashString(const std::string& input); std::string HashString(const std::string& input);
std::string HashFile(const std::string& file); std::string HashFile(const std::string& file);

View File

@ -13,7 +13,7 @@
#include "cmMakefile.h" #include "cmMakefile.h"
#include <cmsys/auto_ptr.hxx> #include <cm_auto_ptr.hxx>
cmCustomCommand::cmCustomCommand() cmCustomCommand::cmCustomCommand()
: Backtrace() : Backtrace()

View File

@ -66,7 +66,7 @@ std::string cmCustomCommandGenerator::GetCommand(unsigned int c) const
} }
} }
cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = this->GE->Parse(argv0); CM_AUTO_PTR<cmCompiledGeneratorExpression> cge = this->GE->Parse(argv0);
std::string exe = cge->Evaluate(this->LG, this->Config); std::string exe = cge->Evaluate(this->LG, this->Config);
return exe; return exe;
@ -145,7 +145,7 @@ std::vector<std::string> const& cmCustomCommandGenerator::GetDepends() const
std::vector<std::string> depends = this->CC.GetDepends(); std::vector<std::string> depends = this->CC.GetDepends();
for (std::vector<std::string>::const_iterator i = depends.begin(); for (std::vector<std::string>::const_iterator i = depends.begin();
i != depends.end(); ++i) { i != depends.end(); ++i) {
cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = this->GE->Parse(*i); CM_AUTO_PTR<cmCompiledGeneratorExpression> cge = this->GE->Parse(*i);
std::vector<std::string> result; std::vector<std::string> result;
cmSystemTools::ExpandListArgument(cge->Evaluate(this->LG, this->Config), cmSystemTools::ExpandListArgument(cge->Evaluate(this->LG, this->Config),
result); result);

View File

@ -13,8 +13,8 @@
#include "cmELF.h" #include "cmELF.h"
#include <cm_auto_ptr.hxx>
#include <cmsys/FStream.hxx> #include <cmsys/FStream.hxx>
#include <cmsys/auto_ptr.hxx>
// Include the ELF format information system header. // Include the ELF format information system header.
#if defined(__OpenBSD__) #if defined(__OpenBSD__)
@ -107,7 +107,7 @@ public:
}; };
// Construct and take ownership of the file stream object. // Construct and take ownership of the file stream object.
cmELFInternal(cmELF* external, cmsys::auto_ptr<cmsys::ifstream>& fin, cmELFInternal(cmELF* external, CM_AUTO_PTR<cmsys::ifstream>& fin,
ByteOrderType order) ByteOrderType order)
: External(external) : External(external)
, Stream(*fin.release()) , Stream(*fin.release())
@ -237,7 +237,7 @@ public:
typedef typename Types::tagtype tagtype; typedef typename Types::tagtype tagtype;
// Construct with a stream and byte swap indicator. // Construct with a stream and byte swap indicator.
cmELFInternalImpl(cmELF* external, cmsys::auto_ptr<cmsys::ifstream>& fin, cmELFInternalImpl(cmELF* external, CM_AUTO_PTR<cmsys::ifstream>& fin,
ByteOrderType order); ByteOrderType order);
// Return the number of sections as specified by the ELF header. // Return the number of sections as specified by the ELF header.
@ -537,8 +537,9 @@ private:
}; };
template <class Types> template <class Types>
cmELFInternalImpl<Types>::cmELFInternalImpl( cmELFInternalImpl<Types>::cmELFInternalImpl(cmELF* external,
cmELF* external, cmsys::auto_ptr<cmsys::ifstream>& fin, ByteOrderType order) CM_AUTO_PTR<cmsys::ifstream>& fin,
ByteOrderType order)
: cmELFInternal(external, fin, order) : cmELFInternal(external, fin, order)
{ {
// Read the main header. // Read the main header.
@ -755,7 +756,7 @@ cmELF::cmELF(const char* fname)
: Internal(CM_NULLPTR) : Internal(CM_NULLPTR)
{ {
// Try to open the file. // Try to open the file.
cmsys::auto_ptr<cmsys::ifstream> fin(new cmsys::ifstream(fname)); CM_AUTO_PTR<cmsys::ifstream> fin(new cmsys::ifstream(fname));
// Quit now if the file could not be opened. // Quit now if the file could not be opened.
if (!fin.get() || !*fin) { if (!fin.get() || !*fin) {

View File

@ -25,8 +25,8 @@
#include "cmVersion.h" #include "cmVersion.h"
#include <assert.h> #include <assert.h>
#include <cm_auto_ptr.hxx>
#include <cmsys/FStream.hxx> #include <cmsys/FStream.hxx>
#include <cmsys/auto_ptr.hxx>
static std::string cmExportFileGeneratorEscape(std::string const& str) static std::string cmExportFileGeneratorEscape(std::string const& str)
{ {
@ -69,15 +69,15 @@ const char* cmExportFileGenerator::GetMainExportFileName() const
bool cmExportFileGenerator::GenerateImportFile() bool cmExportFileGenerator::GenerateImportFile()
{ {
// Open the output file to generate it. // Open the output file to generate it.
cmsys::auto_ptr<cmsys::ofstream> foutPtr; CM_AUTO_PTR<cmsys::ofstream> foutPtr;
if (this->AppendMode) { if (this->AppendMode) {
// Open for append. // Open for append.
cmsys::auto_ptr<cmsys::ofstream> ap( CM_AUTO_PTR<cmsys::ofstream> ap(
new cmsys::ofstream(this->MainImportFile.c_str(), std::ios::app)); new cmsys::ofstream(this->MainImportFile.c_str(), std::ios::app));
foutPtr = ap; foutPtr = ap;
} else { } else {
// Generate atomically and with copy-if-different. // Generate atomically and with copy-if-different.
cmsys::auto_ptr<cmGeneratedFileStream> ap( CM_AUTO_PTR<cmGeneratedFileStream> ap(
new cmGeneratedFileStream(this->MainImportFile.c_str(), true)); new cmGeneratedFileStream(this->MainImportFile.c_str(), true));
ap->SetCopyIfDifferent(true); ap->SetCopyIfDifferent(true);
foutPtr = ap; foutPtr = ap;
@ -393,7 +393,7 @@ void cmExportFileGenerator::PopulateIncludeDirectoriesInterface(
std::string dirs = cmGeneratorExpression::Preprocess( std::string dirs = cmGeneratorExpression::Preprocess(
tei->InterfaceIncludeDirectories, preprocessRule, true); tei->InterfaceIncludeDirectories, preprocessRule, true);
this->ReplaceInstallPrefix(dirs); this->ReplaceInstallPrefix(dirs);
cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(dirs); CM_AUTO_PTR<cmCompiledGeneratorExpression> cge = ge.Parse(dirs);
std::string exportDirs = std::string exportDirs =
cge->Evaluate(target->GetLocalGenerator(), "", false, target); cge->Evaluate(target->GetLocalGenerator(), "", false, target);

View File

@ -16,7 +16,7 @@
#include "cmVersion.h" #include "cmVersion.h"
#include "cmake.h" #include "cmake.h"
#include <cmsys/auto_ptr.hxx> #include <cm_auto_ptr.hxx>
bool cmExportLibraryDependenciesCommand::InitialPass( bool cmExportLibraryDependenciesCommand::InitialPass(
std::vector<std::string> const& args, cmExecutionStatus&) std::vector<std::string> const& args, cmExecutionStatus&)
@ -53,13 +53,13 @@ void cmExportLibraryDependenciesCommand::FinalPass()
void cmExportLibraryDependenciesCommand::ConstFinalPass() const void cmExportLibraryDependenciesCommand::ConstFinalPass() const
{ {
// Use copy-if-different if not appending. // Use copy-if-different if not appending.
cmsys::auto_ptr<cmsys::ofstream> foutPtr; CM_AUTO_PTR<cmsys::ofstream> foutPtr;
if (this->Append) { if (this->Append) {
cmsys::auto_ptr<cmsys::ofstream> ap( CM_AUTO_PTR<cmsys::ofstream> ap(
new cmsys::ofstream(this->Filename.c_str(), std::ios::app)); new cmsys::ofstream(this->Filename.c_str(), std::ios::app));
foutPtr = ap; foutPtr = ap;
} else { } else {
cmsys::auto_ptr<cmGeneratedFileStream> ap( CM_AUTO_PTR<cmGeneratedFileStream> ap(
new cmGeneratedFileStream(this->Filename.c_str(), true)); new cmGeneratedFileStream(this->Filename.c_str(), true));
ap->SetCopyIfDifferent(true); ap->SetCopyIfDifferent(true);
foutPtr = ap; foutPtr = ap;

View File

@ -66,7 +66,7 @@ std::string cmExportTryCompileFileGenerator::FindTargets(
cmGeneratorExpressionDAGChecker dagChecker(tgt->GetName(), propName, cmGeneratorExpressionDAGChecker dagChecker(tgt->GetName(), propName,
CM_NULLPTR, CM_NULLPTR); CM_NULLPTR, CM_NULLPTR);
cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(prop); CM_AUTO_PTR<cmCompiledGeneratorExpression> cge = ge.Parse(prop);
cmTarget dummyHead; cmTarget dummyHead;
dummyHead.SetType(cmState::EXECUTABLE, "try_compile_dummy_exe"); dummyHead.SetType(cmState::EXECUTABLE, "try_compile_dummy_exe");

View File

@ -34,12 +34,12 @@
// include sys/stat.h after sys/types.h // include sys/stat.h after sys/types.h
#include <sys/stat.h> #include <sys/stat.h>
#include <cm_auto_ptr.hxx>
#include <cmsys/Directory.hxx> #include <cmsys/Directory.hxx>
#include <cmsys/Encoding.hxx> #include <cmsys/Encoding.hxx>
#include <cmsys/FStream.hxx> #include <cmsys/FStream.hxx>
#include <cmsys/Glob.hxx> #include <cmsys/Glob.hxx>
#include <cmsys/RegularExpression.hxx> #include <cmsys/RegularExpression.hxx>
#include <cmsys/auto_ptr.hxx>
// Table of permissions flags. // Table of permissions flags.
#if defined(_WIN32) && !defined(__CYGWIN__) #if defined(_WIN32) && !defined(__CYGWIN__)
@ -330,7 +330,7 @@ bool cmFileCommand::HandleHashCommand(std::vector<std::string> const& args)
return false; return false;
} }
cmsys::auto_ptr<cmCryptoHash> hash(cmCryptoHash::New(args[0].c_str())); CM_AUTO_PTR<cmCryptoHash> hash(cmCryptoHash::New(args[0].c_str()));
if (hash.get()) { if (hash.get()) {
std::string out = hash->HashFile(args[1]); std::string out = hash->HashFile(args[1]);
if (!out.empty()) { if (!out.empty()) {
@ -2478,7 +2478,7 @@ bool cmFileCommand::HandleDownloadCommand(std::vector<std::string> const& args)
const char* cainfo = this->Makefile->GetDefinition("CMAKE_TLS_CAINFO"); const char* cainfo = this->Makefile->GetDefinition("CMAKE_TLS_CAINFO");
std::string expectedHash; std::string expectedHash;
std::string hashMatchMSG; std::string hashMatchMSG;
cmsys::auto_ptr<cmCryptoHash> hash; CM_AUTO_PTR<cmCryptoHash> hash;
bool showProgress = false; bool showProgress = false;
while (i != args.end()) { while (i != args.end()) {
@ -2534,7 +2534,7 @@ bool cmFileCommand::HandleDownloadCommand(std::vector<std::string> const& args)
this->SetError("DOWNLOAD missing sum value for EXPECTED_MD5."); this->SetError("DOWNLOAD missing sum value for EXPECTED_MD5.");
return false; return false;
} }
hash = cmsys::auto_ptr<cmCryptoHash>(cmCryptoHash::New("MD5")); hash = CM_AUTO_PTR<cmCryptoHash>(cmCryptoHash::New("MD5"));
hashMatchMSG = "MD5 sum"; hashMatchMSG = "MD5 sum";
expectedHash = cmSystemTools::LowerCase(*i); expectedHash = cmSystemTools::LowerCase(*i);
} else if (*i == "SHOW_PROGRESS") { } else if (*i == "SHOW_PROGRESS") {
@ -2555,7 +2555,7 @@ bool cmFileCommand::HandleDownloadCommand(std::vector<std::string> const& args)
} }
std::string algo = i->substr(0, pos); std::string algo = i->substr(0, pos);
expectedHash = cmSystemTools::LowerCase(i->substr(pos + 1)); expectedHash = cmSystemTools::LowerCase(i->substr(pos + 1));
hash = cmsys::auto_ptr<cmCryptoHash>(cmCryptoHash::New(algo.c_str())); hash = CM_AUTO_PTR<cmCryptoHash>(cmCryptoHash::New(algo.c_str()));
if (!hash.get()) { if (!hash.get()) {
std::string err = "DOWNLOAD EXPECTED_HASH given unknown ALGO: "; std::string err = "DOWNLOAD EXPECTED_HASH given unknown ALGO: ";
err += algo; err += algo;
@ -2971,11 +2971,11 @@ void cmFileCommand::AddEvaluationFile(const std::string& inputName,
cmListFileBacktrace lfbt = this->Makefile->GetBacktrace(); cmListFileBacktrace lfbt = this->Makefile->GetBacktrace();
cmGeneratorExpression outputGe(lfbt); cmGeneratorExpression outputGe(lfbt);
cmsys::auto_ptr<cmCompiledGeneratorExpression> outputCge = CM_AUTO_PTR<cmCompiledGeneratorExpression> outputCge =
outputGe.Parse(outputExpr); outputGe.Parse(outputExpr);
cmGeneratorExpression conditionGe(lfbt); cmGeneratorExpression conditionGe(lfbt);
cmsys::auto_ptr<cmCompiledGeneratorExpression> conditionCge = CM_AUTO_PTR<cmCompiledGeneratorExpression> conditionCge =
conditionGe.Parse(condition); conditionGe.Parse(condition);
this->Makefile->AddEvaluationFile(inputName, outputCge, conditionCge, this->Makefile->AddEvaluationFile(inputName, outputCge, conditionCge,

View File

@ -1500,9 +1500,9 @@ void cmFindPackageCommand::StoreVersionFound()
this->Makefile->AddDefinition(ver + "_COUNT", buf); this->Makefile->AddDefinition(ver + "_COUNT", buf);
} }
#include <cm_auto_ptr.hxx>
#include <cmsys/Glob.hxx> #include <cmsys/Glob.hxx>
#include <cmsys/String.h> #include <cmsys/String.h>
#include <cmsys/auto_ptr.hxx>
class cmFileList; class cmFileList;
class cmFileListGeneratorBase class cmFileListGeneratorBase
@ -1515,10 +1515,10 @@ protected:
private: private:
bool Search(cmFileList&); bool Search(cmFileList&);
virtual bool Search(std::string const& parent, cmFileList&) = 0; virtual bool Search(std::string const& parent, cmFileList&) = 0;
virtual cmsys::auto_ptr<cmFileListGeneratorBase> Clone() const = 0; virtual CM_AUTO_PTR<cmFileListGeneratorBase> Clone() const = 0;
friend class cmFileList; friend class cmFileList;
cmFileListGeneratorBase* SetNext(cmFileListGeneratorBase const& next); cmFileListGeneratorBase* SetNext(cmFileListGeneratorBase const& next);
cmsys::auto_ptr<cmFileListGeneratorBase> Next; CM_AUTO_PTR<cmFileListGeneratorBase> Next;
}; };
class cmFileList class cmFileList
@ -1551,7 +1551,7 @@ public:
private: private:
virtual bool Visit(std::string const& fullPath) = 0; virtual bool Visit(std::string const& fullPath) = 0;
friend class cmFileListGeneratorBase; friend class cmFileListGeneratorBase;
cmsys::auto_ptr<cmFileListGeneratorBase> First; CM_AUTO_PTR<cmFileListGeneratorBase> First;
cmFileListGeneratorBase* Last; cmFileListGeneratorBase* Last;
}; };
@ -1621,9 +1621,9 @@ private:
std::string fullPath = parent + this->String; std::string fullPath = parent + this->String;
return this->Consider(fullPath, lister); return this->Consider(fullPath, lister);
} }
cmsys::auto_ptr<cmFileListGeneratorBase> Clone() const CM_OVERRIDE CM_AUTO_PTR<cmFileListGeneratorBase> Clone() const CM_OVERRIDE
{ {
cmsys::auto_ptr<cmFileListGeneratorBase> g( CM_AUTO_PTR<cmFileListGeneratorBase> g(
new cmFileListGeneratorFixed(*this)); new cmFileListGeneratorFixed(*this));
return g; return g;
} }
@ -1655,9 +1655,9 @@ private:
} }
return false; return false;
} }
cmsys::auto_ptr<cmFileListGeneratorBase> Clone() const CM_OVERRIDE CM_AUTO_PTR<cmFileListGeneratorBase> Clone() const CM_OVERRIDE
{ {
cmsys::auto_ptr<cmFileListGeneratorBase> g( CM_AUTO_PTR<cmFileListGeneratorBase> g(
new cmFileListGeneratorEnumerate(*this)); new cmFileListGeneratorEnumerate(*this));
return g; return g;
} }
@ -1706,9 +1706,9 @@ private:
} }
return false; return false;
} }
cmsys::auto_ptr<cmFileListGeneratorBase> Clone() const CM_OVERRIDE CM_AUTO_PTR<cmFileListGeneratorBase> Clone() const CM_OVERRIDE
{ {
cmsys::auto_ptr<cmFileListGeneratorBase> g( CM_AUTO_PTR<cmFileListGeneratorBase> g(
new cmFileListGeneratorProject(*this)); new cmFileListGeneratorProject(*this));
return g; return g;
} }
@ -1763,9 +1763,9 @@ private:
} }
return false; return false;
} }
cmsys::auto_ptr<cmFileListGeneratorBase> Clone() const CM_OVERRIDE CM_AUTO_PTR<cmFileListGeneratorBase> Clone() const CM_OVERRIDE
{ {
cmsys::auto_ptr<cmFileListGeneratorBase> g( CM_AUTO_PTR<cmFileListGeneratorBase> g(
new cmFileListGeneratorMacProject(*this)); new cmFileListGeneratorMacProject(*this));
return g; return g;
} }
@ -1807,9 +1807,9 @@ private:
} }
return false; return false;
} }
cmsys::auto_ptr<cmFileListGeneratorBase> Clone() const CM_OVERRIDE CM_AUTO_PTR<cmFileListGeneratorBase> Clone() const CM_OVERRIDE
{ {
cmsys::auto_ptr<cmFileListGeneratorBase> g( CM_AUTO_PTR<cmFileListGeneratorBase> g(
new cmFileListGeneratorCaseInsensitive(*this)); new cmFileListGeneratorCaseInsensitive(*this));
return g; return g;
} }
@ -1853,10 +1853,9 @@ private:
} }
return false; return false;
} }
cmsys::auto_ptr<cmFileListGeneratorBase> Clone() const CM_OVERRIDE CM_AUTO_PTR<cmFileListGeneratorBase> Clone() const CM_OVERRIDE
{ {
cmsys::auto_ptr<cmFileListGeneratorBase> g( CM_AUTO_PTR<cmFileListGeneratorBase> g(new cmFileListGeneratorGlob(*this));
new cmFileListGeneratorGlob(*this));
return g; return g;
} }
}; };

View File

@ -11,7 +11,7 @@
============================================================================*/ ============================================================================*/
#include "cmForEachCommand.h" #include "cmForEachCommand.h"
#include <cmsys/auto_ptr.hxx> #include <cm_auto_ptr.hxx>
cmForEachFunctionBlocker::cmForEachFunctionBlocker(cmMakefile* mf) cmForEachFunctionBlocker::cmForEachFunctionBlocker(cmMakefile* mf)
: Makefile(mf) : Makefile(mf)
@ -36,8 +36,7 @@ bool cmForEachFunctionBlocker::IsFunctionBlocked(const cmListFileFunction& lff,
// if this is the endofreach for this statement // if this is the endofreach for this statement
if (!this->Depth) { if (!this->Depth) {
// Remove the function blocker for this scope or bail. // Remove the function blocker for this scope or bail.
cmsys::auto_ptr<cmFunctionBlocker> fb( CM_AUTO_PTR<cmFunctionBlocker> fb(mf.RemoveFunctionBlocker(this, lff));
mf.RemoveFunctionBlocker(this, lff));
if (!fb.get()) { if (!fb.get()) {
return false; return false;
} }
@ -184,7 +183,7 @@ bool cmForEachCommand::InitialPass(std::vector<std::string> const& args,
bool cmForEachCommand::HandleInMode(std::vector<std::string> const& args) bool cmForEachCommand::HandleInMode(std::vector<std::string> const& args)
{ {
cmsys::auto_ptr<cmForEachFunctionBlocker> f( CM_AUTO_PTR<cmForEachFunctionBlocker> f(
new cmForEachFunctionBlocker(this->Makefile)); new cmForEachFunctionBlocker(this->Makefile));
f->Args.push_back(args[0]); f->Args.push_back(args[0]);

View File

@ -26,14 +26,14 @@ cmGeneratorExpression::cmGeneratorExpression(
{ {
} }
cmsys::auto_ptr<cmCompiledGeneratorExpression> cmGeneratorExpression::Parse( CM_AUTO_PTR<cmCompiledGeneratorExpression> cmGeneratorExpression::Parse(
std::string const& input) std::string const& input)
{ {
return cmsys::auto_ptr<cmCompiledGeneratorExpression>( return CM_AUTO_PTR<cmCompiledGeneratorExpression>(
new cmCompiledGeneratorExpression(this->Backtrace, input)); new cmCompiledGeneratorExpression(this->Backtrace, input));
} }
cmsys::auto_ptr<cmCompiledGeneratorExpression> cmGeneratorExpression::Parse( CM_AUTO_PTR<cmCompiledGeneratorExpression> cmGeneratorExpression::Parse(
const char* input) const char* input)
{ {
return this->Parse(std::string(input ? input : "")); return this->Parse(std::string(input ? input : ""));

View File

@ -17,8 +17,8 @@
#include "cmListFileCache.h" #include "cmListFileCache.h"
#include <cm_auto_ptr.hxx>
#include <cmsys/RegularExpression.hxx> #include <cmsys/RegularExpression.hxx>
#include <cmsys/auto_ptr.hxx>
class cmGeneratorTarget; class cmGeneratorTarget;
class cmLocalGenerator; class cmLocalGenerator;
@ -47,9 +47,8 @@ public:
cmListFileBacktrace const& backtrace = cmListFileBacktrace()); cmListFileBacktrace const& backtrace = cmListFileBacktrace());
~cmGeneratorExpression(); ~cmGeneratorExpression();
cmsys::auto_ptr<cmCompiledGeneratorExpression> Parse( CM_AUTO_PTR<cmCompiledGeneratorExpression> Parse(std::string const& input);
std::string const& input); CM_AUTO_PTR<cmCompiledGeneratorExpression> Parse(const char* input);
cmsys::auto_ptr<cmCompiledGeneratorExpression> Parse(const char* input);
enum PreprocessContext enum PreprocessContext
{ {

View File

@ -23,9 +23,8 @@
cmGeneratorExpressionEvaluationFile::cmGeneratorExpressionEvaluationFile( cmGeneratorExpressionEvaluationFile::cmGeneratorExpressionEvaluationFile(
const std::string& input, const std::string& input,
cmsys::auto_ptr<cmCompiledGeneratorExpression> outputFileExpr, CM_AUTO_PTR<cmCompiledGeneratorExpression> outputFileExpr,
cmsys::auto_ptr<cmCompiledGeneratorExpression> condition, CM_AUTO_PTR<cmCompiledGeneratorExpression> condition, bool inputIsContent)
bool inputIsContent)
: Input(input) : Input(input)
, OutputFileExpr(outputFileExpr) , OutputFileExpr(outputFileExpr)
, Condition(condition) , Condition(condition)
@ -135,7 +134,7 @@ void cmGeneratorExpressionEvaluationFile::Generate(cmLocalGenerator* lg)
cmListFileBacktrace lfbt = this->OutputFileExpr->GetBacktrace(); cmListFileBacktrace lfbt = this->OutputFileExpr->GetBacktrace();
cmGeneratorExpression contentGE(lfbt); cmGeneratorExpression contentGE(lfbt);
cmsys::auto_ptr<cmCompiledGeneratorExpression> inputExpression = CM_AUTO_PTR<cmCompiledGeneratorExpression> inputExpression =
contentGE.Parse(inputContent); contentGE.Parse(inputContent);
std::map<std::string, std::string> outputFiles; std::map<std::string, std::string> outputFiles;

View File

@ -14,7 +14,7 @@
#include "cmGeneratorExpression.h" #include "cmGeneratorExpression.h"
#include <cmsys/auto_ptr.hxx> #include <cm_auto_ptr.hxx>
#include <sys/types.h> #include <sys/types.h>
class cmLocalGenerator; class cmLocalGenerator;
@ -24,9 +24,8 @@ class cmGeneratorExpressionEvaluationFile
public: public:
cmGeneratorExpressionEvaluationFile( cmGeneratorExpressionEvaluationFile(
const std::string& input, const std::string& input,
cmsys::auto_ptr<cmCompiledGeneratorExpression> outputFileExpr, CM_AUTO_PTR<cmCompiledGeneratorExpression> outputFileExpr,
cmsys::auto_ptr<cmCompiledGeneratorExpression> condition, CM_AUTO_PTR<cmCompiledGeneratorExpression> condition, bool inputIsContent);
bool inputIsContent);
void Generate(cmLocalGenerator* lg); void Generate(cmLocalGenerator* lg);
@ -42,8 +41,8 @@ private:
private: private:
const std::string Input; const std::string Input;
const cmsys::auto_ptr<cmCompiledGeneratorExpression> OutputFileExpr; const CM_AUTO_PTR<cmCompiledGeneratorExpression> OutputFileExpr;
const cmsys::auto_ptr<cmCompiledGeneratorExpression> Condition; const CM_AUTO_PTR<cmCompiledGeneratorExpression> Condition;
std::vector<std::string> Files; std::vector<std::string> Files;
const bool InputIsContent; const bool InputIsContent;
}; };

View File

@ -24,7 +24,7 @@ std::string cmGeneratorExpressionNode::EvaluateDependentExpression(
cmGeneratorExpressionDAGChecker* dagChecker) cmGeneratorExpressionDAGChecker* dagChecker)
{ {
cmGeneratorExpression ge(context->Backtrace); cmGeneratorExpression ge(context->Backtrace);
cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(prop); CM_AUTO_PTR<cmCompiledGeneratorExpression> cge = ge.Parse(prop);
cge->SetEvaluateForBuildsystem(context->EvaluateForBuildsystem); cge->SetEvaluateForBuildsystem(context->EvaluateForBuildsystem);
std::string result = std::string result =
cge->Evaluate(lg, context->Config, context->Quiet, headTarget, cge->Evaluate(lg, context->Config, context->Quiet, headTarget,

View File

@ -42,13 +42,13 @@ class cmGeneratorTarget::TargetPropertyEntry
static cmLinkImplItem NoLinkImplItem; static cmLinkImplItem NoLinkImplItem;
public: public:
TargetPropertyEntry(cmsys::auto_ptr<cmCompiledGeneratorExpression> cge, TargetPropertyEntry(CM_AUTO_PTR<cmCompiledGeneratorExpression> cge,
cmLinkImplItem const& item = NoLinkImplItem) cmLinkImplItem const& item = NoLinkImplItem)
: ge(cge) : ge(cge)
, LinkImplItem(item) , LinkImplItem(item)
{ {
} }
const cmsys::auto_ptr<cmCompiledGeneratorExpression> ge; const CM_AUTO_PTR<cmCompiledGeneratorExpression> ge;
cmLinkImplItem const& LinkImplItem; cmLinkImplItem const& LinkImplItem;
}; };
cmLinkImplItem cmGeneratorTarget::TargetPropertyEntry::NoLinkImplItem; cmLinkImplItem cmGeneratorTarget::TargetPropertyEntry::NoLinkImplItem;
@ -253,7 +253,7 @@ void CreatePropertyGeneratorExpressions(
for (std::vector<std::string>::const_iterator it = entries.begin(); for (std::vector<std::string>::const_iterator it = entries.begin();
it != entries.end(); ++it, ++btIt) { it != entries.end(); ++it, ++btIt) {
cmGeneratorExpression ge(*btIt); cmGeneratorExpression ge(*btIt);
cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(*it); CM_AUTO_PTR<cmCompiledGeneratorExpression> cge = ge.Parse(*it);
cge->SetEvaluateForBuildsystem(evaluateForBuildsystem); cge->SetEvaluateForBuildsystem(evaluateForBuildsystem);
items.push_back(new cmGeneratorTarget::TargetPropertyEntry(cge)); items.push_back(new cmGeneratorTarget::TargetPropertyEntry(cge));
} }
@ -443,7 +443,7 @@ std::string cmGeneratorTarget::GetOutputName(const std::string& config,
// Now evaluate genex and update the previously-prepared map entry. // Now evaluate genex and update the previously-prepared map entry.
cmGeneratorExpression ge; cmGeneratorExpression ge;
cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(outName); CM_AUTO_PTR<cmCompiledGeneratorExpression> cge = ge.Parse(outName);
i->second = cge->Evaluate(this->LocalGenerator, config); i->second = cge->Evaluate(this->LocalGenerator, config);
} else if (i->second.empty()) { } else if (i->second.empty()) {
// An empty map entry indicates we have been called recursively // An empty map entry indicates we have been called recursively
@ -461,7 +461,7 @@ void cmGeneratorTarget::AddSource(const std::string& src)
this->Target->AddSource(src); this->Target->AddSource(src);
cmListFileBacktrace lfbt = this->Makefile->GetBacktrace(); cmListFileBacktrace lfbt = this->Makefile->GetBacktrace();
cmGeneratorExpression ge(lfbt); cmGeneratorExpression ge(lfbt);
cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(src); CM_AUTO_PTR<cmCompiledGeneratorExpression> cge = ge.Parse(src);
cge->SetEvaluateForBuildsystem(true); cge->SetEvaluateForBuildsystem(true);
this->SourceEntries.push_back(new TargetPropertyEntry(cge)); this->SourceEntries.push_back(new TargetPropertyEntry(cge));
this->SourceFilesMap.clear(); this->SourceFilesMap.clear();
@ -477,7 +477,7 @@ void cmGeneratorTarget::AddTracedSources(std::vector<std::string> const& srcs)
this->LinkImplementationLanguageIsContextDependent = true; this->LinkImplementationLanguageIsContextDependent = true;
cmListFileBacktrace lfbt = this->Makefile->GetBacktrace(); cmListFileBacktrace lfbt = this->Makefile->GetBacktrace();
cmGeneratorExpression ge(lfbt); cmGeneratorExpression ge(lfbt);
cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(srcFiles); CM_AUTO_PTR<cmCompiledGeneratorExpression> cge = ge.Parse(srcFiles);
cge->SetEvaluateForBuildsystem(true); cge->SetEvaluateForBuildsystem(true);
this->SourceEntries.push_back( this->SourceEntries.push_back(
new cmGeneratorTarget::TargetPropertyEntry(cge)); new cmGeneratorTarget::TargetPropertyEntry(cge));
@ -862,7 +862,7 @@ static void AddInterfaceEntries(
if (it->Target) { if (it->Target) {
std::string genex = "$<TARGET_PROPERTY:" + *it + "," + prop + ">"; std::string genex = "$<TARGET_PROPERTY:" + *it + "," + prop + ">";
cmGeneratorExpression ge(it->Backtrace); cmGeneratorExpression ge(it->Backtrace);
cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(genex); CM_AUTO_PTR<cmCompiledGeneratorExpression> cge = ge.Parse(genex);
cge->SetEvaluateForBuildsystem(true); cge->SetEvaluateForBuildsystem(true);
entries.push_back( entries.push_back(
new cmGeneratorTarget::TargetPropertyEntry(cge, *it)); new cmGeneratorTarget::TargetPropertyEntry(cge, *it));
@ -2119,8 +2119,7 @@ void cmTargetTraceDependencies::CheckCustomCommand(cmCustomCommand const& cc)
// Check for target references in generator expressions. // Check for target references in generator expressions.
for (cmCustomCommandLine::const_iterator cli = cit->begin(); for (cmCustomCommandLine::const_iterator cli = cit->begin();
cli != cit->end(); ++cli) { cli != cit->end(); ++cli) {
const cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = const CM_AUTO_PTR<cmCompiledGeneratorExpression> cge = ge.Parse(*cli);
ge.Parse(*cli);
cge->Evaluate(this->GeneratorTarget->GetLocalGenerator(), "", true); cge->Evaluate(this->GeneratorTarget->GetLocalGenerator(), "", true);
std::set<cmGeneratorTarget*> geTargets = cge->GetTargets(); std::set<cmGeneratorTarget*> geTargets = cge->GetTargets();
targets.insert(geTargets.begin(), geTargets.end()); targets.insert(geTargets.begin(), geTargets.end());
@ -2405,7 +2404,7 @@ std::vector<std::string> cmGeneratorTarget::GetIncludeDirectories(
libDir = frameworkCheck.match(1); libDir = frameworkCheck.match(1);
cmGeneratorExpression ge; cmGeneratorExpression ge;
cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = CM_AUTO_PTR<cmCompiledGeneratorExpression> cge =
ge.Parse(libDir.c_str()); ge.Parse(libDir.c_str());
linkInterfaceIncludeDirectoriesEntries.push_back( linkInterfaceIncludeDirectoriesEntries.push_back(
new cmGeneratorTarget::TargetPropertyEntry(cge)); new cmGeneratorTarget::TargetPropertyEntry(cge));
@ -2629,7 +2628,7 @@ void cmGeneratorTarget::GetCompileDefinitions(
} }
case cmPolicies::OLD: { case cmPolicies::OLD: {
cmGeneratorExpression ge; cmGeneratorExpression ge;
cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = CM_AUTO_PTR<cmCompiledGeneratorExpression> cge =
ge.Parse(configProp); ge.Parse(configProp);
linkInterfaceCompileDefinitionsEntries.push_back( linkInterfaceCompileDefinitionsEntries.push_back(
new cmGeneratorTarget::TargetPropertyEntry(cge)); new cmGeneratorTarget::TargetPropertyEntry(cge));
@ -3981,7 +3980,7 @@ void cmGeneratorTarget::ExpandLinkItems(
dagChecker.SetTransitivePropertiesOnly(); dagChecker.SetTransitivePropertiesOnly();
} }
std::vector<std::string> libs; std::vector<std::string> libs;
cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(value); CM_AUTO_PTR<cmCompiledGeneratorExpression> cge = ge.Parse(value);
cmSystemTools::ExpandListArgument(cge->Evaluate(this->LocalGenerator, config, cmSystemTools::ExpandListArgument(cge->Evaluate(this->LocalGenerator, config,
false, headTarget, this, false, headTarget, this,
&dagChecker), &dagChecker),
@ -4246,8 +4245,7 @@ bool cmGeneratorTarget::ComputeOutputDir(const std::string& config,
if (const char* config_outdir = this->GetProperty(configProp)) { if (const char* config_outdir = this->GetProperty(configProp)) {
// Use the user-specified per-configuration output directory. // Use the user-specified per-configuration output directory.
cmGeneratorExpression ge; cmGeneratorExpression ge;
cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = CM_AUTO_PTR<cmCompiledGeneratorExpression> cge = ge.Parse(config_outdir);
ge.Parse(config_outdir);
out = cge->Evaluate(this->LocalGenerator, config); out = cge->Evaluate(this->LocalGenerator, config);
// Skip per-configuration subdirectory. // Skip per-configuration subdirectory.
@ -4255,7 +4253,7 @@ bool cmGeneratorTarget::ComputeOutputDir(const std::string& config,
} else if (const char* outdir = this->GetProperty(propertyName)) { } else if (const char* outdir = this->GetProperty(propertyName)) {
// Use the user-specified output directory. // Use the user-specified output directory.
cmGeneratorExpression ge; cmGeneratorExpression ge;
cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(outdir); CM_AUTO_PTR<cmCompiledGeneratorExpression> cge = ge.Parse(outdir);
out = cge->Evaluate(this->LocalGenerator, config); out = cge->Evaluate(this->LocalGenerator, config);
// Skip per-configuration subdirectory if the value contained a // Skip per-configuration subdirectory if the value contained a
@ -4990,7 +4988,7 @@ void cmGeneratorTarget::ComputeLinkImplementationLibraries(
cmGeneratorExpressionDAGChecker dagChecker( cmGeneratorExpressionDAGChecker dagChecker(
this->GetName(), "LINK_LIBRARIES", CM_NULLPTR, CM_NULLPTR); this->GetName(), "LINK_LIBRARIES", CM_NULLPTR, CM_NULLPTR);
cmGeneratorExpression ge(*btIt); cmGeneratorExpression ge(*btIt);
cmsys::auto_ptr<cmCompiledGeneratorExpression> const cge = ge.Parse(*le); CM_AUTO_PTR<cmCompiledGeneratorExpression> const cge = ge.Parse(*le);
std::string const evaluated = std::string const evaluated =
cge->Evaluate(this->LocalGenerator, config, false, head, &dagChecker); cge->Evaluate(this->LocalGenerator, config, false, head, &dagChecker);
cmSystemTools::ExpandListArgument(evaluated, llibs); cmSystemTools::ExpandListArgument(evaluated, llibs);

View File

@ -674,7 +674,7 @@ std::set<std::string> cmGlobalVisualStudio7Generator::IsPartOfDefaultBuild(
target->Target->GetMakefile()->GetDefinition( target->Target->GetMakefile()->GetDefinition(
"CMAKE_VS_INCLUDE_INSTALL_TO_DEFAULT_BUILD"); "CMAKE_VS_INCLUDE_INSTALL_TO_DEFAULT_BUILD");
cmGeneratorExpression ge; cmGeneratorExpression ge;
cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = CM_AUTO_PTR<cmCompiledGeneratorExpression> cge =
ge.Parse(propertyValue); ge.Parse(propertyValue);
if (cmSystemTools::IsOn( if (cmSystemTools::IsOn(
cge->Evaluate(target->GetLocalGenerator(), *i))) { cge->Evaluate(target->GetLocalGenerator(), *i))) {

View File

@ -24,7 +24,7 @@
#include "cmXCodeObject.h" #include "cmXCodeObject.h"
#include "cmake.h" #include "cmake.h"
#include <cmsys/auto_ptr.hxx> #include <cm_auto_ptr.hxx>
#if defined(CMAKE_BUILD_WITH_CMAKE) #if defined(CMAKE_BUILD_WITH_CMAKE)
#include "cmXMLParser.h" #include "cmXMLParser.h"
@ -175,7 +175,7 @@ cmGlobalGenerator* cmGlobalXCodeGenerator::Factory::CreateGlobalGenerator(
parser.ParseFile( parser.ParseFile(
"/Developer/Applications/Xcode.app/Contents/version.plist"); "/Developer/Applications/Xcode.app/Contents/version.plist");
} }
cmsys::auto_ptr<cmGlobalXCodeGenerator> gg( CM_AUTO_PTR<cmGlobalXCodeGenerator> gg(
new cmGlobalXCodeGenerator(cm, parser.Version)); new cmGlobalXCodeGenerator(cm, parser.Version));
if (gg->XcodeVersion == 20) { if (gg->XcodeVersion == 20) {
cmSystemTools::Message("Xcode 2.0 not really supported by cmake, " cmSystemTools::Message("Xcode 2.0 not really supported by cmake, "

View File

@ -64,9 +64,8 @@ void cmGraphVizWriter::ReadSettings(const char* settingsFileName,
cm.SetHomeOutputDirectory(""); cm.SetHomeOutputDirectory("");
cm.GetCurrentSnapshot().SetDefaultDefinitions(); cm.GetCurrentSnapshot().SetDefaultDefinitions();
cmGlobalGenerator ggi(&cm); cmGlobalGenerator ggi(&cm);
cmsys::auto_ptr<cmMakefile> mf( CM_AUTO_PTR<cmMakefile> mf(new cmMakefile(&ggi, cm.GetCurrentSnapshot()));
new cmMakefile(&ggi, cm.GetCurrentSnapshot())); CM_AUTO_PTR<cmLocalGenerator> lg(ggi.CreateLocalGenerator(mf.get()));
cmsys::auto_ptr<cmLocalGenerator> lg(ggi.CreateLocalGenerator(mf.get()));
const char* inFileName = settingsFileName; const char* inFileName = settingsFileName;

View File

@ -46,8 +46,7 @@ bool cmIfFunctionBlocker::IsFunctionBlocked(const cmListFileFunction& lff,
// if this is the endif for this if statement, then start executing // if this is the endif for this if statement, then start executing
if (!this->ScopeDepth) { if (!this->ScopeDepth) {
// Remove the function blocker for this scope or bail. // Remove the function blocker for this scope or bail.
cmsys::auto_ptr<cmFunctionBlocker> fb( CM_AUTO_PTR<cmFunctionBlocker> fb(mf.RemoveFunctionBlocker(this, lff));
mf.RemoveFunctionBlocker(this, lff));
if (!fb.get()) { if (!fb.get()) {
return false; return false;
} }

View File

@ -69,7 +69,7 @@ void cmInstallDirectoryGenerator::GenerateScriptForConfig(
cmGeneratorExpression ge; cmGeneratorExpression ge;
for (std::vector<std::string>::const_iterator i = this->Directories.begin(); for (std::vector<std::string>::const_iterator i = this->Directories.begin();
i != this->Directories.end(); ++i) { i != this->Directories.end(); ++i) {
cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(*i); CM_AUTO_PTR<cmCompiledGeneratorExpression> cge = ge.Parse(*i);
cmSystemTools::ExpandListArgument( cmSystemTools::ExpandListArgument(
cge->Evaluate(this->LocalGenerator, config), dirs); cge->Evaluate(this->LocalGenerator, config), dirs);
} }

View File

@ -90,7 +90,7 @@ void cmInstallFilesGenerator::GenerateScriptForConfig(
cmGeneratorExpression ge; cmGeneratorExpression ge;
for (std::vector<std::string>::const_iterator i = this->Files.begin(); for (std::vector<std::string>::const_iterator i = this->Files.begin();
i != this->Files.end(); ++i) { i != this->Files.end(); ++i) {
cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(*i); CM_AUTO_PTR<cmCompiledGeneratorExpression> cge = ge.Parse(*i);
cmSystemTools::ExpandListArgument( cmSystemTools::ExpandListArgument(
cge->Evaluate(this->LocalGenerator, config), files); cge->Evaluate(this->LocalGenerator, config), files);
} }

View File

@ -22,7 +22,7 @@
class cmInstalledFile class cmInstalledFile
{ {
public: public:
typedef cmsys::auto_ptr<cmCompiledGeneratorExpression> typedef CM_AUTO_PTR<cmCompiledGeneratorExpression>
CompiledGeneratorExpressionPtrType; CompiledGeneratorExpressionPtrType;
typedef std::vector<cmCompiledGeneratorExpression*> ExpressionVectorType; typedef std::vector<cmCompiledGeneratorExpression*> ExpressionVectorType;

View File

@ -30,8 +30,8 @@
#include "cmDependsJava.h" #include "cmDependsJava.h"
#endif #endif
#include <cm_auto_ptr.hxx>
#include <cmsys/Terminal.h> #include <cmsys/Terminal.h>
#include <cmsys/auto_ptr.hxx>
#include <algorithm> #include <algorithm>
#include <queue> #include <queue>
@ -121,7 +121,7 @@ void cmLocalUnixMakefileGenerator3::Generate()
if ((*t)->GetType() == cmState::INTERFACE_LIBRARY) { if ((*t)->GetType() == cmState::INTERFACE_LIBRARY) {
continue; continue;
} }
cmsys::auto_ptr<cmMakefileTargetGenerator> tg( CM_AUTO_PTR<cmMakefileTargetGenerator> tg(
cmMakefileTargetGenerator::New(*t)); cmMakefileTargetGenerator::New(*t));
if (tg.get()) { if (tg.get()) {
tg->WriteRuleFiles(); tg->WriteRuleFiles();

View File

@ -1850,7 +1850,7 @@ void cmLocalVisualStudio7Generator::OutputTargetRules(
if (!addedPrelink) { if (!addedPrelink) {
event.Write(target->GetPreLinkCommands()); event.Write(target->GetPreLinkCommands());
} }
cmsys::auto_ptr<cmCustomCommand> pcc( CM_AUTO_PTR<cmCustomCommand> pcc(
this->MaybeCreateImplibDir(target, configName, this->FortranProject)); this->MaybeCreateImplibDir(target, configName, this->FortranProject));
if (pcc.get()) { if (pcc.get()) {
event.Write(*pcc); event.Write(*pcc);

View File

@ -74,12 +74,12 @@ void cmLocalVisualStudioGenerator::ComputeObjectFilenames(
} }
} }
cmsys::auto_ptr<cmCustomCommand> CM_AUTO_PTR<cmCustomCommand>
cmLocalVisualStudioGenerator::MaybeCreateImplibDir(cmGeneratorTarget* target, cmLocalVisualStudioGenerator::MaybeCreateImplibDir(cmGeneratorTarget* target,
const std::string& config, const std::string& config,
bool isFortran) bool isFortran)
{ {
cmsys::auto_ptr<cmCustomCommand> pcc; CM_AUTO_PTR<cmCustomCommand> pcc;
// If an executable exports symbols then VS wants to create an // If an executable exports symbols then VS wants to create an
// import library but forgets to create the output directory. // import library but forgets to create the output directory.

View File

@ -16,7 +16,7 @@
#include "cmGlobalVisualStudioGenerator.h" #include "cmGlobalVisualStudioGenerator.h"
#include <cmsys/auto_ptr.hxx> #include <cm_auto_ptr.hxx>
class cmSourceFile; class cmSourceFile;
class cmSourceGroup; class cmSourceGroup;
@ -59,8 +59,9 @@ protected:
virtual bool CustomCommandUseLocal() const { return false; } virtual bool CustomCommandUseLocal() const { return false; }
/** Construct a custom command to make exe import lib dir. */ /** Construct a custom command to make exe import lib dir. */
cmsys::auto_ptr<cmCustomCommand> MaybeCreateImplibDir( CM_AUTO_PTR<cmCustomCommand> MaybeCreateImplibDir(cmGeneratorTarget* target,
cmGeneratorTarget* target, const std::string& config, bool isFortran); const std::string& config,
bool isFortran);
}; };
#endif #endif

View File

@ -35,10 +35,10 @@
#include "cmake.h" #include "cmake.h"
#include <stdlib.h> // required for atoi #include <stdlib.h> // required for atoi
#include <cm_auto_ptr.hxx>
#include <cmsys/FStream.hxx> #include <cmsys/FStream.hxx>
#include <cmsys/RegularExpression.hxx> #include <cmsys/RegularExpression.hxx>
#include <cmsys/SystemTools.hxx> #include <cmsys/SystemTools.hxx>
#include <cmsys/auto_ptr.hxx>
#include <assert.h> #include <assert.h>
#include <ctype.h> // for isspace #include <ctype.h> // for isspace
@ -262,7 +262,7 @@ bool cmMakefile::ExecuteCommand(const cmListFileFunction& lff,
// Lookup the command prototype. // Lookup the command prototype.
if (cmCommand* proto = this->GetState()->GetCommand(name)) { if (cmCommand* proto = this->GetState()->GetCommand(name)) {
// Clone the prototype. // Clone the prototype.
cmsys::auto_ptr<cmCommand> pcmd(proto->Clone()); CM_AUTO_PTR<cmCommand> pcmd(proto->Clone());
pcmd->SetMakefile(this); pcmd->SetMakefile(this);
// Decide whether to invoke the command. // Decide whether to invoke the command.
@ -589,9 +589,8 @@ void cmMakefile::EnforceDirectoryLevelRules() const
void cmMakefile::AddEvaluationFile( void cmMakefile::AddEvaluationFile(
const std::string& inputFile, const std::string& inputFile,
cmsys::auto_ptr<cmCompiledGeneratorExpression> outputName, CM_AUTO_PTR<cmCompiledGeneratorExpression> outputName,
cmsys::auto_ptr<cmCompiledGeneratorExpression> condition, CM_AUTO_PTR<cmCompiledGeneratorExpression> condition, bool inputIsContent)
bool inputIsContent)
{ {
this->EvaluationFiles.push_back(new cmGeneratorExpressionEvaluationFile( this->EvaluationFiles.push_back(new cmGeneratorExpressionEvaluationFile(
inputFile, outputName, condition, inputIsContent)); inputFile, outputName, condition, inputIsContent));
@ -2890,7 +2889,7 @@ void cmMakefile::PopFunctionBlockerBarrier(bool reportError)
FunctionBlockersType::size_type barrier = FunctionBlockersType::size_type barrier =
this->FunctionBlockerBarriers.back(); this->FunctionBlockerBarriers.back();
while (this->FunctionBlockers.size() > barrier) { while (this->FunctionBlockers.size() > barrier) {
cmsys::auto_ptr<cmFunctionBlocker> fb(this->FunctionBlockers.back()); CM_AUTO_PTR<cmFunctionBlocker> fb(this->FunctionBlockers.back());
this->FunctionBlockers.pop_back(); this->FunctionBlockers.pop_back();
if (reportError) { if (reportError) {
// Report the context in which the unclosed block was opened. // Report the context in which the unclosed block was opened.
@ -3027,7 +3026,7 @@ void cmMakefile::AddFunctionBlocker(cmFunctionBlocker* fb)
this->FunctionBlockers.push_back(fb); this->FunctionBlockers.push_back(fb);
} }
cmsys::auto_ptr<cmFunctionBlocker> cmMakefile::RemoveFunctionBlocker( CM_AUTO_PTR<cmFunctionBlocker> cmMakefile::RemoveFunctionBlocker(
cmFunctionBlocker* fb, const cmListFileFunction& lff) cmFunctionBlocker* fb, const cmListFileFunction& lff)
{ {
// Find the function blocker stack barrier for the current scope. // Find the function blocker stack barrier for the current scope.
@ -3060,11 +3059,11 @@ cmsys::auto_ptr<cmFunctionBlocker> cmMakefile::RemoveFunctionBlocker(
} }
cmFunctionBlocker* b = *pos; cmFunctionBlocker* b = *pos;
this->FunctionBlockers.erase(pos); this->FunctionBlockers.erase(pos);
return cmsys::auto_ptr<cmFunctionBlocker>(b); return CM_AUTO_PTR<cmFunctionBlocker>(b);
} }
} }
return cmsys::auto_ptr<cmFunctionBlocker>(); return CM_AUTO_PTR<cmFunctionBlocker>();
} }
const char* cmMakefile::GetHomeDirectory() const const char* cmMakefile::GetHomeDirectory() const
@ -3692,7 +3691,7 @@ cmTarget* cmMakefile::AddImportedTarget(const std::string& name,
cmState::TargetType type, bool global) cmState::TargetType type, bool global)
{ {
// Create the target. // Create the target.
cmsys::auto_ptr<cmTarget> target(new cmTarget); CM_AUTO_PTR<cmTarget> target(new cmTarget);
target->SetType(type, name); target->SetType(type, name);
target->MarkAsImported(global); target->MarkAsImported(global);
target->SetMakefile(this); target->SetMakefile(this);

View File

@ -28,8 +28,8 @@
#include "cmSourceGroup.h" #include "cmSourceGroup.h"
#endif #endif
#include <cm_auto_ptr.hxx>
#include <cmsys/RegularExpression.hxx> #include <cmsys/RegularExpression.hxx>
#include <cmsys/auto_ptr.hxx>
#if defined(CMAKE_BUILD_WITH_CMAKE) #if defined(CMAKE_BUILD_WITH_CMAKE)
#ifdef CMake_HAVE_CXX_UNORDERED_MAP #ifdef CMake_HAVE_CXX_UNORDERED_MAP
#include <unordered_map> #include <unordered_map>
@ -97,7 +97,7 @@ public:
* Remove the function blocker whose scope ends with the given command. * Remove the function blocker whose scope ends with the given command.
* This returns ownership of the function blocker object. * This returns ownership of the function blocker object.
*/ */
cmsys::auto_ptr<cmFunctionBlocker> RemoveFunctionBlocker( CM_AUTO_PTR<cmFunctionBlocker> RemoveFunctionBlocker(
cmFunctionBlocker* fb, const cmListFileFunction& lff); cmFunctionBlocker* fb, const cmListFileFunction& lff);
/** /**
@ -771,11 +771,10 @@ public:
void EnforceDirectoryLevelRules() const; void EnforceDirectoryLevelRules() const;
void AddEvaluationFile( void AddEvaluationFile(const std::string& inputFile,
const std::string& inputFile, CM_AUTO_PTR<cmCompiledGeneratorExpression> outputName,
cmsys::auto_ptr<cmCompiledGeneratorExpression> outputName, CM_AUTO_PTR<cmCompiledGeneratorExpression> condition,
cmsys::auto_ptr<cmCompiledGeneratorExpression> condition, bool inputIsContent);
bool inputIsContent);
std::vector<cmGeneratorExpressionEvaluationFile*> GetEvaluationFiles() const; std::vector<cmGeneratorExpressionEvaluationFile*> GetEvaluationFiles() const;
std::vector<cmExportBuildFileGenerator*> GetExportBuildFileGenerators() std::vector<cmExportBuildFileGenerator*> GetExportBuildFileGenerators()

View File

@ -134,7 +134,7 @@ void cmMakefileTargetGenerator::WriteTargetBuildRules()
if (const char* additional_clean_files = if (const char* additional_clean_files =
this->Makefile->GetProperty("ADDITIONAL_MAKE_CLEAN_FILES")) { this->Makefile->GetProperty("ADDITIONAL_MAKE_CLEAN_FILES")) {
cmGeneratorExpression ge; cmGeneratorExpression ge;
cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = CM_AUTO_PTR<cmCompiledGeneratorExpression> cge =
ge.Parse(additional_clean_files); ge.Parse(additional_clean_files);
cmSystemTools::ExpandListArgument( cmSystemTools::ExpandListArgument(

View File

@ -155,7 +155,7 @@ bool cmQtAutoGenerators::Run(const std::string& targetDirectory,
snapshot.GetDirectory().SetCurrentBinary(targetDirectory); snapshot.GetDirectory().SetCurrentBinary(targetDirectory);
snapshot.GetDirectory().SetCurrentSource(targetDirectory); snapshot.GetDirectory().SetCurrentSource(targetDirectory);
cmsys::auto_ptr<cmMakefile> mf(new cmMakefile(&gg, snapshot)); CM_AUTO_PTR<cmMakefile> mf(new cmMakefile(&gg, snapshot));
gg.SetCurrentMakefile(mf.get()); gg.SetCurrentMakefile(mf.get());
this->ReadAutogenInfoFile(mf.get(), targetDirectory, config); this->ReadAutogenInfoFile(mf.get(), targetDirectory, config);

View File

@ -89,7 +89,7 @@ bool cmStringCommand::HandleHashCommand(std::vector<std::string> const& args)
return false; return false;
} }
cmsys::auto_ptr<cmCryptoHash> hash(cmCryptoHash::New(args[0].c_str())); CM_AUTO_PTR<cmCryptoHash> hash(cmCryptoHash::New(args[0].c_str()));
if (hash.get()) { if (hash.get()) {
std::string out = hash->HashString(args[2]); std::string out = hash->HashString(args[2]);
this->Makefile->AddDefinition(args[1], out.c_str()); this->Makefile->AddDefinition(args[1], out.c_str());

View File

@ -19,7 +19,7 @@
#include "cmPolicies.h" #include "cmPolicies.h"
#include "cmPropertyMap.h" #include "cmPropertyMap.h"
#include <cmsys/auto_ptr.hxx> #include <cm_auto_ptr.hxx>
#if defined(CMAKE_BUILD_WITH_CMAKE) #if defined(CMAKE_BUILD_WITH_CMAKE)
#ifdef CMake_HAVE_CXX_UNORDERED_MAP #ifdef CMake_HAVE_CXX_UNORDERED_MAP
#include <unordered_map> #include <unordered_map>

View File

@ -13,7 +13,7 @@
#include "cmAlgorithms.h" #include "cmAlgorithms.h"
#include <cmsys/auto_ptr.hxx> #include <cm_auto_ptr.hxx>
static const char* const cmVariableWatchAccessStrings[] = { static const char* const cmVariableWatchAccessStrings[] = {
"READ_ACCESS", "UNKNOWN_READ_ACCESS", "UNKNOWN_DEFINED_ACCESS", "READ_ACCESS", "UNKNOWN_READ_ACCESS", "UNKNOWN_DEFINED_ACCESS",
@ -48,7 +48,7 @@ bool cmVariableWatch::AddWatch(const std::string& variable, WatchMethod method,
void* client_data /*=0*/, void* client_data /*=0*/,
DeleteData delete_data /*=0*/) DeleteData delete_data /*=0*/)
{ {
cmsys::auto_ptr<cmVariableWatch::Pair> p(new cmVariableWatch::Pair); CM_AUTO_PTR<cmVariableWatch::Pair> p(new cmVariableWatch::Pair);
p->Method = method; p->Method = method;
p->ClientData = client_data; p->ClientData = client_data;
p->DeleteDataCall = delete_data; p->DeleteDataCall = delete_data;

View File

@ -42,7 +42,7 @@
#include "cmVisualStudioGeneratorOptions.h" #include "cmVisualStudioGeneratorOptions.h"
#include "windows.h" #include "windows.h"
#include <cmsys/auto_ptr.hxx> #include <cm_auto_ptr.hxx>
cmIDEFlagTable const* cmVisualStudio10TargetGenerator::GetClFlagTable() const cmIDEFlagTable const* cmVisualStudio10TargetGenerator::GetClFlagTable() const
{ {
@ -1229,8 +1229,7 @@ void cmVisualStudio10TargetGenerator::WriteExtraSource(cmSourceFile const* sf)
if (!deployContent.empty()) { if (!deployContent.empty()) {
cmGeneratorExpression ge; cmGeneratorExpression ge;
cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = CM_AUTO_PTR<cmCompiledGeneratorExpression> cge = ge.Parse(deployContent);
ge.Parse(deployContent);
// Deployment location cannot be set on a configuration basis // Deployment location cannot be set on a configuration basis
if (!deployLocation.empty()) { if (!deployLocation.empty()) {
this->WriteString("<Link>", 3); this->WriteString("<Link>", 3);
@ -1684,7 +1683,7 @@ bool cmVisualStudio10TargetGenerator::ComputeClOptions(
// copied from cmLocalVisualStudio7Generator.cxx 805 // copied from cmLocalVisualStudio7Generator.cxx 805
// TODO: Integrate code below with cmLocalVisualStudio7Generator. // TODO: Integrate code below with cmLocalVisualStudio7Generator.
cmsys::auto_ptr<Options> pOptions(new Options( CM_AUTO_PTR<Options> pOptions(new Options(
this->LocalGenerator, Options::Compiler, this->GetClFlagTable())); this->LocalGenerator, Options::Compiler, this->GetClFlagTable()));
Options& clOptions = *pOptions; Options& clOptions = *pOptions;
@ -1848,7 +1847,7 @@ bool cmVisualStudio10TargetGenerator::ComputeRcOptions()
bool cmVisualStudio10TargetGenerator::ComputeRcOptions( bool cmVisualStudio10TargetGenerator::ComputeRcOptions(
std::string const& configName) std::string const& configName)
{ {
cmsys::auto_ptr<Options> pOptions(new Options( CM_AUTO_PTR<Options> pOptions(new Options(
this->LocalGenerator, Options::ResourceCompiler, this->GetRcFlagTable())); this->LocalGenerator, Options::ResourceCompiler, this->GetRcFlagTable()));
Options& rcOptions = *pOptions; Options& rcOptions = *pOptions;
@ -1905,7 +1904,7 @@ bool cmVisualStudio10TargetGenerator::ComputeMasmOptions()
bool cmVisualStudio10TargetGenerator::ComputeMasmOptions( bool cmVisualStudio10TargetGenerator::ComputeMasmOptions(
std::string const& configName) std::string const& configName)
{ {
cmsys::auto_ptr<Options> pOptions(new Options( CM_AUTO_PTR<Options> pOptions(new Options(
this->LocalGenerator, Options::MasmCompiler, this->GetMasmFlagTable())); this->LocalGenerator, Options::MasmCompiler, this->GetMasmFlagTable()));
Options& masmOptions = *pOptions; Options& masmOptions = *pOptions;
@ -2058,7 +2057,7 @@ void cmVisualStudio10TargetGenerator::WriteAntBuildOptions(
if (const char* nativeLibDirectoriesExpression = if (const char* nativeLibDirectoriesExpression =
this->GeneratorTarget->GetProperty("ANDROID_NATIVE_LIB_DIRECTORIES")) { this->GeneratorTarget->GetProperty("ANDROID_NATIVE_LIB_DIRECTORIES")) {
cmGeneratorExpression ge; cmGeneratorExpression ge;
cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = CM_AUTO_PTR<cmCompiledGeneratorExpression> cge =
ge.Parse(nativeLibDirectoriesExpression); ge.Parse(nativeLibDirectoriesExpression);
std::string nativeLibDirs = std::string nativeLibDirs =
cge->Evaluate(this->LocalGenerator, configName); cge->Evaluate(this->LocalGenerator, configName);
@ -2071,7 +2070,7 @@ void cmVisualStudio10TargetGenerator::WriteAntBuildOptions(
this->GeneratorTarget->GetProperty( this->GeneratorTarget->GetProperty(
"ANDROID_NATIVE_LIB_DEPENDENCIES")) { "ANDROID_NATIVE_LIB_DEPENDENCIES")) {
cmGeneratorExpression ge; cmGeneratorExpression ge;
cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = CM_AUTO_PTR<cmCompiledGeneratorExpression> cge =
ge.Parse(nativeLibDependenciesExpression); ge.Parse(nativeLibDependenciesExpression);
std::string nativeLibDeps = std::string nativeLibDeps =
cge->Evaluate(this->LocalGenerator, configName); cge->Evaluate(this->LocalGenerator, configName);
@ -2090,7 +2089,7 @@ void cmVisualStudio10TargetGenerator::WriteAntBuildOptions(
if (const char* jarDirectoriesExpression = if (const char* jarDirectoriesExpression =
this->GeneratorTarget->GetProperty("ANDROID_JAR_DIRECTORIES")) { this->GeneratorTarget->GetProperty("ANDROID_JAR_DIRECTORIES")) {
cmGeneratorExpression ge; cmGeneratorExpression ge;
cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = CM_AUTO_PTR<cmCompiledGeneratorExpression> cge =
ge.Parse(jarDirectoriesExpression); ge.Parse(jarDirectoriesExpression);
std::string jarDirectories = std::string jarDirectories =
cge->Evaluate(this->LocalGenerator, configName); cge->Evaluate(this->LocalGenerator, configName);
@ -2150,7 +2149,7 @@ bool cmVisualStudio10TargetGenerator::ComputeLinkOptions()
bool cmVisualStudio10TargetGenerator::ComputeLinkOptions( bool cmVisualStudio10TargetGenerator::ComputeLinkOptions(
std::string const& config) std::string const& config)
{ {
cmsys::auto_ptr<Options> pOptions(new Options( CM_AUTO_PTR<Options> pOptions(new Options(
this->LocalGenerator, Options::Linker, this->GetLinkFlagTable(), 0, this)); this->LocalGenerator, Options::Linker, this->GetLinkFlagTable(), 0, this));
Options& linkOptions = *pOptions; Options& linkOptions = *pOptions;

View File

@ -37,8 +37,7 @@ bool cmWhileFunctionBlocker::IsFunctionBlocked(const cmListFileFunction& lff,
// if this is the endwhile for this while loop then execute // if this is the endwhile for this while loop then execute
if (!this->Depth) { if (!this->Depth) {
// Remove the function blocker for this scope or bail. // Remove the function blocker for this scope or bail.
cmsys::auto_ptr<cmFunctionBlocker> fb( CM_AUTO_PTR<cmFunctionBlocker> fb(mf.RemoveFunctionBlocker(this, lff));
mf.RemoveFunctionBlocker(this, lff));
if (!fb.get()) { if (!fb.get()) {
return false; return false;
} }

221
Source/cm_auto_ptr.hxx Normal file
View File

@ -0,0 +1,221 @@
/*============================================================================
CMake - Cross Platform Makefile Generator
Copyright 2000-2016 Kitware, Inc.
Distributed under the OSI-approved BSD License (the "License");
see accompanying file Copyright.txt for details.
This software is distributed WITHOUT ANY WARRANTY; without even the
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the License for more information.
============================================================================*/
#ifndef CM_AUTO_PTR_HXX
#define CM_AUTO_PTR_HXX
#include <cmsys/Configure.hxx>
// FIXME: Use std::auto_ptr on compilers that do not warn about it.
#define CM_AUTO_PTR cm::auto_ptr
// The HP compiler cannot handle the conversions necessary to use
// auto_ptr_ref to pass an auto_ptr returned from one function
// directly to another function as in use_auto_ptr(get_auto_ptr()).
// We instead use const_cast to achieve the syntax on those platforms.
// We do not use const_cast on other platforms to maintain the C++
// standard design and guarantee that if an auto_ptr is bound
// to a reference-to-const then ownership will be maintained.
#if defined(__HP_aCC)
#define cm_AUTO_PTR_REF 0
#define cm_AUTO_PTR_CONST const
#define cm_AUTO_PTR_CAST(a) cast(a)
#else
#define cm_AUTO_PTR_REF 1
#define cm_AUTO_PTR_CONST
#define cm_AUTO_PTR_CAST(a) a
#endif
// In C++11, clang will warn about using dynamic exception specifications
// as they are deprecated. But as this class is trying to faithfully
// mimic std::auto_ptr, we want to keep the 'throw()' decorations below.
// So we suppress the warning.
#if defined(__clang__) && defined(__has_warning)
#if __has_warning("-Wdeprecated")
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated"
#endif
#endif
namespace cm {
template <class X>
class auto_ptr;
#if cm_AUTO_PTR_REF
namespace detail {
// The auto_ptr_ref template is supposed to be a private member of
// auto_ptr but Borland 5.8 cannot handle it. Instead put it in
// a private namespace.
template <class Y>
struct auto_ptr_ref
{
Y* p_;
// The extra constructor argument prevents implicit conversion to
// auto_ptr_ref from auto_ptr through the constructor. Normally
// this should be done with the explicit keyword but Borland 5.x
// generates code in the conversion operator to call itself
// infinately.
auto_ptr_ref(Y* p, int)
: p_(p)
{
}
};
}
#endif
/** C++98 Standard Section 20.4.5 - Template class auto_ptr. */
template <class X>
class auto_ptr
{
#if !cm_AUTO_PTR_REF
template <typename Y>
static inline auto_ptr<Y>& cast(auto_ptr<Y> const& a)
{
return const_cast<auto_ptr<Y>&>(a);
}
#endif
/** The pointer to the object held. */
X* x_;
public:
/** The type of object held by the auto_ptr. */
typedef X element_type;
/** Construct from an auto_ptr holding a compatible object. This
transfers ownership to the newly constructed auto_ptr. */
template <class Y>
auto_ptr(auto_ptr<Y> cm_AUTO_PTR_CONST& a) throw()
: x_(cm_AUTO_PTR_CAST(a).release())
{
}
/** Assign from an auto_ptr holding a compatible object. This
transfers ownership to the left-hand-side of the assignment. */
template <class Y>
auto_ptr& operator=(auto_ptr<Y> cm_AUTO_PTR_CONST& a) throw()
{
this->reset(cm_AUTO_PTR_CAST(a).release());
return *this;
}
/**
* Explicitly construct from a raw pointer. This is typically
* called with the result of operator new. For example:
*
* auto_ptr<X> ptr(new X());
*/
explicit auto_ptr(X* p = 0) throw()
: x_(p)
{
}
/** Construct from another auto_ptr holding an object of the same
type. This transfers ownership to the newly constructed
auto_ptr. */
auto_ptr(auto_ptr cm_AUTO_PTR_CONST& a) throw()
: x_(cm_AUTO_PTR_CAST(a).release())
{
}
/** Assign from another auto_ptr holding an object of the same type.
This transfers ownership to the newly constructed auto_ptr. */
auto_ptr& operator=(auto_ptr cm_AUTO_PTR_CONST& a) throw()
{
this->reset(cm_AUTO_PTR_CAST(a).release());
return *this;
}
/** Destruct and delete the object held. */
~auto_ptr() throw()
{
// Assume object destructor is nothrow.
delete this->x_;
}
/** Dereference and return a reference to the object held. */
X& operator*() const throw() { return *this->x_; }
/** Return a pointer to the object held. */
X* operator->() const throw() { return this->x_; }
/** Return a pointer to the object held. */
X* get() const throw() { return this->x_; }
/** Return a pointer to the object held and reset to hold no object.
This transfers ownership to the caller. */
X* release() throw()
{
X* x = this->x_;
this->x_ = 0;
return x;
}
/** Assume ownership of the given object. The object previously
held is deleted. */
void reset(X* p = 0) throw()
{
if (this->x_ != p) {
// Assume object destructor is nothrow.
delete this->x_;
this->x_ = p;
}
}
/** Convert to an auto_ptr holding an object of a compatible type.
This transfers ownership to the returned auto_ptr. */
template <class Y>
operator auto_ptr<Y>() throw()
{
return auto_ptr<Y>(this->release());
}
#if cm_AUTO_PTR_REF
/** Construct from an auto_ptr_ref. This is used when the
constructor argument is a call to a function returning an
auto_ptr. */
auto_ptr(detail::auto_ptr_ref<X> r) throw()
: x_(r.p_)
{
}
/** Assign from an auto_ptr_ref. This is used when a function
returning an auto_ptr is passed on the right-hand-side of an
assignment. */
auto_ptr& operator=(detail::auto_ptr_ref<X> r) throw()
{
this->reset(r.p_);
return *this;
}
/** Convert to an auto_ptr_ref. This is used when a function
returning an auto_ptr is the argument to the constructor of
another auto_ptr. */
template <class Y>
operator detail::auto_ptr_ref<Y>() throw()
{
return detail::auto_ptr_ref<Y>(this->release(), 1);
}
#endif
};
} // namespace cm
// Undo warning suppression.
#if defined(__clang__) && defined(__has_warning)
#if __has_warning("-Wdeprecated")
#pragma clang diagnostic pop
#endif
#endif
#endif

View File

@ -397,7 +397,7 @@ void cmake::ReadListFile(const std::vector<std::string>& args,
snapshot.GetDirectory().SetCurrentSource( snapshot.GetDirectory().SetCurrentSource(
cmSystemTools::GetCurrentWorkingDirectory()); cmSystemTools::GetCurrentWorkingDirectory());
snapshot.SetDefaultDefinitions(); snapshot.SetDefaultDefinitions();
cmsys::auto_ptr<cmMakefile> mf(new cmMakefile(gg, snapshot)); CM_AUTO_PTR<cmMakefile> mf(new cmMakefile(gg, snapshot));
if (this->GetWorkingMode() != NORMAL_MODE) { if (this->GetWorkingMode() != NORMAL_MODE) {
std::string file(cmSystemTools::CollapseFullPath(path)); std::string file(cmSystemTools::CollapseFullPath(path));
cmSystemTools::ConvertToUnixSlashes(file); cmSystemTools::ConvertToUnixSlashes(file);
@ -1743,7 +1743,7 @@ int cmake::CheckBuildSystem()
cm.SetHomeOutputDirectory(""); cm.SetHomeOutputDirectory("");
cm.GetCurrentSnapshot().SetDefaultDefinitions(); cm.GetCurrentSnapshot().SetDefaultDefinitions();
cmGlobalGenerator gg(&cm); cmGlobalGenerator gg(&cm);
cmsys::auto_ptr<cmMakefile> mf(new cmMakefile(&gg, cm.GetCurrentSnapshot())); CM_AUTO_PTR<cmMakefile> mf(new cmMakefile(&gg, cm.GetCurrentSnapshot()));
if (!mf->ReadListFile(this->CheckBuildSystemArgument.c_str()) || if (!mf->ReadListFile(this->CheckBuildSystemArgument.c_str()) ||
cmSystemTools::GetErrorOccuredFlag()) { cmSystemTools::GetErrorOccuredFlag()) {
if (verbose) { if (verbose) {
@ -1764,14 +1764,12 @@ int cmake::CheckBuildSystem()
} }
// Create the generator and use it to clear the dependencies. // Create the generator and use it to clear the dependencies.
cmsys::auto_ptr<cmGlobalGenerator> ggd( CM_AUTO_PTR<cmGlobalGenerator> ggd(this->CreateGlobalGenerator(genName));
this->CreateGlobalGenerator(genName));
if (ggd.get()) { if (ggd.get()) {
cm.GetCurrentSnapshot().SetDefaultDefinitions(); cm.GetCurrentSnapshot().SetDefaultDefinitions();
cmsys::auto_ptr<cmMakefile> mfd( CM_AUTO_PTR<cmMakefile> mfd(
new cmMakefile(ggd.get(), cm.GetCurrentSnapshot())); new cmMakefile(ggd.get(), cm.GetCurrentSnapshot()));
cmsys::auto_ptr<cmLocalGenerator> lgd( CM_AUTO_PTR<cmLocalGenerator> lgd(ggd->CreateLocalGenerator(mfd.get()));
ggd->CreateLocalGenerator(mfd.get()));
lgd->ClearDependencies(mfd.get(), verbose); lgd->ClearDependencies(mfd.get(), verbose);
} }
} }
@ -1911,7 +1909,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
cmsys::auto_ptr<cmGraphVizWriter> gvWriter( CM_AUTO_PTR<cmGraphVizWriter> gvWriter(
new cmGraphVizWriter(this->GetGlobalGenerator()->GetLocalGenerators())); new cmGraphVizWriter(this->GetGlobalGenerator()->GetLocalGenerators()));
std::string settingsFile = this->GetHomeOutputDirectory(); std::string settingsFile = this->GetHomeOutputDirectory();
@ -2392,7 +2390,7 @@ int cmake::Build(const std::string& dir, const std::string& target,
std::cerr << "Error: could not find CMAKE_GENERATOR in Cache\n"; std::cerr << "Error: could not find CMAKE_GENERATOR in Cache\n";
return 1; return 1;
} }
cmsys::auto_ptr<cmGlobalGenerator> gen( CM_AUTO_PTR<cmGlobalGenerator> gen(
this->CreateGlobalGenerator(cachedGenerator)); this->CreateGlobalGenerator(cachedGenerator));
if (!gen.get()) { if (!gen.get()) {
std::cerr << "Error: could create CMAKE_GENERATOR \"" << cachedGenerator std::cerr << "Error: could create CMAKE_GENERATOR \"" << cachedGenerator

View File

@ -765,9 +765,8 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
cmState::Snapshot snapshot = cm.GetCurrentSnapshot(); cmState::Snapshot snapshot = cm.GetCurrentSnapshot();
snapshot.GetDirectory().SetCurrentBinary(startOutDir); snapshot.GetDirectory().SetCurrentBinary(startOutDir);
snapshot.GetDirectory().SetCurrentSource(startDir); snapshot.GetDirectory().SetCurrentSource(startDir);
cmsys::auto_ptr<cmMakefile> mf(new cmMakefile(ggd, snapshot)); CM_AUTO_PTR<cmMakefile> mf(new cmMakefile(ggd, snapshot));
cmsys::auto_ptr<cmLocalGenerator> lgd( CM_AUTO_PTR<cmLocalGenerator> lgd(ggd->CreateLocalGenerator(mf.get()));
ggd->CreateLocalGenerator(mf.get()));
// Actually scan dependencies. // Actually scan dependencies.
return lgd->UpdateDependencies(depInfo.c_str(), verbose, color) ? 0 return lgd->UpdateDependencies(depInfo.c_str(), verbose, color) ? 0

View File

@ -365,7 +365,6 @@ KWSYS_CXX_SOURCES="\
SystemTools" SystemTools"
KWSYS_FILES="\ KWSYS_FILES="\
auto_ptr.hxx \
Directory.hxx \ Directory.hxx \
Encoding.h \ Encoding.h \
Encoding.hxx \ Encoding.hxx \