Commit ae5e97a0 authored by Albert Astals Cid's avatar Albert Astals Cid Committed by Brad King

Delete some default constructors and assignment operators

They are unused, but if someone used them they would lead to
problems since they would copy the internal raw pointers
and the destructor would cause double delete
parent e3353a01
...@@ -22,6 +22,9 @@ public: ...@@ -22,6 +22,9 @@ public:
cmCPackGeneratorFactory(); cmCPackGeneratorFactory();
~cmCPackGeneratorFactory(); ~cmCPackGeneratorFactory();
cmCPackGeneratorFactory(const cmCPackGeneratorFactory&) = delete;
cmCPackGeneratorFactory& operator=(const cmCPackGeneratorFactory&) = delete;
//! Get the generator //! Get the generator
cmCPackGenerator* NewGenerator(const std::string& name); cmCPackGenerator* NewGenerator(const std::string& name);
void DeleteGenerator(cmCPackGenerator* gen); void DeleteGenerator(cmCPackGenerator* gen);
......
...@@ -26,6 +26,9 @@ public: ...@@ -26,6 +26,9 @@ public:
cmCPackLog(); cmCPackLog();
~cmCPackLog(); ~cmCPackLog();
cmCPackLog(const cmCPackLog&) = delete;
cmCPackLog& operator=(const cmCPackLog&) = delete;
enum __log_tags enum __log_tags
{ {
NOTAG = 0, NOTAG = 0,
......
...@@ -140,6 +140,11 @@ public: ...@@ -140,6 +140,11 @@ public:
cmSystemTools::SetStdoutCallback(nullptr); cmSystemTools::SetStdoutCallback(nullptr);
cmSystemTools::SetMessageCallback(nullptr); cmSystemTools::SetMessageCallback(nullptr);
} }
cmCTestBuildAndTestCaptureRAII(const cmCTestBuildAndTestCaptureRAII&) =
delete;
cmCTestBuildAndTestCaptureRAII& operator=(
const cmCTestBuildAndTestCaptureRAII&) = delete;
}; };
int cmCTestBuildAndTestHandler::RunCMakeAndTest(std::string* outstring) int cmCTestBuildAndTestHandler::RunCMakeAndTest(std::string* outstring)
......
...@@ -680,6 +680,8 @@ class cmCTestBuildHandler::LaunchHelper ...@@ -680,6 +680,8 @@ class cmCTestBuildHandler::LaunchHelper
public: public:
LaunchHelper(cmCTestBuildHandler* handler); LaunchHelper(cmCTestBuildHandler* handler);
~LaunchHelper(); ~LaunchHelper();
LaunchHelper(const LaunchHelper&) = delete;
LaunchHelper& operator=(const LaunchHelper&) = delete;
private: private:
cmCTestBuildHandler* Handler; cmCTestBuildHandler* Handler;
......
...@@ -52,6 +52,8 @@ public: ...@@ -52,6 +52,8 @@ public:
} }
cmsysProcess_Delete(this->Process); cmsysProcess_Delete(this->Process);
} }
cmCTestRunProcess(const cmCTestRunProcess&) = delete;
cmCTestRunProcess& operator=(const cmCTestRunProcess&) = delete;
void SetCommand(const char* command) void SetCommand(const char* command)
{ {
this->CommandLineStrings.clear(); this->CommandLineStrings.clear();
...@@ -786,6 +788,9 @@ struct cmCTestCoverageHandlerLocale ...@@ -786,6 +788,9 @@ struct cmCTestCoverageHandlerLocale
cmSystemTools::UnsetEnv("LC_ALL"); cmSystemTools::UnsetEnv("LC_ALL");
} }
} }
cmCTestCoverageHandlerLocale(const cmCTestCoverageHandlerLocale&) = delete;
cmCTestCoverageHandlerLocale& operator=(
const cmCTestCoverageHandlerLocale&) = delete;
std::string lc_all; std::string lc_all;
}; };
......
...@@ -16,6 +16,8 @@ class cmCTestCurl ...@@ -16,6 +16,8 @@ class cmCTestCurl
public: public:
cmCTestCurl(cmCTest*); cmCTestCurl(cmCTest*);
~cmCTestCurl(); ~cmCTestCurl();
cmCTestCurl(const cmCTestCurl&) = delete;
cmCTestCurl& operator=(const cmCTestCurl&) = delete;
bool UploadFile(std::string const& local_file, std::string const& url, bool UploadFile(std::string const& local_file, std::string const& url,
std::string const& fields, std::string& response); std::string const& fields, std::string& response);
bool HttpRequest(std::string const& url, std::string const& fields, bool HttpRequest(std::string const& url, std::string const& fields,
......
...@@ -76,6 +76,8 @@ public: ...@@ -76,6 +76,8 @@ public:
} }
} }
} }
SaveRestoreErrorState(const SaveRestoreErrorState&) = delete;
SaveRestoreErrorState& operator=(const SaveRestoreErrorState&) = delete;
private: private:
bool InitialErrorState; bool InitialErrorState;
......
...@@ -28,6 +28,9 @@ private: ...@@ -28,6 +28,9 @@ private:
cmCTestLaunch(int argc, const char* const* argv); cmCTestLaunch(int argc, const char* const* argv);
~cmCTestLaunch(); ~cmCTestLaunch();
cmCTestLaunch(const cmCTestLaunch&) = delete;
cmCTestLaunch& operator=(const cmCTestLaunch&) = delete;
// Run the real command. // Run the real command.
int Run(); int Run();
void RunChild(); void RunChild();
......
...@@ -54,6 +54,8 @@ public: ...@@ -54,6 +54,8 @@ public:
{ {
} }
~Entry() { archive_entry_free(this->Object); } ~Entry() { archive_entry_free(this->Object); }
Entry(const Entry&) = delete;
Entry& operator=(const Entry&) = delete;
operator struct archive_entry*() { return this->Object; } operator struct archive_entry*() { return this->Object; }
}; };
......
...@@ -58,6 +58,9 @@ public: ...@@ -58,6 +58,9 @@ public:
~cmArchiveWrite(); ~cmArchiveWrite();
cmArchiveWrite(const cmArchiveWrite&) = delete;
cmArchiveWrite& operator=(const cmArchiveWrite&) = delete;
/** /**
* Add a path (file or directory) to the archive. Directories are * Add a path (file or directory) to the archive. Directories are
* added recursively. The "path" must be readable on disk, either * added recursively. The "path" must be readable on disk, either
......
...@@ -491,12 +491,16 @@ public: ...@@ -491,12 +491,16 @@ public:
typedef std::map<cmSourceFile*, cmCPluginAPISourceFile*> derived; typedef std::map<cmSourceFile*, cmCPluginAPISourceFile*> derived;
typedef derived::iterator iterator; typedef derived::iterator iterator;
typedef derived::value_type value_type; typedef derived::value_type value_type;
cmCPluginAPISourceFileMap() = default;
~cmCPluginAPISourceFileMap() ~cmCPluginAPISourceFileMap()
{ {
for (auto const& i : *this) { for (auto const& i : *this) {
delete i.second; delete i.second;
} }
} }
cmCPluginAPISourceFileMap(const cmCPluginAPISourceFileMap&) = delete;
cmCPluginAPISourceFileMap& operator=(const cmCPluginAPISourceFileMap&) =
delete;
}; };
cmCPluginAPISourceFileMap cmCPluginAPISourceFiles; cmCPluginAPISourceFileMap cmCPluginAPISourceFiles;
......
...@@ -182,6 +182,9 @@ public: ...@@ -182,6 +182,9 @@ public:
cmCTest(); cmCTest();
~cmCTest(); ~cmCTest();
cmCTest(const cmCTest&) = delete;
cmCTest& operator=(const cmCTest&) = delete;
/** Set the notes files to be created. */ /** Set the notes files to be created. */
void SetNotesFiles(const char* notes); void SetNotesFiles(const char* notes);
......
...@@ -31,6 +31,9 @@ public: ...@@ -31,6 +31,9 @@ public:
const std::string& config); const std::string& config);
~cmComputeLinkDepends(); ~cmComputeLinkDepends();
cmComputeLinkDepends(const cmComputeLinkDepends&) = delete;
cmComputeLinkDepends& operator=(const cmComputeLinkDepends&) = delete;
// Basic information about each link item. // Basic information about each link item.
struct LinkEntry struct LinkEntry
{ {
......
...@@ -32,6 +32,9 @@ public: ...@@ -32,6 +32,9 @@ public:
cmCustomCommandGenerator(cmCustomCommand const& cc, std::string config, cmCustomCommandGenerator(cmCustomCommand const& cc, std::string config,
cmLocalGenerator* lg); cmLocalGenerator* lg);
~cmCustomCommandGenerator(); ~cmCustomCommandGenerator();
cmCustomCommandGenerator(const cmCustomCommandGenerator&) = delete;
cmCustomCommandGenerator& operator=(const cmCustomCommandGenerator&) =
delete;
cmCustomCommand const& GetCC() const { return this->CC; } cmCustomCommand const& GetCC() const { return this->CC; }
unsigned int GetNumberOfCommands() const; unsigned int GetNumberOfCommands() const;
std::string GetCommand(unsigned int c) const; std::string GetCommand(unsigned int c) const;
......
...@@ -24,6 +24,10 @@ public: ...@@ -24,6 +24,10 @@ public:
cmDependsJavaParserHelper(); cmDependsJavaParserHelper();
~cmDependsJavaParserHelper(); ~cmDependsJavaParserHelper();
cmDependsJavaParserHelper(const cmDependsJavaParserHelper&) = delete;
cmDependsJavaParserHelper& operator=(const cmDependsJavaParserHelper&) =
delete;
int ParseString(const char* str, int verb); int ParseString(const char* str, int verb);
int ParseFile(const char* file); int ParseFile(const char* file);
......
...@@ -28,6 +28,9 @@ public: ...@@ -28,6 +28,9 @@ public:
/** Destruct. */ /** Destruct. */
~cmELF(); ~cmELF();
cmELF(const cmELF&) = delete;
cmELF& operator=(const cmELF&) = delete;
/** Get the error message if any. */ /** Get the error message if any. */
std::string const& GetErrorMessage() const { return this->ErrorMessage; } std::string const& GetErrorMessage() const { return this->ErrorMessage; }
......
...@@ -25,6 +25,9 @@ public: ...@@ -25,6 +25,9 @@ public:
/// Destructor /// Destructor
~cmExportSet(); ~cmExportSet();
cmExportSet(const cmExportSet&) = delete;
cmExportSet& operator=(const cmExportSet&) = delete;
void Compute(cmLocalGenerator* lg); void Compute(cmLocalGenerator* lg);
void AddTargetExport(cmTargetExport* tgt); void AddTargetExport(cmTargetExport* tgt);
......
...@@ -23,6 +23,8 @@ void cmExportSetMap::clear() ...@@ -23,6 +23,8 @@ void cmExportSetMap::clear()
this->derived::clear(); this->derived::clear();
} }
cmExportSetMap::cmExportSetMap() = default;
cmExportSetMap::~cmExportSetMap() cmExportSetMap::~cmExportSetMap()
{ {
this->clear(); this->clear();
......
...@@ -25,8 +25,13 @@ public: ...@@ -25,8 +25,13 @@ public:
void clear(); void clear();
cmExportSetMap();
/// Overloaded destructor deletes all member export sets. /// Overloaded destructor deletes all member export sets.
~cmExportSetMap(); ~cmExportSetMap();
cmExportSetMap(const cmExportSetMap&) = delete;
cmExportSetMap& operator=(const cmExportSetMap&) = delete;
}; };
#endif #endif
...@@ -2691,6 +2691,9 @@ public: ...@@ -2691,6 +2691,9 @@ public:
} }
} }
cURLEasyGuard(const cURLEasyGuard&) = delete;
cURLEasyGuard& operator=(const cURLEasyGuard&) = delete;
void release() { this->Easy = nullptr; } void release() { this->Easy = nullptr; }
private: private:
......
...@@ -20,6 +20,9 @@ public: ...@@ -20,6 +20,9 @@ public:
cmFileTimeComparison(); cmFileTimeComparison();
~cmFileTimeComparison(); ~cmFileTimeComparison();
cmFileTimeComparison(const cmFileTimeComparison&) = delete;
cmFileTimeComparison& operator=(const cmFileTimeComparison&) = delete;
/** /**
* Compare file modification times. * Compare file modification times.
* Return true for successful comparison and false for error. * Return true for successful comparison and false for error.
......
...@@ -1372,6 +1372,9 @@ public: ...@@ -1372,6 +1372,9 @@ public:
cmSystemTools::RemoveFile(this->File); cmSystemTools::RemoveFile(this->File);
} }
} }
cmFindPackageCommandHoldFile(const cmFindPackageCommandHoldFile&) = delete;
cmFindPackageCommandHoldFile& operator=(
const cmFindPackageCommandHoldFile&) = delete;
void Release() { this->File = nullptr; } void Release() { this->File = nullptr; }
}; };
......
...@@ -141,6 +141,9 @@ struct cmFortranParser_s ...@@ -141,6 +141,9 @@ struct cmFortranParser_s
std::set<std::string> defines, cmFortranSourceInfo& info); std::set<std::string> defines, cmFortranSourceInfo& info);
~cmFortranParser_s(); ~cmFortranParser_s();
cmFortranParser_s(const cmFortranParser_s&) = delete;
cmFortranParser_s& operator=(const cmFortranParser_s&) = delete;
bool FindIncludeFile(const char* dir, const char* includeName, bool FindIncludeFile(const char* dir, const char* includeName,
std::string& fileName); std::string& fileName);
......
...@@ -32,6 +32,9 @@ public: ...@@ -32,6 +32,9 @@ public:
Property(); Property();
~Property(); ~Property();
Property(const Property&) = delete;
Property& operator=(const Property&) = delete;
ExpressionVectorType ValueExpressions; ExpressionVectorType ValueExpressions;
}; };
...@@ -41,6 +44,9 @@ public: ...@@ -41,6 +44,9 @@ public:
~cmInstalledFile(); ~cmInstalledFile();
cmInstalledFile(const cmInstalledFile&) = delete;
cmInstalledFile& operator=(const cmInstalledFile&) = delete;
void RemoveProperty(const std::string& prop); void RemoveProperty(const std::string& prop);
void SetProperty(cmMakefile const* mf, const std::string& prop, void SetProperty(cmMakefile const* mf, const std::string& prop,
......
...@@ -27,6 +27,8 @@ struct cmListFileParser ...@@ -27,6 +27,8 @@ struct cmListFileParser
cmListFileParser(cmListFile* lf, cmListFileBacktrace lfbt, cmListFileParser(cmListFile* lf, cmListFileBacktrace lfbt,
cmMessenger* messenger, const char* filename); cmMessenger* messenger, const char* filename);
~cmListFileParser(); ~cmListFileParser();
cmListFileParser(const cmListFileParser&) = delete;
cmListFileParser& operator=(const cmListFileParser&) = delete;
void IssueFileOpenError(std::string const& text) const; void IssueFileOpenError(std::string const& text) const;
void IssueError(std::string const& text) const; void IssueError(std::string const& text) const;
bool ParseFile(); bool ParseFile();
......
...@@ -348,6 +348,9 @@ public: ...@@ -348,6 +348,9 @@ public:
this->Makefile->Backtrace = this->Makefile->Backtrace.Pop(); this->Makefile->Backtrace = this->Makefile->Backtrace.Pop();
} }
cmMakefileCall(const cmMakefileCall&) = delete;
cmMakefileCall& operator=(const cmMakefileCall&) = delete;
private: private:
cmMakefile* Makefile; cmMakefile* Makefile;
}; };
...@@ -439,6 +442,9 @@ public: ...@@ -439,6 +442,9 @@ public:
~IncludeScope(); ~IncludeScope();
void Quiet() { this->ReportError = false; } void Quiet() { this->ReportError = false; }
IncludeScope(const IncludeScope&) = delete;
IncludeScope& operator=(const IncludeScope&) = delete;
private: private:
cmMakefile* Makefile; cmMakefile* Makefile;
bool NoPolicyScope; bool NoPolicyScope;
...@@ -606,6 +612,9 @@ public: ...@@ -606,6 +612,9 @@ public:
void Quiet() { this->ReportError = false; } void Quiet() { this->ReportError = false; }
ListFileScope(const ListFileScope&) = delete;
ListFileScope& operator=(const ListFileScope&) = delete;
private: private:
cmMakefile* Makefile; cmMakefile* Makefile;
bool ReportError; bool ReportError;
...@@ -1497,6 +1506,9 @@ public: ...@@ -1497,6 +1506,9 @@ public:
void Quiet() { this->ReportError = false; } void Quiet() { this->ReportError = false; }
BuildsystemFileScope(const BuildsystemFileScope&) = delete;
BuildsystemFileScope& operator=(const BuildsystemFileScope&) = delete;
private: private:
cmMakefile* Makefile; cmMakefile* Makefile;
cmGlobalGenerator* GG; cmGlobalGenerator* GG;
......
...@@ -313,6 +313,9 @@ public: ...@@ -313,6 +313,9 @@ public:
PolicyPushPop(cmMakefile* m); PolicyPushPop(cmMakefile* m);
~PolicyPushPop(); ~PolicyPushPop();
PolicyPushPop(const PolicyPushPop&) = delete;
PolicyPushPop& operator=(const PolicyPushPop&) = delete;
private: private:
cmMakefile* Makefile; cmMakefile* Makefile;
}; };
...@@ -743,6 +746,9 @@ public: ...@@ -743,6 +746,9 @@ public:
cmPolicies::PolicyMap const& pm); cmPolicies::PolicyMap const& pm);
~FunctionPushPop(); ~FunctionPushPop();
FunctionPushPop(const FunctionPushPop&) = delete;
FunctionPushPop& operator=(const FunctionPushPop&) = delete;
void Quiet() { this->ReportError = false; } void Quiet() { this->ReportError = false; }
private: private:
...@@ -757,6 +763,9 @@ public: ...@@ -757,6 +763,9 @@ public:
cmPolicies::PolicyMap const& pm); cmPolicies::PolicyMap const& pm);
~MacroPushPop(); ~MacroPushPop();
MacroPushPop(const MacroPushPop&) = delete;
MacroPushPop& operator=(const MacroPushPop&) = delete;
void Quiet() { this->ReportError = false; } void Quiet() { this->ReportError = false; }
private: private:
......
...@@ -25,6 +25,8 @@ public: ...@@ -25,6 +25,8 @@ public:
cmOrderDirectories(cmGlobalGenerator* gg, cmGeneratorTarget const* target, cmOrderDirectories(cmGlobalGenerator* gg, cmGeneratorTarget const* target,
const char* purpose); const char* purpose);
~cmOrderDirectories(); ~cmOrderDirectories();
cmOrderDirectories(const cmOrderDirectories&) = delete;
cmOrderDirectories& operator=(const cmOrderDirectories&) = delete;
void AddRuntimeLibrary(std::string const& fullPath, void AddRuntimeLibrary(std::string const& fullPath,
const char* soname = nullptr); const char* soname = nullptr);
void AddLinkLibrary(std::string const& fullPath); void AddLinkLibrary(std::string const& fullPath);
......
...@@ -92,6 +92,9 @@ public: ...@@ -92,6 +92,9 @@ public:
*/ */
~cmLBDepend() { cmDeleteAll(this->DependInformationMap); } ~cmLBDepend() { cmDeleteAll(this->DependInformationMap); }
cmLBDepend(const cmLBDepend&) = delete;
cmLBDepend& operator=(const cmLBDepend&) = delete;
/** /**
* Set the makefile that is used as a source of classes. * Set the makefile that is used as a source of classes.
*/ */
......
...@@ -34,6 +34,9 @@ public: ...@@ -34,6 +34,9 @@ public:
~cmSourceFile(); ~cmSourceFile();
cmSourceFile(const cmSourceFile&) = delete;
cmSourceFile& operator=(const cmSourceFile&) = delete;
/** /**
* Get the list of the custom commands for this source file * Get the list of the custom commands for this source file
*/ */
......
...@@ -35,6 +35,9 @@ public: ...@@ -35,6 +35,9 @@ public:
cmState(); cmState();
~cmState(); ~cmState();
cmState(const cmState&) = delete;
cmState& operator=(const cmState&) = delete;
enum Mode enum Mode
{ {
Unknown, Unknown,
......
...@@ -521,6 +521,8 @@ public: ...@@ -521,6 +521,8 @@ public:
} }
free(this->ArgV); free(this->ArgV);
} }
cmSystemToolsArgV(const cmSystemToolsArgV&) = delete;
cmSystemToolsArgV& operator=(const cmSystemToolsArgV&) = delete;
void Store(std::vector<std::string>& args) const void Store(std::vector<std::string>& args) const
{ {
for (char** arg = this->ArgV; arg && *arg; ++arg) { for (char** arg = this->ArgV; arg && *arg; ++arg) {
...@@ -533,7 +535,7 @@ void cmSystemTools::ParseUnixCommandLine(const char* command, ...@@ -533,7 +535,7 @@ void cmSystemTools::ParseUnixCommandLine(const char* command,
std::vector<std::string>& args) std::vector<std::string>& args)
{ {
// Invoke the underlying parser. // Invoke the underlying parser.
cmSystemToolsArgV argv = cmsysSystem_Parse_CommandForUnix(command, 0); cmSystemToolsArgV argv(cmsysSystem_Parse_CommandForUnix(command, 0));
argv.Store(args); argv.Store(args);
} }
......
...@@ -72,6 +72,9 @@ protected: ...@@ -72,6 +72,9 @@ protected:
this->DeleteDataCall(this->ClientData); this->DeleteDataCall(this->ClientData);
} }
} }
Pair() = default;
Pair(const Pair&) = delete;
Pair& operator=(const Pair&) = delete;
}; };
typedef std::vector<std::shared_ptr<Pair>> VectorOfPairs; typedef std::vector<std::shared_ptr<Pair>> VectorOfPairs;
......
...@@ -22,6 +22,9 @@ public: ...@@ -22,6 +22,9 @@ public:
cmWorkingDirectory(std::string const& newdir); cmWorkingDirectory(std::string const& newdir);
~cmWorkingDirectory(); ~cmWorkingDirectory();
cmWorkingDirectory(const cmWorkingDirectory&) = delete;
cmWorkingDirectory& operator=(const cmWorkingDirectory&) = delete;
bool SetDirectory(std::string const& newdir); bool SetDirectory(std::string const& newdir);
void Pop(); void Pop();
bool Failed() const { return ResultCode != 0; } bool Failed() const { return ResultCode != 0; }
......
...@@ -146,6 +146,8 @@ public: ...@@ -146,6 +146,8 @@ public:
xmlwr.StartDocument(); xmlwr.StartDocument();
} }
~cmXMLDocument() { xmlwr.EndDocument(); } ~cmXMLDocument() { xmlwr.EndDocument(); }
cmXMLDocument(const cmXMLDocument&) = delete;
cmXMLDocument& operator=(const cmXMLDocument&) = delete;
private: private:
friend class cmXMLElement; friend class cmXMLElement;
...@@ -172,6 +174,9 @@ public: ...@@ -172,6 +174,9 @@ public:
} }
~cmXMLElement() { xmlwr.EndElement(); } ~cmXMLElement() { xmlwr.EndElement(); }
cmXMLElement(const cmXMLElement&) = delete;
cmXMLElement& operator=(const cmXMLElement&) = delete;
template <typename T> template <typename T>
cmXMLElement& Attribute(const char* name, T const& value) cmXMLElement& Attribute(const char* name, T const& value)
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment