diff options
author | Jose <pepone@users.noreply.github.com> | 2021-12-28 21:27:53 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-12-28 21:27:53 +0100 |
commit | bc2762ed4c196ff500ad49bb9e5039e826762045 (patch) | |
tree | 0703cb36a831353f29bfae8e53608f0f88e1e945 /cpp/src | |
parent | Update C++ tests to support building with v143 binary distribution (diff) | |
download | ice-bc2762ed4c196ff500ad49bb9e5039e826762045.tar.bz2 ice-bc2762ed4c196ff500ad49bb9e5039e826762045.tar.xz ice-bc2762ed4c196ff500ad49bb9e5039e826762045.zip |
Fixes for C++98 mapping build with C++17 mode or greater
Diffstat (limited to 'cpp/src')
30 files changed, 206 insertions, 74 deletions
diff --git a/cpp/src/Ice/ConnectionFactory.cpp b/cpp/src/Ice/ConnectionFactory.cpp index 9732cbe81b2..85821904220 100644 --- a/cpp/src/Ice/ConnectionFactory.cpp +++ b/cpp/src/Ice/ConnectionFactory.cpp @@ -48,7 +48,7 @@ IceUtil::Shared* IceInternal::upCast(IncomingConnectionFactory* p) { return p; } namespace { -#ifdef ICE_CPP11_MAPPING +#ifdef ICE_CPP11_COMPILER template <typename Map> void remove(Map& m, const typename Map::key_type& k, const typename Map::mapped_type& v) { @@ -463,9 +463,9 @@ IceInternal::OutgoingConnectionFactory::findConnection(const vector<EndpointIPtr assert(!endpoints.empty()); for(vector<EndpointIPtr>::const_iterator p = endpoints.begin(); p != endpoints.end(); ++p) { -#ifdef ICE_CPP11_MAPPING +#ifdef ICE_CPP11_COMPILER auto connection = find(_connectionsByEndpoint, *p, - [](const ConnectionIPtr& conn) + [](const auto& conn) { return conn->isActiveOrHolding(); }); @@ -501,9 +501,9 @@ IceInternal::OutgoingConnectionFactory::findConnection(const vector<ConnectorInf continue; } -#ifdef ICE_CPP11_MAPPING +#ifdef ICE_CPP11_COMPILER auto connection = find(_connections, p->connector, - [](const ConnectionIPtr& conn) + [](const auto& conn) { return conn->isActiveOrHolding(); }); diff --git a/cpp/src/Ice/LocatorInfo.cpp b/cpp/src/Ice/LocatorInfo.cpp index b1a5159365d..654033f2311 100644 --- a/cpp/src/Ice/LocatorInfo.cpp +++ b/cpp/src/Ice/LocatorInfo.cpp @@ -133,8 +133,8 @@ IceInternal::LocatorManager::destroy() { IceUtil::Mutex::Lock sync(*this); -#ifdef ICE_CPP11_MAPPING - for_each(_table.begin(), _table.end(), [](pair<shared_ptr<Ice::LocatorPrx>, LocatorInfoPtr> it){ it.second->destroy(); }); +#ifdef ICE_CPP11_COMPILER + for_each(_table.begin(), _table.end(), [](const auto& it){ it.second->destroy(); }); #else for_each(_table.begin(), _table.end(), Ice::secondVoidMemFun<const LocatorPrx, LocatorInfo>(&LocatorInfo::destroy)); #endif @@ -773,7 +773,7 @@ IceInternal::LocatorInfo::trace(const string& msg, const ReferencePtr& ref, cons const char* sep = endpoints.size() > 1 ? ":" : ""; ostringstream o; -#ifdef ICE_CPP11_MAPPING +#ifdef ICE_CPP11_COMPILER transform(endpoints.begin(), endpoints.end(), ostream_iterator<string>(o, sep), [](const EndpointPtr& endpoint) { diff --git a/cpp/src/Ice/ObjectAdapterFactory.cpp b/cpp/src/Ice/ObjectAdapterFactory.cpp index ac8bf7774cb..c9821adf2e8 100644 --- a/cpp/src/Ice/ObjectAdapterFactory.cpp +++ b/cpp/src/Ice/ObjectAdapterFactory.cpp @@ -46,8 +46,8 @@ IceInternal::ObjectAdapterFactory::shutdown() // Deactivate outside the thread synchronization, to avoid // deadlocks. // -#ifdef ICE_CPP11_MAPPING - for_each(adapters.begin(), adapters.end(), [](const ObjectAdapterIPtr& adapter) { adapter->deactivate(); }); +#ifdef ICE_CPP11_COMPILER + for_each(adapters.begin(), adapters.end(), [](const auto& adapter) { adapter->deactivate(); }); #else for_each(adapters.begin(), adapters.end(), IceUtil::voidMemFun(&ObjectAdapter::deactivate)); #endif @@ -75,8 +75,8 @@ IceInternal::ObjectAdapterFactory::waitForShutdown() // // Now we wait for deactivation of each object adapter. // -#ifdef ICE_CPP11_MAPPING - for_each(adapters.begin(), adapters.end(), [](const ObjectAdapterIPtr& adapter) { adapter->waitForDeactivate(); }); +#ifdef ICE_CPP11_COMPILER + for_each(adapters.begin(), adapters.end(), [](const auto& adapter) { adapter->waitForDeactivate(); }); #else for_each(adapters.begin(), adapters.end(), IceUtil::voidMemFun(&ObjectAdapter::waitForDeactivate)); #endif @@ -108,8 +108,8 @@ IceInternal::ObjectAdapterFactory::destroy() // // Now we destroy each object adapter. // -#ifdef ICE_CPP11_MAPPING - for_each(adapters.begin(), adapters.end(), [](const ObjectAdapterIPtr& adapter) { adapter->destroy(); }); +#ifdef ICE_CPP11_COMPILER + for_each(adapters.begin(), adapters.end(), [](const auto& adapter) { adapter->destroy(); }); #else for_each(adapters.begin(), adapters.end(), IceUtil::voidMemFun(&ObjectAdapter::destroy)); #endif @@ -128,7 +128,7 @@ IceInternal::ObjectAdapterFactory::updateObservers(void (ObjectAdapterI::*fn)()) IceUtil::Monitor<IceUtil::RecMutex>::Lock sync(*this); adapters = _adapters; } -#ifdef ICE_CPP11_MAPPING +#ifdef ICE_CPP11_COMPILER for_each(adapters.begin(), adapters.end(), [fn](const ObjectAdapterIPtr& adapter) { diff --git a/cpp/src/Ice/ObjectAdapterI.cpp b/cpp/src/Ice/ObjectAdapterI.cpp index 69c25758483..f41f1b54df4 100644 --- a/cpp/src/Ice/ObjectAdapterI.cpp +++ b/cpp/src/Ice/ObjectAdapterI.cpp @@ -98,9 +98,9 @@ Ice::ObjectAdapterI::activate() // if(_state != StateUninitialized) { -#ifdef ICE_CPP11_MAPPING +#ifdef ICE_CPP11_COMPILER for_each(_incomingConnectionFactories.begin(), _incomingConnectionFactories.end(), - [](const IncomingConnectionFactoryPtr& factory) + [](const auto& factory) { factory->activate(); }); @@ -159,9 +159,9 @@ Ice::ObjectAdapterI::activate() IceUtil::Monitor<IceUtil::RecMutex>::Lock sync(*this); assert(_state == StateActivating); -#ifdef ICE_CPP11_MAPPING +#ifdef ICE_CPP11_COMPILER for_each(_incomingConnectionFactories.begin(), _incomingConnectionFactories.end(), - [](const IncomingConnectionFactoryPtr& factory) + [](const auto& factory) { factory->activate(); }); @@ -182,9 +182,9 @@ Ice::ObjectAdapterI::hold() checkForDeactivation(); _state = StateHeld; -#ifdef ICE_CPP11_MAPPING +#ifdef ICE_CPP11_COMPILER for_each(_incomingConnectionFactories.begin(), _incomingConnectionFactories.end(), - [](const IncomingConnectionFactoryPtr& factory) + [](const auto& factory) { factory->hold(); }); @@ -206,9 +206,9 @@ Ice::ObjectAdapterI::waitForHold() incomingConnectionFactories = _incomingConnectionFactories; } -#ifdef ICE_CPP11_MAPPING +#ifdef ICE_CPP11_COMPILER for_each(incomingConnectionFactories.begin(), incomingConnectionFactories.end(), - [](const IncomingConnectionFactoryPtr& factory) + [](const auto& factory) { factory->waitUntilHolding(); }); @@ -269,9 +269,9 @@ Ice::ObjectAdapterI::deactivate() ICE_NOEXCEPT // } -#ifdef ICE_CPP11_MAPPING +#ifdef ICE_CPP11_COMPILER for_each(_incomingConnectionFactories.begin(), _incomingConnectionFactories.end(), - [](const IncomingConnectionFactoryPtr& factory) + [](const auto& factory) { factory->destroy(); }); @@ -317,9 +317,9 @@ Ice::ObjectAdapterI::waitForDeactivate() ICE_NOEXCEPT // Now we wait until all incoming connection factories are // finished. // -#ifdef ICE_CPP11_MAPPING +#ifdef ICE_CPP11_COMPILER for_each(incomingConnectionFactories.begin(), incomingConnectionFactories.end(), - [](const IncomingConnectionFactoryPtr& factory) + [](const auto& factory) { factory->waitUntilFinished(); }); @@ -639,8 +639,8 @@ Ice::ObjectAdapterI::getEndpoints() const ICE_NOEXCEPT EndpointSeq endpoints; transform(_incomingConnectionFactories.begin(), _incomingConnectionFactories.end(), back_inserter(endpoints), -#ifdef ICE_CPP11_MAPPING - [](const IncomingConnectionFactoryPtr& factory) +#ifdef ICE_CPP11_COMPILER + [](const auto& factory) { return factory->endpoint(); }); @@ -831,9 +831,9 @@ Ice::ObjectAdapterI::updateConnectionObservers() IceUtil::Monitor<IceUtil::RecMutex>::Lock sync(*this); f = _incomingConnectionFactories; } -#ifdef ICE_CPP11_MAPPING +#ifdef ICE_CPP11_COMPILER for_each(f.begin(), f.end(), - [](const IncomingConnectionFactoryPtr& factory) + [](const auto& factory) { factory->updateConnectionObservers(); }); diff --git a/cpp/src/Ice/RouterInfo.cpp b/cpp/src/Ice/RouterInfo.cpp index 7828e69510d..ed5c6a3b54b 100644 --- a/cpp/src/Ice/RouterInfo.cpp +++ b/cpp/src/Ice/RouterInfo.cpp @@ -25,8 +25,8 @@ void IceInternal::RouterManager::destroy() { IceUtil::Mutex::Lock sync(*this); -#ifdef ICE_CPP11_MAPPING - for_each(_table.begin(), _table.end(), [](const pair<shared_ptr<RouterPrx>, RouterInfoPtr> it){ it.second->destroy(); }); +#ifdef ICE_CPP11_COMPILER + for_each(_table.begin(), _table.end(), [](const auto& it){ it.second->destroy(); }); #else for_each(_table.begin(), _table.end(), Ice::secondVoidMemFun<const RouterPrx, RouterInfo>(&RouterInfo::destroy)); #endif diff --git a/cpp/src/IceGrid/AdapterCache.cpp b/cpp/src/IceGrid/AdapterCache.cpp index 941a653b5f3..cf6441e53fa 100644 --- a/cpp/src/IceGrid/AdapterCache.cpp +++ b/cpp/src/IceGrid/AdapterCache.cpp @@ -20,7 +20,7 @@ using namespace IceGrid; namespace IceGrid { -struct ReplicaLoadComp : binary_function<ServerAdapterEntryPtr&, ServerAdapterEntryPtr&, bool> +struct ReplicaLoadComp { bool operator()(const pair<float, ServerAdapterEntryPtr>& lhs, const pair<float, ServerAdapterEntryPtr>& rhs) { @@ -28,7 +28,7 @@ struct ReplicaLoadComp : binary_function<ServerAdapterEntryPtr&, ServerAdapterEn } }; -struct ReplicaPriorityComp : binary_function<ServerAdapterEntryPtr&, ServerAdapterEntryPtr&, bool> +struct ReplicaPriorityComp { bool operator()(const ServerAdapterEntryPtr& lhs, const ServerAdapterEntryPtr& rhs) { @@ -36,8 +36,7 @@ struct ReplicaPriorityComp : binary_function<ServerAdapterEntryPtr&, ServerAdapt } }; -struct TransformToReplicaLoad : - public unary_function<const ServerAdapterEntryPtr&, pair<float, ServerAdapterEntryPtr> > +struct TransformToReplicaLoad { public: @@ -52,7 +51,7 @@ public: LoadSample _loadSample; }; -struct TransformToReplica : public unary_function<const pair<string, ServerAdapterEntryPtr>&, ServerAdapterEntryPtr> +struct TransformToReplica { ServerAdapterEntryPtr operator()(const pair<float, ServerAdapterEntryPtr>& value) diff --git a/cpp/src/IceGrid/AllocatableObjectCache.cpp b/cpp/src/IceGrid/AllocatableObjectCache.cpp index 0f77b299ea1..5ec7256f437 100644 --- a/cpp/src/IceGrid/AllocatableObjectCache.cpp +++ b/cpp/src/IceGrid/AllocatableObjectCache.cpp @@ -16,7 +16,7 @@ using namespace IceGrid; namespace IceGrid { -struct AllocatableObjectEntryCI : binary_function<AllocatableObjectEntryPtr&, AllocatableObjectEntryPtr&, bool> +struct AllocatableObjectEntryCI { bool diff --git a/cpp/src/IceGrid/Database.cpp b/cpp/src/IceGrid/Database.cpp index 4abfe9e436d..7dcb555fb30 100644 --- a/cpp/src/IceGrid/Database.cpp +++ b/cpp/src/IceGrid/Database.cpp @@ -43,7 +43,7 @@ const string internalObjectsDbName = "internal-objects"; const string internalObjectsByTypeDbName = "internal-objectsByType"; const string serialsDbName = "serials"; -struct ObjectLoadCI : binary_function<pair<Ice::ObjectPrx, float>&, pair<Ice::ObjectPrx, float>&, bool> +struct ObjectLoadCI { bool operator()(const pair<Ice::ObjectPrx, float>& lhs, const pair<Ice::ObjectPrx, float>& rhs) { @@ -433,8 +433,11 @@ Database::syncApplications(const ApplicationInfoSeq& newApplications, Ice::Long } } +#ifdef ICE_CPP11_COMPILER + for_each(entries.begin(), entries.end(), [](const auto& it) {it->sync(); }); +#else for_each(entries.begin(), entries.end(), IceUtil::voidMemFun(&ServerEntry::sync)); - +#endif if(_traceLevels->application > 0) { Ice::Trace out(_traceLevels->logger, _traceLevels->applicationCat); @@ -614,7 +617,11 @@ Database::addApplication(const ApplicationInfo& info, AdminSessionI* session, Ic load(helper, entries, info.uuid, info.revision); startUpdating(info.descriptor.name, info.uuid, info.revision); +#ifdef ICE_CPP11_COMPILER + for_each(entries.begin(), entries.end(), [](const auto& it) { it->sync(); }); +#else for_each(entries.begin(), entries.end(), IceUtil::voidMemFun(&ServerEntry::sync)); +#endif serial = _applicationObserverTopic->applicationAdded(dbSerial, info); } catch(const IceDB::KeyTooLongException& ex) @@ -668,7 +675,11 @@ Database::addApplication(const ApplicationInfo& info, AdminSessionI* session, Ic dbSerial = removeApplication(info.descriptor.name, txn); txn.commit(); +#ifdef ICE_CPP11_COMPILER + for_each(entries.begin(), entries.end(), [](const auto& it) { it->sync(); }); +#else for_each(entries.begin(), entries.end(), IceUtil::voidMemFun(&ServerEntry::sync)); +#endif serial = _applicationObserverTopic->applicationRemoved(dbSerial, info.descriptor.name); } catch(const DeploymentException& ex) @@ -682,7 +693,11 @@ Database::addApplication(const ApplicationInfo& info, AdminSessionI* session, Ic } _applicationObserverTopic->waitForSyncedSubscribers(serial); +#ifdef ICE_CPP11_COMPILER + for_each(entries.begin(), entries.end(), [](const auto& it) { it->waitForSyncNoThrow(); }); +#else for_each(entries.begin(), entries.end(), IceUtil::voidMemFun(&ServerEntry::waitForSyncNoThrow)); +#endif finishUpdating(info.descriptor.name); throw; } @@ -870,8 +885,11 @@ Database::removeApplication(const string& name, AdminSessionI* session, Ice::Lon txn.commit(); startUpdating(name, appInfo.uuid, appInfo.revision); - +#ifdef ICE_CPP11_COMPILER + for_each(entries.begin(), entries.end(), [](const auto& it) { it->sync(); }); +#else for_each(entries.begin(), entries.end(), IceUtil::voidMemFun(&ServerEntry::sync)); +#endif serial = _applicationObserverTopic->applicationRemoved(dbSerial, name); } catch(const IceDB::LMDBException& ex) @@ -884,7 +902,11 @@ Database::removeApplication(const string& name, AdminSessionI* session, Ice::Lon if(_master) { +#ifdef ICE_CPP11_COMPILER + for_each(entries.begin(), entries.end(), [](const auto& it) { it->waitForSyncNoThrow(); }); +#else for_each(entries.begin(), entries.end(), IceUtil::voidMemFun(&ServerEntry::waitForSyncNoThrow)); +#endif } if(_traceLevels->application > 0) @@ -2548,8 +2570,11 @@ Database::finishApplicationUpdate(const ApplicationUpdateInfo& update, checkForUpdate(previousAppHelper, appHelper, txn); reload(previousAppHelper, appHelper, entries, oldApp.uuid, oldApp.revision + 1, noRestart); +#ifdef ICE_CPP11_COMPILER + for_each(entries.begin(), entries.end(), [](const auto& it) { it->sync(); }); +#else for_each(entries.begin(), entries.end(), IceUtil::voidMemFun(&ServerEntry::sync)); - +#endif ApplicationInfo info = oldApp; info.updateTime = update.updateTime; info.updateUser = update.updateUser; @@ -2635,12 +2660,19 @@ Database::finishApplicationUpdate(const ApplicationUpdateInfo& update, assert(p != _updating.end()); p->unmarkUpdated(); +#ifdef ICE_CPP11_COMPILER + for_each(entries.begin(), entries.end(), [](const auto& it) { it->sync(); }); +#else for_each(entries.begin(), entries.end(), IceUtil::voidMemFun(&ServerEntry::sync)); - +#endif serial = _applicationObserverTopic->applicationUpdated(dbSerial, newUpdate); } _applicationObserverTopic->waitForSyncedSubscribers(serial); // Wait for subscriber to be updated. +#ifdef ICE_CPP11_COMPILER + for_each(entries.begin(), entries.end(), [](const auto& it) { it->waitForSyncNoThrow(); }); +#else for_each(entries.begin(), entries.end(), IceUtil::voidMemFun(&ServerEntry::waitForSyncNoThrow)); +#endif finishUpdating(newDesc.name); throw; } diff --git a/cpp/src/IceGrid/DescriptorHelper.cpp b/cpp/src/IceGrid/DescriptorHelper.cpp index c62bf1e622a..8e289af98b0 100644 --- a/cpp/src/IceGrid/DescriptorHelper.cpp +++ b/cpp/src/IceGrid/DescriptorHelper.cpp @@ -23,7 +23,7 @@ using namespace IceGrid; namespace IceGrid { -struct GetReplicaGroupId : unary_function<const ReplicaGroupDescriptor&, const string&> +struct GetReplicaGroupId { const string& operator()(const ReplicaGroupDescriptor& desc) @@ -32,7 +32,7 @@ struct GetReplicaGroupId : unary_function<const ReplicaGroupDescriptor&, const s } }; -struct GetAdapterId : unary_function<const AdapterDescriptor&, const string&> +struct GetAdapterId { const string& operator()(const AdapterDescriptor& desc) @@ -41,7 +41,7 @@ struct GetAdapterId : unary_function<const AdapterDescriptor&, const string&> } }; -struct GetObjectId : unary_function<const ObjectDescriptor&, const Ice::Identity&> +struct GetObjectId { const Ice::Identity& operator()(const ObjectDescriptor& desc) @@ -76,7 +76,7 @@ isSeqEqual(const Seq& lseq, const Seq& rseq, GetKeyFunc func, EqFunc eq = equal_ return true; } -struct TemplateDescriptorEqual : std::binary_function<TemplateDescriptor&, TemplateDescriptor&, bool> +struct TemplateDescriptorEqual { bool operator()(const TemplateDescriptor& lhs, const TemplateDescriptor& rhs) @@ -120,7 +120,7 @@ struct TemplateDescriptorEqual : std::binary_function<TemplateDescriptor&, Templ } }; -struct ObjectDescriptorEq : std::binary_function<const ObjectDescriptor&, const ObjectDescriptor&, bool> +struct ObjectDescriptorEq { bool operator()(const ObjectDescriptor& lhs, const ObjectDescriptor& rhs) @@ -141,7 +141,7 @@ struct ObjectDescriptorEq : std::binary_function<const ObjectDescriptor&, const } }; -struct AdapterEq : std::binary_function<const AdapterDescriptor&, const AdapterDescriptor&, bool> +struct AdapterEq { bool operator()(const AdapterDescriptor& lhs, const AdapterDescriptor& rhs) @@ -186,7 +186,7 @@ struct AdapterEq : std::binary_function<const AdapterDescriptor&, const AdapterD } }; -struct ReplicaGroupEq : std::binary_function<const ReplicaGroupDescriptor&, const ReplicaGroupDescriptor&, bool> +struct ReplicaGroupEq { bool operator()(const ReplicaGroupDescriptor& lhs, const ReplicaGroupDescriptor& rhs) diff --git a/cpp/src/IceGrid/NodeCache.cpp b/cpp/src/IceGrid/NodeCache.cpp index 1407c998f1c..5b7c22cb583 100644 --- a/cpp/src/IceGrid/NodeCache.cpp +++ b/cpp/src/IceGrid/NodeCache.cpp @@ -19,7 +19,7 @@ using namespace IceGrid; namespace IceGrid { -struct ToInternalServerDescriptor : std::unary_function<CommunicatorDescriptorPtr&, void> +struct ToInternalServerDescriptor { ToInternalServerDescriptor(const InternalServerDescriptorPtr& descriptor, const InternalNodeInfoPtr& node, int iceVersion) : diff --git a/cpp/src/IceGrid/NodeI.cpp b/cpp/src/IceGrid/NodeI.cpp index 8017fa3bdd4..d07257220f0 100644 --- a/cpp/src/IceGrid/NodeI.cpp +++ b/cpp/src/IceGrid/NodeI.cpp @@ -884,8 +884,11 @@ NodeI::checkConsistency(const NodeSessionPrx& session) } sort(servers.begin(), servers.end()); } - +#ifdef ICE_CPP11_COMPILER + for_each(commands.begin(), commands.end(), [](const auto& it) { it->execute(); }); +#else for_each(commands.begin(), commands.end(), IceUtil::voidMemFun(&ServerCommand::execute)); +#endif } void diff --git a/cpp/src/IceGrid/NodeSessionI.cpp b/cpp/src/IceGrid/NodeSessionI.cpp index 5f0a9d62b03..5cfa991ef1b 100644 --- a/cpp/src/IceGrid/NodeSessionI.cpp +++ b/cpp/src/IceGrid/NodeSessionI.cpp @@ -368,7 +368,11 @@ NodeSessionI::destroyImpl(bool shutdown) } ServerEntrySeq servers = _database->getNode(_info->name)->getServers(); +#ifdef ICE_CPP11_COMPILER + for_each(servers.begin(), servers.end(), [](const auto& it) {it->unsync(); }); +#else for_each(servers.begin(), servers.end(), IceUtil::voidMemFun(&ServerEntry::unsync)); +#endif // // If the registry isn't being shutdown we remove the node diff --git a/cpp/src/IceGrid/ObjectCache.cpp b/cpp/src/IceGrid/ObjectCache.cpp index 337b31776ef..9d1e15cab56 100644 --- a/cpp/src/IceGrid/ObjectCache.cpp +++ b/cpp/src/IceGrid/ObjectCache.cpp @@ -17,7 +17,7 @@ using namespace IceGrid; namespace IceGrid { -struct ObjectEntryCI : binary_function<ObjectEntryPtr&, ObjectEntryPtr&, bool> +struct ObjectEntryCI { bool @@ -27,7 +27,7 @@ struct ObjectEntryCI : binary_function<ObjectEntryPtr&, ObjectEntryPtr&, bool> } }; -struct ObjectLoadCI : binary_function<pair<Ice::ObjectPrx, float>&, pair<Ice::ObjectPrx, float>&, bool> +struct ObjectLoadCI { bool operator()(const pair<Ice::ObjectPrx, float>& lhs, const pair<Ice::ObjectPrx, float>& rhs) { diff --git a/cpp/src/IceGrid/ServerCache.cpp b/cpp/src/IceGrid/ServerCache.cpp index 725b0b08757..bdc1e1e5632 100644 --- a/cpp/src/IceGrid/ServerCache.cpp +++ b/cpp/src/IceGrid/ServerCache.cpp @@ -21,7 +21,7 @@ using namespace IceGrid; namespace IceGrid { - struct AddCommunicator : std::unary_function<CommunicatorDescriptorPtr&, void> + struct AddCommunicator { AddCommunicator(ServerCache& serverCache, const ServerEntryPtr& entry, const string& application) : _serverCache(serverCache), _entry(entry), _application(application) @@ -45,7 +45,7 @@ namespace IceGrid const string _application; }; - struct RemoveCommunicator : std::unary_function<CommunicatorDescriptorPtr&, void> + struct RemoveCommunicator { RemoveCommunicator(ServerCache& serverCache, const ServerEntryPtr& entry) : _serverCache(serverCache), _entry(entry) diff --git a/cpp/src/IceGrid/ServerI.cpp b/cpp/src/IceGrid/ServerI.cpp index 2f70ba75c07..c73c4d9ac57 100644 --- a/cpp/src/IceGrid/ServerI.cpp +++ b/cpp/src/IceGrid/ServerI.cpp @@ -367,7 +367,7 @@ private: }; typedef IceUtil::Handle<ResetPropertiesCB> ResetPropertiesCBPtr; -struct EnvironmentEval : std::unary_function<string, string> +struct EnvironmentEval { string diff --git a/cpp/src/IceGrid/Util.h b/cpp/src/IceGrid/Util.h index 8091e0738e7..d3d0ba30a5b 100644 --- a/cpp/src/IceGrid/Util.h +++ b/cpp/src/IceGrid/Util.h @@ -39,7 +39,7 @@ void setupThreadPool(const Ice::PropertiesPtr&, const std::string&, int, int = 0 int getMMVersion(const std::string&); template<class Function> -struct ForEachCommunicator : std::unary_function<CommunicatorDescriptorPtr&, void> +struct ForEachCommunicator { ForEachCommunicator(Function f) : _function(f) { @@ -131,7 +131,7 @@ inline forEachCommunicator(Function function) } template<class T, class A> -struct ObjFunc : std::unary_function<A, void> +struct ObjFunc { T& _obj; typedef void (T::*MemberFN)(A); diff --git a/cpp/src/IcePatch2/Calc.cpp b/cpp/src/IcePatch2/Calc.cpp index 358f8631d6e..4dd9ab86450 100644 --- a/cpp/src/IcePatch2/Calc.cpp +++ b/cpp/src/IcePatch2/Calc.cpp @@ -15,7 +15,7 @@ using namespace IceInternal; using namespace IcePatch2; using namespace IcePatch2Internal; -struct FileInfoPathLess: public binary_function<const LargeFileInfo&, const LargeFileInfo&, bool> +struct FileInfoPathLess { bool operator()(const LargeFileInfo& lhs, const LargeFileInfo& rhs) @@ -24,7 +24,7 @@ struct FileInfoPathLess: public binary_function<const LargeFileInfo&, const Larg } }; -struct IFileInfoPathEqual: public binary_function<const LargeFileInfo&, const LargeFileInfo&, bool> +struct IFileInfoPathEqual { bool operator()(const LargeFileInfo& lhs, const LargeFileInfo& rhs) @@ -46,7 +46,7 @@ struct IFileInfoPathEqual: public binary_function<const LargeFileInfo&, const La } }; -struct IFileInfoPathLess: public binary_function<const LargeFileInfo&, const LargeFileInfo&, bool> +struct IFileInfoPathLess { bool operator()(const LargeFileInfo& lhs, const LargeFileInfo& rhs) diff --git a/cpp/src/IcePatch2Lib/Util.h b/cpp/src/IcePatch2Lib/Util.h index 380510a36c2..040eeb7b7ef 100644 --- a/cpp/src/IcePatch2Lib/Util.h +++ b/cpp/src/IcePatch2Lib/Util.h @@ -46,7 +46,7 @@ ICEPATCH2_API void decompressFile(const std::string&); ICEPATCH2_API void setFileFlags(const std::string&, const IcePatch2::LargeFileInfo&); -struct FileInfoEqual : public std::binary_function<const IcePatch2::LargeFileInfo&, const IcePatch2::LargeFileInfo&, bool> +struct FileInfoEqual { bool operator()(const IcePatch2::LargeFileInfo& lhs, const IcePatch2::LargeFileInfo& rhs) @@ -78,7 +78,7 @@ struct FileInfoEqual : public std::binary_function<const IcePatch2::LargeFileInf } }; -struct FileInfoWithoutFlagsLess : public std::binary_function<const IcePatch2::LargeFileInfo&, const IcePatch2::LargeFileInfo&, bool> +struct FileInfoWithoutFlagsLess { bool operator()(const IcePatch2::LargeFileInfo& lhs, const IcePatch2::LargeFileInfo& rhs) diff --git a/cpp/src/IceUtil/StringConverter.cpp b/cpp/src/IceUtil/StringConverter.cpp index 73fee027596..4dd0da44c47 100644 --- a/cpp/src/IceUtil/StringConverter.cpp +++ b/cpp/src/IceUtil/StringConverter.cpp @@ -2,6 +2,12 @@ // Copyright (c) ZeroC, Inc. All rights reserved. // +#if defined(_MSC_VER) && (_MSVC_LANG >= 201703L) + // TODO codecvt was deprecated in C++17 and cause build failures with VC++ compiler + // we should replace this code with MultiByteToWideChar() and WideCharToMultiByte() +# define _SILENCE_CXX17_CODECVT_HEADER_DEPRECATION_WARNING +#endif + #include <IceUtil/StringConverter.h> #include <IceUtil/MutexPtrLock.h> #include <IceUtil/Mutex.h> diff --git a/cpp/src/Slice/Parser.cpp b/cpp/src/Slice/Parser.cpp index 51f8386163f..81b840c43b5 100644 --- a/cpp/src/Slice/Parser.cpp +++ b/cpp/src/Slice/Parser.cpp @@ -1107,7 +1107,11 @@ Slice::Contained::Contained(const ContainerPtr& container, const string& name) : void Slice::Container::destroy() { +#ifdef ICE_CPP11_COMPILER + for_each(_contents.begin(), _contents.end(), [](const auto& it) { it->destroy(); }); +#else for_each(_contents.begin(), _contents.end(), ::IceUtil::voidMemFun(&SyntaxTreeBase::destroy)); +#endif _contents.clear(); _introducedMap.clear(); SyntaxTreeBase::destroy(); diff --git a/cpp/src/Slice/Parser.h b/cpp/src/Slice/Parser.h index 4884695abca..d1695cef443 100644 --- a/cpp/src/Slice/Parser.h +++ b/cpp/src/Slice/Parser.h @@ -181,7 +181,7 @@ struct OptionalDef // CICompare -- function object to do case-insensitive string comparison. // ---------------------------------------------------------------------- -class CICompare : public std::binary_function<std::string, std::string, bool> +class CICompare { public: @@ -197,7 +197,7 @@ bool cICompare(const std::string&, const std::string&); // most-derived to least-derived order. // ---------------------------------------------------------------------- -class DerivedToBaseCompare : public std::binary_function<std::string, std::string, bool> +class DerivedToBaseCompare { public: diff --git a/cpp/src/Slice/PythonUtil.cpp b/cpp/src/Slice/PythonUtil.cpp index 73753088677..5826c4d5871 100644 --- a/cpp/src/Slice/PythonUtil.cpp +++ b/cpp/src/Slice/PythonUtil.cpp @@ -949,7 +949,11 @@ Slice::Python::CodeVisitor::visitClassDefStart(const ClassDefPtr& p) // ClassList allBases = p->allBases(); StringList ids; +#ifdef ICE_CPP11_COMPILER + transform(allBases.begin(), allBases.end(), back_inserter(ids), [](const auto& it) { return it->scoped(); }); +#else transform(allBases.begin(), allBases.end(), back_inserter(ids), IceUtil::constMemFun(&Contained::scoped)); +#endif StringList other; other.push_back(scoped); other.push_back("::Ice::Object"); diff --git a/cpp/src/iceserviceinstall/ServiceInstaller.cpp b/cpp/src/iceserviceinstall/ServiceInstaller.cpp index 87290996584..0dad28f56a8 100644 --- a/cpp/src/iceserviceinstall/ServiceInstaller.cpp +++ b/cpp/src/iceserviceinstall/ServiceInstaller.cpp @@ -706,8 +706,14 @@ IceServiceInstaller::addLog(const string& log) const // We don't support to use a string converter with this tool, so don't need to // use string converters in calls to stringToWstring. // - LONG res = RegCreateKeyExW(HKEY_LOCAL_MACHINE, stringToWstring(createLog(log)).c_str(), 0, L"REG_SZ", - REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, 0, &key, &disposition); + LONG res = RegCreateKeyExW(HKEY_LOCAL_MACHINE, + stringToWstring(createLog(log)).c_str(), + 0, + const_cast<wchar_t*>(L"REG_SZ"), + REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, + 0, + &key, + &disposition); if(res != ERROR_SUCCESS) { @@ -748,8 +754,15 @@ IceServiceInstaller::addSource(const string& source, const string& log, const st // HKEY key = 0; DWORD disposition = 0; - LONG res = RegCreateKeyExW(HKEY_LOCAL_MACHINE, stringToWstring(createSource(source, log)).c_str(), - 0, L"REG_SZ", REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, 0, &key, &disposition); + LONG res = RegCreateKeyExW(HKEY_LOCAL_MACHINE, + stringToWstring(createSource(source, log)).c_str(), + 0, + const_cast<wchar_t*>(L"REG_SZ"), + REG_OPTION_NON_VOLATILE, + KEY_ALL_ACCESS, + 0, + &key, + &disposition); if(res != ERROR_SUCCESS) { throw runtime_error("Could not create Event Log source in registry: " + IceUtilInternal::errorToString(res)); diff --git a/cpp/src/slice2cpp/Gen.cpp b/cpp/src/slice2cpp/Gen.cpp index 0b6c01ac6e7..220b5ccb70f 100644 --- a/cpp/src/slice2cpp/Gen.cpp +++ b/cpp/src/slice2cpp/Gen.cpp @@ -3077,7 +3077,11 @@ Slice::Gen::ObjectVisitor::visitClassDefStart(const ClassDefPtr& p) ClassList allBases = p->allBases(); StringList ids; +#ifdef ICE_CPP11_COMPILER + transform(allBases.begin(), allBases.end(), back_inserter(ids), [](const auto& it) { return it->scoped(); }); +#else transform(allBases.begin(), allBases.end(), back_inserter(ids), ::IceUtil::constMemFun(&Contained::scoped)); +#endif StringList other; other.push_back(p->scoped()); other.push_back("::Ice::Object"); @@ -3217,9 +3221,12 @@ Slice::Gen::ObjectVisitor::visitClassDefEnd(const ClassDefPtr& p) if(!allOps.empty()) { StringList allOpNames; +#ifdef ICE_CPP11_COMPILER + transform(allOps.begin(), allOps.end(), back_inserter(allOpNames), [](const auto& it) { return it->name(); }); +#else transform(allOps.begin(), allOps.end(), back_inserter(allOpNames), ::IceUtil::constMemFun(&Contained::name)); - +#endif allOpNames.push_back("ice_id"); allOpNames.push_back("ice_ids"); allOpNames.push_back("ice_isA"); @@ -6163,7 +6170,11 @@ Slice::Gen::Cpp11DeclVisitor::visitClassDefStart(const ClassDefPtr& p) ClassList allBases = p->allBases(); StringList ids; +#ifdef ICE_CPP11_COMPILER + transform(allBases.begin(), allBases.end(), back_inserter(ids), [](const auto& it) { return it->scoped(); }); +#else transform(allBases.begin(), allBases.end(), back_inserter(ids), ::IceUtil::constMemFun(&Contained::scoped)); +#endif StringList other; other.push_back(p->scoped()); other.push_back("::Ice::Object"); @@ -6184,7 +6195,11 @@ Slice::Gen::Cpp11DeclVisitor::visitClassDefStart(const ClassDefPtr& p) C << eb << ';'; StringList allOpNames; +#ifdef ICE_CPP11_COMPILER + transform(allOps.begin(), allOps.end(), back_inserter(allOpNames), [](const auto& it) { return it->name(); }); +#else transform(allOps.begin(), allOps.end(), back_inserter(allOpNames), ::IceUtil::constMemFun(&Contained::name)); +#endif allOpNames.push_back("ice_id"); allOpNames.push_back("ice_ids"); allOpNames.push_back("ice_isA"); @@ -7978,7 +7993,11 @@ Slice::Gen::Cpp11InterfaceVisitor::visitClassDefStart(const ClassDefPtr& p) ClassList allBases = p->allBases(); StringList ids; +#ifdef ICE_CPP11_COMPILER + transform(allBases.begin(), allBases.end(), back_inserter(ids), [](const auto& it) { return it->scoped(); }); +#else transform(allBases.begin(), allBases.end(), back_inserter(ids), ::IceUtil::constMemFun(&Contained::scoped)); +#endif StringList other; other.push_back(p->scoped()); other.push_back("::Ice::Object"); @@ -8076,7 +8095,11 @@ Slice::Gen::Cpp11InterfaceVisitor::visitClassDefEnd(const ClassDefPtr& p) if(!allOps.empty()) { StringList allOpNames; +#ifdef ICE_CPP11_COMPILER + transform(allOps.begin(), allOps.end(), back_inserter(allOpNames), [](const auto& it) { return it->name(); }); +#else transform(allOps.begin(), allOps.end(), back_inserter(allOpNames), ::IceUtil::constMemFun(&Contained::name)); +#endif allOpNames.push_back("ice_id"); allOpNames.push_back("ice_ids"); allOpNames.push_back("ice_isA"); diff --git a/cpp/src/slice2cs/Gen.cpp b/cpp/src/slice2cs/Gen.cpp index cbe3518cb94..71848e82fe9 100644 --- a/cpp/src/slice2cs/Gen.cpp +++ b/cpp/src/slice2cs/Gen.cpp @@ -393,7 +393,11 @@ Slice::CsVisitor::writeDispatch(const ClassDefPtr& p) StringList ids; ClassList bases = p->bases(); bool hasBaseClass = !bases.empty() && !bases.front()->isInterface(); +#ifdef ICE_CPP11_COMPILER + transform(allBases.begin(), allBases.end(), back_inserter(ids), [](const auto& it) { return it->scoped(); }); +#else transform(allBases.begin(), allBases.end(), back_inserter(ids), constMemFun(&Contained::scoped)); +#endif StringList other; other.push_back(p->scoped()); other.push_back("::Ice::Object"); @@ -646,7 +650,11 @@ Slice::CsVisitor::writeDispatch(const ClassDefPtr& p) if(!allOps.empty() || (!p->isInterface() && !hasBaseClass)) { StringList allOpNames; +#ifdef ICE_CPP11_COMPILER + transform(allOps.begin(), allOps.end(), back_inserter(allOpNames), [](const auto& it) { return it->name(); }); +#else transform(allOps.begin(), allOps.end(), back_inserter(allOpNames), constMemFun(&Contained::name)); +#endif allOpNames.push_back("ice_id"); allOpNames.push_back("ice_ids"); allOpNames.push_back("ice_isA"); @@ -762,7 +770,11 @@ Slice::CsVisitor::writeMarshaling(const ClassDefPtr& p) StringList ids; ClassList bases = p->bases(); +#ifdef ICE_CPP11_COMPILER + transform(allBases.begin(), allBases.end(), back_inserter(ids), [](const auto& it) { return it->scoped(); }); +#else transform(allBases.begin(), allBases.end(), back_inserter(ids), constMemFun(&Contained::scoped)); +#endif StringList other; other.push_back(p->scoped()); other.push_back("::Ice::Value"); @@ -4883,7 +4895,11 @@ Slice::Gen::HelperVisitor::visitClassDefStart(const ClassDefPtr& p) string scoped = p->scoped(); ClassList allBases = p->allBases(); StringList ids; +#ifdef ICE_CPP11_COMPILER + transform(allBases.begin(), allBases.end(), back_inserter(ids), [](const auto& it) { return it->scoped(); }); +#else transform(allBases.begin(), allBases.end(), back_inserter(ids), ::IceUtil::constMemFun(&Contained::scoped)); +#endif StringList other; other.push_back(p->scoped()); other.push_back("::Ice::Object"); diff --git a/cpp/src/slice2java/Gen.cpp b/cpp/src/slice2java/Gen.cpp index 160ab5c238d..ae85e3731b7 100644 --- a/cpp/src/slice2java/Gen.cpp +++ b/cpp/src/slice2java/Gen.cpp @@ -1145,7 +1145,11 @@ Slice::JavaVisitor::writeDispatch(Output& out, const ClassDefPtr& p) ClassList allBases = p->allBases(); StringList ids; +#ifdef ICE_CPP11_COMPILER + transform(allBases.begin(), allBases.end(), back_inserter(ids), [](const auto& it) { return it->scoped(); }); +#else transform(allBases.begin(), allBases.end(), back_inserter(ids), constMemFun(&Contained::scoped)); +#endif StringList other; other.push_back(scoped); other.push_back("::Ice::Object"); @@ -1388,7 +1392,11 @@ Slice::JavaVisitor::writeDispatch(Output& out, const ClassDefPtr& p) if(!allOps.empty()) { StringList allOpNames; +#ifdef ICE_CPP11_COMPILER + transform(allOps.begin(), allOps.end(), back_inserter(allOpNames), [](const auto& it) { return it->name(); }); +#else transform(allOps.begin(), allOps.end(), back_inserter(allOpNames), constMemFun(&Contained::name)); +#endif allOpNames.push_back("ice_id"); allOpNames.push_back("ice_ids"); allOpNames.push_back("ice_isA"); diff --git a/cpp/src/slice2java/GenCompat.cpp b/cpp/src/slice2java/GenCompat.cpp index 0f390f01057..a9f67d0ed08 100644 --- a/cpp/src/slice2java/GenCompat.cpp +++ b/cpp/src/slice2java/GenCompat.cpp @@ -1107,7 +1107,11 @@ Slice::JavaCompatVisitor::writeDispatchAndMarshalling(Output& out, const ClassDe ClassList allBases = p->allBases(); StringList ids; +#ifdef ICE_CPP11_COMPILER + transform(allBases.begin(), allBases.end(), back_inserter(ids), [](const auto& it) { return it->scoped(); }); +#else transform(allBases.begin(), allBases.end(), back_inserter(ids), constMemFun(&Contained::scoped)); +#endif StringList other; other.push_back(scoped); other.push_back("::Ice::Object"); @@ -1539,7 +1543,11 @@ Slice::JavaCompatVisitor::writeDispatchAndMarshalling(Output& out, const ClassDe if(!allOps.empty()) { StringList allOpNames; +#ifdef ICE_CPP11_COMPILER + transform(allOps.begin(), allOps.end(), back_inserter(allOpNames), [](const auto& it) { return it->name(); }); +#else transform(allOps.begin(), allOps.end(), back_inserter(allOpNames), constMemFun(&Contained::name)); +#endif allOpNames.push_back("ice_id"); allOpNames.push_back("ice_ids"); allOpNames.push_back("ice_isA"); @@ -4879,7 +4887,11 @@ Slice::GenCompat::HelperVisitor::visitClassDefStart(const ClassDefPtr& p) ClassList allBases = p->allBases(); StringList ids; +#ifdef ICE_CPP11_COMPILER + transform(allBases.begin(), allBases.end(), back_inserter(ids), [](const auto& it) { return it->scoped(); }); +#else transform(allBases.begin(), allBases.end(), back_inserter(ids), constMemFun(&Contained::scoped)); +#endif StringList other; other.push_back(scoped); other.push_back("::Ice::Object"); diff --git a/cpp/src/slice2js/Gen.cpp b/cpp/src/slice2js/Gen.cpp index 721e75c585a..7edc5a42089 100644 --- a/cpp/src/slice2js/Gen.cpp +++ b/cpp/src/slice2js/Gen.cpp @@ -1330,7 +1330,11 @@ Slice::Gen::TypesVisitor::visitClassDefStart(const ClassDefPtr& p) ClassList allBases = p->allBases(); StringList ids; +#ifdef ICE_CPP11_COMPILER + transform(allBases.begin(), allBases.end(), back_inserter(ids), [](const auto& it) { return it->scoped(); }); +#else transform(allBases.begin(), allBases.end(), back_inserter(ids), ::IceUtil::constMemFun(&Contained::scoped)); +#endif StringList other; other.push_back(scoped); other.push_back("::Ice::Object"); diff --git a/cpp/src/slice2objc/Gen.cpp b/cpp/src/slice2objc/Gen.cpp index c11a95535cd..61d3b92ae2e 100644 --- a/cpp/src/slice2objc/Gen.cpp +++ b/cpp/src/slice2objc/Gen.cpp @@ -212,7 +212,11 @@ Slice::ObjCVisitor::writeDispatchAndMarshalling(const ClassDefPtr& p) ClassList allBases = p->allBases(); StringList ids; +#ifdef ICE_CPP11_COMPILER + transform(allBases.begin(), allBases.end(), back_inserter(ids), [](const auto& it) { return it->scoped(); }); +#else transform(allBases.begin(), allBases.end(), back_inserter(ids), ::IceUtil::constMemFun(&Contained::scoped)); +#endif StringList other; other.push_back(p->scoped()); diff --git a/cpp/src/slice2rb/Main.cpp b/cpp/src/slice2rb/Main.cpp index c6a6692111c..7d4e755b724 100644 --- a/cpp/src/slice2rb/Main.cpp +++ b/cpp/src/slice2rb/Main.cpp @@ -24,12 +24,12 @@ int main(int argc, char* argv[]) } catch(const std::exception& ex) { - consoleErr << argv[0] << ": error:" << ex.what() << endl; + consoleErr << args[0] << ": error:" << ex.what() << endl; return EXIT_FAILURE; } catch(...) { - consoleErr << argv[0] << ": error:" << "unknown exception" << endl; + consoleErr << args[0] << ": error:" << "unknown exception" << endl; return EXIT_FAILURE; } } |