diff options
author | Sean McBride <sean@rogue-research.com> | 2021-10-14 16:13:23 (GMT) |
---|---|---|
committer | Sean McBride <sean@rogue-research.com> | 2021-10-15 15:23:12 (GMT) |
commit | e2a4718d186d4848bae2beb926279ea334e0fef3 (patch) | |
tree | c5f6f7ed5526d131bc534cb6bd6a86c00361f917 | |
parent | 315fc296e3c1ecddbf59a2144b0dff9a05c715ed (diff) | |
download | CMake-e2a4718d186d4848bae2beb926279ea334e0fef3.zip CMake-e2a4718d186d4848bae2beb926279ea334e0fef3.tar.gz CMake-e2a4718d186d4848bae2beb926279ea334e0fef3.tar.bz2 |
Source: Fix Clang -Wdeprecated warnings
Applied C++ 'rule of three'.
-rw-r--r-- | Source/CTest/cmCTestTestHandler.cxx | 2 | ||||
-rw-r--r-- | Source/cmCMakePresetsFile.h | 18 | ||||
-rw-r--r-- | Source/cmFileTime.h | 2 | ||||
-rw-r--r-- | Source/cmSearchPath.h | 3 | ||||
-rw-r--r-- | Source/cm_codecvt.cxx | 6 | ||||
-rw-r--r-- | Source/cm_codecvt.hxx | 6 |
6 files changed, 23 insertions, 14 deletions
diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx index 6e97a83..34088d2 100644 --- a/Source/CTest/cmCTestTestHandler.cxx +++ b/Source/CTest/cmCTestTestHandler.cxx @@ -59,6 +59,8 @@ public: } virtual ~cmCTestCommand() = default; + cmCTestCommand(const cmCTestCommand&) = default; + cmCTestCommand& operator=(const cmCTestCommand&) = default; bool operator()(std::vector<cmListFileArgument> const& args, cmExecutionStatus& status) diff --git a/Source/cmCMakePresetsFile.h b/Source/cmCMakePresetsFile.h index 7aa9b6a..c48a1f8 100644 --- a/Source/cmCMakePresetsFile.h +++ b/Source/cmCMakePresetsFile.h @@ -60,18 +60,20 @@ public: class Preset { public: -#if __cplusplus < 201703L && (!defined(_MSVC_LANG) || _MSVC_LANG < 201703L) + Preset() = default; + Preset(Preset&& /*other*/) = default; + Preset(const Preset& /*other*/) = default; + Preset& operator=(const Preset& /*other*/) = default; + virtual ~Preset() = default; +#if __cplusplus >= 201703L || (defined(_MSVC_LANG) && _MSVC_LANG >= 201703L) + Preset& operator=(Preset&& /*other*/) = default; +#else // The move assignment operators for several STL classes did not become // noexcept until C++17, which causes some tools to warn about this move - // assignment operator throwing an exception when it shouldn't. Disable the - // move assignment operator until C++17 is enabled. - // Explicitly defining a copy assignment operator prevents the compiler - // from automatically generating a move assignment operator. - Preset& operator=(const Preset& /*other*/) = default; + // assignment operator throwing an exception when it shouldn't. + Preset& operator=(Preset&& /*other*/) = delete; #endif - virtual ~Preset() = default; - std::string Name; std::vector<std::string> Inherits; bool Hidden; diff --git a/Source/cmFileTime.h b/Source/cmFileTime.h index 4419880..ccc9633 100644 --- a/Source/cmFileTime.h +++ b/Source/cmFileTime.h @@ -24,6 +24,8 @@ public: #endif cmFileTime() = default; ~cmFileTime() = default; + cmFileTime(const cmFileTime&) = default; + cmFileTime& operator=(const cmFileTime&) = default; /** * @brief Loads the file time of fileName from the file system diff --git a/Source/cmSearchPath.h b/Source/cmSearchPath.h index c15cb97..09f9722 100644 --- a/Source/cmSearchPath.h +++ b/Source/cmSearchPath.h @@ -26,6 +26,9 @@ public: cmSearchPath(cmFindCommon* findCmd = nullptr); ~cmSearchPath(); + cmSearchPath(const cmSearchPath&) = default; + cmSearchPath& operator=(const cmSearchPath&) = default; + const std::vector<std::string>& GetPaths() const { return this->Paths; } std::size_t size() const { return this->Paths.size(); } diff --git a/Source/cm_codecvt.cxx b/Source/cm_codecvt.cxx index 216d3f0..df4440f 100644 --- a/Source/cm_codecvt.cxx +++ b/Source/cm_codecvt.cxx @@ -42,7 +42,7 @@ codecvt::codecvt(Encoding e) codecvt::~codecvt() = default; -bool codecvt::do_always_noconv() const throw() +bool codecvt::do_always_noconv() const noexcept { return this->m_noconv; } @@ -234,12 +234,12 @@ void codecvt::BufferPartial(mbstate_t& state, int size, } #endif -int codecvt::do_max_length() const throw() +int codecvt::do_max_length() const noexcept { return 4; } -int codecvt::do_encoding() const throw() +int codecvt::do_encoding() const noexcept { return 0; } diff --git a/Source/cm_codecvt.hxx b/Source/cm_codecvt.hxx index b73204f..9af083f 100644 --- a/Source/cm_codecvt.hxx +++ b/Source/cm_codecvt.hxx @@ -24,14 +24,14 @@ public: protected: ~codecvt() override; - bool do_always_noconv() const throw() override; + bool do_always_noconv() const noexcept override; result do_out(mbstate_t& state, const char* from, const char* from_end, const char*& from_next, char* to, char* to_end, char*& to_next) const override; result do_unshift(mbstate_t& state, char* to, char*, char*& to_next) const override; - int do_max_length() const throw() override; - int do_encoding() const throw() override; + int do_max_length() const noexcept override; + int do_encoding() const noexcept override; private: // The mbstate_t argument to do_out and do_unshift is responsible |