diff options
Diffstat (limited to 'cpp')
-rw-r--r-- | cpp/include/Ice/BatchRequestInterceptor.h | 2 | ||||
-rw-r--r-- | cpp/include/Ice/Exception.h | 6 | ||||
-rw-r--r-- | cpp/include/Ice/Object.h | 4 | ||||
-rw-r--r-- | cpp/include/Ice/Optional.h | 12 | ||||
-rw-r--r-- | cpp/include/Ice/Value.h | 9 | ||||
-rw-r--r-- | cpp/src/slice2cpp/Gen.cpp | 17 |
6 files changed, 38 insertions, 12 deletions
diff --git a/cpp/include/Ice/BatchRequestInterceptor.h b/cpp/include/Ice/BatchRequestInterceptor.h index 95d6d0e5baa..88907554efa 100644 --- a/cpp/include/Ice/BatchRequestInterceptor.h +++ b/cpp/include/Ice/BatchRequestInterceptor.h @@ -42,6 +42,6 @@ typedef IceUtil::Handle<BatchRequestInterceptor> BatchRequestInterceptorPtr; #endif -}; +} #endif diff --git a/cpp/include/Ice/Exception.h b/cpp/include/Ice/Exception.h index ee38d00688d..954d1fcaf42 100644 --- a/cpp/include/Ice/Exception.h +++ b/cpp/include/Ice/Exception.h @@ -35,6 +35,7 @@ public: LocalException(const char*, int); #ifdef ICE_CPP11_COMPILER + LocalException(const LocalException&) = default; virtual ~LocalException(); #else virtual ~LocalException() throw(); @@ -72,8 +73,8 @@ public: protected: - virtual void _writeImpl(::Ice::OutputStream*) const {}; - virtual void _readImpl(::Ice::InputStream*) {}; + virtual void _writeImpl(::Ice::OutputStream*) const {} + virtual void _readImpl(::Ice::InputStream*) {} }; @@ -86,6 +87,7 @@ public: SystemException(const char*, int); #ifdef ICE_CPP11_COMPILER + SystemException(const SystemException&) = default; virtual ~SystemException(); #else virtual ~SystemException() throw(); diff --git a/cpp/include/Ice/Object.h b/cpp/include/Ice/Object.h index c468513cd52..0a5628a7676 100644 --- a/cpp/include/Ice/Object.h +++ b/cpp/include/Ice/Object.h @@ -127,8 +127,8 @@ public: virtual void _iceWrite(Ice::OutputStream*) const; virtual void _iceRead(Ice::InputStream*); - virtual bool _iceGcVisit(IceInternal::GCVisitor&) { return false; }; - virtual void ice_collectable(bool) { }; + virtual bool _iceGcVisit(IceInternal::GCVisitor&) { return false; } + virtual void ice_collectable(bool) { } virtual void ice_preMarshal(); virtual void ice_postUnmarshal(); diff --git a/cpp/include/Ice/Optional.h b/cpp/include/Ice/Optional.h index 7ab17c3deab..f6a83854fcf 100644 --- a/cpp/include/Ice/Optional.h +++ b/cpp/include/Ice/Optional.h @@ -294,7 +294,7 @@ union storage_t unsigned char dummy_; T value_; - constexpr storage_t( trivial_init_t ) noexcept : dummy_() {}; + constexpr storage_t( trivial_init_t ) noexcept : dummy_() {} template <class... Args> constexpr storage_t( Args&&... args ) : value_(constexpr_forward<Args>(args)...) {} @@ -309,7 +309,7 @@ union constexpr_storage_t unsigned char dummy_; T value_; - constexpr constexpr_storage_t( trivial_init_t ) noexcept : dummy_() {}; + constexpr constexpr_storage_t( trivial_init_t ) noexcept : dummy_() {} template <class... Args> constexpr constexpr_storage_t( Args&&... args ) : value_(constexpr_forward<Args>(args)...) {} @@ -324,7 +324,7 @@ struct optional_base bool init_; storage_t<T> storage_; - constexpr optional_base() noexcept : init_(false), storage_(trivial_init) {}; + constexpr optional_base() noexcept : init_(false), storage_(trivial_init) {} explicit constexpr optional_base(const T& v) : init_(true), storage_(v) {} @@ -347,7 +347,7 @@ struct constexpr_optional_base bool init_; constexpr_storage_t<T> storage_; - constexpr constexpr_optional_base() noexcept : init_(false), storage_(trivial_init) {}; + constexpr constexpr_optional_base() noexcept : init_(false), storage_(trivial_init) {} explicit constexpr constexpr_optional_base(const T& v) : init_(true), storage_(v) {} @@ -422,8 +422,8 @@ public: typedef T value_type; // 20.5.5.1, constructors - constexpr optional() noexcept : OptionalBase<T>() {}; - constexpr optional(nullopt_t) noexcept : OptionalBase<T>() {}; + constexpr optional() noexcept : OptionalBase<T>() {} + constexpr optional(nullopt_t) noexcept : OptionalBase<T>() {} optional(const optional& rhs) : OptionalBase<T>() diff --git a/cpp/include/Ice/Value.h b/cpp/include/Ice/Value.h index 411f5661792..dc14eacb76d 100644 --- a/cpp/include/Ice/Value.h +++ b/cpp/include/Ice/Value.h @@ -24,6 +24,15 @@ class ICE_API Value { public: + // See "Rule of zero" at http://en.cppreference.com/w/cpp/language/rule_of_three + // The virtual dtor is actually not stricly necessary since Values are always stored + // in std::shared_ptr + + Value() = default; + Value(const Value&) = default; + Value(Value&&) = default; + Value& operator=(const Value&) = default; + Value& operator=(Value&&) = default; virtual ~Value() = default; virtual void ice_preMarshal(); diff --git a/cpp/src/slice2cpp/Gen.cpp b/cpp/src/slice2cpp/Gen.cpp index 185f987f2b2..cf7cf502f22 100644 --- a/cpp/src/slice2cpp/Gen.cpp +++ b/cpp/src/slice2cpp/Gen.cpp @@ -704,6 +704,7 @@ Slice::Gen::generate(const UnitPtr& p) C << nl << "# pragma warning(disable:4458) // declaration of ... hides class member"; C << nl << "#elif defined(__clang__)"; C << nl << "# pragma clang diagnostic ignored \"-Wshadow\""; + C << nl << "# pragma clang diagnostic ignored \"-Wdeprecated-declarations\""; C << nl << "#elif defined(__GNUC__)"; C << nl << "# pragma GCC diagnostic ignored \"-Wshadow\""; C << nl << "#endif"; @@ -5329,6 +5330,10 @@ Slice::Gen::Cpp11TypesVisitor::visitExceptionStart(const ExceptionPtr& p) // Out of line dtor to avoid weak vtable H << sp << nl << _dllMemberExport << "virtual ~" << name << "();"; + + // Default copy ctor + H << sp << nl << name << "(const " << name << "&) = default;"; + C << sp; C << nl << scoped.substr(2) << "::~" << name << "()"; C << sb; @@ -6353,7 +6358,7 @@ Slice::Gen::Cpp11LocalObjectVisitor::visitClassDefStart(const ClassDefPtr& p) // // Out of line virtual dtor to avoid weak vtable // - H << sp << nl << _dllMemberExport << "virtual ~" << name << "();"; + H << nl << _dllMemberExport << "virtual ~" << name << "();"; C << sp << nl << scoped.substr(2) << "::~" << name << "()"; C << sb; C << eb; @@ -6390,6 +6395,11 @@ Slice::Gen::Cpp11LocalObjectVisitor::visitClassDefStart(const ClassDefPtr& p) H << sp << nl << name << "() = default;"; } + H << sp << nl << name << "(const " << name << "&) = default;"; + H << nl << name << "(" << name << "&&) = default;"; + H << nl << name << "& operator=(const " << name << "&) = default;"; + H << nl << name << "& operator=(" << name << "&&) = default;"; + emitOneShotConstructor(p); } @@ -7148,6 +7158,11 @@ Slice::Gen::Cpp11ValueVisitor::visitClassDefStart(const ClassDefPtr& p) H << sp << nl << name << "() = default;"; + H << sp << nl << name << "(const " << name << "&) = default;"; + H << nl << name << "(" << name << "&&) = default;"; + H << nl << name << "& operator=(const " << name << "&) = default;"; + H << nl << name << "& operator=(" << name << "&&) = default;"; + emitOneShotConstructor(p); writeIceTuple(H, p->allDataMembers(), _useWstring); |