diff options
author | Brad King <brad.king@kitware.com> | 2021-10-27 13:23:42 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2021-10-27 13:24:01 (GMT) |
commit | db422ae0c7b3b871c067c9afcd2b0d8a43376ff6 (patch) | |
tree | 72e8df50b7c3f6905bb19847960e19915f64c20d | |
parent | 9bb7982a15e51b0336e58d4cafc20529ec50550d (diff) | |
parent | 8f8f73712a35a634c7c0a19bef9ee1eb597a8cb4 (diff) | |
download | CMake-db422ae0c7b3b871c067c9afcd2b0d8a43376ff6.zip CMake-db422ae0c7b3b871c067c9afcd2b0d8a43376ff6.tar.gz CMake-db422ae0c7b3b871c067c9afcd2b0d8a43376ff6.tar.bz2 |
Merge topic 'more-rule-of-3'
8f8f73712a Source: fix more rule of 3 warnings from clang -Wdeprecated
Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !6659
-rw-r--r-- | Source/cmCMakePresetsFile.h | 48 | ||||
-rw-r--r-- | Source/cmXMLParser.h | 1 |
2 files changed, 31 insertions, 18 deletions
diff --git a/Source/cmCMakePresetsFile.h b/Source/cmCMakePresetsFile.h index c48a1f8..769fb4e 100644 --- a/Source/cmCMakePresetsFile.h +++ b/Source/cmCMakePresetsFile.h @@ -101,14 +101,18 @@ public: class ConfigurePreset : public Preset { public: -#if __cplusplus < 201703L && (!defined(_MSVC_LANG) || _MSVC_LANG < 201703L) + ConfigurePreset() = default; + ConfigurePreset(ConfigurePreset&& /*other*/) = default; + ConfigurePreset(const ConfigurePreset& /*other*/) = default; + ConfigurePreset& operator=(const ConfigurePreset& /*other*/) = default; + ~ConfigurePreset() override = default; +#if __cplusplus >= 201703L || (defined(_MSVC_LANG) && _MSVC_LANG >= 201703L) + ConfigurePreset& operator=(ConfigurePreset&& /*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. - ConfigurePreset& operator=(const ConfigurePreset& /*other*/) = default; + // assignment operator throwing an exception when it shouldn't. + ConfigurePreset& operator=(ConfigurePreset&& /*other*/) = delete; #endif std::string Generator; @@ -142,14 +146,18 @@ public: class BuildPreset : public Preset { public: -#if __cplusplus < 201703L && (!defined(_MSVC_LANG) || _MSVC_LANG < 201703L) + BuildPreset() = default; + BuildPreset(BuildPreset&& /*other*/) = default; + BuildPreset(const BuildPreset& /*other*/) = default; + BuildPreset& operator=(const BuildPreset& /*other*/) = default; + ~BuildPreset() override = default; +#if __cplusplus >= 201703L || (defined(_MSVC_LANG) && _MSVC_LANG >= 201703L) + BuildPreset& operator=(BuildPreset&& /*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. - BuildPreset& operator=(const BuildPreset& /*other*/) = default; + // assignment operator throwing an exception when it shouldn't. + BuildPreset& operator=(BuildPreset&& /*other*/) = delete; #endif std::string ConfigurePreset; @@ -168,14 +176,18 @@ public: class TestPreset : public Preset { public: -#if __cplusplus < 201703L && (!defined(_MSVC_LANG) || _MSVC_LANG < 201703L) + TestPreset() = default; + TestPreset(TestPreset&& /*other*/) = default; + TestPreset(const TestPreset& /*other*/) = default; + TestPreset& operator=(const TestPreset& /*other*/) = default; + ~TestPreset() override = default; +#if __cplusplus >= 201703L || (defined(_MSVC_LANG) && _MSVC_LANG >= 201703L) + TestPreset& operator=(TestPreset&& /*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. - TestPreset& operator=(const TestPreset& /*other*/) = default; + // assignment operator throwing an exception when it shouldn't. + TestPreset& operator=(TestPreset&& /*other*/) = delete; #endif struct OutputOptions diff --git a/Source/cmXMLParser.h b/Source/cmXMLParser.h index 7e805d7..176252d 100644 --- a/Source/cmXMLParser.h +++ b/Source/cmXMLParser.h @@ -21,6 +21,7 @@ class cmXMLParser { public: cmXMLParser(); + cmXMLParser(const cmXMLParser& /*other*/) = default; virtual ~cmXMLParser(); //! Parse given XML string |