diff options
author | Bernard Normier <bernard@zeroc.com> | 2016-06-27 16:29:41 -0400 |
---|---|---|
committer | Bernard Normier <bernard@zeroc.com> | 2016-06-27 16:29:41 -0400 |
commit | fff68e2470492ef3c7b80654f4c5977066d89323 (patch) | |
tree | c3147db6d0b745428ad53a717b35b828759ee8bc /cpp | |
parent | Refactored SSL and iAP transports, support for running SSL on top (diff) | |
download | ice-fff68e2470492ef3c7b80654f4c5977066d89323.tar.bz2 ice-fff68e2470492ef3c7b80654f4c5977066d89323.tar.xz ice-fff68e2470492ef3c7b80654f4c5977066d89323.zip |
Exported classes no longer have weak vtables with clang
Diffstat (limited to 'cpp')
62 files changed, 436 insertions, 243 deletions
diff --git a/cpp/include/Glacier2/SessionHelper.h b/cpp/include/Glacier2/SessionHelper.h index b0226226560..8fc1013c801 100644 --- a/cpp/include/Glacier2/SessionHelper.h +++ b/cpp/include/Glacier2/SessionHelper.h @@ -35,8 +35,8 @@ const int GLACIER2_TCP_PORT = 4063; class GLACIER2_API SessionHelper : public virtual ICE_SHARED { - public: + virtual ~SessionHelper(); virtual void destroy() = 0; virtual Ice::CommunicatorPtr communicator() const = 0; @@ -53,8 +53,8 @@ ICE_DEFINE_PTR(SessionHelperPtr, SessionHelper); class GLACIER2_API SessionCallback : public virtual ICE_SHARED { - public: + virtual ~SessionCallback(); virtual void createdCommunicator(const SessionHelperPtr& session) = 0; virtual void connected(const SessionHelperPtr&) = 0; diff --git a/cpp/include/Ice/AsyncResult.h b/cpp/include/Ice/AsyncResult.h index 730183fcf52..e8aea029007 100644 --- a/cpp/include/Ice/AsyncResult.h +++ b/cpp/include/Ice/AsyncResult.h @@ -27,6 +27,8 @@ class ICE_API AsyncResult : private IceUtil::noncopyable, public Ice::LocalObjec { public: + virtual ~AsyncResult(); + virtual void cancel() = 0; virtual Int getHash() const = 0; diff --git a/cpp/include/Ice/Buffer.h b/cpp/include/Ice/Buffer.h index 3cde5701a99..2384cfcd314 100644 --- a/cpp/include/Ice/Buffer.h +++ b/cpp/include/Ice/Buffer.h @@ -23,7 +23,6 @@ public: Buffer(const Ice::Byte* beg, const Ice::Byte* end) : b(beg, end), i(b.begin()) { } Buffer(const std::vector<Ice::Byte>& v) : b(v), i(b.begin()) { } Buffer(Buffer& o, bool adopt) : b(o.b, adopt), i(b.begin()) { } - virtual ~Buffer() { } void swapBuffer(Buffer&); diff --git a/cpp/include/Ice/Dispatcher.h b/cpp/include/Ice/Dispatcher.h index b34b9b12c36..51dceba00c7 100644 --- a/cpp/include/Ice/Dispatcher.h +++ b/cpp/include/Ice/Dispatcher.h @@ -22,7 +22,7 @@ class ICE_API DispatcherCall : public virtual IceUtil::Shared { public: - virtual ~DispatcherCall() { } + virtual ~DispatcherCall(); virtual void run() = 0; }; @@ -33,6 +33,8 @@ class ICE_API Dispatcher : public virtual IceUtil::Shared { public: + virtual ~Dispatcher(); + virtual void dispatch(const DispatcherCallPtr&, const ConnectionPtr&) = 0; }; diff --git a/cpp/include/Ice/DynamicLibrary.h b/cpp/include/Ice/DynamicLibrary.h index 1620862d03e..d3764338c90 100644 --- a/cpp/include/Ice/DynamicLibrary.h +++ b/cpp/include/Ice/DynamicLibrary.h @@ -21,7 +21,7 @@ class ICE_API DynamicLibrary : public ::IceUtil::Shared public: DynamicLibrary(); - ~DynamicLibrary(); + virtual ~DynamicLibrary(); #ifdef _WIN32 typedef FARPROC symbol_type; @@ -40,12 +40,12 @@ public: // // The name of the library is constructed from the given // information. If no version is supplied and the boolean - // argument is true, the Ice version (10 * major + minor) is + // argument is true, the Ice version (10 * major + minor) is // used instead. // // For example, consider the following entry point: - // - // foo:create + // + // foo:create // // This would result in libfoo.so.11 (Unix) and foo11.dll // (Windows), where the Ice version is 1.1.x. @@ -93,6 +93,8 @@ class ICE_API DynamicLibraryList : public ::IceUtil::Shared { public: + virtual ~DynamicLibraryList(); + void add(const DynamicLibraryPtr&); private: diff --git a/cpp/include/Ice/Exception.h b/cpp/include/Ice/Exception.h index 269feb41516..d06f576aae3 100644 --- a/cpp/include/Ice/Exception.h +++ b/cpp/include/Ice/Exception.h @@ -44,7 +44,10 @@ class ICE_API LocalException : public IceUtil::Exception public: LocalException(const char*, int); -#ifndef ICE_CPP11_COMPILER + +#ifdef ICE_CPP11_COMPILER + virtual ~LocalException(); +#else virtual ~LocalException() throw(); #endif @@ -81,7 +84,9 @@ class ICE_API SystemException : public IceUtil::Exception public: SystemException(const char*, int); -#ifndef ICE_CPP11_COMPILER +#ifdef ICE_CPP11_COMPILER + virtual ~SystemException(); +#else virtual ~SystemException() throw(); #endif diff --git a/cpp/include/Ice/IncomingAsync.h b/cpp/include/Ice/IncomingAsync.h index 1848d0c79e7..edffd56dda6 100644 --- a/cpp/include/Ice/IncomingAsync.h +++ b/cpp/include/Ice/IncomingAsync.h @@ -21,6 +21,9 @@ class ICE_API AMDCallback : public virtual Ice::LocalObject { public: + virtual ~AMDCallback(); + + virtual void ice_exception(const ::std::exception&) = 0; virtual void ice_exception() = 0; }; @@ -100,6 +103,8 @@ class ICE_API AMD_Object_ice_invoke : public virtual Ice::AMDCallback { public: + virtual ~AMD_Object_ice_invoke(); + virtual void ice_response(bool, const std::vector<Ice::Byte>&) = 0; virtual void ice_response(bool, const std::pair<const Ice::Byte*, const Ice::Byte*>&) = 0; }; diff --git a/cpp/include/Ice/InputStream.h b/cpp/include/Ice/InputStream.h index 062dfc850c0..e6b08af4314 100644 --- a/cpp/include/Ice/InputStream.h +++ b/cpp/include/Ice/InputStream.h @@ -713,7 +713,7 @@ private: { public: - virtual ~EncapsDecoder() { } + virtual ~EncapsDecoder(); virtual void read(PatchFunc, void*) = 0; virtual void throwException(const Ice::UserExceptionFactoryPtr&) = 0; diff --git a/cpp/include/Ice/MetricsAdminI.h b/cpp/include/Ice/MetricsAdminI.h index 57a4fa50a9c..cda90d06061 100644 --- a/cpp/include/Ice/MetricsAdminI.h +++ b/cpp/include/Ice/MetricsAdminI.h @@ -96,6 +96,8 @@ public: }; ICE_DEFINE_PTR(RegExpPtr, RegExp); + virtual ~MetricsMapI(); + MetricsMapI(const std::string&, const Ice::PropertiesPtr&); MetricsMapI(const MetricsMapI&); @@ -128,6 +130,8 @@ class ICE_API MetricsMapFactory : { public: + virtual ~MetricsMapFactory(); + MetricsMapFactory(IceMX::Updater*); virtual MetricsMapIPtr create(const std::string&, const Ice::PropertiesPtr&) = 0; @@ -266,7 +270,7 @@ public: return metrics; } - bool + bool isDetached() const { return _object->current == 0; @@ -290,7 +294,7 @@ public: MetricsMapT(const std::string& mapPrefix, const Ice::PropertiesPtr& properties, - const std::map<std::string, std::pair<SubMapMember, MetricsMapFactoryPtr> >& subMaps) : + const std::map<std::string, std::pair<SubMapMember, MetricsMapFactoryPtr> >& subMaps) : MetricsMapI(mapPrefix, properties), _destroyed(false) { std::vector<std::string> subMapNames; @@ -311,8 +315,8 @@ public: continue; // This sub-map isn't configured. } } - _subMaps.insert(std::make_pair(p->first, - std::make_pair(p->second.first, + _subMaps.insert(std::make_pair(p->first, + std::make_pair(p->second.first, p->second.second->create(subMapPrefix, properties)))); } } @@ -321,7 +325,7 @@ public: { } - virtual void + virtual void destroy() { Lock sync(*this); @@ -334,7 +338,7 @@ public: getMetrics() const { IceMX::MetricsMap objects; - + Lock sync(*this); for(typename std::map<std::string, EntryTPtr>::const_iterator p = _objects.begin(); p != _objects.end(); ++p) { @@ -342,12 +346,12 @@ public: } return objects; } - + virtual IceMX::MetricsFailuresSeq getFailures() { IceMX::MetricsFailuresSeq failures; - + Lock sync(*this); for(typename std::map<std::string, EntryTPtr>::const_iterator p = _objects.begin(); p != _objects.end(); ++p) { @@ -359,7 +363,7 @@ public: } return failures; } - + virtual IceMX::MetricsFailures getFailures(const std::string& id) { @@ -402,7 +406,7 @@ public: return ICE_NULLPTR; } } - + for(std::vector<RegExpPtr>::const_iterator p = _reject.begin(); p != _reject.end(); ++p) { if((*p)->match(helper, true)) @@ -444,7 +448,7 @@ public: // // Lookup the metrics object. - // + // Lock sync(*this); if(_destroyed) { @@ -474,7 +478,7 @@ public: p->second->attach(helper); return p->second; } - + private: virtual MetricsMapIPtr clone() const @@ -561,7 +565,7 @@ public: template<class SubMapMetricsType> void registerSubMap(const std::string& subMap, IceMX::MetricsMap MetricsType::* member) { - _subMaps[subMap] = std::pair<IceMX::MetricsMap MetricsType::*, + _subMaps[subMap] = std::pair<IceMX::MetricsMap MetricsType::*, MetricsMapFactoryPtr>(member, ICE_MAKE_SHARED(MetricsMapFactoryT<SubMapMetricsType>, ICE_NULLPTR)); } @@ -573,12 +577,12 @@ private: class MetricsViewI : public IceUtil::Shared { public: - + MetricsViewI(const std::string&); void destroy(); - bool addOrUpdateMap(const Ice::PropertiesPtr&, const std::string&, const MetricsMapFactoryPtr&, + bool addOrUpdateMap(const Ice::PropertiesPtr&, const std::string&, const MetricsMapFactoryPtr&, const Ice::LoggerPtr&); bool removeMap(const std::string&); @@ -656,7 +660,7 @@ public: void unregisterMap(const std::string&); virtual Ice::StringSeq getMetricsViewNames(Ice::StringSeq&, const ::Ice::Current&); - + #ifdef ICE_CPP11_MAPPING virtual void enableMetricsView(std::string, const ::Ice::Current&); virtual void disableMetricsView(std::string, const ::Ice::Current&); @@ -667,7 +671,7 @@ public: virtual void enableMetricsView(const std::string&, const ::Ice::Current&); virtual void disableMetricsView(const std::string&, const ::Ice::Current&); virtual IceMX::MetricsView getMetricsView(const std::string&, Ice::Long&, const ::Ice::Current&); - virtual IceMX::MetricsFailuresSeq getMapMetricsFailures(const std::string&, const std::string&, + virtual IceMX::MetricsFailuresSeq getMapMetricsFailures(const std::string&, const std::string&, const ::Ice::Current&); virtual IceMX::MetricsFailures getMetricsFailures(const std::string&, const std::string&, const std::string&, const ::Ice::Current&); diff --git a/cpp/include/Ice/NativePropertiesAdmin.h b/cpp/include/Ice/NativePropertiesAdmin.h index a1e8b9c5671..dc8734a35f0 100644 --- a/cpp/include/Ice/NativePropertiesAdmin.h +++ b/cpp/include/Ice/NativePropertiesAdmin.h @@ -40,6 +40,8 @@ class ICE_API PropertiesAdminUpdateCallback { public: + virtual ~PropertiesAdminUpdateCallback(); + virtual void updated(const PropertyDict&) = 0; }; ICE_DEFINE_PTR(PropertiesAdminUpdateCallbackPtr, PropertiesAdminUpdateCallback); @@ -51,6 +53,8 @@ class ICE_API NativePropertiesAdmin { public: + virtual ~NativePropertiesAdmin(); + virtual void addUpdateCallback(const PropertiesAdminUpdateCallbackPtr&) = 0; virtual void removeUpdateCallback(const PropertiesAdminUpdateCallbackPtr&) = 0; }; diff --git a/cpp/include/Ice/Object.h b/cpp/include/Ice/Object.h index 74db6c878a9..7a2b0cc11ad 100644 --- a/cpp/include/Ice/Object.h +++ b/cpp/include/Ice/Object.h @@ -52,6 +52,8 @@ class ICE_API DispatchInterceptorAsyncCallback : public virtual IceUtil::Shared { public: + virtual ~DispatchInterceptorAsyncCallback(); + virtual bool response(bool) = 0; virtual bool exception(const std::exception&) = 0; virtual bool exception() = 0; @@ -62,7 +64,7 @@ class ICE_API Request { public: - virtual ~Request() {} + virtual ~Request(); virtual const Current& getCurrent() = 0; }; diff --git a/cpp/include/Ice/Outgoing.h b/cpp/include/Ice/Outgoing.h index 86a61d1e173..5c03011e699 100644 --- a/cpp/include/Ice/Outgoing.h +++ b/cpp/include/Ice/Outgoing.h @@ -40,7 +40,7 @@ class ICE_API OutgoingBase : private IceUtil::noncopyable { public: - virtual ~OutgoingBase() { } + virtual ~OutgoingBase(); virtual void sent() = 0; virtual void completed(const Ice::Exception&) = 0; diff --git a/cpp/include/Ice/OutgoingAsync.h b/cpp/include/Ice/OutgoingAsync.h index f08ccfc8b17..de692621c3e 100644 --- a/cpp/include/Ice/OutgoingAsync.h +++ b/cpp/include/Ice/OutgoingAsync.h @@ -39,6 +39,9 @@ class CollocatedRequestHandler; class ICE_API OutgoingAsyncCompletionCallback { +public: + virtual ~OutgoingAsyncCompletionCallback(); + protected: virtual bool handleSent(bool, bool) = 0; @@ -361,6 +364,8 @@ class ICE_API CommunicatorFlushBatchAsync : public OutgoingAsyncBase, { public: + virtual ~CommunicatorFlushBatchAsync(); + CommunicatorFlushBatchAsync(const InstancePtr&); void flushConnection(const Ice::ConnectionIPtr&); @@ -510,7 +515,7 @@ protected: }; template<> -class ICE_API OutgoingAsyncT<void> : public OutgoingAsync +class OutgoingAsyncT<void> : public OutgoingAsync { public: @@ -566,7 +571,7 @@ public: }; template<> -class ICE_API LambdaOutgoing<void> : public OutgoingAsyncT<void>, public LambdaInvoke +class LambdaOutgoing<void> : public OutgoingAsyncT<void>, public LambdaInvoke { public: @@ -602,7 +607,7 @@ public: } }; -class ICE_API CustomLambdaOutgoing : public OutgoingAsync, public LambdaInvoke +class CustomLambdaOutgoing : public OutgoingAsync, public LambdaInvoke { public: @@ -719,6 +724,8 @@ class ICE_API CallbackBase : public IceUtil::Shared { public: + virtual ~CallbackBase(); + void checkCallback(bool, bool); virtual void completed(const ::Ice::AsyncResultPtr&) const = 0; @@ -733,6 +740,9 @@ typedef IceUtil::Handle<CallbackBase> CallbackBasePtr; // class ICE_API GenericCallbackBase : public virtual CallbackBase { +public: + + virtual ~GenericCallbackBase(); }; // @@ -838,7 +848,7 @@ private: const CallbackBasePtr _callback; }; -class ICE_API CallbackOutgoing : public OutgoingAsync, public CallbackCompletion +class CallbackOutgoing : public OutgoingAsync, public CallbackCompletion { public: diff --git a/cpp/include/Ice/OutputStream.h b/cpp/include/Ice/OutputStream.h index 1a03c2e1737..cf90475ceec 100644 --- a/cpp/include/Ice/OutputStream.h +++ b/cpp/include/Ice/OutputStream.h @@ -508,7 +508,7 @@ public: void initialize(IceInternal::Instance*, const EncodingVersion&); void finished(std::vector<Byte>&); - virtual std::pair<const Byte*, const Byte*> finished(); + std::pair<const Byte*, const Byte*> finished(); // Optionals bool writeOptImpl(Int, OptionalFormat); @@ -548,7 +548,7 @@ private: { public: - virtual ~EncapsEncoder() { } + virtual ~EncapsEncoder(); virtual void write(const ValuePtr&) = 0; virtual void write(const UserException&) = 0; diff --git a/cpp/include/Ice/Proxy.h b/cpp/include/Ice/Proxy.h index e3edf70b1e0..33bb2d33da2 100644 --- a/cpp/include/Ice/Proxy.h +++ b/cpp/include/Ice/Proxy.h @@ -766,10 +766,7 @@ public: protected: - virtual ::std::shared_ptr<ObjectPrx> __newInstance() const - { - return IceInternal::createProxy<Prx>(); - } + virtual ::std::shared_ptr<ObjectPrx> __newInstance() const = 0; }; ICE_API ::std::ostream& operator<<(::std::ostream&, const ::Ice::ObjectPrx&); @@ -1414,6 +1411,13 @@ private: IceUtil::Mutex _mutex; }; +} } + +ICE_API ::std::ostream& operator<<(::std::ostream&, const ::IceProxy::Ice::Object&); + +namespace Ice +{ + template<typename Prx, typename Base> class Proxy : public virtual Base { @@ -1526,19 +1530,9 @@ public: protected: - virtual Object* __newInstance() const - { - return new Prx(); - } + virtual ::IceProxy::Ice::Object* __newInstance() const = 0; }; -} } - -ICE_API ::std::ostream& operator<<(::std::ostream&, const ::IceProxy::Ice::Object&); - -namespace Ice -{ - ICE_API bool proxyIdentityLess(const ObjectPrx&, const ObjectPrx&); ICE_API bool proxyIdentityEqual(const ObjectPrx&, const ObjectPrx&); diff --git a/cpp/include/Ice/SlicedData.h b/cpp/include/Ice/SlicedData.h index 3f6528cb207..2b005d2b01a 100644 --- a/cpp/include/Ice/SlicedData.h +++ b/cpp/include/Ice/SlicedData.h @@ -66,6 +66,10 @@ class ICE_API SlicedData { public: +#ifndef ICE_CPP11_MAPPING + virtual ~SlicedData(); +#endif + SlicedData(const SliceInfoSeq&); const SliceInfoSeq slices; diff --git a/cpp/include/Ice/UserExceptionFactory.h b/cpp/include/Ice/UserExceptionFactory.h index b810c2956b6..80ec182bd55 100644 --- a/cpp/include/Ice/UserExceptionFactory.h +++ b/cpp/include/Ice/UserExceptionFactory.h @@ -22,7 +22,7 @@ class ICE_API UserExceptionFactory : public IceUtil::Shared public: virtual void createAndThrow(const ::std::string&) = 0; - virtual ~UserExceptionFactory() {} + virtual ~UserExceptionFactory(); }; typedef ::IceUtil::Handle<UserExceptionFactory> UserExceptionFactoryPtr; diff --git a/cpp/include/IcePatch2/ClientUtil.h b/cpp/include/IcePatch2/ClientUtil.h index a741b3af269..982cc0a43d9 100644 --- a/cpp/include/IcePatch2/ClientUtil.h +++ b/cpp/include/IcePatch2/ClientUtil.h @@ -28,6 +28,8 @@ class ICE_PATCH2_API PatcherFeedback : public IceUtil::Shared { public: + virtual ~PatcherFeedback(); + // // The summary file can't be loaded for the given reason. This // should return true to accept doing a thorough patch, false @@ -77,6 +79,9 @@ typedef IceUtil::Handle<PatcherFeedback> PatcherFeedbackPtr; class ICE_PATCH2_API Patcher : public IceUtil::Shared { public: + + virtual ~Patcher(); + // // Prepare the patching. This involves creating the local checksum // files if no summary file exists or if a thorough patch was diff --git a/cpp/include/IceSSL/Plugin.h b/cpp/include/IceSSL/Plugin.h index 6987dfa71ca..3f15974a556 100644 --- a/cpp/include/IceSSL/Plugin.h +++ b/cpp/include/IceSSL/Plugin.h @@ -461,6 +461,8 @@ class ICE_SSL_API NativeConnectionInfo : public ConnectionInfo { public: + virtual ~NativeConnectionInfo(); + // // The certificate chain. This may be empty if the peer did not // supply a certificate. The peer's certificate (if any) is the @@ -478,6 +480,8 @@ class ICE_SSL_API CertificateVerifier : public Ice::EnableSharedFromThis<Certifi { public: + virtual ~CertificateVerifier(); + // // Return false if the connection should be rejected, or true to // allow it. @@ -505,6 +509,8 @@ class ICE_SSL_API PasswordPrompt : public Ice::EnableSharedFromThis<PasswordProm { public: + virtual ~PasswordPrompt(); + // // The getPassword method may be invoked repeatedly, such as when // several encrypted files are opened, or when multiple password @@ -518,6 +524,8 @@ class ICE_SSL_API Plugin : public Ice::Plugin { public: + virtual ~Plugin(); + // // Establish the certificate verifier object. This should be done // before any connections are established. diff --git a/cpp/include/IceUtil/Shared.h b/cpp/include/IceUtil/Shared.h index cb3af36a7a2..756b10e5f22 100644 --- a/cpp/include/IceUtil/Shared.h +++ b/cpp/include/IceUtil/Shared.h @@ -38,9 +38,7 @@ public: SimpleShared(); SimpleShared(const SimpleShared&); - virtual ~SimpleShared() - { - } + virtual ~SimpleShared(); SimpleShared& operator=(const SimpleShared&) { diff --git a/cpp/include/IceUtil/StringConverter.h b/cpp/include/IceUtil/StringConverter.h index 00af6bcf3c6..1979107cc67 100644 --- a/cpp/include/IceUtil/StringConverter.h +++ b/cpp/include/IceUtil/StringConverter.h @@ -26,7 +26,7 @@ class ICE_API UTF8Buffer public: virtual Byte* getMoreBytes(size_t howMany, Byte* firstUnused) = 0; - virtual ~UTF8Buffer() {} + virtual ~UTF8Buffer(); }; // diff --git a/cpp/include/IceUtil/Timer.h b/cpp/include/IceUtil/Timer.h index f0555280a9f..1d6261f3796 100644 --- a/cpp/include/IceUtil/Timer.h +++ b/cpp/include/IceUtil/Timer.h @@ -35,7 +35,7 @@ class ICE_API TimerTask { public: - virtual ~TimerTask() { } + virtual ~TimerTask(); virtual void runTimerTask() = 0; }; diff --git a/cpp/src/Glacier2Lib/SessionHelper.cpp b/cpp/src/Glacier2Lib/SessionHelper.cpp index 7c8884def81..6204bd89126 100644 --- a/cpp/src/Glacier2Lib/SessionHelper.cpp +++ b/cpp/src/Glacier2Lib/SessionHelper.cpp @@ -299,6 +299,12 @@ SessionHelperI::objectAdapter() return internalObjectAdapter(); } + +Glacier2::SessionHelper::~SessionHelper() +{ + // Out of line to avoid weak vtable +} + bool Glacier2::SessionHelper::operator==(const Glacier2::SessionHelper& other) const { @@ -326,6 +332,12 @@ SessionHelperI::internalObjectAdapter() return _adapter; } +Glacier2::SessionCallback::~SessionCallback() +{ + // Out of line to avoid weak vtable +} + + namespace { diff --git a/cpp/src/Ice/Acceptor.cpp b/cpp/src/Ice/Acceptor.cpp index 4faae242150..892361d967d 100644 --- a/cpp/src/Ice/Acceptor.cpp +++ b/cpp/src/Ice/Acceptor.cpp @@ -13,4 +13,11 @@ using namespace std; using namespace Ice; using namespace IceInternal; + +Acceptor::~Acceptor() +{ + // Out of line to avoid weak vtable +} + + IceUtil::Shared* IceInternal::upCast(Acceptor* p) { return p; } diff --git a/cpp/src/Ice/Acceptor.h b/cpp/src/Ice/Acceptor.h index 372371da0ab..269c8963226 100644 --- a/cpp/src/Ice/Acceptor.h +++ b/cpp/src/Ice/Acceptor.h @@ -22,6 +22,7 @@ namespace IceInternal class ICE_API Acceptor : public virtual ::IceUtil::Shared { public: + virtual ~Acceptor(); virtual NativeInfoPtr getNativeInfo() = 0; virtual void close() = 0; diff --git a/cpp/src/Ice/AsyncResult.cpp b/cpp/src/Ice/AsyncResult.cpp index 7a772dd3637..60e5ac65773 100644 --- a/cpp/src/Ice/AsyncResult.cpp +++ b/cpp/src/Ice/AsyncResult.cpp @@ -18,6 +18,11 @@ using namespace Ice; IceUtil::Shared* Ice::upCast(AsyncResult* p) { return p; } +AsyncResult::~AsyncResult() +{ + // Out of line to avoid weak vtable +} + void AsyncResult::__check(const AsyncResultPtr& r, const IceProxy::Ice::Object* prx, const string& operation) { @@ -69,4 +74,3 @@ AsyncResult::__check(const AsyncResultPtr& r, const string& operation) } #endif - diff --git a/cpp/src/Ice/Connector.cpp b/cpp/src/Ice/Connector.cpp index d251b1bb603..a9a2ec72e3e 100644 --- a/cpp/src/Ice/Connector.cpp +++ b/cpp/src/Ice/Connector.cpp @@ -13,4 +13,9 @@ using namespace std; using namespace Ice; using namespace IceInternal; +Connector::~Connector() +{ + // Out of line to avoid weak vtable +} + IceUtil::Shared* IceInternal::upCast(Connector* p) { return p; } diff --git a/cpp/src/Ice/Connector.h b/cpp/src/Ice/Connector.h index 5735ce530bd..377c0427f03 100644 --- a/cpp/src/Ice/Connector.h +++ b/cpp/src/Ice/Connector.h @@ -21,6 +21,8 @@ class ICE_API Connector : public ::IceUtil::Shared { public: + virtual ~Connector(); + virtual TransceiverPtr connect() = 0; virtual Ice::Short type() const = 0; diff --git a/cpp/src/Ice/DynamicLibrary.cpp b/cpp/src/Ice/DynamicLibrary.cpp index 8128d4f6cf1..75985b6ab06 100644 --- a/cpp/src/Ice/DynamicLibrary.cpp +++ b/cpp/src/Ice/DynamicLibrary.cpp @@ -279,6 +279,11 @@ IceInternal::DynamicLibrary::getErrorMessage() const return _err; } +IceInternal::DynamicLibraryList::~DynamicLibraryList() +{ + // Out of line to avoid weak vtable +} + void IceInternal::DynamicLibraryList::add(const DynamicLibraryPtr& library) { diff --git a/cpp/src/Ice/EndpointI.cpp b/cpp/src/Ice/EndpointI.cpp index af4a2244602..663de016608 100644 --- a/cpp/src/Ice/EndpointI.cpp +++ b/cpp/src/Ice/EndpointI.cpp @@ -17,6 +17,12 @@ IceUtil::Shared* IceInternal::upCast(EndpointI* p) { return p; } IceUtil::Shared* IceInternal::upCast(EndpointI_connectors* p) { return p; } #endif + +IceInternal::EndpointI_connectors::~EndpointI_connectors() +{ + // Out of line to avoid weak vtable +} + void IceInternal::EndpointI::streamWrite(Ice::OutputStream* s) const { diff --git a/cpp/src/Ice/EndpointI.h b/cpp/src/Ice/EndpointI.h index b2260474d3d..1dd10708142 100644 --- a/cpp/src/Ice/EndpointI.h +++ b/cpp/src/Ice/EndpointI.h @@ -33,7 +33,7 @@ class ICE_API EndpointI_connectors : public virtual ICE_SHARED { public: - virtual ~EndpointI_connectors() { } + virtual ~EndpointI_connectors(); virtual void connectors(const std::vector<ConnectorPtr>&) = 0; virtual void exception(const Ice::LocalException&) = 0; diff --git a/cpp/src/Ice/Exception.cpp b/cpp/src/Ice/Exception.cpp index b24d64a6b53..d9d1f929fc1 100644 --- a/cpp/src/Ice/Exception.cpp +++ b/cpp/src/Ice/Exception.cpp @@ -145,11 +145,13 @@ Ice::LocalException::LocalException(const char* file, int line) : { } +Ice::LocalException::~LocalException() #ifndef ICE_CPP11_COMPILER -Ice::LocalException::~LocalException() throw() + throw() +#endif { + // Out of line to avoid weak vtable } -#endif namespace { @@ -172,11 +174,12 @@ Ice::SystemException::SystemException(const char* file, int line) : { } +Ice::SystemException::~SystemException() #ifndef ICE_CPP11_COMPILER -Ice::SystemException::~SystemException() throw() + throw() +#endif { } -#endif namespace { diff --git a/cpp/src/Ice/FactoryTable.cpp b/cpp/src/Ice/FactoryTable.cpp index 2842670fa90..78b8a1c8b2b 100644 --- a/cpp/src/Ice/FactoryTable.cpp +++ b/cpp/src/Ice/FactoryTable.cpp @@ -12,6 +12,12 @@ using namespace std; + +Ice::UserExceptionFactory::~UserExceptionFactory() +{ + // Out of line to avoid weak vtable +} + // // Add a factory to the exception factory table. // If the factory is present already, increment its reference count. diff --git a/cpp/src/Ice/IncomingAsync.cpp b/cpp/src/Ice/IncomingAsync.cpp index a38a1b4e599..d6a8059bba7 100644 --- a/cpp/src/Ice/IncomingAsync.cpp +++ b/cpp/src/Ice/IncomingAsync.cpp @@ -26,6 +26,16 @@ using namespace IceInternal; #ifndef ICE_CPP11_MAPPING IceUtil::Shared* IceInternal::upCast(IncomingAsync* p) { return p; } IceUtil::Shared* Ice::upCast(AMD_Object_ice_invoke* p) { return p; } + +Ice::AMDCallback::~AMDCallback() +{ + // Out of line to avoid weak vtable +} + +Ice::AMD_Object_ice_invoke::~AMD_Object_ice_invoke() +{ + // Out of line to avoid weak vtable +} #endif namespace diff --git a/cpp/src/Ice/InputStream.cpp b/cpp/src/Ice/InputStream.cpp index 315de0e6c53..20bba90db7e 100644 --- a/cpp/src/Ice/InputStream.cpp +++ b/cpp/src/Ice/InputStream.cpp @@ -1731,6 +1731,11 @@ Ice::InputStream::initEncaps() } } +Ice::InputStream::EncapsDecoder::~EncapsDecoder() +{ + // Out of line to avoid weak vtable +} + string Ice::InputStream::EncapsDecoder::readTypeId(bool isIndex) { diff --git a/cpp/src/Ice/MetricsAdminI.cpp b/cpp/src/Ice/MetricsAdminI.cpp index 44fa3baa450..d8f03c8b0f6 100644 --- a/cpp/src/Ice/MetricsAdminI.cpp +++ b/cpp/src/Ice/MetricsAdminI.cpp @@ -145,6 +145,11 @@ MetricsMapI::RegExp::match(const string& value) #endif } +MetricsMapI::~MetricsMapI() +{ + // Out of line to avoid weak vtable +} + MetricsMapI::MetricsMapI(const std::string& mapPrefix, const PropertiesPtr& properties) : _properties(properties->getPropertiesForPrefix(mapPrefix)), _retain(properties->getPropertyAsIntWithDefault(mapPrefix + "RetainDetached", 10)), @@ -213,6 +218,11 @@ MetricsMapI::getProperties() const return _properties; } +MetricsMapFactory::~MetricsMapFactory() +{ + // Out of line to avoid weak vtable +} + MetricsMapFactory::MetricsMapFactory(Updater* updater) : _updater(updater) { } diff --git a/cpp/src/Ice/Network.cpp b/cpp/src/Ice/Network.cpp index 317e1e3bbc4..e0788a5d72a 100755 --- a/cpp/src/Ice/Network.cpp +++ b/cpp/src/Ice/Network.cpp @@ -185,7 +185,7 @@ setTcpLoopbackFastPath(SOCKET fd) WSAIoctl(fd, SIO_LOOPBACK_FAST_PATH, &OptionValue, sizeof(OptionValue), NULL, 0, &NumberOfBytesReturned, 0, 0); if(status == SOCKET_ERROR) { - // On platforms that do not support fast path (< Windows 8), WSAEONOTSUPP is expected. + // On platforms that do not support fast path (< Windows 8), WSAEONOTSUPP is expected. DWORD LastError = ::GetLastError(); if(LastError != WSAEOPNOTSUPP) { @@ -777,6 +777,16 @@ getAddressStorageSize(const Address& addr) } +ReadyCallback::~ReadyCallback() +{ + // Out of line to avoid weak vtable +} + +NativeInfo::~NativeInfo() +{ + // Out of line to avoid weak vtable +} + void NativeInfo::setReadyCallback(const ReadyCallbackPtr& callback) { diff --git a/cpp/src/Ice/Network.h b/cpp/src/Ice/Network.h index aae80089dbe..9d85d061925 100755 --- a/cpp/src/Ice/Network.h +++ b/cpp/src/Ice/Network.h @@ -191,6 +191,9 @@ class ICE_API ReadyCallback : public virtual ::IceUtil::Shared { public: + virtual ~ReadyCallback(); + + virtual void ready(SocketOperation, bool) = 0; }; typedef IceUtil::Handle<ReadyCallback> ReadyCallbackPtr; @@ -199,6 +202,8 @@ class ICE_API NativeInfo : public virtual IceUtil::Shared { public: + virtual ~NativeInfo(); + NativeInfo(SOCKET socketFd = INVALID_SOCKET) : _fd(socketFd) { } diff --git a/cpp/src/Ice/NetworkProxy.cpp b/cpp/src/Ice/NetworkProxy.cpp index b03f3b3007e..bdcf580b8d1 100644 --- a/cpp/src/Ice/NetworkProxy.cpp +++ b/cpp/src/Ice/NetworkProxy.cpp @@ -17,6 +17,11 @@ using namespace IceInternal; IceUtil::Shared* IceInternal::upCast(NetworkProxy* p) { return p; } +NetworkProxy::~NetworkProxy() +{ + // Out of line to avoid weak vtable +} + #ifndef ICE_OS_WINRT namespace diff --git a/cpp/src/Ice/NetworkProxy.h b/cpp/src/Ice/NetworkProxy.h index 266480e5265..6e1d7f483ef 100644 --- a/cpp/src/Ice/NetworkProxy.h +++ b/cpp/src/Ice/NetworkProxy.h @@ -20,6 +20,8 @@ class ICE_API NetworkProxy : public virtual IceUtil::Shared { public: + virtual ~NetworkProxy(); + // // Write the connection request on the connection established // with the network proxy server. This is called right after diff --git a/cpp/src/Ice/Object.cpp b/cpp/src/Ice/Object.cpp index f5fae21f3ff..b4f7dcb5ec4 100644 --- a/cpp/src/Ice/Object.cpp +++ b/cpp/src/Ice/Object.cpp @@ -56,6 +56,16 @@ const string __Ice__Object_ids[] = } +Ice::DispatchInterceptorAsyncCallback::~DispatchInterceptorAsyncCallback() +{ + // Out of line to avoid weak vtable +} + +Ice::Request::~Request() +{ + // Out of line to avoid weak vtable +} + bool #ifdef ICE_CPP11_MAPPING Ice::Object::ice_isA(string s, const Current&) const diff --git a/cpp/src/Ice/Outgoing.cpp b/cpp/src/Ice/Outgoing.cpp index d1e91bbe85f..3c1ad6bfd14 100644 --- a/cpp/src/Ice/Outgoing.cpp +++ b/cpp/src/Ice/Outgoing.cpp @@ -22,6 +22,11 @@ using namespace Ice; using namespace Ice::Instrumentation; using namespace IceInternal; +OutgoingBase::~OutgoingBase() +{ + // Out of line to avoid weak vtable +} + OutgoingBase::OutgoingBase(Instance* instance) : _os(instance, Ice::currentProtocolEncoding), _sent(false) { } diff --git a/cpp/src/Ice/OutgoingAsync.cpp b/cpp/src/Ice/OutgoingAsync.cpp index 55d1c9b2ae2..c5854246715 100644 --- a/cpp/src/Ice/OutgoingAsync.cpp +++ b/cpp/src/Ice/OutgoingAsync.cpp @@ -39,6 +39,11 @@ const unsigned char OutgoingAsyncBase::Done = 0x4; const unsigned char OutgoingAsyncBase::EndCalled = 0x8; #endif +OutgoingAsyncCompletionCallback::~OutgoingAsyncCompletionCallback() +{ + // Out of line to avoid weak vtable +} + bool OutgoingAsyncBase::sent() { @@ -1305,6 +1310,11 @@ ConnectionFlushBatchAsync::invoke(const string& operation) } } +CommunicatorFlushBatchAsync::~CommunicatorFlushBatchAsync() +{ + // Out of line to avoid weak vtable +} + CommunicatorFlushBatchAsync::CommunicatorFlushBatchAsync(const InstancePtr& instance) : OutgoingAsyncBase(instance) { @@ -1557,6 +1567,11 @@ public: // CallbackBasePtr IceInternal::__dummyCallback = new DummyCallback; +CallbackBase::~CallbackBase() +{ + // Out of line to avoid weak vtable +} + void CallbackBase::checkCallback(bool obj, bool cb) { @@ -1570,4 +1585,10 @@ CallbackBase::checkCallback(bool obj, bool cb) } } +GenericCallbackBase::~GenericCallbackBase() +{ + // Out of line to avoid weak vtable +} + + #endif diff --git a/cpp/src/Ice/OutputStream.cpp b/cpp/src/Ice/OutputStream.cpp index ee28c1e5325..653b8e39adb 100644 --- a/cpp/src/Ice/OutputStream.cpp +++ b/cpp/src/Ice/OutputStream.cpp @@ -897,6 +897,11 @@ Ice::OutputStream::initEncaps() } } +Ice::OutputStream::EncapsEncoder::~EncapsEncoder() +{ + // Out of line to avoid weak vtable +} + Int Ice::OutputStream::EncapsEncoder::registerTypeId(const string& typeId) { diff --git a/cpp/src/Ice/PropertiesAdminI.cpp b/cpp/src/Ice/PropertiesAdminI.cpp index ed82eaff96d..a7e6174c79c 100644 --- a/cpp/src/Ice/PropertiesAdminI.cpp +++ b/cpp/src/Ice/PropertiesAdminI.cpp @@ -21,6 +21,16 @@ const char* traceCategory = "Admin.Properties"; } +PropertiesAdminUpdateCallback::~PropertiesAdminUpdateCallback() +{ + // Out of line to avoid weak vtable +} + +NativePropertiesAdmin::~NativePropertiesAdmin() +{ + // Out of line to avoid weak vtable +} + namespace IceInternal { diff --git a/cpp/src/Ice/ProtocolInstance.cpp b/cpp/src/Ice/ProtocolInstance.cpp index 406acbd300f..ff34eb018ad 100644 --- a/cpp/src/Ice/ProtocolInstance.cpp +++ b/cpp/src/Ice/ProtocolInstance.cpp @@ -20,6 +20,11 @@ using namespace IceInternal; IceUtil::Shared* IceInternal::upCast(ProtocolInstance* p) { return p; } +IceInternal::ProtocolInstance::~ProtocolInstance() +{ + // Out of line to avoid weak vtable +} + IceInternal::ProtocolInstance::ProtocolInstance(const CommunicatorPtr& com, Short type, const string& protocol, bool secure) : _instance(getInstance(com)), diff --git a/cpp/src/Ice/ProtocolInstance.h b/cpp/src/Ice/ProtocolInstance.h index 3c1c0927d0e..0fce9e8b121 100644 --- a/cpp/src/Ice/ProtocolInstance.h +++ b/cpp/src/Ice/ProtocolInstance.h @@ -27,6 +27,8 @@ class ICE_API ProtocolInstance : public IceUtil::Shared { public: + virtual ~ProtocolInstance(); + ProtocolInstance(const Ice::CommunicatorPtr&, Ice::Short, const std::string&, bool); int traceLevel() const diff --git a/cpp/src/Ice/ProtocolPluginFacade.cpp b/cpp/src/Ice/ProtocolPluginFacade.cpp index 545b588c602..657764923aa 100644 --- a/cpp/src/Ice/ProtocolPluginFacade.cpp +++ b/cpp/src/Ice/ProtocolPluginFacade.cpp @@ -20,6 +20,11 @@ using namespace IceInternal; IceUtil::Shared* IceInternal::upCast(ProtocolPluginFacade* p) { return p; } +IceInternal::ProtocolPluginFacade::~ProtocolPluginFacade() +{ + // Out of line to avoid weak vtable +} + ProtocolPluginFacadePtr IceInternal::getProtocolPluginFacade(const CommunicatorPtr& communicator) { diff --git a/cpp/src/Ice/ProtocolPluginFacade.h b/cpp/src/Ice/ProtocolPluginFacade.h index 3da47418f6c..d8f7ac2965f 100644 --- a/cpp/src/Ice/ProtocolPluginFacade.h +++ b/cpp/src/Ice/ProtocolPluginFacade.h @@ -36,6 +36,8 @@ class ICE_API ProtocolPluginFacade : public ::IceUtil::Shared { public: + virtual ~ProtocolPluginFacade(); + // // Get the Communicator instance with which this facade is // associated. diff --git a/cpp/src/Ice/SlicedData.cpp b/cpp/src/Ice/SlicedData.cpp index a746be2803f..ca2b28e5cef 100644 --- a/cpp/src/Ice/SlicedData.cpp +++ b/cpp/src/Ice/SlicedData.cpp @@ -18,6 +18,11 @@ using namespace Ice; IceUtil::Shared* Ice::upCast(SliceInfo* p) { return p; } IceUtil::Shared* Ice::upCast(SlicedData* p) { return p; } IceUtil::Shared* Ice::upCast(UnknownSlicedValue* p) { return p; } + +Ice::SlicedData::~SlicedData() +{ + // Out of line to avoid weak vtable +} #endif Ice::SlicedData::SlicedData(const SliceInfoSeq& seq) : diff --git a/cpp/src/Ice/ThreadPool.cpp b/cpp/src/Ice/ThreadPool.cpp index f36e21a19c5..ea2e18d99c3 100644 --- a/cpp/src/Ice/ThreadPool.cpp +++ b/cpp/src/Ice/ThreadPool.cpp @@ -109,6 +109,16 @@ class ThreadPoolDestroyedException } +Ice::DispatcherCall::~DispatcherCall() +{ + // Out of line to avoid weak vtable +} + +Ice::Dispatcher::~Dispatcher() +{ + // Out of line to avoid weak vtable +} + IceInternal::DispatchWorkItem::DispatchWorkItem() { } diff --git a/cpp/src/Ice/Timer.cpp b/cpp/src/Ice/Timer.cpp index 2f4d88f7680..c19ba12a92b 100644 --- a/cpp/src/Ice/Timer.cpp +++ b/cpp/src/Ice/Timer.cpp @@ -13,6 +13,11 @@ using namespace std; using namespace IceUtil; +TimerTask::~TimerTask() +{ + // Out of line to avoid weak vtable +} + Timer::Timer() : Thread("IceUtil timer thread"), _destroyed(false) diff --git a/cpp/src/IceDB/IceDB.cpp b/cpp/src/IceDB/IceDB.cpp index 85dd9b1cde2..8f4d5316909 100644 --- a/cpp/src/IceDB/IceDB.cpp +++ b/cpp/src/IceDB/IceDB.cpp @@ -269,6 +269,11 @@ Txn::mtxn() const return _mtxn; } +ReadOnlyTxn::~ReadOnlyTxn() +{ + // Out of line to avoid weak vtable +} + ReadOnlyTxn::ReadOnlyTxn(const Env& env) : Txn(env, MDB_RDONLY) { @@ -290,6 +295,11 @@ ReadOnlyTxn::renew() } } +ReadWriteTxn::~ReadWriteTxn() +{ + // Out of line to avoid weak vtable +} + ReadWriteTxn::ReadWriteTxn(const Env& env) : Txn(env, 0) { @@ -496,4 +506,3 @@ IceDB::getMapSize(int configValue) return ((configValue <= 0) ? defaultMapSize : configValue) * 1024 * 1024; } - diff --git a/cpp/src/IceDB/IceDB.h b/cpp/src/IceDB/IceDB.h index 560f96b0cee..25a4ab365db 100644 --- a/cpp/src/IceDB/IceDB.h +++ b/cpp/src/IceDB/IceDB.h @@ -196,6 +196,8 @@ class ICE_DB_API ReadOnlyTxn : public Txn { public: + virtual ~ReadOnlyTxn(); + explicit ReadOnlyTxn(const Env&); void reset(); @@ -206,6 +208,8 @@ class ICE_DB_API ReadWriteTxn : public Txn { public: + virtual ~ReadWriteTxn(); + explicit ReadWriteTxn(const Env&); }; diff --git a/cpp/src/IcePatch2Lib/ClientUtil.cpp b/cpp/src/IcePatch2Lib/ClientUtil.cpp index e54d7b1242c..07c30450029 100644 --- a/cpp/src/IcePatch2Lib/ClientUtil.cpp +++ b/cpp/src/IcePatch2Lib/ClientUtil.cpp @@ -20,6 +20,17 @@ using namespace IceUtil; using namespace IcePatch2; using namespace IcePatch2Internal; + +IcePatch2::Patcher::~Patcher() +{ + // Out of line to avoid weak vtable +} + +IcePatch2::PatcherFeedback::~PatcherFeedback() +{ + // Out of line to avoid weak vtable +} + namespace { diff --git a/cpp/src/IcePatch2Lib/Util.cpp b/cpp/src/IcePatch2Lib/Util.cpp index ad1d00ed63f..4e89aebc6a2 100644 --- a/cpp/src/IcePatch2Lib/Util.cpp +++ b/cpp/src/IcePatch2Lib/Util.cpp @@ -1016,6 +1016,11 @@ getFileInfoSeqInternal(const string& basePath, const string& relPath, int compre } +IcePatch2Internal::GetFileInfoSeqCB::~GetFileInfoSeqCB() +{ + // Out of line to avoid weak vtable +} + bool IcePatch2Internal::getFileInfoSeq(const string& basePath, int compress, GetFileInfoSeqCB* cb, LargeFileInfoSeq& infoSeq) diff --git a/cpp/src/IcePatch2Lib/Util.h b/cpp/src/IcePatch2Lib/Util.h index 1eb580a354e..12bc86a93b2 100644 --- a/cpp/src/IcePatch2Lib/Util.h +++ b/cpp/src/IcePatch2Lib/Util.h @@ -156,7 +156,7 @@ class ICE_PATCH2_API GetFileInfoSeqCB { public: - virtual ~GetFileInfoSeqCB() { } + virtual ~GetFileInfoSeqCB(); virtual bool remove(const std::string&) = 0; virtual bool checksum(const std::string&) = 0; diff --git a/cpp/src/IceSSL/PluginI.cpp b/cpp/src/IceSSL/PluginI.cpp index cd6bbab1f53..fb29af51d78 100755 --- a/cpp/src/IceSSL/PluginI.cpp +++ b/cpp/src/IceSSL/PluginI.cpp @@ -41,6 +41,26 @@ registerIceSSL(bool loadOnInitialize) } +IceSSL::CertificateVerifier::~CertificateVerifier() +{ + // Out of line to avoid weak vtable +} + +IceSSL::NativeConnectionInfo::~NativeConnectionInfo() +{ + // Out of line to avoid weak vtable +} + +IceSSL::PasswordPrompt::~PasswordPrompt() +{ + // Out of line to avoid weak vtable +} + +IceSSL::Plugin::~Plugin() +{ + // Out of line to avoid weak vtable +} + // // Objective-C function to allow Objective-C programs to register plugin. // diff --git a/cpp/src/IceUtil/Shared.cpp b/cpp/src/IceUtil/Shared.cpp index 4012f58e169..75b43462398 100644 --- a/cpp/src/IceUtil/Shared.cpp +++ b/cpp/src/IceUtil/Shared.cpp @@ -29,6 +29,11 @@ IceUtil::SimpleShared::SimpleShared(const SimpleShared&) : { } +IceUtil::SimpleShared::~SimpleShared() +{ + // Out of line to avoid weak vtable +} + IceUtil::Shared::Shared() : _ref(0), _flags(0) @@ -41,14 +46,14 @@ IceUtil::Shared::Shared(const Shared&) : { } -void +void IceUtil::Shared::__incRef() { assert(_ref >= 0); ++_ref; } -void +void IceUtil::Shared::__decRef() { assert(_ref > 0); diff --git a/cpp/src/IceUtil/StringConverter.cpp b/cpp/src/IceUtil/StringConverter.cpp index 65924d465a3..f122084eb68 100644 --- a/cpp/src/IceUtil/StringConverter.cpp +++ b/cpp/src/IceUtil/StringConverter.cpp @@ -428,6 +428,10 @@ WindowsStringConverter::fromUTF8(const Byte* sourceStart, const Byte* sourceEnd, } +IceUtil::UTF8Buffer::~UTF8Buffer() +{ + // Out of line to avoid weak vtable +} WstringConverterPtr IceUtil::createUnicodeWstringConverter() diff --git a/cpp/src/slice2cpp/Gen.cpp b/cpp/src/slice2cpp/Gen.cpp index 5fe808581fa..e8bcdb73501 100644 --- a/cpp/src/slice2cpp/Gen.cpp +++ b/cpp/src/slice2cpp/Gen.cpp @@ -1819,7 +1819,10 @@ Slice::Gen::ProxyVisitor::visitClassDefStart(const ClassDefPtr& p) // Generated helper class to deal with multiple inheritance // when using Proxy template. // - H << sp << nl << "class _" << _dllExport << fixKwd(p->name() + "PrxBase") << " : "; + + string baseName = fixKwd("_" + p->name() + "Base"); + + H << sp << nl << "class " << _dllExport << baseName << " : "; H.useCurrentPosAsIndent(); for(ClassList::const_iterator q = bases.begin(); q != bases.end();) { @@ -1836,12 +1839,23 @@ Slice::Gen::ProxyVisitor::visitClassDefStart(const ClassDefPtr& p) H << nl << "public:"; H.inc(); + // Out of line dtor to avoid weak vtable + H << sp << nl << "virtual ~" << baseName << "();"; + C << sp; + C << nl << "::IceProxy" << scope << baseName << "::~" << baseName << "()"; + C << sb; + C << eb; + + H.dec(); + H << sp << nl << "protected:"; + H.inc(); + H << sp << nl << "virtual Object* __newInstance() const = 0;"; H << eb << ';'; } H << sp << nl << "class " << _dllExport << name << " : "; - H << "public virtual ::IceProxy::Ice::Proxy< ::IceProxy" << scoped << ", "; + H << "public virtual ::Ice::Proxy<" << name << ", "; if(bases.empty()) { H << "::IceProxy::Ice::Object"; @@ -1852,7 +1866,7 @@ Slice::Gen::ProxyVisitor::visitClassDefStart(const ClassDefPtr& p) } else { - H << "_" << fixKwd(p->name() + "PrxBase"); + H << fixKwd("_" + p->name() + "Base"); } H << ">"; @@ -1861,17 +1875,6 @@ Slice::Gen::ProxyVisitor::visitClassDefStart(const ClassDefPtr& p) H << nl << "public:"; H.inc(); - if(_dllExport != "") - { - // - // To export the virtual table - // - C << nl << "#ifdef __SUNPRO_CC"; - C << nl << "class " << _dllExport - << "IceProxy" << scoped << ";"; - C << nl << "#endif"; - } - C << nl << _dllExport << "::IceProxy::Ice::Object* ::IceProxy" << scope << "upCast(::IceProxy" << scoped << "* p) { return p; }"; @@ -1904,9 +1907,21 @@ Slice::Gen::ProxyVisitor::visitClassDefEnd(const ClassDefPtr& p) string scope = fixKwd(p->scope()); H << nl << nl << "static const ::std::string& ice_staticId();"; + + H.dec(); + H << sp << nl << "protected: "; + H.inc(); + H << nl << "virtual ::IceProxy::Ice::Object* __newInstance() const;"; H << eb << ';'; C << sp; + C << nl << "::IceProxy::Ice::Object*"; + C << nl << "IceProxy" << scoped << "::__newInstance() const"; + C << sb; + C << nl << "return new " << name << ";"; + C << eb; + + C << sp; C << nl << "const ::std::string&" << nl << "IceProxy" << scoped << "::ice_staticId()"; C << sb; C << nl << "return "<< scoped << "::ice_staticId();"; @@ -2553,6 +2568,12 @@ Slice::Gen::ObjectVisitor::visitClassDefStart(const ClassDefPtr& p) H << nl << "typedef " << p->name() << "Ptr PointerType;"; } + H << sp << nl << "virtual ~" << name << "();"; + C << sp; + C << nl << scoped.substr(2) << "::~" << name << "()"; + C << sb; + C << eb; + vector<string> params; vector<string> allTypes; vector<string> allParamDecls; @@ -2586,124 +2607,7 @@ Slice::Gen::ObjectVisitor::visitClassDefStart(const ClassDefPtr& p) H << sb << eb; } - /* - * Strong guarantee: commented-out code marked "Strong guarantee" generates - * a copy-assignment operator that provides the strong exception guarantee. - * For now, this is commented out, and we use the compiler-generated - * copy-assignment operator. However, that one does not provide the strong - * guarantee. - - H << ';'; - if(!p->isAbstract()) - { - H << nl << name << "& operator=(const " << name << "&)"; - if(allDataMembers.empty()) - { - H << " { return *this; }"; - } - H << ';'; - } - - // - // __swap() is static because classes may be abstract, so we - // can't use a non-static member function when we do an upcall - // from a non-abstract derived __swap to the __swap in an abstract base. - // - H << sp << nl << "static void __swap(" << name << "&, " << name << "&) throw()"; - if(allDataMembers.empty()) - { - H << " {}"; - } - H << ';'; - H << nl << "void swap(" << name << "& rhs) throw()"; - H << sb; - if(!allDataMembers.empty()) - { - H << nl << "__swap(*this, rhs);"; - } - H << eb; - - * Strong guarantee - */ - emitOneShotConstructor(p); - H << sp; - - /* - * Strong guarantee - - if(!allDataMembers.empty()) - { - C << sp << nl << "void"; - C << nl << scoped.substr(2) << "::__swap(" << name << "& __lhs, " << name << "& __rhs) throw()"; - C << sb; - - if(base) - { - emitUpcall(base, "::__swap(__lhs, __rhs);"); - } - - // - // We use a map to remember for which types we have already declared - // a temporary variable and reuse that variable if a class has - // more than one member of the same type. That way, we don't use more - // temporaries than necessary. (::std::swap() instantiates a new temporary - // each time it is used.) - // - map<string, int> tmpMap; - map<string, int>::iterator pos; - int tmpCount = 0; - - for(q = dataMembers.begin(); q != dataMembers.end(); ++q) - { - string memberName = fixKwd((*q)->name()); - TypePtr type = (*q)->type(); - BuiltinPtr builtin = BuiltinPtr::dynamicCast(type); - if(builtin && builtin->kind() != Builtin::KindString - || EnumPtr::dynamicCast(type) || ProxyPtr::dynamicCast(type) - || ClassDeclPtr::dynamicCast(type) || StructPtr::dynamicCast(type)) - { - // - // For built-in types (except string), enums, proxies, structs, and classes, - // do the swap via a temporary variable. - // - string typeName = typeToString(type); - pos = tmpMap.find(typeName); - if(pos == tmpMap.end()) - { - pos = tmpMap.insert(pos, make_pair(typeName, tmpCount)); - C << nl << typeName << " __tmp" << tmpCount << ';'; - tmpCount++; - } - C << nl << "__tmp" << pos->second << " = __rhs." << memberName << ';'; - C << nl << "__rhs." << memberName << " = __lhs." << memberName << ';'; - C << nl << "__lhs." << memberName << " = __tmp" << pos->second << ';'; - } - else - { - // - // For dictionaries, vectors, and maps, use the standard container's - // swap() (which is usually optimized). - // - C << nl << "__lhs." << memberName << ".swap(__rhs." << memberName << ");"; - } - } - C << eb; - - if(!p->isAbstract()) - { - C << sp << nl << scoped << "&"; - C << nl << scoped.substr(2) << "::operator=(const " << name << "& __rhs)"; - C << sb; - C << nl << name << " __tmp(__rhs);"; - C << nl << "__swap(*this, __tmp);"; - C << nl << "return *this;"; - C << eb; - } - } - - * Strong guarantee - */ } if(!p->isLocal()) @@ -2867,6 +2771,8 @@ Slice::Gen::ObjectVisitor::visitClassDefEnd(const ClassDefPtr& p) bool basePreserved = p->inheritsMetaData("preserve-slice"); bool preserved = p->hasMetaData("preserve-slice"); + bool inProtected = false; + if(!p->isLocal()) { OperationList allOps = p->allOperations(); @@ -3018,6 +2924,7 @@ Slice::Gen::ObjectVisitor::visitClassDefEnd(const ClassDefPtr& p) H.dec(); H << sp << nl << "protected:"; + inProtected = true; H.inc(); H << nl << "virtual void __writeImpl(::Ice::OutputStream*) const;"; @@ -3107,7 +3014,7 @@ Slice::Gen::ObjectVisitor::visitClassDefEnd(const ClassDefPtr& p) // // Emit data members. Access visibility may be specified by metadata. // - bool inProtected = true; + DataMemberList dataMembers = p->dataMembers(); bool prot = p->hasMetaData("protected"); for(DataMemberList::const_iterator q = dataMembers.begin(); q != dataMembers.end(); ++q) @@ -3136,21 +3043,6 @@ Slice::Gen::ObjectVisitor::visitClassDefEnd(const ClassDefPtr& p) emitDataMember(*q); } - if(!p->isAbstract()) - { - // - // We add a protected destructor to force heap instantiation of the class. - // - if(!inProtected) - { - H.dec(); - H << nl << "protected:"; - H.inc(); - inProtected = true; - } - H << sp << nl << "virtual ~" << fixKwd(p->name()) << "() {}"; - } - if(!p->isLocal() && preserved && !basePreserved) { if(!inProtected) @@ -4433,8 +4325,8 @@ Slice::Gen::ImplVisitor::visitClassDefStart(const ClassDefPtr& p) return true; } -Slice::Gen::AsyncVisitor::AsyncVisitor(Output& h, Output&, const string& dllExport) : - H(h), _dllExport(dllExport), _useWstring(false) +Slice::Gen::AsyncVisitor::AsyncVisitor(Output& h, Output& c, const string& dllExport) : + H(h), C(c), _dllExport(dllExport), _useWstring(false) { } @@ -4549,12 +4441,22 @@ Slice::Gen::AsyncVisitor::visitOperation(const OperationPtr& p) if(cl->hasMetaData("amd") || p->hasMetaData("amd")) { - H << sp << nl << "class " << _dllExport << classNameAMD << '_' << name + string cbName = classNameAMD + '_' + name; + + H << sp << nl << "class " << _dllExport << cbName << " : public virtual ::Ice::AMDCallback"; H << sb; H.dec(); H << nl << "public:"; H.inc(); + + // Out of line dtor to avoid weak vtable + H << sp << nl << "virtual ~" << cbName << "();"; + C << sp; + C << nl << classScope.substr(2) << cbName << "::~" << cbName << "()"; + C << sb; + C << eb; + H << sp; H << nl << "virtual void ice_response" << spar << paramsAMD << epar << " = 0;"; H << eb << ';'; @@ -5756,6 +5658,13 @@ Slice::Gen::Cpp11TypesVisitor::visitExceptionStart(const ExceptionPtr& p) H << nl << "public:"; H.inc(); + // Out of line dtor to avoid weak vtable + H << nl << "virtual ~" << name << "();"; + C << sp; + C << nl << scoped.substr(2) << "::~" << name << "()"; + C << sb; + C << eb; + if(p->isLocal()) { H << sp << nl << name << "(const char* __ice_file, int __ice_line) : "; @@ -5767,18 +5676,17 @@ Slice::Gen::Cpp11TypesVisitor::visitExceptionStart(const ExceptionPtr& p) else { H.zeroIndent(); - H << nl << "//"; + H << sp << nl << "//"; H << nl << "// COMPILERFIX: Apple LLVM version 7.3.0 crash when using"; - H << nl << "// default generated constructor in classes derived from"; - H << nl << "// std::exception"; + H << " a '= default' constructor in classes derived from std::exception"; H << nl << "//"; - H << nl << "#ifdef __APPLE__"; + H << nl << "#if defined(__APPLE___) && defined(__clang__)"; H.restoreIndent(); - H << sp << nl << name << "() {}"; + H << nl << name << "() {}"; H.zeroIndent(); H << nl << "#else"; H.restoreIndent(); - H << sp << nl << name << "() = default;"; + H << nl << name << "() = default;"; H.zeroIndent(); H << nl << "#endif"; H.restoreIndent(); @@ -5940,10 +5848,7 @@ Slice::Gen::Cpp11TypesVisitor::visitExceptionEnd(const ExceptionPtr& p) { H << sp << nl << "virtual void __write(::Ice::OutputStream*) const;"; H << nl << "virtual void __read(::Ice::InputStream*);"; - } - if(preserved && !basePreserved) - { H << sp << nl << "::std::shared_ptr<::Ice::SlicedData> __slicedData;"; C << sp << nl << "void" << nl << scoped.substr(2) << "::__write(::Ice::OutputStream* __os) const"; @@ -6852,6 +6757,14 @@ Slice::Gen::Cpp11LocalObjectVisitor::visitClassDefStart(const ClassDefPtr& p) H << nl << "typedef ::std::shared_ptr<" << name << "> PointerType;"; } + // + // Out of line virtual dtor to avoid weak vtable + // + H << sp << nl << "virtual ~" << name << "();"; + C << sp << nl << scoped.substr(2) << "::~" << name << "()"; + C << sb; + C << eb; + vector<string> params; vector<string> allTypes; vector<string> allParamDecls; @@ -6881,12 +6794,10 @@ Slice::Gen::Cpp11LocalObjectVisitor::visitClassDefStart(const ClassDefPtr& p) } else { - H << sp << nl << name << "()"; - H << sb << eb; + H << sp << nl << name << "() = default;"; } emitOneShotConstructor(p); - H << sp; } if(p->hasMetaData("cpp:comparable")) @@ -6913,7 +6824,7 @@ Slice::Gen::Cpp11LocalObjectVisitor::visitClassDefEnd(const ClassDefPtr& p) // // Emit data members. Access visibility may be specified by metadata. // - bool inProtected = true; + bool inProtected = false; DataMemberList dataMembers = p->dataMembers(); bool prot = p->hasMetaData("protected"); for(DataMemberList::const_iterator q = dataMembers.begin(); q != dataMembers.end(); ++q) @@ -6942,18 +6853,6 @@ Slice::Gen::Cpp11LocalObjectVisitor::visitClassDefEnd(const ClassDefPtr& p) emitDataMember(*q); } - if(!p->isAbstract()) - { - if(inProtected) - { - H.dec(); - H << sp << nl << "public:"; - H.inc(); - inProtected = false; - } - H << sp << nl << "virtual ~" << fixKwd(p->name()) << "() = default;"; - } - H << eb << ';'; } @@ -7746,6 +7645,14 @@ Slice::Gen::Cpp11ValueVisitor::visitClassDefStart(const ClassDefPtr& p) H << nl << "typedef ::std::shared_ptr<" << name << "> PointerType;"; } + // Out of line dtor to avoid weak vtable + H << sp; + H << nl << "virtual ~" << name << "();"; + C << sp; + C << nl << scoped.substr(2) << "::~" << name << "()"; + C << sb; + C << eb; + vector<string> params; vector<string> allTypes; vector<string> allParamDecls; diff --git a/cpp/src/slice2cpp/Gen.h b/cpp/src/slice2cpp/Gen.h index 114f13781c0..3bd6af85405 100644 --- a/cpp/src/slice2cpp/Gen.h +++ b/cpp/src/slice2cpp/Gen.h @@ -290,6 +290,7 @@ private: private: ::IceUtilInternal::Output& H; + ::IceUtilInternal::Output& C; std::string _dllExport; int _useWstring; |