From 4e6c8d8b35e5d7a15645df189f96627aa229c1ca Mon Sep 17 00:00:00 2001 From: Howard Hinnant Date: Tue, 5 Sep 2017 15:23:47 -0400 Subject: [PATCH] Remove use of deprecated behavior involving copy members * If any of the destructor, copy assignment or copy constructor are user-declared, both copy members should be user-declared, otherwise the compiler-generation of them is deprecated. --- SConstruct | 4 ++-- src/ripple/app/paths/impl/FlowDebugInfo.h | 1 + src/ripple/app/tx/applySteps.h | 2 ++ src/ripple/basics/CountedObject.h | 2 ++ src/ripple/beast/clock/abstract_clock.h | 2 ++ .../beast/container/detail/aged_container_iterator.h | 10 +--------- src/ripple/beast/insight/Base.h | 3 +++ src/ripple/core/SociDB.h | 9 +++++++++ src/ripple/core/impl/DummySociDynamicBackend.cpp | 8 ++++++++ src/ripple/core/impl/SociDB.cpp | 9 +++++++++ src/ripple/ledger/RawView.h | 3 +++ src/ripple/protocol/STBase.h | 1 + src/ripple/protocol/STObject.h | 2 ++ src/ripple/protocol/STPathSet.h | 1 + src/ripple/unity/soci.cpp | 10 ++++++++++ 15 files changed, 56 insertions(+), 11 deletions(-) diff --git a/SConstruct b/SConstruct index ac9faed5d..0a8427636 100644 --- a/SConstruct +++ b/SConstruct @@ -563,7 +563,8 @@ def config_env(toolchain, variant, env): env.Append(CXXFLAGS=[ '-frtti', '-std=c++14', - '-Wno-invalid-offsetof' + '-Wno-invalid-offsetof', + '-Wdeprecated' ]) env.Append(CPPDEFINES=['_FILE_OFFSET_BITS=64']) @@ -576,7 +577,6 @@ def config_env(toolchain, variant, env): # These should be the same regardless of platform... if Beast.system.osx: env.Append(CCFLAGS=[ - '-Wno-deprecated', '-Wno-deprecated-declarations', '-Wno-unused-function', ]) diff --git a/src/ripple/app/paths/impl/FlowDebugInfo.h b/src/ripple/app/paths/impl/FlowDebugInfo.h index f0334d514..f0a2b0d3b 100644 --- a/src/ripple/app/paths/impl/FlowDebugInfo.h +++ b/src/ripple/app/paths/impl/FlowDebugInfo.h @@ -161,6 +161,7 @@ struct FlowDebugInfo auto const end = FlowDebugInfo::clock::now (); info->timePoints[tag].second = end; } + Stopper(Stopper&&) = default; }; return Stopper (std::move (name), *this); } diff --git a/src/ripple/app/tx/applySteps.h b/src/ripple/app/tx/applySteps.h index a9acd1664..90b83d348 100644 --- a/src/ripple/app/tx/applySteps.h +++ b/src/ripple/app/tx/applySteps.h @@ -61,6 +61,7 @@ public: { } + PreflightResult(PreflightResult const&) = default; /// Deleted copy assignment operator PreflightResult& operator=(PreflightResult const&) = delete; }; @@ -114,6 +115,7 @@ public: { } + PreclaimResult(PreclaimResult const&) = default; /// Deleted copy assignment operator PreclaimResult& operator=(PreclaimResult const&) = delete; }; diff --git a/src/ripple/basics/CountedObject.h b/src/ripple/basics/CountedObject.h index 6329997fb..52e6a6bf9 100644 --- a/src/ripple/basics/CountedObject.h +++ b/src/ripple/basics/CountedObject.h @@ -112,6 +112,8 @@ public: getCounter ().increment (); } + CountedObject& operator=(CountedObject const&) = default; + ~CountedObject () { getCounter ().decrement (); diff --git a/src/ripple/beast/clock/abstract_clock.h b/src/ripple/beast/clock/abstract_clock.h index 352f389a1..77e8bf25a 100644 --- a/src/ripple/beast/clock/abstract_clock.h +++ b/src/ripple/beast/clock/abstract_clock.h @@ -66,6 +66,8 @@ public: static bool const is_steady = Clock::is_steady; virtual ~abstract_clock() = default; + abstract_clock() = default; + abstract_clock(abstract_clock const&) = default; /** Returns the current time. */ virtual time_point now() const = 0; diff --git a/src/ripple/beast/container/detail/aged_container_iterator.h b/src/ripple/beast/container/detail/aged_container_iterator.h index b849f4ade..86187bcd2 100644 --- a/src/ripple/beast/container/detail/aged_container_iterator.h +++ b/src/ripple/beast/container/detail/aged_container_iterator.h @@ -51,15 +51,7 @@ class aged_container_iterator public: using time_point = typename Iterator::value_type::stashed::time_point; - // Could be '= default', but Visual Studio 2013 chokes on it [Aug 2014] - aged_container_iterator () - { - } - - // copy constructor - aged_container_iterator ( - aged_container_iterator - const& other) = default; + aged_container_iterator() = default; // Disable constructing a const_iterator from a non-const_iterator. // Converting between reverse and non-reverse iterators should be explicit. diff --git a/src/ripple/beast/insight/Base.h b/src/ripple/beast/insight/Base.h index f885d5fa9..f12dce93b 100644 --- a/src/ripple/beast/insight/Base.h +++ b/src/ripple/beast/insight/Base.h @@ -30,6 +30,9 @@ class Base { public: virtual ~Base () = 0; + Base() = default; + Base(Base const&) = default; + Base& operator=(Base const&) = default; }; } diff --git a/src/ripple/core/SociDB.h b/src/ripple/core/SociDB.h index a4ba1e838..56ab8525c 100644 --- a/src/ripple/core/SociDB.h +++ b/src/ripple/core/SociDB.h @@ -28,6 +28,11 @@ This module requires the @ref beast_sqlite external module. */ +#if defined(__clang__) +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated" +#endif + #include #include #define SOCI_USE_BOOST @@ -138,4 +143,8 @@ std::unique_ptr makeCheckpointer (soci::session&, JobQueue&, Logs #include "version.h" #endif +#if defined(__clang__) +#pragma clang diagnostic pop +#endif + #endif diff --git a/src/ripple/core/impl/DummySociDynamicBackend.cpp b/src/ripple/core/impl/DummySociDynamicBackend.cpp index d88bf0557..59aebf56a 100644 --- a/src/ripple/core/impl/DummySociDynamicBackend.cpp +++ b/src/ripple/core/impl/DummySociDynamicBackend.cpp @@ -24,6 +24,11 @@ header file and some macros to be defined.) */ +#if defined(__clang__) +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated" +#endif + #include #include #include @@ -57,3 +62,6 @@ void unload_all (){}; } // namespace dynamic_backends } // namespace soci +#if defined(__clang__) +#pragma clang diagnostic pop +#endif diff --git a/src/ripple/core/impl/SociDB.cpp b/src/ripple/core/impl/SociDB.cpp index c43daa05b..d995bf5aa 100644 --- a/src/ripple/core/impl/SociDB.cpp +++ b/src/ripple/core/impl/SociDB.cpp @@ -17,6 +17,11 @@ */ //============================================================================== +#if defined(__clang__) +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated" +#endif + #include #include @@ -271,3 +276,7 @@ std::unique_ptr makeCheckpointer ( } } + +#if defined(__clang__) +#pragma clang diagnostic pop +#endif diff --git a/src/ripple/ledger/RawView.h b/src/ripple/ledger/RawView.h index ffe9f6ff3..e85ba7b12 100644 --- a/src/ripple/ledger/RawView.h +++ b/src/ripple/ledger/RawView.h @@ -38,6 +38,9 @@ class RawView { public: virtual ~RawView() = default; + RawView() = default; + RawView(RawView const&) = default; + RawView& operator=(RawView const&) = delete; /** Delete an existing state item. diff --git a/src/ripple/protocol/STBase.h b/src/ripple/protocol/STBase.h index a664e3cb3..804fca475 100644 --- a/src/ripple/protocol/STBase.h +++ b/src/ripple/protocol/STBase.h @@ -67,6 +67,7 @@ public: virtual ~STBase() = default; + STBase(const STBase& t) = default; STBase& operator= (const STBase& t); bool operator== (const STBase& t) const; diff --git a/src/ripple/protocol/STObject.h b/src/ripple/protocol/STObject.h index 993129215..a17471c82 100644 --- a/src/ripple/protocol/STObject.h +++ b/src/ripple/protocol/STObject.h @@ -98,6 +98,7 @@ private: typename T::value_type; public: + ValueProxy(ValueProxy const&) = default; ValueProxy& operator= (ValueProxy const&) = delete; template @@ -125,6 +126,7 @@ private: typename std::decay::type>; public: + OptionalProxy(OptionalProxy const&) = default; OptionalProxy& operator= (OptionalProxy const&) = delete; /** Returns `true` if the field is set. diff --git a/src/ripple/protocol/STPathSet.h b/src/ripple/protocol/STPathSet.h index b84a74c1b..caf80b3cc 100644 --- a/src/ripple/protocol/STPathSet.h +++ b/src/ripple/protocol/STPathSet.h @@ -118,6 +118,7 @@ public: } STPathElement(STPathElement const&) = default; + STPathElement& operator=(STPathElement const&) = default; int getNodeType () const diff --git a/src/ripple/unity/soci.cpp b/src/ripple/unity/soci.cpp index 50ea517a4..ea76a2dce 100644 --- a/src/ripple/unity/soci.cpp +++ b/src/ripple/unity/soci.cpp @@ -16,6 +16,12 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ //============================================================================== + +#if defined(__clang__) +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated" +#endif + #include // Core soci @@ -50,3 +56,7 @@ #include #include + +#if defined(__clang__) +#pragma clang diagnostic pop +#endif