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/src | |
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/src')
40 files changed, 335 insertions, 186 deletions
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; |