diff options
Diffstat (limited to 'cpp')
174 files changed, 1351 insertions, 1192 deletions
diff --git a/cpp/include/Ice/MetricsAdminI.h b/cpp/include/Ice/MetricsAdminI.h index 46beb043200..cad066d3670 100644 --- a/cpp/include/Ice/MetricsAdminI.h +++ b/cpp/include/Ice/MetricsAdminI.h @@ -325,7 +325,14 @@ public: } } - MetricsMapT(const MetricsMapT& other) : MetricsMapI(other), _destroyed(false) + MetricsMapT(const MetricsMapT& other) + : +#ifndef ICE_CPP11_MAPPING + IceUtil::Shared(), +#endif + MetricsMapI(other), + IceUtil::Mutex(), + _destroyed(false) { } diff --git a/cpp/include/Ice/Proxy.h b/cpp/include/Ice/Proxy.h index dc1c073c04b..cea157c6863 100644 --- a/cpp/include/Ice/Proxy.h +++ b/cpp/include/Ice/Proxy.h @@ -1620,8 +1620,6 @@ checkedCast(const ::std::shared_ptr<T>& b, const std::string& f, const ::Ice::Co return r; } -ICE_API ::std::ostream& operator<<(::std::ostream&, const Ice::ObjectPrx&); - } #else // C++98 mapping diff --git a/cpp/include/IceUtil/Config.h b/cpp/include/IceUtil/Config.h index be1ab674324..4f40c912047 100644 --- a/cpp/include/IceUtil/Config.h +++ b/cpp/include/IceUtil/Config.h @@ -227,6 +227,12 @@ # define ICE_DEPRECATED_API(msg) /**/ #endif +#if defined(__clang__) || defined(__GNUC__) +# define ICE_MAYBE_UNUSED __attribute__((unused)) +#else +# define ICE_MAYBE_UNUSED /**/ +#endif + #ifdef _WIN32 # include <windows.h> diff --git a/cpp/include/IceUtil/PushDisableWarnings.h b/cpp/include/IceUtil/PushDisableWarnings.h index 9bc7c0fb863..c66654e5144 100644 --- a/cpp/include/IceUtil/PushDisableWarnings.h +++ b/cpp/include/IceUtil/PushDisableWarnings.h @@ -24,6 +24,7 @@ # pragma clang diagnostic push # pragma clang diagnostic ignored "-Wredundant-decls" // expected when using forward Slice declarations # pragma clang diagnostic ignored "-Wdocumentation-deprecated-sync" // see zeroc-ice/ice issue #211 +# pragma clang diagnostic ignored "-Wshadow-field-in-constructor" // expected in some generated header files #elif defined(__GNUC__) # pragma GCC diagnostic push diff --git a/cpp/src/Glacier2/InstrumentationI.cpp b/cpp/src/Glacier2/InstrumentationI.cpp index 304d86615f9..77b3017cc6c 100644 --- a/cpp/src/Glacier2/InstrumentationI.cpp +++ b/cpp/src/Glacier2/InstrumentationI.cpp @@ -109,7 +109,7 @@ namespace struct ForwardedUpdate { - ForwardedUpdate(bool client) : client(client) + ForwardedUpdate(bool clientP) : client(clientP) { } diff --git a/cpp/src/Glacier2/ProxyVerifier.cpp b/cpp/src/Glacier2/ProxyVerifier.cpp index 21740ec2e56..ec7d2f8b3b6 100644 --- a/cpp/src/Glacier2/ProxyVerifier.cpp +++ b/cpp/src/Glacier2/ProxyVerifier.cpp @@ -577,21 +577,21 @@ public: } pos = 0; - for(vector<AddressMatcher*>::const_iterator i = _addressRules.begin(); i != _addressRules.end(); ++i) + for(vector<AddressMatcher*>::const_iterator j = _addressRules.begin(); j != _addressRules.end(); ++j) { - if(!(*i)->match(host, pos)) + if(!(*j)->match(host, pos)) { if(_traceLevel >= 3) { Trace out(_communicator->getLogger(), "Glacier2"); - out << (*i)->toString() << " failed to match " << host << " at pos=" << pos << "\n"; + out << (*j)->toString() << " failed to match " << host << " at pos=" << pos << "\n"; } return false; } if(_traceLevel >= 3) { Trace out(_communicator->getLogger(), "Glacier2"); - out << (*i)->toString() << " matched " << host << " at pos=" << pos << "\n"; + out << (*j)->toString() << " matched " << host << " at pos=" << pos << "\n"; } } } diff --git a/cpp/src/Glacier2/SessionRouterI.cpp b/cpp/src/Glacier2/SessionRouterI.cpp index 958bbc5e649..3a4b613002b 100644 --- a/cpp/src/Glacier2/SessionRouterI.cpp +++ b/cpp/src/Glacier2/SessionRouterI.cpp @@ -553,11 +553,11 @@ CreateSession::unexpectedAuthorizeException(const Ice::Exception& ex) } void -CreateSession::createException(const Ice::Exception& ex) +CreateSession::createException(const Ice::Exception& sex) { try { - ex.ice_throw(); + sex.ice_throw(); } catch(const CannotCreateSessionException& ex) { diff --git a/cpp/src/Ice/ACM.cpp b/cpp/src/Ice/ACM.cpp index cc20ccc070d..4048d17ab82 100644 --- a/cpp/src/Ice/ACM.cpp +++ b/cpp/src/Ice/ACM.cpp @@ -43,41 +43,41 @@ IceInternal::ACMConfig::ACMConfig(const Ice::PropertiesPtr& p, else { timeoutProperty = prefix + ".Timeout"; - }; + } - int timeout = p->getPropertyAsIntWithDefault(timeoutProperty, static_cast<int>(dflt.timeout.toSeconds())); - if(timeout >= 0) + int timeoutVal = p->getPropertyAsIntWithDefault(timeoutProperty, static_cast<int>(dflt.timeout.toSeconds())); + if(timeoutVal >= 0) { - this->timeout = IceUtil::Time::seconds(timeout); + timeout = IceUtil::Time::seconds(timeoutVal); } else { l->warning("invalid value for property `" + timeoutProperty + "', default value will be used instead"); - this->timeout = dflt.timeout; + timeout = dflt.timeout; } int hb = p->getPropertyAsIntWithDefault(prefix + ".Heartbeat", static_cast<int>(dflt.heartbeat)); if(hb >= static_cast<int>(ICE_ENUM(ACMHeartbeat, HeartbeatOff)) && hb <= static_cast<int>(ICE_ENUM(ACMHeartbeat, HeartbeatAlways))) { - this->heartbeat = static_cast<Ice::ACMHeartbeat>(hb); + heartbeat = static_cast<Ice::ACMHeartbeat>(hb); } else { l->warning("invalid value for property `" + prefix + ".Heartbeat" + "', default value will be used instead"); - this->heartbeat = dflt.heartbeat; + heartbeat = dflt.heartbeat; } int cl = p->getPropertyAsIntWithDefault(prefix + ".Close", static_cast<int>(dflt.close)); if(cl >= static_cast<int>(ICE_ENUM(ACMClose, CloseOff)) && cl <= static_cast<int>(ICE_ENUM(ACMClose, CloseOnIdleForceful))) { - this->close = static_cast<Ice::ACMClose>(cl); + close = static_cast<Ice::ACMClose>(cl); } else { l->warning("invalid value for property `" + prefix + ".Close" + "', default value will be used instead"); - this->close = dflt.close; + close = dflt.close; } } @@ -307,7 +307,7 @@ IceInternal::ConnectionACMMonitor::~ConnectionACMMonitor() } void -IceInternal::ConnectionACMMonitor::add(const ConnectionIPtr& connection) +IceInternal::ConnectionACMMonitor::add(ICE_MAYBE_UNUSED const ConnectionIPtr& connection) { Lock sync(*this); assert(!_connection && connection); @@ -319,7 +319,7 @@ IceInternal::ConnectionACMMonitor::add(const ConnectionIPtr& connection) } void -IceInternal::ConnectionACMMonitor::remove(const ConnectionIPtr& connection) +IceInternal::ConnectionACMMonitor::remove(ICE_MAYBE_UNUSED const ConnectionIPtr& connection) { Lock sync(*this); assert(_connection == connection); diff --git a/cpp/src/Ice/ArgVector.cpp b/cpp/src/Ice/ArgVector.cpp index 29628f2341d..71140916c2f 100644 --- a/cpp/src/Ice/ArgVector.cpp +++ b/cpp/src/Ice/ArgVector.cpp @@ -10,13 +10,13 @@ #include <Ice/ArgVector.h> #include <cstring> -IceInternal::ArgVector::ArgVector(int argc, const char* const argv[]) +IceInternal::ArgVector::ArgVector(int argcP, const char* const argvP[]) { - assert(argc >= 0); - _args.resize(argc); - for(int i = 0; i < argc; ++i) + assert(argcP >= 0); + _args.resize(argcP); + for(int i = 0; i < argcP; ++i) { - _args[i] = argv[i]; + _args[i] = argvP[i]; } setupArgcArgv(); } diff --git a/cpp/src/Ice/CollocatedRequestHandler.cpp b/cpp/src/Ice/CollocatedRequestHandler.cpp index 6a46dfb5efc..0c66da35e8e 100644 --- a/cpp/src/Ice/CollocatedRequestHandler.cpp +++ b/cpp/src/Ice/CollocatedRequestHandler.cpp @@ -270,7 +270,7 @@ CollocatedRequestHandler::systemException(Int requestId, const SystemException& } void -CollocatedRequestHandler::invokeException(Int requestId, const LocalException& ex, int invokeNum, bool amd) +CollocatedRequestHandler::invokeException(Int requestId, const LocalException& ex, int /*invokeNum*/, bool amd) { handleException(requestId, ex, amd); _adapter->decDirectCount(); diff --git a/cpp/src/Ice/CommunicatorI.cpp b/cpp/src/Ice/CommunicatorI.cpp index 2df1fe56f52..5215a4f122c 100644 --- a/cpp/src/Ice/CommunicatorI.cpp +++ b/cpp/src/Ice/CommunicatorI.cpp @@ -58,7 +58,7 @@ CommunicatorFlushBatchAsync::flushConnection(const ConnectionIPtr& con, Ice::Com FlushBatch(const CommunicatorFlushBatchAsyncPtr& outAsync, const InstancePtr& instance, InvocationObserver& observer) : - OutgoingAsyncBase(instance), _outAsync(outAsync), _observer(observer) + OutgoingAsyncBase(instance), _outAsync(outAsync), _parentObserver(observer) { } @@ -82,7 +82,7 @@ CommunicatorFlushBatchAsync::flushConnection(const ConnectionIPtr& con, Ice::Com virtual InvocationObserver& getObserver() { - return _observer; + return _parentObserver; } virtual bool handleSent(bool, bool) @@ -118,7 +118,7 @@ CommunicatorFlushBatchAsync::flushConnection(const ConnectionIPtr& con, Ice::Com private: const CommunicatorFlushBatchAsyncPtr _outAsync; - InvocationObserver& _observer; + InvocationObserver& _parentObserver; }; { diff --git a/cpp/src/Ice/ConnectionFactory.cpp b/cpp/src/Ice/ConnectionFactory.cpp index cc81ec65f12..e61c0ac6f35 100644 --- a/cpp/src/Ice/ConnectionFactory.cpp +++ b/cpp/src/Ice/ConnectionFactory.cpp @@ -1635,7 +1635,7 @@ IceInternal::IncomingConnectionFactory::connectionStartCompleted(const Ice::Conn void IceInternal::IncomingConnectionFactory::connectionStartFailed(const Ice::ConnectionIPtr& /*connection*/, - const Ice::LocalException& ex) + const Ice::LocalException&) { IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this); if(_state >= StateClosed) diff --git a/cpp/src/Ice/ConnectionI.cpp b/cpp/src/Ice/ConnectionI.cpp index 1f3bb85464c..b2dcbfb97eb 100644 --- a/cpp/src/Ice/ConnectionI.cpp +++ b/cpp/src/Ice/ConnectionI.cpp @@ -1680,8 +1680,8 @@ Ice::ConnectionI::message(ThreadPoolCurrent& current) Byte messageType; _readStream.read(messageType); - Byte compress; - _readStream.read(compress); + Byte compressByte; + _readStream.read(compressByte); Int size; _readStream.read(size); if(size < headerSize) diff --git a/cpp/src/Ice/GCObject.cpp b/cpp/src/Ice/GCObject.cpp index 1d365fb6813..8cbdedcd958 100644 --- a/cpp/src/Ice/GCObject.cpp +++ b/cpp/src/Ice/GCObject.cpp @@ -118,7 +118,7 @@ public: } bool -ClearMembers::visit(GCObject* obj) +ClearMembers::visit(GCObject*) { return true; } diff --git a/cpp/src/Ice/Incoming.cpp b/cpp/src/Ice/Incoming.cpp index 8a64b7eabe7..dc22aa009a5 100644 --- a/cpp/src/Ice/Incoming.cpp +++ b/cpp/src/Ice/Incoming.cpp @@ -67,6 +67,7 @@ IceInternal::IncomingBase::IncomingBase(Instance* instance, ResponseHandler* res } IceInternal::IncomingBase::IncomingBase(IncomingBase& other) : + IceUtil::noncopyable(), // TODO, remove noncopyable base class _current(other._current), _servant(other._servant), _locator(other._locator), @@ -389,7 +390,7 @@ IceInternal::IncomingBase::handleException(const std::exception& exc, bool amd) _responseHandler->sendNoResponse(); } } - else if(const UserException* ex = dynamic_cast<const UserException*>(&exc)) + else if(const UserException* uex = dynamic_cast<const UserException*>(&exc)) { _observer.userException(); @@ -402,7 +403,7 @@ IceInternal::IncomingBase::handleException(const std::exception& exc, bool amd) _os.write(_current.requestId); _os.write(replyUserException); _os.startEncapsulation(_current.encoding, _format); - _os.write(*ex); + _os.write(*uex); _os.endEncapsulation(); _observer.reply(static_cast<Int>(_os.b.size() - headerSize - 4)); _responseHandler->sendResponse(_current.requestId, &_os, _compress, amd); @@ -454,11 +455,11 @@ IceInternal::IncomingBase::handleException(const std::exception& exc, bool amd) } _os.write(str.str(), false); } - else if(const UserException* ue = dynamic_cast<const UserException*>(&exc)) + else if(const UserException* use = dynamic_cast<const UserException*>(&exc)) { _os.write(replyUnknownUserException); ostringstream str; - str << *ue; + str << *use; if(IceUtilInternal::printStackTraces) { str << '\n' << ex->ice_stackTrace(); @@ -659,11 +660,11 @@ IceInternal::Incoming::invoke(const ServantManagerPtr& servantManager, InputStre if(obsv) { // Read the parameter encapsulation size. - Ice::Int sz; - _is->read(sz); + Ice::Int encapsSize; + _is->read(encapsSize); _is->i -= 4; - _observer.attach(obsv->getDispatchObserver(_current, static_cast<Int>(_is->i - start + sz))); + _observer.attach(obsv->getDispatchObserver(_current, static_cast<Int>(_is->i - start + encapsSize))); } // diff --git a/cpp/src/Ice/InputStream.cpp b/cpp/src/Ice/InputStream.cpp index 5b70f30b864..1427aea6ee7 100644 --- a/cpp/src/Ice/InputStream.cpp +++ b/cpp/src/Ice/InputStream.cpp @@ -224,22 +224,22 @@ Ice::InputStream::setCompactIdResolver(const CompactIdResolverPtr& r) #ifndef ICE_CPP11_MAPPING void -Ice::InputStream::setCollectObjects(bool b) +Ice::InputStream::setCollectObjects(bool on) { - _collectObjects = b; + _collectObjects = on; } #endif void -Ice::InputStream::setSliceValues(bool b) +Ice::InputStream::setSliceValues(bool on) { - _sliceValues = b; + _sliceValues = on; } void -Ice::InputStream::setTraceSlicing(bool b) +Ice::InputStream::setTraceSlicing(bool on) { - _traceSlicing = b; + _traceSlicing = on; } void diff --git a/cpp/src/Ice/Instance.cpp b/cpp/src/Ice/Instance.cpp index 734823cdc06..45dad54ca6e 100644 --- a/cpp/src/Ice/Instance.cpp +++ b/cpp/src/Ice/Instance.cpp @@ -1845,9 +1845,9 @@ IceInternal::Instance::addObjectFactory(const Ice::ObjectFactoryPtr& factory, co // with the value factory manager. This may raise AlreadyRegisteredException. // #ifdef ICE_CPP11_MAPPING - _initData.valueFactoryManager->add([factory](const string& id) + _initData.valueFactoryManager->add([factory](const string& ident) { - return factory->create(id); + return factory->create(ident); }, id); #else diff --git a/cpp/src/Ice/InstrumentationI.cpp b/cpp/src/Ice/InstrumentationI.cpp index c1c1742da07..6099c3f89eb 100644 --- a/cpp/src/Ice/InstrumentationI.cpp +++ b/cpp/src/Ice/InstrumentationI.cpp @@ -52,7 +52,7 @@ getThreadStateMetric(ThreadState s) struct ThreadStateChanged { - ThreadStateChanged(ThreadState oldState, ThreadState newState) : oldState(oldState), newState(newState) + ThreadStateChanged(ThreadState oldStateP, ThreadState newStateP) : oldState(oldStateP), newState(newStateP) { } diff --git a/cpp/src/Ice/LocatorInfo.cpp b/cpp/src/Ice/LocatorInfo.cpp index 126e6a1e808..7fa023a8c9c 100644 --- a/cpp/src/Ice/LocatorInfo.cpp +++ b/cpp/src/Ice/LocatorInfo.cpp @@ -48,7 +48,7 @@ public: #ifdef ICE_CPP11_MAPPING LocatorInfo::RequestPtr request = this; _locatorInfo->getLocator()->findObjectByIdAsync( - _ref->getIdentity(), + _reference->getIdentity(), [request](const ObjectPrxPtr& object) { request->response(object); @@ -66,7 +66,7 @@ public: }); #else _locatorInfo->getLocator()->begin_findObjectById( - _ref->getIdentity(), + _reference->getIdentity(), newCallback_Locator_findObjectById(static_cast<LocatorInfo::Request*>(this), &LocatorInfo::Request::response, &LocatorInfo::Request::exception)); @@ -94,7 +94,7 @@ public: { #ifdef ICE_CPP11_MAPPING LocatorInfo::RequestPtr request = this; - _locatorInfo->getLocator()->findAdapterByIdAsync(_ref->getAdapterId(), + _locatorInfo->getLocator()->findAdapterByIdAsync(_reference->getAdapterId(), [request](const shared_ptr<Ice::ObjectPrx>& object) { request->response(object); @@ -112,7 +112,7 @@ public: }); #else _locatorInfo->getLocator()->begin_findAdapterById( - _ref->getAdapterId(), + _reference->getAdapterId(), newCallback_Locator_findAdapterById(static_cast<LocatorInfo::Request*>(this), &LocatorInfo::Request::response, &LocatorInfo::Request::exception)); @@ -352,7 +352,7 @@ IceInternal::LocatorInfo::RequestCallback::response(const LocatorInfoPtr& locato if(proxy) { ReferencePtr r = proxy->_getReference(); - if(_ref->isWellKnown() && !isSupported(_ref->getEncoding(), r->getEncoding())) + if(_reference->isWellKnown() && !isSupported(_reference->getEncoding(), r->getEncoding())) { // // If a well-known proxy and the returned proxy encoding @@ -364,26 +364,26 @@ IceInternal::LocatorInfo::RequestCallback::response(const LocatorInfoPtr& locato { endpoints = r->getEndpoints(); } - else if(_ref->isWellKnown() && !r->isWellKnown()) + else if(_reference->isWellKnown() && !r->isWellKnown()) { // // We're resolving the endpoints of a well-known object and the proxy returned // by the locator is an indirect proxy. We now need to resolve the endpoints // of this indirect proxy. // - if(_ref->getInstance()->traceLevels()->location >= 1) + if(_reference->getInstance()->traceLevels()->location >= 1) { locatorInfo->trace("retrieved adapter for well-known object from locator, adding to locator cache", - _ref, r); + _reference, r); } - locatorInfo->getEndpoints(r, _ref, _ttl, _callback); + locatorInfo->getEndpoints(r, _reference, _ttl, _callback); return; } } - if(_ref->getInstance()->traceLevels()->location >= 1) + if(_reference->getInstance()->traceLevels()->location >= 1) { - locatorInfo->getEndpointsTrace(_ref, endpoints, false); + locatorInfo->getEndpointsTrace(_reference, endpoints, false); } if(_callback) { @@ -396,7 +396,7 @@ IceInternal::LocatorInfo::RequestCallback::exception(const LocatorInfoPtr& locat { try { - locatorInfo->getEndpointsException(_ref, exc); // This throws. + locatorInfo->getEndpointsException(_reference, exc); // This throws. } catch(const Ice::LocalException& ex) { @@ -410,7 +410,7 @@ IceInternal::LocatorInfo::RequestCallback::exception(const LocatorInfoPtr& locat IceInternal::LocatorInfo::RequestCallback::RequestCallback(const ReferencePtr& ref, int ttl, const GetEndpointsCallbackPtr& cb) : - _ref(ref), _ttl(ttl), _callback(cb) + _reference(ref), _ttl(ttl), _callback(cb) { } @@ -452,7 +452,7 @@ IceInternal::LocatorInfo::Request::addCallback(const ReferencePtr& ref, } IceInternal::LocatorInfo::Request::Request(const LocatorInfoPtr& locatorInfo, const ReferencePtr& ref) : - _locatorInfo(locatorInfo), _ref(ref), _sent(false), _response(false) + _locatorInfo(locatorInfo), _reference(ref), _sent(false), _response(false) { } @@ -461,7 +461,7 @@ IceInternal::LocatorInfo::Request::response(const Ice::ObjectPrxPtr& proxy) { { IceUtil::Monitor<IceUtil::Mutex>::Lock sync(_monitor); - _locatorInfo->finishRequest(_ref, _wellKnownRefs, proxy, false); + _locatorInfo->finishRequest(_reference, _wellKnownRefs, proxy, false); _response = true; _proxy = proxy; _monitor.notifyAll(); @@ -477,7 +477,7 @@ IceInternal::LocatorInfo::Request::exception(const Ice::Exception& ex) { { IceUtil::Monitor<IceUtil::Mutex>::Lock sync(_monitor); - _locatorInfo->finishRequest(_ref, _wellKnownRefs, 0, dynamic_cast<const Ice::UserException*>(&ex)); + _locatorInfo->finishRequest(_reference, _wellKnownRefs, 0, dynamic_cast<const Ice::UserException*>(&ex)); ICE_SET_EXCEPTION_FROM_CLONE(_exception, ex.ice_clone()); _monitor.notifyAll(); diff --git a/cpp/src/Ice/LocatorInfo.h b/cpp/src/Ice/LocatorInfo.h index f381134c803..51ae4993425 100644 --- a/cpp/src/Ice/LocatorInfo.h +++ b/cpp/src/Ice/LocatorInfo.h @@ -106,7 +106,7 @@ public: private: - const ReferencePtr _ref; + const ReferencePtr _reference; const int _ttl; const GetEndpointsCallbackPtr _callback; }; @@ -128,7 +128,7 @@ public: virtual void send() = 0; const LocatorInfoPtr _locatorInfo; - const ReferencePtr _ref; + const ReferencePtr _reference; private: diff --git a/cpp/src/Ice/LoggerAdminI.cpp b/cpp/src/Ice/LoggerAdminI.cpp index 29d7f6d847c..4c9e12502a0 100644 --- a/cpp/src/Ice/LoggerAdminI.cpp +++ b/cpp/src/Ice/LoggerAdminI.cpp @@ -434,9 +434,9 @@ LoggerAdminI::attachRemoteLogger(const RemoteLoggerPrx& prx, { rethrow_exception(e); } - catch(const Ice::LocalException& e) + catch(const Ice::LocalException& le) { - self->deadRemoteLogger(remoteLogger, logger, e, "init"); + self->deadRemoteLogger(remoteLogger, logger, le, "init"); } }); } @@ -618,16 +618,16 @@ LoggerAdminI::log(const LogMessage& logMessage) // // Queue updated, now find which remote loggers want this message // - for(RemoteLoggerMap::const_iterator p = _remoteLoggerMap.begin(); p != _remoteLoggerMap.end(); ++p) + for(RemoteLoggerMap::const_iterator q = _remoteLoggerMap.begin(); q != _remoteLoggerMap.end(); ++q) { - const Filters& filters = p->second; + const Filters& filters = q->second; if(filters.messageTypes.empty() || filters.messageTypes.count(logMessage.type) != 0) { if(logMessage.type != ICE_ENUM(LogMessageType, TraceMessage) || filters.traceCategories.empty() || filters.traceCategories.count(logMessage.traceCategory) != 0) { - remoteLoggers.push_back(p->first); + remoteLoggers.push_back(q->first); } } } diff --git a/cpp/src/Ice/LoggerI.cpp b/cpp/src/Ice/LoggerI.cpp index 11dd325abdb..34402e695c3 100644 --- a/cpp/src/Ice/LoggerI.cpp +++ b/cpp/src/Ice/LoggerI.cpp @@ -176,22 +176,22 @@ Ice::LoggerI::write(const string& message, bool indent) string date = IceUtil::Time::now().toString("%Y%m%d-%H%M%S"); while(true) { - ostringstream s; - s << basename << "-" << date; + ostringstream oss; + oss << basename << "-" << date; if(id > 0) { - s << "-" << id; + oss << "-" << id; } if(!ext.empty()) { - s << "." << ext; + oss << "." << ext; } - if(IceUtilInternal::fileExists(s.str())) + if(IceUtilInternal::fileExists(oss.str())) { id++; continue; } - archive = s.str(); + archive = oss.str(); break; } diff --git a/cpp/src/Ice/MetricsAdminI.cpp b/cpp/src/Ice/MetricsAdminI.cpp index a6b43e38411..8f0efd735fa 100644 --- a/cpp/src/Ice/MetricsAdminI.cpp +++ b/cpp/src/Ice/MetricsAdminI.cpp @@ -203,6 +203,11 @@ MetricsMapI::MetricsMapI(const std::string& mapPrefix, const PropertiesPtr& prop } MetricsMapI::MetricsMapI(const MetricsMapI& map) : +#ifdef ICE_CPP11_MAPPING + std::enable_shared_from_this<MetricsMapI>(), +#else + IceUtil::Shared(), +#endif _properties(map._properties), _groupByAttributes(map._groupByAttributes), _groupBySeparators(map._groupBySeparators), @@ -451,11 +456,11 @@ MetricsAdminI::updateViews() q = views.insert(make_pair(viewName, q->second)).first; } - for(map<string, MetricsMapFactoryPtr>::const_iterator p = _factories.begin(); p != _factories.end(); ++p) + for(map<string, MetricsMapFactoryPtr>::const_iterator r = _factories.begin(); r != _factories.end(); ++r) { - if(q->second->addOrUpdateMap(_properties, p->first, p->second, _logger)) + if(q->second->addOrUpdateMap(_properties, r->first, r->second, _logger)) { - updatedMaps.insert(p->second); + updatedMaps.insert(r->second); } } } diff --git a/cpp/src/Ice/Network.cpp b/cpp/src/Ice/Network.cpp index f4629771ac6..1a943d09271 100755 --- a/cpp/src/Ice/Network.cpp +++ b/cpp/src/Ice/Network.cpp @@ -52,6 +52,10 @@ # include <sys/sockio.h> #endif +#if defined(__GNUC__) && (__GNUC__ < 5) +# pragma GCC diagnostic ignored "-Wmissing-field-initializers" +#endif + #if defined(_WIN32) # ifndef SIO_LOOPBACK_FAST_PATH # define SIO_LOOPBACK_FAST_PATH _WSAIOW(IOC_VENDOR,16) @@ -1156,7 +1160,7 @@ IceInternal::getAddresses(const string& host, int port, ProtocolSupport protocol struct addrinfo* info = 0; int retry = 5; - struct addrinfo hints = { 0 }; + struct addrinfo hints = {}; if(protocol == EnableIPv4) { hints.ai_family = PF_INET; diff --git a/cpp/src/Ice/OpaqueEndpointI.cpp b/cpp/src/Ice/OpaqueEndpointI.cpp index 9a5de0c1db9..d294dbde7b3 100644 --- a/cpp/src/Ice/OpaqueEndpointI.cpp +++ b/cpp/src/Ice/OpaqueEndpointI.cpp @@ -57,7 +57,7 @@ class OpaqueEndpointInfoI : public Ice::OpaqueEndpointInfo { public: - OpaqueEndpointInfoI(Ice::Short type, const Ice::EncodingVersion& rawEncoding, const Ice::ByteSeq& rawByes); + OpaqueEndpointInfoI(Ice::Short type, const Ice::EncodingVersion& rawEncoding, const Ice::ByteSeq& rawBytes); virtual Ice::Short type() const ICE_NOEXCEPT @@ -86,9 +86,9 @@ private: // // COMPILERFIX: inlining this constructor causes crashes with gcc 4.0.1. // -OpaqueEndpointInfoI::OpaqueEndpointInfoI(Ice::Short type, const Ice::EncodingVersion& rawEncoding, - const Ice::ByteSeq& rawBytes) : - Ice::OpaqueEndpointInfo(ICE_NULLPTR, -1, false, rawEncoding, rawBytes), +OpaqueEndpointInfoI::OpaqueEndpointInfoI(Ice::Short type, const Ice::EncodingVersion& rawEncodingP, + const Ice::ByteSeq& rawBytesP) : + Ice::OpaqueEndpointInfo(ICE_NULLPTR, -1, false, rawEncodingP, rawBytesP), _type(type) { } diff --git a/cpp/src/Ice/OutgoingAsync.cpp b/cpp/src/Ice/OutgoingAsync.cpp index d91288630d8..5883ec11a5a 100644 --- a/cpp/src/Ice/OutgoingAsync.cpp +++ b/cpp/src/Ice/OutgoingAsync.cpp @@ -643,7 +643,7 @@ ProxyOutgoingAsyncBase::cancelable(const CancellationHandlerPtr& handler) } void -ProxyOutgoingAsyncBase::retryException(const Exception& ex) +ProxyOutgoingAsyncBase::retryException(const Exception&) { try { diff --git a/cpp/src/Ice/OutputStream.cpp b/cpp/src/Ice/OutputStream.cpp index 74295648081..8adf90577ad 100644 --- a/cpp/src/Ice/OutputStream.cpp +++ b/cpp/src/Ice/OutputStream.cpp @@ -662,9 +662,9 @@ Ice::OutputStream::write(const string* begin, const string* end, bool convert) writeSize(sz); if(sz > 0) { - for(int i = 0; i < sz; ++i) + for(int j = 0; j < sz; ++j) { - write(begin[i], convert); + write(begin[j], convert); } } } @@ -757,9 +757,9 @@ Ice::OutputStream::write(const wstring* begin, const wstring* end) writeSize(sz); if(sz > 0) { - for(int i = 0; i < sz; ++i) + for(int j = 0; j < sz; ++j) { - write(begin[i]); + write(begin[j]); } } } diff --git a/cpp/src/Ice/PropertiesAdminI.cpp b/cpp/src/Ice/PropertiesAdminI.cpp index 131830fa17d..fca4132d3b4 100644 --- a/cpp/src/Ice/PropertiesAdminI.cpp +++ b/cpp/src/Ice/PropertiesAdminI.cpp @@ -198,7 +198,7 @@ PropertiesAdminI::setProperties(const PropertyDict& props, const Current&) for(const auto& cb : callbacks) #else vector<PropertiesAdminUpdateCallbackPtr> callbacks = _updateCallbacks; - for(vector<PropertiesAdminUpdateCallbackPtr>::const_iterator p = callbacks.begin(); p != callbacks.end(); ++p) + for(vector<PropertiesAdminUpdateCallbackPtr>::const_iterator q = callbacks.begin(); q != callbacks.end(); ++q) #endif { try @@ -206,7 +206,7 @@ PropertiesAdminI::setProperties(const PropertyDict& props, const Current&) #ifdef ICE_CPP11_MAPPING cb(changes); #else - (*p)->updated(changes); + (*q)->updated(changes); #endif } catch(const std::exception& ex) diff --git a/cpp/src/Ice/Proxy.cpp b/cpp/src/Ice/Proxy.cpp index c655f08e46b..128e02727ce 100644 --- a/cpp/src/Ice/Proxy.cpp +++ b/cpp/src/Ice/Proxy.cpp @@ -483,7 +483,7 @@ IceProxy::Ice::Object::_iceI_begin_ice_invoke(const string& operation, const Context& ctx, const ::IceInternal::CallbackBasePtr& del, const ::Ice::LocalObjectPtr& cookie, - bool sync) + bool /*sync*/) { pair<const Byte*, const Byte*> inPair; if(inEncaps.empty()) diff --git a/cpp/src/Ice/Reference.cpp b/cpp/src/Ice/Reference.cpp index f4b295f6b23..6e35deb5fb1 100644 --- a/cpp/src/Ice/Reference.cpp +++ b/cpp/src/Ice/Reference.cpp @@ -550,6 +550,7 @@ IceInternal::Reference::Reference(const InstancePtr& instance, } IceInternal::Reference::Reference(const Reference& r) : + IceUtil::Shared(), _hashInitialized(false), _instance(r._instance), _communicator(r._communicator), diff --git a/cpp/src/Ice/RetryQueue.cpp b/cpp/src/Ice/RetryQueue.cpp index 1f382b268a6..a73921cc8a3 100644 --- a/cpp/src/Ice/RetryQueue.cpp +++ b/cpp/src/Ice/RetryQueue.cpp @@ -44,7 +44,7 @@ IceInternal::RetryTask::runTimerTask() } void -IceInternal::RetryTask::asyncRequestCanceled(const OutgoingAsyncBasePtr& outAsync, const Ice::LocalException& ex) +IceInternal::RetryTask::asyncRequestCanceled(const OutgoingAsyncBasePtr& /*outAsync*/, const Ice::LocalException& ex) { if(_queue->cancel(ICE_SHARED_FROM_THIS)) { diff --git a/cpp/src/Ice/RouterInfo.cpp b/cpp/src/Ice/RouterInfo.cpp index 18d56ccb201..cbc2cf12b6a 100644 --- a/cpp/src/Ice/RouterInfo.cpp +++ b/cpp/src/Ice/RouterInfo.cpp @@ -259,9 +259,9 @@ IceInternal::RouterInfo::addProxy(const Ice::ObjectPrxPtr& proxy, const AddProxy #ifdef ICE_CPP11_MAPPING RouterInfoPtr self = this; _router->addProxiesAsync(proxies, - [self, cookie](const Ice::ObjectProxySeq& proxies) + [self, cookie](const Ice::ObjectProxySeq& p) { - self->addProxyResponse(proxies, cookie); + self->addProxyResponse(p, cookie); }, [self, cookie](exception_ptr e) { diff --git a/cpp/src/Ice/Selector.cpp b/cpp/src/Ice/Selector.cpp index 52de030b469..8f16bdd3a12 100644 --- a/cpp/src/Ice/Selector.cpp +++ b/cpp/src/Ice/Selector.cpp @@ -379,8 +379,14 @@ Selector::enable(EventHandler* handler, SocketOperation status) epoll_event event; memset(&event, 0, sizeof(epoll_event)); event.data.ptr = handler; - event.events |= newStatus & SocketOperationRead ? EPOLLIN : 0; - event.events |= newStatus & SocketOperationWrite ? EPOLLOUT : 0; + if(newStatus & SocketOperationRead) + { + event.events |= EPOLLIN; + } + if(newStatus & SocketOperationWrite) + { + event.events |= EPOLLOUT; + } if(epoll_ctl(_queueFd, previous ? EPOLL_CTL_MOD : EPOLL_CTL_ADD, fd, &event) != 0) { Ice::Error out(_instance->initializationData().logger); @@ -426,8 +432,14 @@ Selector::disable(EventHandler* handler, SocketOperation status) epoll_event event; memset(&event, 0, sizeof(epoll_event)); event.data.ptr = handler; - event.events |= newStatus & SocketOperationRead ? EPOLLIN : 0; - event.events |= newStatus & SocketOperationWrite ? EPOLLOUT : 0; + if(newStatus & SocketOperationRead) + { + event.events |= EPOLLIN; + } + if(newStatus & SocketOperationWrite) + { + event.events |= EPOLLOUT; + } if(epoll_ctl(_queueFd, newStatus ? EPOLL_CTL_MOD : EPOLL_CTL_DEL, fd, &event) != 0) { Ice::Error out(_instance->initializationData().logger); @@ -929,8 +941,14 @@ Selector::updateSelectorForEventHandler(EventHandler* handler, SocketOperation r status = static_cast<SocketOperation>(status & ~handler->_disabled); previous = static_cast<SocketOperation>(previous & ~handler->_disabled); } - event.events |= status & SocketOperationRead ? EPOLLIN : 0; - event.events |= status & SocketOperationWrite ? EPOLLOUT : 0; + if(status & SocketOperationRead) + { + event.events |= EPOLLIN; + } + if(status & SocketOperationWrite) + { + event.events |= EPOLLOUT; + } int op; if(!previous && status) { diff --git a/cpp/src/Ice/ServantManager.cpp b/cpp/src/Ice/ServantManager.cpp index 91d1578a487..ca990f2d33a 100644 --- a/cpp/src/Ice/ServantManager.cpp +++ b/cpp/src/Ice/ServantManager.cpp @@ -212,22 +212,22 @@ IceInternal::ServantManager::findServant(const Identity& ident, const string& fa if(p == servantMapMap.end() || (q = p->second.find(facet)) == p->second.end()) { - DefaultServantMap::const_iterator p = _defaultServantMap.find(ident.category); - if(p == _defaultServantMap.end()) + DefaultServantMap::const_iterator d = _defaultServantMap.find(ident.category); + if(d == _defaultServantMap.end()) { - p = _defaultServantMap.find(""); - if(p == _defaultServantMap.end()) + d = _defaultServantMap.find(""); + if(d == _defaultServantMap.end()) { return 0; } else { - return p->second; + return d->second; } } else { - return p->second; + return d->second; } } else diff --git a/cpp/src/Ice/Thread.cpp b/cpp/src/Ice/Thread.cpp index dc10ed825e2..4186303e0ea 100644 --- a/cpp/src/Ice/Thread.cpp +++ b/cpp/src/Ice/Thread.cpp @@ -567,8 +567,8 @@ IceUtil::ThreadControl::join() throw BadThreadControlException(__FILE__, __LINE__); } - void* ignore = 0; - int rc = pthread_join(_thread, &ignore); + void* status = 0; + int rc = pthread_join(_thread, &status); if(rc != 0) { throw ThreadSyscallException(__FILE__, __LINE__, rc); diff --git a/cpp/src/Ice/TransceiverF.h b/cpp/src/Ice/TransceiverF.h index 69ce222eca0..e28b124e8b2 100644 --- a/cpp/src/Ice/TransceiverF.h +++ b/cpp/src/Ice/TransceiverF.h @@ -30,8 +30,8 @@ ICE_API IceUtil::Shared* upCast(UdpTransceiver*); typedef Handle<UdpTransceiver> UdpTransceiverPtr; class WSTransceiver; -ICE_API IceUtil::Shared* upCast(Transceiver*); -typedef Handle<Transceiver> TransceiverPtr; +ICE_API IceUtil::Shared* upCast(WSTransceiver*); +typedef Handle<WSTransceiver> WSTransceiverPtr; } diff --git a/cpp/src/Ice/WSTransceiver.h b/cpp/src/Ice/WSTransceiver.h index cb1533d8a25..caf06a96d69 100644 --- a/cpp/src/Ice/WSTransceiver.h +++ b/cpp/src/Ice/WSTransceiver.h @@ -140,7 +140,6 @@ private: std::vector<Ice::Byte> _pingPayload; }; -typedef IceUtil::Handle<WSTransceiver> WSTransceiverPtr; } diff --git a/cpp/src/IceBT/DBus.cpp b/cpp/src/IceBT/DBus.cpp index 927d8299249..97c19935767 100644 --- a/cpp/src/IceBT/DBus.cpp +++ b/cpp/src/IceBT/DBus.cpp @@ -751,9 +751,9 @@ private: // string sig = ::dbus_message_iter_get_signature(_iter); string::iterator p = sig.begin(); - TypePtr t = buildType(p); + TypePtr vt = buildType(p); VariantValuePtr v = new VariantValue; - v->v = readValue(t); + v->v = readValue(vt); popIter(); return v; } diff --git a/cpp/src/IceBT/EndpointI.cpp b/cpp/src/IceBT/EndpointI.cpp index 281ed56ad8a..3c6b26a3c20 100644 --- a/cpp/src/IceBT/EndpointI.cpp +++ b/cpp/src/IceBT/EndpointI.cpp @@ -171,7 +171,7 @@ IceBT::EndpointI::transceiver() const } void -IceBT::EndpointI::connectors_async(EndpointSelectionType selType, const IceInternal::EndpointI_connectorsPtr& cb) const +IceBT::EndpointI::connectors_async(EndpointSelectionType /*selType*/, const IceInternal::EndpointI_connectorsPtr& cb) const { vector<IceInternal::ConnectorPtr> connectors; connectors.push_back(new ConnectorI(_instance, _addr, _uuid, _timeout, _connectionId)); diff --git a/cpp/src/IceBT/TransceiverI.cpp b/cpp/src/IceBT/TransceiverI.cpp index d9ac8fd9aef..35bc5d54a30 100644 --- a/cpp/src/IceBT/TransceiverI.cpp +++ b/cpp/src/IceBT/TransceiverI.cpp @@ -31,7 +31,7 @@ IceBT::TransceiverI::getNativeInfo() } IceInternal::SocketOperation -IceBT::TransceiverI::initialize(IceInternal::Buffer& readBuffer, IceInternal::Buffer& writeBuffer) +IceBT::TransceiverI::initialize(IceInternal::Buffer& /*readBuffer*/, IceInternal::Buffer& /*writeBuffer*/) { IceUtil::Monitor<IceUtil::Mutex>::Lock lock(_lock); diff --git a/cpp/src/IceBox/ServiceManagerI.cpp b/cpp/src/IceBox/ServiceManagerI.cpp index 7c730f1d26d..d0c82984777 100644 --- a/cpp/src/IceBox/ServiceManagerI.cpp +++ b/cpp/src/IceBox/ServiceManagerI.cpp @@ -361,12 +361,11 @@ IceBox::ServiceManagerI::start() throw FailureException(__FILE__, __LINE__, "ServiceManager: configuration must include at least one IceBox service"); } - PropertyDict::iterator p; StringSeq loadOrder = properties->getPropertyAsList("IceBox.LoadOrder"); vector<StartServiceInfo> servicesInfo; for(StringSeq::const_iterator q = loadOrder.begin(); q != loadOrder.end(); ++q) { - p = services.find(prefix + *q); + PropertyDict::iterator p = services.find(prefix + *q); if(p == services.end()) { throw FailureException(__FILE__, __LINE__, "ServiceManager: no service definition for `" + @@ -375,7 +374,7 @@ IceBox::ServiceManagerI::start() servicesInfo.push_back(StartServiceInfo(*q, p->second, _argv)); services.erase(p); } - for(p = services.begin(); p != services.end(); ++p) + for(PropertyDict::iterator p = services.begin(); p != services.end(); ++p) { servicesInfo.push_back(StartServiceInfo(p->first.substr(prefix.size()), p->second, _argv)); } @@ -1060,9 +1059,9 @@ ServiceManagerI::observerCompleted(const shared_ptr<ServiceObserverPrx>& observe auto p = _observers.find(observer); if(p != _observers.end()) { - auto observer = *p; + auto found = *p; _observers.erase(p); - observerRemoved(observer, ex); + observerRemoved(found, ex); } } #else @@ -1085,7 +1084,7 @@ ServiceManagerI::observerCompleted(const Ice::AsyncResultPtr& result) set<ServiceObserverPrx>::iterator p = _observers.find(observer); if(p != _observers.end()) { - ServiceObserverPrx observer = *p; + observer = *p; _observers.erase(p); observerRemoved(observer, ex); } diff --git a/cpp/src/IceDiscovery/LookupI.cpp b/cpp/src/IceDiscovery/LookupI.cpp index d4f2669ba5b..593fbe9f2b1 100644 --- a/cpp/src/IceDiscovery/LookupI.cpp +++ b/cpp/src/IceDiscovery/LookupI.cpp @@ -196,9 +196,9 @@ AdapterRequest::invokeWithLookup(const string& domainId, const LookupPrxPtr& loo { rethrow_exception(ex); } - catch(const Ice::LocalException& ex) + catch(const Ice::LocalException& e) { - self->_lookup->adapterRequestException(self, ex); + self->_lookup->adapterRequestException(self, e); } }); #else @@ -235,9 +235,9 @@ ObjectRequest::invokeWithLookup(const string& domainId, const LookupPrxPtr& look { rethrow_exception(ex); } - catch(const Ice::LocalException& ex) + catch(const Ice::LocalException& e) { - self->_lookup->objectRequestException(self, ex); + self->_lookup->objectRequestException(self, e); } }); #else diff --git a/cpp/src/IceGrid/AdapterCache.cpp b/cpp/src/IceGrid/AdapterCache.cpp index cb3593bd874..bce7a41f485 100644 --- a/cpp/src/IceGrid/AdapterCache.cpp +++ b/cpp/src/IceGrid/AdapterCache.cpp @@ -375,7 +375,7 @@ ServerAdapterEntry::addSyncCallback(const SynchronizationCallbackPtr& callback, void ServerAdapterEntry::getLocatorAdapterInfo(LocatorAdapterInfoSeq& adapters, int& nReplicas, bool& replicaGroup, - bool& roundRobin, string& filter, const set<string>&) + bool& roundRobin, string&, const set<string>&) { nReplicas = 1; replicaGroup = false; diff --git a/cpp/src/IceGrid/AdminI.cpp b/cpp/src/IceGrid/AdminI.cpp index 473f05310bc..22184a46f4c 100644 --- a/cpp/src/IceGrid/AdminI.cpp +++ b/cpp/src/IceGrid/AdminI.cpp @@ -434,9 +434,9 @@ public: _proxy.handleException(ex); assert(false); } - catch(const Ice::Exception& ex) + catch(const Ice::Exception& e) { - _amdCB->ice_exception(ex); + _amdCB->ice_exception(e); } } @@ -491,9 +491,9 @@ public: { _amdCB->ice_response(); } - catch(const Ice::Exception& ex) + catch(const Ice::Exception& e) { - _amdCB->ice_exception(ex); + _amdCB->ice_exception(e); } } diff --git a/cpp/src/IceGrid/Client.cpp b/cpp/src/IceGrid/Client.cpp index 36f7c502716..c25c84d690b 100644 --- a/cpp/src/IceGrid/Client.cpp +++ b/cpp/src/IceGrid/Client.cpp @@ -387,8 +387,8 @@ run(const Ice::StringSeq& args) // to lookup for locator proxies. We destroy the plugin, once we have selected a // locator. // - Ice::PluginPtr p = createIceLocatorDiscovery(communicator, "IceGridAdmin.Discovery", Ice::StringSeq()); - IceLocatorDiscovery::PluginPtr plugin = IceLocatorDiscovery::PluginPtr::dynamicCast(p); + Ice::PluginPtr pluginObj = createIceLocatorDiscovery(communicator, "IceGridAdmin.Discovery", Ice::StringSeq()); + IceLocatorDiscovery::PluginPtr plugin = IceLocatorDiscovery::PluginPtr::dynamicCast(pluginObj); plugin->initialize(); vector<Ice::LocatorPrx> locators = plugin->getLocators(instanceName, IceUtil::Time::milliSeconds(300)); @@ -610,8 +610,8 @@ run(const Ice::StringSeq& args) if(registry->ice_getIdentity() == localRegistry->ice_getIdentity()) { Ice::ObjectAdapterPtr colloc = communicator->createObjectAdapter(""); // colloc-only adapter - Ice::ObjectPrx router = colloc->addWithUUID(new ReuseConnectionRouter(locator)); - communicator->setDefaultRouter(Ice::RouterPrx::uncheckedCast(router)); + communicator->setDefaultRouter(Ice::RouterPrx::uncheckedCast( + colloc->addWithUUID(new ReuseConnectionRouter(locator)))); registry = registry->ice_router(communicator->getDefaultRouter()); } diff --git a/cpp/src/IceGrid/Database.cpp b/cpp/src/IceGrid/Database.cpp index cc903e5df9c..aaa34ddde23 100644 --- a/cpp/src/IceGrid/Database.cpp +++ b/cpp/src/IceGrid/Database.cpp @@ -2454,9 +2454,9 @@ Database::checkUpdate(const ApplicationHelper& oldApp, { #if defined(__SUNPRO_CC) && defined(_RWSTD_NO_MEMBER_TEMPLATES) Ice::StringSeq nodes; - for(set<string>::const_iterator p = unreachableNodes.begin(); p != unreachableNodes.end(); ++p) + for(set<string>::const_iterator r = unreachableNodes.begin(); r != unreachableNodes.end(); ++r) { - nodes.push_back(*p); + nodes.push_back(*r); } #else Ice::StringSeq nodes(unreachableNodes.begin(), unreachableNodes.end()); @@ -2472,9 +2472,9 @@ Database::checkUpdate(const ApplicationHelper& oldApp, } if(!reasons.empty()) { - for(vector<string>::const_iterator p = reasons.begin(); p != reasons.end(); ++p) + for(vector<string>::const_iterator r = reasons.begin(); r != reasons.end(); ++r) { - out << "\n" << *p; + out << "\n" << *r; } } } @@ -2496,9 +2496,9 @@ Database::checkUpdate(const ApplicationHelper& oldApp, { #if defined(__SUNPRO_CC) && defined(_RWSTD_NO_MEMBER_TEMPLATES) Ice::StringSeq nodes; - for(set<string>::const_iterator p = unreachableNodes.begin(); p != unreachableNodes.end(); ++p) + for(set<string>::const_iterator r = unreachableNodes.begin(); r != unreachableNodes.end(); ++r) { - nodes.push_back(*p); + nodes.push_back(*r); } #else Ice::StringSeq nodes(unreachableNodes.begin(), unreachableNodes.end()); @@ -2519,9 +2519,9 @@ Database::checkUpdate(const ApplicationHelper& oldApp, { ostringstream os; os << "check for application `" << application << "' update failed:"; - for(vector<string>::const_iterator p = reasons.begin(); p != reasons.end(); ++p) + for(vector<string>::const_iterator r = reasons.begin(); r != reasons.end(); ++r) { - os << "\n" << *p; + os << "\n" << *r; } throw DeploymentException(os.str()); } @@ -2530,13 +2530,13 @@ Database::checkUpdate(const ApplicationHelper& oldApp, void Database::finishApplicationUpdate(const ApplicationUpdateInfo& update, const ApplicationInfo& oldApp, - const ApplicationHelper& previous, - const ApplicationHelper& helper, + const ApplicationHelper& previousAppHelper, + const ApplicationHelper& appHelper, AdminSessionI* /*session*/, bool noRestart, Ice::Long dbSerial) { - const ApplicationDescriptor& newDesc = helper.getDefinition(); + const ApplicationDescriptor& newDesc = appHelper.getDefinition(); ServerEntrySeq entries; int serial = 0; @@ -2544,15 +2544,15 @@ Database::finishApplicationUpdate(const ApplicationUpdateInfo& update, { if(_master) { - checkUpdate(previous, helper, oldApp.uuid, oldApp.revision, noRestart); + checkUpdate(previousAppHelper, appHelper, oldApp.uuid, oldApp.revision, noRestart); } Lock sync(*this); IceDB::ReadWriteTxn txn(_env); - checkForUpdate(previous, helper, txn); - reload(previous, helper, entries, oldApp.uuid, oldApp.revision + 1, noRestart); + checkForUpdate(previousAppHelper, appHelper, txn); + reload(previousAppHelper, appHelper, entries, oldApp.uuid, oldApp.revision + 1, noRestart); for_each(entries.begin(), entries.end(), IceUtil::voidMemFun(&ServerEntry::sync)); diff --git a/cpp/src/IceGrid/DescriptorHelper.cpp b/cpp/src/IceGrid/DescriptorHelper.cpp index 569fa6ff3a2..d4302c6fad4 100644 --- a/cpp/src/IceGrid/DescriptorHelper.cpp +++ b/cpp/src/IceGrid/DescriptorHelper.cpp @@ -995,8 +995,8 @@ Resolver::getProperties(const Ice::StringSeq& references, set<string>& resolved) if(!desc.references.empty()) { resolved.insert(*p); - PropertyDescriptorSeq p = getProperties(desc.references, resolved); - properties.insert(properties.end(), p.begin(), p.end()); + PropertyDescriptorSeq q = getProperties(desc.references, resolved); + properties.insert(properties.end(), q.begin(), q.end()); } PropertyDescriptorSeq pds = operator()(desc.properties); @@ -2655,11 +2655,11 @@ NodeHelper::printDiff(Output& out, const NodeHelper& helper) const } ApplicationHelper::ApplicationHelper(const Ice::CommunicatorPtr& communicator, - const ApplicationDescriptor& desc, + const ApplicationDescriptor& appDesc, bool enableWarning, bool instantiate) : _communicator(communicator), - _def(desc) + _def(appDesc) { if(_def.name.empty()) { diff --git a/cpp/src/IceGrid/IceGridNode.cpp b/cpp/src/IceGrid/IceGridNode.cpp index 87b0c97422d..e7177a60c7d 100644 --- a/cpp/src/IceGrid/IceGridNode.cpp +++ b/cpp/src/IceGrid/IceGridNode.cpp @@ -562,13 +562,13 @@ NodeService::startImpl(int argc, char* argv[], int& status) } else { - string id = communicator()->getProperties()->getProperty("IceGridAdmin.Username"); + string username = communicator()->getProperties()->getProperty("IceGridAdmin.Username"); string password = communicator()->getProperties()->getProperty("IceGridAdmin.Password"); - while(id.empty()) + while(username.empty()) { consoleOut << "user id: " << flush; - getline(cin, id); - id = IceUtilInternal::trim(id); + getline(cin, username); + username = IceUtilInternal::trim(username); } if(password.empty()) @@ -578,7 +578,7 @@ NodeService::startImpl(int argc, char* argv[], int& status) password = IceUtilInternal::trim(password); } - session = registry->createAdminSession(id, password); + session = registry->createAdminSession(username, password); } assert(session); diff --git a/cpp/src/IceGrid/LocatorI.cpp b/cpp/src/IceGrid/LocatorI.cpp index 3d962fe7e8c..9dbfbf71aff 100644 --- a/cpp/src/IceGrid/LocatorI.cpp +++ b/cpp/src/IceGrid/LocatorI.cpp @@ -123,12 +123,12 @@ public: _cb->ice_response(_obj); return; } - catch(const Ice::Exception& ex) + catch(const Ice::Exception& e) { // // Rethrow unexpected exception. // - _cb->ice_exception(ex); + _cb->ice_exception(e); return; } @@ -779,11 +779,11 @@ public: } virtual void - synchronized(const Ice::Exception& ex) + synchronized(const Ice::Exception& sex) { try { - ex.ice_throw(); + sex.ice_throw(); } catch(const AdapterNotExistException&) { diff --git a/cpp/src/IceGrid/LocatorRegistryI.cpp b/cpp/src/IceGrid/LocatorRegistryI.cpp index b541b5dcb81..1bceb964c89 100644 --- a/cpp/src/IceGrid/LocatorRegistryI.cpp +++ b/cpp/src/IceGrid/LocatorRegistryI.cpp @@ -180,9 +180,9 @@ public: { ex.ice_throw(); } - catch(const Ice::Exception& ex) + catch(const Ice::Exception& e) { - _amiCB->exception(ex); + _amiCB->exception(e); } } @@ -221,11 +221,11 @@ public: } virtual void - synchronized(const Ice::Exception& ex) + synchronized(const Ice::Exception& sex) { try { - ex.ice_throw(); + sex.ice_throw(); } catch(const ServerNotExistException&) { diff --git a/cpp/src/IceGrid/NodeCache.cpp b/cpp/src/IceGrid/NodeCache.cpp index cfefc48eedd..023f677d1a1 100644 --- a/cpp/src/IceGrid/NodeCache.cpp +++ b/cpp/src/IceGrid/NodeCache.cpp @@ -204,11 +204,11 @@ public: } void - exception(const Ice::Exception& ex) + exception(const Ice::Exception& lex) { try { - ex.ice_throw(); + lex.ice_throw(); } catch(const DeploymentException& ex) { @@ -266,11 +266,11 @@ public: } void - exception(const Ice::Exception& ex) + exception(const Ice::Exception& dex) { try { - ex.ice_throw(); + dex.ice_throw(); } catch(const DeploymentException& ex) { @@ -389,18 +389,18 @@ NodeEntry::setSession(const NodeSessionIPtr& session) } else { - NodeSessionIPtr session = _session; + NodeSessionIPtr s = _session; sync.release(); try { - session->getNode()->ice_ping(); + s->getNode()->ice_ping(); throw NodeActiveException(); } catch(const Ice::LocalException&) { try { - session->destroy(Ice::emptyCurrent); + s->destroy(Ice::emptyCurrent); } catch(const Ice::ObjectNotExistException&) { diff --git a/cpp/src/IceGrid/NodeI.cpp b/cpp/src/IceGrid/NodeI.cpp index 4a5ea265533..21e84cfa6a9 100644 --- a/cpp/src/IceGrid/NodeI.cpp +++ b/cpp/src/IceGrid/NodeI.cpp @@ -535,8 +535,7 @@ NodeI::patch_async(const AMD_Node_patchPtr& amdCB, } } - set<ServerIPtr>::iterator s = servers.begin(); - while(s != servers.end()) + for(set<ServerIPtr>::iterator s = servers.begin(); s != servers.end();) { if(!appDistrib->icepatch.empty() && (*s)->dependsOnApplicationDistrib()) { diff --git a/cpp/src/IceGrid/NodeSessionManager.cpp b/cpp/src/IceGrid/NodeSessionManager.cpp index f438c1dd2b2..9f2bb50e7e3 100644 --- a/cpp/src/IceGrid/NodeSessionManager.cpp +++ b/cpp/src/IceGrid/NodeSessionManager.cpp @@ -28,7 +28,7 @@ NodeSessionKeepAliveThread::NodeSessionKeepAliveThread(const InternalRegistryPrx { name = name.substr(prefix.size()); } - const_cast<string&>(_name) = name; + const_cast<string&>(_replicaName) = name; } NodeSessionPrx @@ -42,7 +42,7 @@ NodeSessionKeepAliveThread::createSession(InternalRegistryPrx& registry, IceUtil if(traceLevels && traceLevels->replica > 1) { Ice::Trace out(traceLevels->logger, traceLevels->replicaCat); - out << "trying to establish session with replica `" << _name << "'"; + out << "trying to establish session with replica `" << _replicaName << "'"; } set<InternalRegistryPrx> used; @@ -104,7 +104,8 @@ NodeSessionKeepAliveThread::createSession(InternalRegistryPrx& registry, IceUtil { if(traceLevels) { - traceLevels->logger->error("a node with the same name is already active with the replica `" + _name + "'"); + traceLevels->logger->error("a node with the same name is already active with the replica `" + + _replicaName + "'"); } exception.reset(ex.ice_clone()); } @@ -112,7 +113,7 @@ NodeSessionKeepAliveThread::createSession(InternalRegistryPrx& registry, IceUtil { if(traceLevels) { - traceLevels->logger->error("connection to the registry `" + _name + "' was denied:\n" + ex.reason); + traceLevels->logger->error("connection to the registry `" + _replicaName + "' was denied:\n" + ex.reason); } exception.reset(ex.ice_clone()); } @@ -126,7 +127,7 @@ NodeSessionKeepAliveThread::createSession(InternalRegistryPrx& registry, IceUtil if(traceLevels && traceLevels->replica > 0) { Ice::Trace out(traceLevels->logger, traceLevels->replicaCat); - out << "established session with replica `" << _name << "'"; + out << "established session with replica `" << _replicaName << "'"; } } else @@ -134,7 +135,7 @@ NodeSessionKeepAliveThread::createSession(InternalRegistryPrx& registry, IceUtil if(traceLevels && traceLevels->replica > 1) { Ice::Trace out(traceLevels->logger, traceLevels->replicaCat); - out << "failed to establish session with replica `" << _name << "':\n"; + out << "failed to establish session with replica `" << _replicaName << "':\n"; if(exception.get()) { out << *exception.get(); @@ -185,7 +186,7 @@ NodeSessionKeepAliveThread::destroySession(const NodeSessionPrx& session) if(_node->getTraceLevels() && _node->getTraceLevels()->replica > 0) { Ice::Trace out(_node->getTraceLevels()->logger, _node->getTraceLevels()->replicaCat); - out << "destroyed replica `" << _name << "' session"; + out << "destroyed replica `" << _replicaName << "' session"; } } catch(const Ice::LocalException& ex) @@ -193,7 +194,7 @@ NodeSessionKeepAliveThread::destroySession(const NodeSessionPrx& session) if(_node->getTraceLevels() && _node->getTraceLevels()->replica > 1) { Ice::Trace out(_node->getTraceLevels()->logger, _node->getTraceLevels()->replicaCat); - out << "couldn't destroy replica `" << _name << "' session:\n" << ex; + out << "couldn't destroy replica `" << _replicaName << "' session:\n" << ex; } } } @@ -205,7 +206,7 @@ NodeSessionKeepAliveThread::keepAlive(const NodeSessionPrx& session) if(_node->getTraceLevels() && _node->getTraceLevels()->replica > 2) { Ice::Trace out(_node->getTraceLevels()->logger, _node->getTraceLevels()->replicaCat); - out << "sending keep alive message to replica `" << _name << "'"; + out << "sending keep alive message to replica `" << _replicaName << "'"; } try @@ -219,7 +220,7 @@ NodeSessionKeepAliveThread::keepAlive(const NodeSessionPrx& session) if(_node->getTraceLevels() && _node->getTraceLevels()->replica > 0) { Ice::Trace out(_node->getTraceLevels()->logger, _node->getTraceLevels()->replicaCat); - out << "lost session with replica `" << _name << "':\n" << ex; + out << "lost session with replica `" << _replicaName << "':\n" << ex; } return false; } @@ -641,9 +642,9 @@ NodeSessionManager::createdSession(const NodeSessionPrx& session) if(_sessions.find((*p)->ice_getIdentity()) == _sessions.end()) { - NodeSessionKeepAliveThreadPtr session = addReplicaSession(*p); - session->tryCreateSession(); - sessions.push_back(session); + NodeSessionKeepAliveThreadPtr thread = addReplicaSession(*p); + thread->tryCreateSession(); + sessions.push_back(thread); } else { diff --git a/cpp/src/IceGrid/NodeSessionManager.h b/cpp/src/IceGrid/NodeSessionManager.h index f2a994d1e04..37a1c2e282d 100644 --- a/cpp/src/IceGrid/NodeSessionManager.h +++ b/cpp/src/IceGrid/NodeSessionManager.h @@ -44,7 +44,7 @@ protected: virtual NodeSessionPrx createSessionImpl(const InternalRegistryPrx&, IceUtil::Time&); const NodeIPtr _node; - const std::string _name; + const std::string _replicaName; NodeSessionManager& _manager; }; typedef IceUtil::Handle<NodeSessionKeepAliveThread> NodeSessionKeepAliveThreadPtr; diff --git a/cpp/src/IceGrid/Parser.cpp b/cpp/src/IceGrid/Parser.cpp index 41f5743e024..ed7d4840d2f 100644 --- a/cpp/src/IceGrid/Parser.cpp +++ b/cpp/src/IceGrid/Parser.cpp @@ -29,6 +29,8 @@ extern FILE* yyin; extern int yydebug; +int yyparse(); + using namespace std; using namespace IceUtil; using namespace IceUtilInternal; @@ -666,19 +668,19 @@ Parser::diffApplication(const list<string>& origArgs) StringSeq targets; map<string, string> vars; - vector<string>::const_iterator p = args.begin(); - string desc = *p++; + vector<string>::const_iterator arg = args.begin(); + string desc = *arg++; - for(; p != args.end(); ++p) + for(; arg != args.end(); ++arg) { - string::size_type pos = p->find('='); + string::size_type pos = arg->find('='); if(pos != string::npos) { - vars[p->substr(0, pos)] = p->substr(pos + 1); + vars[arg->substr(0, pos)] = arg->substr(pos + 1); } else { - targets.push_back(*p); + targets.push_back(*arg); } } @@ -2476,15 +2478,15 @@ Parser::showLog(const string& id, const string& reader, bool tail, bool follow, _session->ice_getConnection()->setAdapter(adapter); - Ice::Identity id; + Ice::Identity ident; ostringstream name; name << "RemoteLogger-" << loggerCallbackCount++; - id.name = name.str(); - id.category = adminCallbackTemplate->ice_getIdentity().category; + ident.name = name.str(); + ident.category = adminCallbackTemplate->ice_getIdentity().category; RemoteLoggerIPtr servant = new RemoteLoggerI; Ice::RemoteLoggerPrx prx = - Ice::RemoteLoggerPrx::uncheckedCast(adapter->add(servant, id)); + Ice::RemoteLoggerPrx::uncheckedCast(adapter->add(servant, ident)); adapter->activate(); loggerAdmin->attachRemoteLogger(prx, Ice::LogMessageTypeSeq(), Ice::StringSeq(), tail ? lineCount : -1); @@ -2871,11 +2873,11 @@ Parser::Parser(const CommunicatorPtr& communicator, } void -Parser::exception(const Ice::Exception& ex) +Parser::exception(const Ice::Exception& pex) { try { - ex.ice_throw(); + pex.ice_throw(); } catch(const ApplicationNotExistException& ex) { diff --git a/cpp/src/IceGrid/Parser.h b/cpp/src/IceGrid/Parser.h index d98edaf8fe6..e2c06ad33f2 100644 --- a/cpp/src/IceGrid/Parser.h +++ b/cpp/src/IceGrid/Parser.h @@ -23,7 +23,6 @@ #define YYSTYPE std::list<std::string> #define YY_DECL int yylex(YYSTYPE* yylvalp) YY_DECL; -int yyparse(); // // I must set the initial stack depth to the maximum stack depth to diff --git a/cpp/src/IceGrid/RegistryAdminRouter.cpp b/cpp/src/IceGrid/RegistryAdminRouter.cpp index 0f8cb2f1426..36c11d39b6f 100644 --- a/cpp/src/IceGrid/RegistryAdminRouter.cpp +++ b/cpp/src/IceGrid/RegistryAdminRouter.cpp @@ -25,7 +25,7 @@ public: const AMD_Object_ice_invokePtr& cb, const pair<const Byte*, const Byte*>& inParams, const Current& current) : - _callback(cb), _inParams(inParams.first, inParams.second), _current(current) + _adminRouter(adminRouter), _callback(cb), _inParams(inParams.first, inParams.second), _current(current) { } @@ -37,7 +37,7 @@ public: _adminRouter->ice_invoke_async(_callback, make_pair(&_inParams[0], &_inParams[0] + _inParams.size()), _current); } - void synchronized(const Ice::Exception& ex) + void synchronized(const Ice::Exception&) { _callback->ice_exception(Ice::ObjectNotExistException(__FILE__, __LINE__)); } diff --git a/cpp/src/IceGrid/ReplicaCache.cpp b/cpp/src/IceGrid/ReplicaCache.cpp index a964755cc93..5bd4794edef 100644 --- a/cpp/src/IceGrid/ReplicaCache.cpp +++ b/cpp/src/IceGrid/ReplicaCache.cpp @@ -42,8 +42,8 @@ ReplicaCache::add(const string& name, const ReplicaSessionIPtr& session) ReplicaEntryPtr entry; while((entry = getImpl(name))) { - ReplicaSessionIPtr session = entry->getSession(); - if(session->isDestroyed()) + ReplicaSessionIPtr s = entry->getSession(); + if(s->isDestroyed()) { wait(); // Wait for the session to be removed. } @@ -56,14 +56,14 @@ ReplicaCache::add(const string& name, const ReplicaSessionIPtr& session) sync.release(); try { - session->getInternalRegistry()->ice_ping(); + s->getInternalRegistry()->ice_ping(); throw ReplicaActiveException(); } catch(const Ice::LocalException&) { try { - session->destroy(Ice::emptyCurrent); + s->destroy(Ice::emptyCurrent); } catch(const Ice::LocalException&) { diff --git a/cpp/src/IceGrid/ServerCache.cpp b/cpp/src/IceGrid/ServerCache.cpp index 933d204722c..fdceb9c6748 100644 --- a/cpp/src/IceGrid/ServerCache.cpp +++ b/cpp/src/IceGrid/ServerCache.cpp @@ -80,7 +80,7 @@ CheckUpdateResult::CheckUpdateResult(const string& server, bool noRestart, bool remove, const Ice::AsyncResultPtr& result) : - _server(server), _node(node), _noRestart(noRestart), _result(result) + _server(server), _node(node), _remove(remove), _noRestart(noRestart), _result(result) { } @@ -94,7 +94,14 @@ CheckUpdateResult::getResult() catch(const DeploymentException& ex) { ostringstream os; - os << "check for server `" << _server << "' update failed: " << ex.reason; + if(_remove) + { + os << "check for server `" << _server << "' remove failed: " << ex.reason; + } + else + { + os << "check for server `" << _server << "' update failed: " << ex.reason; + } throw DeploymentException(os.str()); } catch(const Ice::OperationNotExistException&) @@ -449,7 +456,7 @@ ServerEntry::update(const ServerInfo& info, bool noRestart) if(info.descriptor->activation == "session") { _allocatable = true; - _load->sessionId = _session ? _session->getId() : string(""); + _load->sessionId = _allocationSession ? _allocationSession->getId() : string(""); } } @@ -493,7 +500,7 @@ ServerEntry::getInfo(bool resolve) const throw ServerNotExistException(); } info = _loaded.get() ? *_loaded : *_load; - session = _session; + session = _allocationSession; } assert(info.descriptor); if(resolve) @@ -696,7 +703,7 @@ ServerEntry::syncImpl() else if(_load.get()) { load = *_load; - session = _session; + session = _allocationSession; timeout = _deactivationTimeout; // loadServer might block to deactivate the previous server. } else @@ -874,7 +881,7 @@ ServerEntry::loadCallback(const ServerPrx& proxy, const AdapterPrxDict& adpts, i { load = *_load; noRestart = _noRestart; - session = _session; + session = _allocationSession; timeout = _deactivationTimeout; // loadServer might block to deactivate the previous server. } } @@ -937,7 +944,7 @@ ServerEntry::destroyCallback() _updated = false; load = *_load; noRestart = _noRestart; - session = _session; + session = _allocationSession; } } @@ -988,7 +995,7 @@ ServerEntry::exception(const Ice::Exception& ex) _updated = false; load = *_load.get(); noRestart = _noRestart; - session = _session; + session = _allocationSession; timeout = _deactivationTimeout; // loadServer might block to deactivate the previous server. } } @@ -1041,7 +1048,7 @@ ServerEntry::checkUpdate(const ServerInfo& info, bool noRestart) } oldInfo = _loaded.get() ? *_loaded : *_load; - session = _session; + session = _allocationSession; } NodeEntryPtr node; @@ -1131,7 +1138,7 @@ ServerEntry::allocated(const SessionIPtr& session) { _load.reset(_loaded.release()); } - _session = session; + _allocationSession = session; _load->sessionId = session->getId(); } @@ -1218,7 +1225,7 @@ ServerEntry::released(const SessionIPtr& session) _load.reset(_loaded.release()); } _load->sessionId = ""; - _session = 0; + _allocationSession = 0; } TraceLevelsPtr traceLevels = _cache.getTraceLevels(); diff --git a/cpp/src/IceGrid/ServerCache.h b/cpp/src/IceGrid/ServerCache.h index 5d743f9db31..ad9dd1587a0 100644 --- a/cpp/src/IceGrid/ServerCache.h +++ b/cpp/src/IceGrid/ServerCache.h @@ -51,6 +51,7 @@ private: const std::string _server; const std::string _node; + const bool _remove; const bool _noRestart; const Ice::AsyncResultPtr _result; }; @@ -130,7 +131,7 @@ private: bool _noRestart; std::vector<SynchronizationCallbackPtr> _callbacks; - SessionIPtr _session; + SessionIPtr _allocationSession; }; typedef IceUtil::Handle<ServerEntry> ServerEntryPtr; typedef std::vector<ServerEntryPtr> ServerEntrySeq; diff --git a/cpp/src/IceGrid/ServerI.cpp b/cpp/src/IceGrid/ServerI.cpp index ae06066629a..22e6cdf1c95 100644 --- a/cpp/src/IceGrid/ServerI.cpp +++ b/cpp/src/IceGrid/ServerI.cpp @@ -3185,8 +3185,8 @@ ServerI::getProperties(const InternalServerDescriptorPtr& desc) // // Copy the descriptor properties. // - PropertyDescriptorSeqDict properties = desc->properties; - PropertyDescriptorSeq& props = properties["config"]; + PropertyDescriptorSeqDict propDict = desc->properties; + PropertyDescriptorSeq& props = propDict["config"]; // // Cache the path of the stderr/stdout file, first check if the @@ -3216,7 +3216,7 @@ ServerI::getProperties(const InternalServerDescriptorPtr& desc) // { const PropertyDescriptorSeq& overrides = _node->getPropertiesOverride(); - for(PropertyDescriptorSeqDict::iterator p = properties.begin(); p != properties.end(); ++p) + for(PropertyDescriptorSeqDict::iterator p = propDict.begin(); p != propDict.end(); ++p) { if(getProperty(p->second, "Ice.Default.Locator").empty()) { @@ -3244,5 +3244,5 @@ ServerI::getProperties(const InternalServerDescriptorPtr& desc) } } - return properties; + return propDict; } diff --git a/cpp/src/IceGrid/Topics.cpp b/cpp/src/IceGrid/Topics.cpp index 83c1d89ac9f..61411270dcf 100644 --- a/cpp/src/IceGrid/Topics.cpp +++ b/cpp/src/IceGrid/Topics.cpp @@ -104,14 +104,14 @@ ObserverTopic::unsubscribe(const Ice::ObjectPrx& observer, const string& name) { Lock sync(*this); Ice::EncodingVersion v = IceInternal::getCompatibleEncoding(observer->ice_getEncodingVersion()); - map<Ice::EncodingVersion, IceStorm::TopicPrx>::const_iterator p = _topics.find(v); - if(p == _topics.end()) + map<Ice::EncodingVersion, IceStorm::TopicPrx>::const_iterator q = _topics.find(v); + if(q == _topics.end()) { return; } try { - p->second->unsubscribe(observer); + q->second->unsubscribe(observer); } catch(const Ice::ObjectAdapterDeactivatedException&) { @@ -468,9 +468,9 @@ NodeObserverTopic::updateServer(const string& node, const ServerDynamicInfo& ser try { - for(vector<NodeObserverPrx>::const_iterator p = _publishers.begin(); p != _publishers.end(); ++p) + for(vector<NodeObserverPrx>::const_iterator q = _publishers.begin(); q != _publishers.end(); ++q) { - (*p)->updateServer(node, server); + (*q)->updateServer(node, server); } } catch(const Ice::LocalException& ex) @@ -524,9 +524,9 @@ NodeObserverTopic::updateAdapter(const string& node, const AdapterDynamicInfo& a try { - for(vector<NodeObserverPrx>::const_iterator p = _publishers.begin(); p != _publishers.end(); ++p) + for(vector<NodeObserverPrx>::const_iterator q = _publishers.begin(); q != _publishers.end(); ++q) { - (*p)->updateAdapter(node, adapter); + (*q)->updateAdapter(node, adapter); } } catch(const Ice::LocalException& ex) @@ -1026,9 +1026,9 @@ ObjectObserverTopic::wellKnownObjectsAddedOrUpdated(const ObjectInfoSeq& infos) q->second = *p; try { - for(vector<ObjectObserverPrx>::const_iterator q = _publishers.begin(); q != _publishers.end(); ++q) + for(vector<ObjectObserverPrx>::const_iterator r = _publishers.begin(); r != _publishers.end(); ++r) { - (*q)->objectUpdated(*p, getContext(_serial)); + (*r)->objectUpdated(*p, getContext(_serial)); } } catch(const Ice::LocalException& ex) @@ -1042,9 +1042,9 @@ ObjectObserverTopic::wellKnownObjectsAddedOrUpdated(const ObjectInfoSeq& infos) _objects.insert(make_pair(p->proxy->ice_getIdentity(), *p)); try { - for(vector<ObjectObserverPrx>::const_iterator q = _publishers.begin(); q != _publishers.end(); ++q) + for(vector<ObjectObserverPrx>::const_iterator r = _publishers.begin(); r != _publishers.end(); ++r) { - (*q)->objectAdded(*p, getContext(_serial)); + (*r)->objectAdded(*p, getContext(_serial)); } } catch(const Ice::LocalException& ex) diff --git a/cpp/src/IceLocatorDiscovery/PluginI.cpp b/cpp/src/IceLocatorDiscovery/PluginI.cpp index d27bac6c46a..ced0f671211 100644 --- a/cpp/src/IceLocatorDiscovery/PluginI.cpp +++ b/cpp/src/IceLocatorDiscovery/PluginI.cpp @@ -588,10 +588,10 @@ LocatorI::LocatorI(const string& name, // datagram on each endpoint. // Ice::EndpointSeq endpoints = lookup->ice_getEndpoints(); - for(vector<Ice::EndpointPtr>::const_iterator p = endpoints.begin(); p != endpoints.end(); ++p) + for(vector<Ice::EndpointPtr>::const_iterator q = endpoints.begin(); q != endpoints.end(); ++q) { Ice::EndpointSeq single; - single.push_back(*p); + single.push_back(*q); _lookups.push_back(make_pair(lookup->ice_endpoints(single), LookupReplyPrxPtr())); } assert(!_lookups.empty()); diff --git a/cpp/src/IceSSL/EndpointI.cpp b/cpp/src/IceSSL/EndpointI.cpp index be21e7dade7..c59f8464ca1 100644 --- a/cpp/src/IceSSL/EndpointI.cpp +++ b/cpp/src/IceSSL/EndpointI.cpp @@ -342,36 +342,36 @@ IceSSL::EndpointI::operator<(const Ice::LocalObject& r) const } bool -IceSSL::EndpointI::checkOption(const string& option, const string& argument, const string& endpoint) +IceSSL::EndpointI::checkOption(const string& /*option*/, const string& /*argument*/, const string& /*endpoint*/) { return false; } IceSSL::EndpointFactoryI::EndpointFactoryI(const InstancePtr& instance, Short type) : - IceInternal::EndpointFactoryWithUnderlying(instance, type), _instance(instance.get()) + IceInternal::EndpointFactoryWithUnderlying(instance, type), _sslInstance(instance.get()) { } void IceSSL::EndpointFactoryI::destroy() { - _instance = 0; + _sslInstance = 0; } IceInternal::EndpointFactoryPtr IceSSL::EndpointFactoryI::cloneWithUnderlying(const IceInternal::ProtocolInstancePtr& instance, Short underlying) const { - return new EndpointFactoryI(new Instance(_instance->engine(), instance->type(), instance->protocol()), underlying); + return new EndpointFactoryI(new Instance(_sslInstance->engine(), instance->type(), instance->protocol()), underlying); } IceInternal::EndpointIPtr IceSSL::EndpointFactoryI::createWithUnderlying(const IceInternal::EndpointIPtr& underlying, vector<string>&, bool) const { - return ICE_MAKE_SHARED(EndpointI, _instance, underlying); + return ICE_MAKE_SHARED(EndpointI, _sslInstance, underlying); } IceInternal::EndpointIPtr -IceSSL::EndpointFactoryI::readWithUnderlying(const IceInternal::EndpointIPtr& underlying, Ice::InputStream* s) const +IceSSL::EndpointFactoryI::readWithUnderlying(const IceInternal::EndpointIPtr& underlying, Ice::InputStream*) const { - return ICE_MAKE_SHARED(EndpointI, _instance, underlying); + return ICE_MAKE_SHARED(EndpointI, _sslInstance, underlying); } diff --git a/cpp/src/IceSSL/EndpointI.h b/cpp/src/IceSSL/EndpointI.h index 4f9b1ddeab7..13df972832a 100644 --- a/cpp/src/IceSSL/EndpointI.h +++ b/cpp/src/IceSSL/EndpointI.h @@ -97,7 +97,7 @@ protected: private: - InstancePtr _instance; + InstancePtr _sslInstance; }; } diff --git a/cpp/src/IceSSL/OpenSSLEngine.cpp b/cpp/src/IceSSL/OpenSSLEngine.cpp index 17d48b342ef..9cf0b277242 100644 --- a/cpp/src/IceSSL/OpenSSLEngine.cpp +++ b/cpp/src/IceSSL/OpenSSLEngine.cpp @@ -748,10 +748,10 @@ OpenSSL::SSLEngine::initialize() } else { - string err = sslErrors(); - if(!err.empty()) + string errStr = sslErrors(); + if(!errStr.empty()) { - msg += ":\n" + err; + msg += ":\n" + errStr; } } throw PluginInitializationException(__FILE__, __LINE__, msg); @@ -847,13 +847,13 @@ OpenSSL::SSLEngine::initialize() // // Establish the cipher list. // - string ciphers = properties->getProperty(propPrefix + "Ciphers"); - if(!ciphers.empty()) + string ciphersStr = properties->getProperty(propPrefix + "Ciphers"); + if(!ciphersStr.empty()) { - if(!SSL_CTX_set_cipher_list(_ctx, ciphers.c_str())) + if(!SSL_CTX_set_cipher_list(_ctx, ciphersStr.c_str())) { throw PluginInitializationException(__FILE__, __LINE__, - "IceSSL: unable to set ciphers using `" + ciphers + "':\n" + sslErrors()); + "IceSSL: unable to set ciphers using `" + ciphersStr + "':\n" + sslErrors()); } } diff --git a/cpp/src/IceSSL/SSLEngine.cpp b/cpp/src/IceSSL/SSLEngine.cpp index 41c598140c9..be9aaf72ddf 100644 --- a/cpp/src/IceSSL/SSLEngine.cpp +++ b/cpp/src/IceSSL/SSLEngine.cpp @@ -224,7 +224,7 @@ IceSSL::SSLEngine::verifyPeerCertName(const string& address, const ConnectionInf } void -IceSSL::SSLEngine::verifyPeer(const string& address, const ConnectionInfoPtr& info, const string& desc) +IceSSL::SSLEngine::verifyPeer(const string& /*address*/, const ConnectionInfoPtr& info, const string& desc) { const CertificateVerifierPtr verifier = getCertificateVerifier(); if(_verifyDepthMax > 0 && static_cast<int>(info->certs.size()) > _verifyDepthMax) diff --git a/cpp/src/IceSSL/SecureTransportCertificateI.cpp b/cpp/src/IceSSL/SecureTransportCertificateI.cpp index cac8020a3b8..d5c02f1d030 100644 --- a/cpp/src/IceSSL/SecureTransportCertificateI.cpp +++ b/cpp/src/IceSSL/SecureTransportCertificateI.cpp @@ -346,15 +346,15 @@ getX509AltName(SecCertificateRef cert, CFTypeRef key) { CFArrayRef section = (CFArrayRef)v; ostringstream os; - for(int i = 0, count = CFArrayGetCount(section); i < count;) + for(int j = 0, count = CFArrayGetCount(section); j < count;) { - CFDictionaryRef d = (CFDictionaryRef)CFArrayGetValueAtIndex(section, i); + CFDictionaryRef d = (CFDictionaryRef)CFArrayGetValueAtIndex(section, j); CFStringRef sectionLabel = static_cast<CFStringRef>(CFDictionaryGetValue(d, kSecPropertyKeyLabel)); CFStringRef sectionValue = static_cast<CFStringRef>(CFDictionaryGetValue(d, kSecPropertyKeyValue)); os << certificateOIDAlias(fromCFString(sectionLabel)) << "=" << fromCFString(sectionValue); - if(++i < count) + if(++j < count) { os << ","; } diff --git a/cpp/src/IceSSL/SecureTransportEngine.cpp b/cpp/src/IceSSL/SecureTransportEngine.cpp index 80c4a1cd489..4ae8b39ec01 100644 --- a/cpp/src/IceSSL/SecureTransportEngine.cpp +++ b/cpp/src/IceSSL/SecureTransportEngine.cpp @@ -857,7 +857,6 @@ IceSSL::SecureTransport::SSLEngine::initialize() PasswordPromptPtr passwordPrompt = getPasswordPrompt(); string certFile = properties->getProperty("IceSSL.CertFile"); - string keyFile = properties->getProperty("IceSSL.KeyFile"); string findCert = properties->getProperty("IceSSL.FindCert"); string keychain = properties->getProperty("IceSSL.Keychain"); string keychainPassword = properties->getProperty("IceSSL.KeychainPassword"); @@ -871,21 +870,24 @@ IceSSL::SecureTransport::SSLEngine::initialize() "IceSSL: invalid value for IceSSL.CertFile:\n" + certFile); } vector<string> keyFiles; - if(!keyFile.empty()) { - if(!IceUtilInternal::splitString(keyFile, IceUtilInternal::pathsep, keyFiles) || keyFiles.size() > 2) - { - throw PluginInitializationException(__FILE__, __LINE__, - "IceSSL: invalid value for IceSSL.KeyFile:\n" + keyFile); - } - if(files.size() != keyFiles.size()) + string keyFile = properties->getProperty("IceSSL.KeyFile"); + if(!keyFile.empty()) { - throw PluginInitializationException(__FILE__, __LINE__, - "IceSSL: IceSSL.KeyFile does not agree with IceSSL.CertFile"); + if(!IceUtilInternal::splitString(keyFile, IceUtilInternal::pathsep, keyFiles) || keyFiles.size() > 2) + { + throw PluginInitializationException(__FILE__, __LINE__, + "IceSSL: invalid value for IceSSL.KeyFile:\n" + keyFile); + } + if(files.size() != keyFiles.size()) + { + throw PluginInitializationException(__FILE__, __LINE__, + "IceSSL: IceSSL.KeyFile does not agree with IceSSL.CertFile"); + } } } - for(int i = 0; i < files.size(); ++i) + for(size_t i = 0; i < files.size(); ++i) { string file = files[i]; string keyFile = keyFiles.empty() ? "" : keyFiles[i]; diff --git a/cpp/src/IceSSL/SecureTransportTransceiverI.cpp b/cpp/src/IceSSL/SecureTransportTransceiverI.cpp index 1a299a72a51..3200e659c8e 100644 --- a/cpp/src/IceSSL/SecureTransportTransceiverI.cpp +++ b/cpp/src/IceSSL/SecureTransportTransceiverI.cpp @@ -253,8 +253,8 @@ IceSSL::SecureTransport::TransceiverI::initialize(IceInternal::Buffer& readBuffe } else if(err == errSSLWouldBlock) { - assert(_flags & SSLWantRead || _flags & SSLWantWrite); - return _flags & SSLWantRead ? IceInternal::SocketOperationRead : IceInternal::SocketOperationWrite; + assert(_tflags & SSLWantRead || _tflags & SSLWantWrite); + return _tflags & SSLWantRead ? IceInternal::SocketOperationRead : IceInternal::SocketOperationWrite; } else if(err == errSSLPeerAuthCompleted) { @@ -294,9 +294,11 @@ IceSSL::SecureTransport::TransceiverI::initialize(IceInternal::Buffer& readBuffe } assert(_ssl); - SSLCipherSuite cipher; - SSLGetNegotiatedCipher(_ssl.get(), &cipher); - _cipher = _engine->getCipherName(cipher); + { + SSLCipherSuite cipher; + SSLGetNegotiatedCipher(_ssl.get(), &cipher); + _cipher = _engine->getCipherName(cipher); + } _engine->verifyPeer(_host, ICE_DYNAMIC_CAST(ConnectionInfo, getInfo()), toString()); @@ -381,7 +383,7 @@ IceSSL::SecureTransport::TransceiverI::write(IceInternal::Buffer& buf) { _buffered = processed; } - assert(_flags & SSLWantWrite); + assert(_tflags & SSLWantWrite); return IceInternal::SocketOperationWrite; } @@ -420,9 +422,9 @@ IceSSL::SecureTransport::TransceiverI::write(IceInternal::Buffer& buf) buf.i += processed; } - if(packetSize > buf.b.end() - buf.i) + if(packetSize > static_cast<size_t>(buf.b.end() - buf.i)) { - packetSize = buf.b.end() - buf.i; + packetSize = static_cast<size_t>(buf.b.end() - buf.i); } } @@ -454,7 +456,7 @@ IceSSL::SecureTransport::TransceiverI::read(IceInternal::Buffer& buf) if(err == errSSLWouldBlock) { buf.i += processed; - assert(_flags & SSLWantRead); + assert(_tflags & SSLWantRead); return IceInternal::SocketOperationRead; } @@ -485,9 +487,9 @@ IceSSL::SecureTransport::TransceiverI::read(IceInternal::Buffer& buf) buf.i += processed; - if(packetSize > buf.b.end() - buf.i) + if(packetSize > static_cast<size_t>(buf.b.end() - buf.i)) { - packetSize = buf.b.end() - buf.i; + packetSize = static_cast<size_t>(buf.b.end() - buf.i); } } @@ -570,7 +572,7 @@ IceSSL::SecureTransport::TransceiverI::~TransceiverI() OSStatus IceSSL::SecureTransport::TransceiverI::writeRaw(const char* data, size_t* length) const { - _flags &= ~SSLWantWrite; + _tflags &= ~SSLWantWrite; try { @@ -579,7 +581,7 @@ IceSSL::SecureTransport::TransceiverI::writeRaw(const char* data, size_t* length if(op == IceInternal::SocketOperationWrite) { *length = buf.i - buf.b.begin(); - _flags |= SSLWantWrite; + _tflags |= SSLWantWrite; return errSSLWouldBlock; } assert(op == IceInternal::SocketOperationNone); @@ -603,7 +605,7 @@ IceSSL::SecureTransport::TransceiverI::writeRaw(const char* data, size_t* length OSStatus IceSSL::SecureTransport::TransceiverI::readRaw(char* data, size_t* length) const { - _flags &= ~SSLWantRead; + _tflags &= ~SSLWantRead; try { @@ -612,7 +614,7 @@ IceSSL::SecureTransport::TransceiverI::readRaw(char* data, size_t* length) const if(op == IceInternal::SocketOperationRead) { *length = buf.i - buf.b.begin(); - _flags |= SSLWantRead; + _tflags |= SSLWantRead; return errSSLWouldBlock; } assert(op == IceInternal::SocketOperationNone); diff --git a/cpp/src/IceSSL/SecureTransportTransceiverI.h b/cpp/src/IceSSL/SecureTransportTransceiverI.h index 9eeae288f51..7609a685c52 100644 --- a/cpp/src/IceSSL/SecureTransportTransceiverI.h +++ b/cpp/src/IceSSL/SecureTransportTransceiverI.h @@ -77,7 +77,7 @@ private: SSLWantWrite = 0x2 }; - mutable Ice::Byte _flags; + mutable Ice::Byte _tflags; size_t _maxSendPacketSize; size_t _maxRecvPacketSize; std::string _cipher; diff --git a/cpp/src/IceSSL/SecureTransportUtil.cpp b/cpp/src/IceSSL/SecureTransportUtil.cpp index d85fbf4d0d3..a9c7b1a68ae 100644 --- a/cpp/src/IceSSL/SecureTransportUtil.cpp +++ b/cpp/src/IceSSL/SecureTransportUtil.cpp @@ -363,11 +363,11 @@ loadPrivateKey(const string& file, SecCertificateRef cert, SecKeychainRef keycha UniqueRef<SecKeyRef> key; for(int i = 0; i < count; ++i) { - SecKeychainItemRef item = + SecKeychainItemRef itemRef = static_cast<SecKeychainItemRef>(const_cast<void*>(CFArrayGetValueAtIndex(items.get(), 0))); - if(SecKeyGetTypeID() == CFGetTypeID(item)) + if(SecKeyGetTypeID() == CFGetTypeID(itemRef)) { - key.retain(reinterpret_cast<SecKeyRef>(item)); + key.retain(reinterpret_cast<SecKeyRef>(itemRef)); break; } } diff --git a/cpp/src/IceStorm/InstrumentationI.cpp b/cpp/src/IceStorm/InstrumentationI.cpp index 872c6b88f83..41cb2725243 100644 --- a/cpp/src/IceStorm/InstrumentationI.cpp +++ b/cpp/src/IceStorm/InstrumentationI.cpp @@ -241,7 +241,7 @@ namespace struct QueuedUpdate { - QueuedUpdate(int count) : count(count) + QueuedUpdate(int countP) : count(countP) { } @@ -265,7 +265,7 @@ namespace struct OutstandingUpdate { - OutstandingUpdate(int count) : count(count) + OutstandingUpdate(int countP) : count(countP) { } @@ -294,7 +294,7 @@ namespace struct DeliveredUpdate { - DeliveredUpdate(int count) : count(count) + DeliveredUpdate(int countP) : count(countP) { } diff --git a/cpp/src/IceStorm/Parser.cpp b/cpp/src/IceStorm/Parser.cpp index 6ee8fe22f41..1ee3aef78d8 100644 --- a/cpp/src/IceStorm/Parser.cpp +++ b/cpp/src/IceStorm/Parser.cpp @@ -22,6 +22,8 @@ extern FILE* yyin; extern int yydebug; +int yyparse(); + using namespace std; using namespace Ice; using namespace IceInternal; @@ -45,9 +47,9 @@ class UnknownManagerException : public Exception { public: - UnknownManagerException(const string& name, const char* file, int line) : + UnknownManagerException(const string& nameP, const char* file, int line) : Exception(file, line), - name(name) + name(nameP) { } @@ -681,12 +683,12 @@ Parser::Parser(const CommunicatorPtr& communicator, const TopicManagerPrx& admin } void -Parser::exception(const Ice::Exception& ex, bool warn) +Parser::exception(const Ice::Exception& pex, bool warn) { ostringstream os; try { - ex.ice_throw(); + pex.ice_throw(); } catch(const LinkExists& ex) { diff --git a/cpp/src/IceStorm/Parser.h b/cpp/src/IceStorm/Parser.h index 5bcea7abf6d..7887c76d9b7 100644 --- a/cpp/src/IceStorm/Parser.h +++ b/cpp/src/IceStorm/Parser.h @@ -22,7 +22,6 @@ #define YYSTYPE std::list<std::string> #define YY_DECL int yylex(YYSTYPE* yylvalp) YY_DECL; -int yyparse(); // // I must set the initial stack depth to the maximum stack depth to diff --git a/cpp/src/IceStorm/Service.cpp b/cpp/src/IceStorm/Service.cpp index b53854cdb0e..28de33887b9 100644 --- a/cpp/src/IceStorm/Service.cpp +++ b/cpp/src/IceStorm/Service.cpp @@ -95,7 +95,7 @@ extern "C" { ICESTORM_SERVICE_API ::IceBox::Service* -createIceStorm(CommunicatorPtr communicator) +createIceStorm(CommunicatorPtr) { return new ServiceI; } @@ -300,11 +300,11 @@ ServiceI::start( int nodeid = atoi(adapterid.substr(start, end-start).c_str()); ostringstream os; os << "node" << nodeid; - Ice::Identity id; - id.category = instanceName; - id.name = os.str(); + Ice::Identity ident; + ident.category = instanceName; + ident.name = os.str(); - nodes[nodeid] = NodePrx::uncheckedCast((*p)->ice_adapterId(adapterid)->ice_identity(id)); + nodes[nodeid] = NodePrx::uncheckedCast((*p)->ice_adapterId(adapterid)->ice_identity(ident)); } } diff --git a/cpp/src/IceStorm/TopicI.cpp b/cpp/src/IceStorm/TopicI.cpp index 414b89ecfbc..16008fdcde1 100644 --- a/cpp/src/IceStorm/TopicI.cpp +++ b/cpp/src/IceStorm/TopicI.cpp @@ -394,12 +394,12 @@ TopicImpl::TopicImpl( // for(SubscriberRecordSeq::const_iterator p = subscribers.begin(); p != subscribers.end(); ++p) { - Ice::Identity id = p->obj->ice_getIdentity(); + Ice::Identity ident = p->obj->ice_getIdentity(); TraceLevelsPtr traceLevels = _instance->traceLevels(); if(traceLevels->topic > 0) { Ice::Trace out(traceLevels->logger, traceLevels->topicCat); - out << _name << " recreate " << _instance->communicator()->identityToString(id); + out << _name << " recreate " << _instance->communicator()->identityToString(ident); if(traceLevels->topic > 1) { out << " endpoints: " << IceStormInternal::describeEndpoints(p->obj); @@ -418,7 +418,7 @@ TopicImpl::TopicImpl( catch(const Ice::Exception& ex) { Ice::Warning out(traceLevels->logger); - out << _name << " recreate " << _instance->communicator()->identityToString(id); + out << _name << " recreate " << _instance->communicator()->identityToString(ident); if(traceLevels->topic > 1) { out << " endpoints: " << IceStormInternal::describeEndpoints(p->obj); @@ -1058,7 +1058,6 @@ TopicImpl::observerAddSubscriber(const LogUpdate& llu, const SubscriberRecord& r { // If the subscriber is already in the database display a // diagnostic. - TraceLevelsPtr traceLevels = _instance->traceLevels(); if(traceLevels->topic > 0) { Ice::Trace out(traceLevels->logger, traceLevels->topicCat); diff --git a/cpp/src/IceStorm/TopicManagerI.cpp b/cpp/src/IceStorm/TopicManagerI.cpp index ee8a3c4482a..ad37e967dd5 100644 --- a/cpp/src/IceStorm/TopicManagerI.cpp +++ b/cpp/src/IceStorm/TopicManagerI.cpp @@ -422,13 +422,13 @@ TopicManagerImpl::observerInit(const LogUpdate& llu, const TopicContentSeq& cont for(TopicContentSeq::const_iterator p = content.begin(); p != content.end(); ++p) { - SubscriberRecordKey key; - key.topic = p->id; + SubscriberRecordKey srkey; + srkey.topic = p->id; SubscriberRecord rec; rec.link = false; rec.cost = 0; - _subscriberMap.put(txn, key, rec); + _subscriberMap.put(txn, srkey, rec); for(SubscriberRecordSeq::const_iterator q = p->records.begin(); q != p->records.end(); ++q) { @@ -486,14 +486,14 @@ TopicManagerImpl::observerInit(const LogUpdate& llu, const TopicContentSeq& cont for(TopicContentSeq::const_iterator q = content.begin(); q != content.end(); ++q) { string name = identityToTopicName(q->id); - map<string, TopicImplPtr>::const_iterator p = _topics.find(name); - if(p == _topics.end()) + map<string, TopicImplPtr>::const_iterator r = _topics.find(name); + if(r == _topics.end()) { installTopic(name, q->id, true, q->records); } else { - p->second->update(q->records); + r->second->update(q->records); } } // Clear the set of observers. diff --git a/cpp/src/IceUtil/RecMutex.cpp b/cpp/src/IceUtil/RecMutex.cpp index abc47d6cbe2..1acb4471166 100644 --- a/cpp/src/IceUtil/RecMutex.cpp +++ b/cpp/src/IceUtil/RecMutex.cpp @@ -113,7 +113,7 @@ IceUtil::RecMutex::lock(LockState& state) const #else void -IceUtil::RecMutex::init(const MutexProtocol protocol) +IceUtil::RecMutex::init(ICE_MAYBE_UNUSED const MutexProtocol protocol) { int rc; pthread_mutexattr_t attr; diff --git a/cpp/src/Slice/CPlusPlusUtil.cpp b/cpp/src/Slice/CPlusPlusUtil.cpp index 8ebdd2f16b2..0ac929e440c 100644 --- a/cpp/src/Slice/CPlusPlusUtil.cpp +++ b/cpp/src/Slice/CPlusPlusUtil.cpp @@ -62,7 +62,7 @@ toOptional(const string& s, int typeCtx) } string -stringTypeToString(const TypePtr& type, const StringList& metaData, int typeCtx) +stringTypeToString(const TypePtr&, const StringList& metaData, int typeCtx) { string strType = findMetaData(metaData, typeCtx); if(strType == "wstring" || (typeCtx & TypeContextUseWstring && strType == "")) @@ -192,10 +192,10 @@ writeParamAllocateCode(Output& out, const TypePtr& type, bool optional, const st seqType = findMetaData(seq->getMetaData(), typeCtx); } - string s; + string str; if(seqType == "%array") { - s = typeToString(seq, scope, metaData, TypeContextAMIPrivateEnd); + str = typeToString(seq, scope, metaData, TypeContextAMIPrivateEnd); } else if(seqType.find("%range") == 0) { @@ -204,16 +204,16 @@ writeParamAllocateCode(Output& out, const TypePtr& type, bool optional, const st { md.push_back("cpp:type:" + seqType.substr(strlen("%range:"))); } - s = typeToString(seq, scope, md, 0); + str = typeToString(seq, scope, md, 0); } - if(!s.empty()) + if(!str.empty()) { if(optional) { - s = toOptional(s, typeCtx); + str = toOptional(str, typeCtx); } - out << nl << s << ' ' << fixedName << "_tmp_;"; + out << nl << str << ' ' << fixedName << "_tmp_;"; } } } diff --git a/cpp/src/Slice/GrammarUtil.h b/cpp/src/Slice/GrammarUtil.h index de34f2b8e63..952dfdedfc6 100644 --- a/cpp/src/Slice/GrammarUtil.h +++ b/cpp/src/Slice/GrammarUtil.h @@ -213,7 +213,6 @@ public: #define YYSTYPE Slice::GrammarBasePtr #define YY_DECL int slice_lex(YYSTYPE* yylvalp) YY_DECL; -int slice_parse(); // // I must set the initial stack depth to the maximum stack depth to diff --git a/cpp/src/Slice/JavaUtil.cpp b/cpp/src/Slice/JavaUtil.cpp index 094f2fd373a..09bfc4bcdce 100644 --- a/cpp/src/Slice/JavaUtil.cpp +++ b/cpp/src/Slice/JavaUtil.cpp @@ -971,11 +971,11 @@ Slice::JavaCompatGenerator::getPackagePrefix(const ContainedPtr& cont) const string q; if(!m->findMetaData(prefix, q)) { - UnitPtr unit = cont->unit(); + UnitPtr ut = cont->unit(); string file = cont->file(); assert(!file.empty()); - DefinitionContextPtr dc = unit->findDefinitionContext(file); + DefinitionContextPtr dc = ut->findDefinitionContext(file); assert(dc); q = dc->findMetaData(prefix); } @@ -2777,7 +2777,7 @@ Slice::JavaCompatGenerator::writeSequenceMarshalUnmarshalCode(Output& out, out << nl << "else"; out << sb; out << nl << stream << ".writeSize(" << v << ".size());"; - string typeS = typeToString(type, TypeModeIn, package); + typeS = typeToString(type, TypeModeIn, package); out << nl << "for(" << typeS << " elem : " << v << ')'; out << sb; writeMarshalUnmarshalCode(out, package, type, OptionalNone, false, 0, "elem", true, iter, false, customStream); @@ -3451,11 +3451,11 @@ Slice::JavaGenerator::getPackagePrefix(const ContainedPtr& cont) const string q; if(!m->findMetaData(prefix, q)) { - UnitPtr unit = cont->unit(); + UnitPtr ut = cont->unit(); string file = cont->file(); assert(!file.empty()); - DefinitionContextPtr dc = unit->findDefinitionContext(file); + DefinitionContextPtr dc = ut->findDefinitionContext(file); assert(dc); q = dc->findMetaData(prefix); } @@ -4265,10 +4265,10 @@ Slice::JavaGenerator::writeMarshalUnmarshalCode(Output& out, string s = optionalParam && optionalMapping ? param + ".get()" : param; if(sz > 1) { - string ignore; + string ignore2; out << nl << "final int optSize = " << s << " == null ? 0 : "; - if(findMetaData("java:buffer", seq->getMetaData(), ignore) || - findMetaData("java:buffer", metaData, ignore)) + if(findMetaData("java:buffer", seq->getMetaData(), ignore2) || + findMetaData("java:buffer", metaData, ignore2)) { out << s << ".remaining() / " << sz << ";"; } @@ -4470,7 +4470,7 @@ Slice::JavaGenerator::writeDictionaryMarshalUnmarshalCode(Output& out, out << nl << "final " << keyS << " key;"; writeMarshalUnmarshalCode(out, package, key, OptionalNone, false, 0, "key", false, iter, customStream); - string valueS = typeToObjectString(value, TypeModeIn, package); + valueS = typeToObjectString(value, TypeModeIn, package); ostringstream patchParams; patchParams << "value -> " << v << ".put(key, value), " << valueS << ".class"; writeMarshalUnmarshalCode(out, package, value, OptionalNone, false, 0, "value", false, iter, customStream, @@ -4671,7 +4671,7 @@ Slice::JavaGenerator::writeSequenceMarshalUnmarshalCode(Output& out, // Marshal/unmarshal a custom sequence type. // BuiltinPtr b = BuiltinPtr::dynamicCast(type); - string typeS = getUnqualified(seq, package); + typeS = getUnqualified(seq, package); ostringstream o; o << origContentS; int d = depth; @@ -4689,8 +4689,8 @@ Slice::JavaGenerator::writeSequenceMarshalUnmarshalCode(Output& out, out << nl << "else"; out << sb; out << nl << stream << ".writeSize(" << v << ".size());"; - string typeS = typeToString(type, TypeModeIn, package); - out << nl << "for(" << typeS << " elem : " << v << ')'; + string ctypeS = typeToString(type, TypeModeIn, package); + out << nl << "for(" << ctypeS << " elem : " << v << ')'; out << sb; writeMarshalUnmarshalCode(out, package, type, OptionalNone, false, 0, "elem", true, iter, customStream); out << eb; diff --git a/cpp/src/Slice/Parser.cpp b/cpp/src/Slice/Parser.cpp index 21faf648c1e..72c351ac9f8 100644 --- a/cpp/src/Slice/Parser.cpp +++ b/cpp/src/Slice/Parser.cpp @@ -26,6 +26,8 @@ using namespace Slice; extern FILE* slice_in; extern int slice_debug; +int slice_parse(); + // // Operation attributes // @@ -376,8 +378,8 @@ Slice::SyntaxTreeBase::SyntaxTreeBase(const UnitPtr& unit, const DefinitionConte // Type // ---------------------------------------------------------------------- -Slice::Type::Type(const UnitPtr& unit) : - SyntaxTreeBase(unit) +Slice::Type::Type(const UnitPtr& ut) : + SyntaxTreeBase(ut) { } @@ -524,9 +526,9 @@ const char* Slice::Builtin::builtinTable[] = "Value" }; -Slice::Builtin::Builtin(const UnitPtr& unit, Kind kind) : - SyntaxTreeBase(unit), - Type(unit), +Slice::Builtin::Builtin(const UnitPtr& ut, Kind kind) : + SyntaxTreeBase(ut), + Type(ut), _kind(kind) { // @@ -2072,10 +2074,10 @@ Slice::Container::enumerators(const string& scoped) const string name = scoped.substr(lastColon + 1); for(EnumList::iterator p = enums.begin(); p != enums.end(); ++p) { - ContainedList cl = (*p)->lookupContained(name, false); - if(!cl.empty()) + ContainedList cl2 = (*p)->lookupContained(name, false); + if(!cl2.empty()) { - result.push_back(EnumeratorPtr::dynamicCast(cl.front())); + result.push_back(EnumeratorPtr::dynamicCast(cl2.front())); } } } @@ -3527,7 +3529,7 @@ Slice::ClassDecl::recDependencies(set<ConstructedPtr>& dependencies) void Slice::ClassDecl::checkBasesAreLegal(const string& name, bool intf, bool local, const ClassList& bases, - const UnitPtr& unit) + const UnitPtr& ut) { // // Local definitions cannot have non-local bases, and vice versa. @@ -3540,7 +3542,7 @@ Slice::ClassDecl::checkBasesAreLegal(const string& name, bool intf, bool local, msg << (local ? "local" : "non-local") << " " << (intf ? "interface" : "class") << " `" << name << "' cannot have " << ((*p)->isLocal() ? "local" : "non-local") << " base " << ((*p)->isInterface() ? "interface" : "class") << " `" << (*p)->name() << "'"; - unit->error(msg.str()); + ut->error(msg.str()); } } @@ -3577,7 +3579,7 @@ Slice::ClassDecl::checkBasesAreLegal(const string& name, bool intf, bool local, // name (that is, if the union of the intersections of all possible pairs // of partitions is empty). // - checkPairIntersections(spl, name, unit); + checkPairIntersections(spl, name, ut); } } @@ -3679,7 +3681,7 @@ Slice::ClassDecl::toStringPartitionList(const GraphPartitionList& gpl) // in the other and, if so, complain. // void -Slice::ClassDecl::checkPairIntersections(const StringPartitionList& l, const string& name, const UnitPtr& unit) +Slice::ClassDecl::checkPairIntersections(const StringPartitionList& l, const string& name, const UnitPtr& ut) { set<string> reported; for(StringPartitionList::const_iterator i = l.begin(); i != l.end(); ++i) @@ -3696,7 +3698,7 @@ Slice::ClassDecl::checkPairIntersections(const StringPartitionList& l, const str { string msg = "ambiguous multiple inheritance: `" + name; msg += "' inherits operation `" + *s1 + "' from two or more unrelated base interfaces"; - unit->error(msg); + ut->error(msg); reported.insert(*s1); } else if(!CICompare()(*s1, *s2) && !CICompare()(*s2, *s1) && @@ -3705,7 +3707,7 @@ Slice::ClassDecl::checkPairIntersections(const StringPartitionList& l, const str string msg = "ambiguous multiple inheritance: `" + name; msg += "' inherits operations `" + *s1 + "' and `" + *s2; msg += "', which differ only in capitalization, from unrelated base interfaces"; - unit->error(msg); + ut->error(msg); reported.insert(*s1); reported.insert(*s2); } @@ -3807,8 +3809,8 @@ Slice::ClassDef::createOperation(const string& name, } string baseName = IceUtilInternal::toLower((*q)->name()); - string newName = IceUtilInternal::toLower(name); - if(baseName == newName) + string newName2 = IceUtilInternal::toLower(name); + if(baseName == newName2) { string msg = "operation `" + name + "' differs only in capitalization from " + (*q)->kindOf(); msg += " `" + (*q)->name() + "', which is defined in a base interface or class"; @@ -3903,8 +3905,8 @@ Slice::ClassDef::createDataMember(const string& name, const TypePtr& type, bool } string baseName = IceUtilInternal::toLower((*q)->name()); - string newName = IceUtilInternal::toLower(name); - if(baseName == newName) + string newName2 = IceUtilInternal::toLower(name); + if(baseName == newName2) { string msg = "data member `" + name + "' differs only in capitalization from " + (*q)->kindOf(); msg += " `" + (*q)->name() + "', which is defined in a base interface or class"; @@ -4449,8 +4451,8 @@ Slice::Exception::createDataMember(const string& name, const TypePtr& type, bool } string baseName = IceUtilInternal::toLower((*r)->name()); - string newName = IceUtilInternal::toLower(name); - if(baseName == newName) + string newName2 = IceUtilInternal::toLower(name); + if(baseName == newName2) { string msg = "exception member `" + name + "' differs only in capitalization from exception member `"; msg += (*r)->name() + "', which is defined in a base exception"; @@ -6002,7 +6004,7 @@ Slice::Operation::attributes() const // freezeMD = freezeMD.substr(1); - int i = 0; + i = 0; while(i < 4) { if(freezeMD.find(txAttribute[i]) == 0) diff --git a/cpp/src/Slice/Preprocessor.cpp b/cpp/src/Slice/Preprocessor.cpp index 397dad8eb69..3783cd7dd1a 100644 --- a/cpp/src/Slice/Preprocessor.cpp +++ b/cpp/src/Slice/Preprocessor.cpp @@ -309,7 +309,7 @@ Slice::Preprocessor::printMakefileDependencies(ostream& out, Language lang, cons bool Slice::Preprocessor::printMakefileDependencies(ostream& out, Language lang, const vector<string>& includePaths, - const vector<string>& extraArgs, const string& cppSourceExt, + const vector<string>& extraArgs, const string& /*cppSourceExt*/, const string& optValue) { if(!checkInputFile()) @@ -548,7 +548,7 @@ Slice::Preprocessor::printMakefileDependencies(ostream& out, Language lang, cons } } - string::size_type pos = 0; + pos = 0; while((pos = result.find("\\", pos + 1)) != string::npos) { result.insert(pos, 1, '\\'); @@ -590,7 +590,7 @@ Slice::Preprocessor::printMakefileDependencies(ostream& out, Language lang, cons // // Change .o[bj] suffix to the h header extension suffix. // - string::size_type pos = result.find(suffix); + pos = result.find(suffix); if(pos != string::npos) { string name = result.substr(0, pos); @@ -621,7 +621,7 @@ Slice::Preprocessor::printMakefileDependencies(ostream& out, Language lang, cons // // Find end of next file. // - string::size_type pos = 0; + pos = 0; while((pos = result.find_first_of(" :\t\r\n\\", pos + 1)) != string::npos) { if(result[pos] == ':') @@ -654,7 +654,7 @@ Slice::Preprocessor::printMakefileDependencies(ostream& out, Language lang, cons // // Change .o[bj] suffix to .cs suffix. // - string::size_type pos; + pos = 0; if((pos = result.find(suffix)) != string::npos) { result.replace(pos, suffix.size() - 1, ".cs"); @@ -668,7 +668,7 @@ Slice::Preprocessor::printMakefileDependencies(ostream& out, Language lang, cons // // Change .o[bj] suffix to .js suffix. // - string::size_type pos; + pos = 0; if((pos = result.find(suffix)) != string::npos) { result.replace(pos, suffix.size() - 1, ".js"); @@ -684,7 +684,7 @@ Slice::Preprocessor::printMakefileDependencies(ostream& out, Language lang, cons { result = pyPrefix + result; } - string::size_type pos; + pos = 0; if((pos = result.find(suffix)) != string::npos) { result.replace(pos, suffix.size() - 1, "_ice.py"); @@ -696,7 +696,7 @@ Slice::Preprocessor::printMakefileDependencies(ostream& out, Language lang, cons // // Change .o[bj] suffix to .rb suffix. // - string::size_type pos; + pos = 0; if((pos = result.find(suffix)) != string::npos) { result.replace(pos, suffix.size() - 1, ".rb"); @@ -708,7 +708,7 @@ Slice::Preprocessor::printMakefileDependencies(ostream& out, Language lang, cons // // Change .o[bj] suffix to .php suffix. // - string::size_type pos; + pos = 0; if((pos = result.find(suffix)) != string::npos) { result.replace(pos, suffix.size() - 1, ".php"); @@ -717,7 +717,7 @@ Slice::Preprocessor::printMakefileDependencies(ostream& out, Language lang, cons } case ObjC: { - string::size_type pos = result.find(suffix); + pos = result.find(suffix); if(pos != string::npos) { string name = result.substr(0, pos); diff --git a/cpp/src/Slice/Python.cpp b/cpp/src/Slice/Python.cpp index adc4a3ba3f1..b84de7c0ec1 100644 --- a/cpp/src/Slice/Python.cpp +++ b/cpp/src/Slice/Python.cpp @@ -148,21 +148,21 @@ createPackageDirectory(const string& output, const string& pkgdir) // PackageVisitor. We need every intermediate subdirectory to have an __init__.py file, which // can be empty. // - const string init = path + "/__init__.py"; - if(!IceUtilInternal::fileExists(init)) + const string initFile = path + "/__init__.py"; + if(!IceUtilInternal::fileExists(initFile)) { // // Create an empty file. // IceUtilInternal::Output out; - out.open(init.c_str()); + out.open(initFile.c_str()); if(!out) { ostringstream os; - os << "cannot open '" << init << "': " << IceUtilInternal::errorToString(errno); + os << "cannot open '" << initFile << "': " << IceUtilInternal::errorToString(errno); throw FileException(__FILE__, __LINE__, os.str()); } - FileTracker::instance()->addFile(init); + FileTracker::instance()->addFile(initFile); } } } @@ -233,16 +233,16 @@ PackageVisitor::createModules(const UnitPtr& unit, const string& module, const s for(StringList::iterator p = modules.begin(); p != modules.end(); ++p) { - vector<string> v; - if(!IceUtilInternal::splitString(*p, ".", v)) + vector<string> vs; + if(!IceUtilInternal::splitString(*p, ".", vs)) { assert(false); } string currentModule; string path = dir.empty() ? "." : dir; - for(vector<string>::iterator q = v.begin(); q != v.end(); ++q) + for(vector<string>::iterator q = vs.begin(); q != vs.end(); ++q) { - if(q != v.begin()) + if(q != vs.begin()) { addSubmodule(path, currentModule, *q); currentModule += "."; @@ -413,9 +413,9 @@ PackageVisitor::writeInit(const string& dir, const string& name, const StringLis ofstream os(IceUtilInternal::streamFilename(initPath).c_str()); if(!os) { - ostringstream os; - os << "cannot open file '" << initPath << "': " << IceUtilInternal::errorToString(errno); - throw FileException(__FILE__, __LINE__, os.str()); + ostringstream oss; + oss << "cannot open file '" << initPath << "': " << IceUtilInternal::errorToString(errno); + throw FileException(__FILE__, __LINE__, oss.str()); } FileTracker::instance()->addFile(initPath); @@ -749,9 +749,9 @@ Slice::Python::compile(const vector<string>& argv) out.open(path.c_str()); if(!out) { - ostringstream os; - os << "cannot open '" << path << "': " << IceUtilInternal::errorToString(errno); - throw FileException(__FILE__, __LINE__, os.str()); + ostringstream oss; + oss << "cannot open '" << path << "': " << IceUtilInternal::errorToString(errno); + throw FileException(__FILE__, __LINE__, oss.str()); } FileTracker::instance()->addFile(path); diff --git a/cpp/src/Slice/PythonUtil.cpp b/cpp/src/Slice/PythonUtil.cpp index e14565a6c4a..c4b3f48726b 100644 --- a/cpp/src/Slice/PythonUtil.cpp +++ b/cpp/src/Slice/PythonUtil.cpp @@ -2307,12 +2307,12 @@ Slice::Python::CodeVisitor::stripMarkup(const string& comment) string::size_type start = 0; while(start != string::npos) { - string::size_type nl = text.find_first_of("\r\n", start); + string::size_type newline = text.find_first_of("\r\n", start); string line; - if(nl != string::npos) + if(newline != string::npos) { - line = text.substr(start, nl - start); - start = nl; + line = text.substr(start, newline - start); + start = newline; } else { @@ -2849,7 +2849,7 @@ Slice::Python::CodeVisitor::writeDocstring(const OperationPtr& op, DocstringMode } string -Slice::Python::getPackageDirectory(const string& file, const UnitPtr& unit) +Slice::Python::getPackageDirectory(const string& file, const UnitPtr& ut) { // // file must be a fully-qualified path name. @@ -2858,7 +2858,7 @@ Slice::Python::getPackageDirectory(const string& file, const UnitPtr& unit) // // Check if the file contains the python:pkgdir global metadata. // - DefinitionContextPtr dc = unit->findDefinitionContext(file); + DefinitionContextPtr dc = ut->findDefinitionContext(file); assert(dc); const string prefix = "python:pkgdir:"; string pkgdir = dc->findMetaData(prefix); @@ -2874,7 +2874,7 @@ Slice::Python::getPackageDirectory(const string& file, const UnitPtr& unit) } string -Slice::Python::getImportFileName(const string& file, const UnitPtr& unit, const vector<string>& includePaths) +Slice::Python::getImportFileName(const string& file, const UnitPtr& ut, const vector<string>& includePaths) { // // The file and includePaths arguments must be fully-qualified path names. @@ -2883,7 +2883,7 @@ Slice::Python::getImportFileName(const string& file, const UnitPtr& unit, const // // Check if the file contains the python:pkgdir global metadata. // - string pkgdir = getPackageDirectory(file, unit); + string pkgdir = getPackageDirectory(file, ut); if(!pkgdir.empty()) { // @@ -3046,11 +3046,11 @@ Slice::Python::getPackageMetadata(const ContainedPtr& cont) string q; if(!m->findMetaData(prefix, q)) { - UnitPtr unit = cont->unit(); + UnitPtr ut = cont->unit(); string file = cont->file(); assert(!file.empty()); - DefinitionContextPtr dc = unit->findDefinitionContext(file); + DefinitionContextPtr dc = ut->findDefinitionContext(file); assert(dc); q = dc->findMetaData(prefix); } @@ -3232,8 +3232,8 @@ Slice::Python::MetaDataVisitor::visitSequence(const SequencePtr& p) const string file = p->file(); const string line = p->line(); StringList protobufMetaData; - const UnitPtr unit = p->unit(); - const DefinitionContextPtr dc = unit->findDefinitionContext(file); + const UnitPtr ut = p->unit(); + const DefinitionContextPtr dc = ut->findDefinitionContext(file); assert(dc); for(StringList::const_iterator q = metaData.begin(); q != metaData.end(); ) @@ -3285,8 +3285,8 @@ StringList Slice::Python::MetaDataVisitor::validateSequence(const string& file, const string& line, const TypePtr& type, const StringList& metaData) { - const UnitPtr unit = type->unit(); - const DefinitionContextPtr dc = unit->findDefinitionContext(file); + const UnitPtr ut = type->unit(); + const DefinitionContextPtr dc = ut->findDefinitionContext(file); assert(dc); static const string prefix = "python:"; @@ -3322,8 +3322,8 @@ Slice::Python::MetaDataVisitor::reject(const ContainedPtr& cont) StringList localMetaData = cont->getMetaData(); static const string prefix = "python:"; - const UnitPtr unit = cont->unit(); - const DefinitionContextPtr dc = unit->findDefinitionContext(cont->file()); + const UnitPtr ut = cont->unit(); + const DefinitionContextPtr dc = ut->findDefinitionContext(cont->file()); assert(dc); for(StringList::const_iterator p = localMetaData.begin(); p != localMetaData.end();) diff --git a/cpp/src/Slice/Ruby.cpp b/cpp/src/Slice/Ruby.cpp index 8b61d7947b0..40e6d2f3de5 100644 --- a/cpp/src/Slice/Ruby.cpp +++ b/cpp/src/Slice/Ruby.cpp @@ -296,9 +296,9 @@ Slice::Ruby::compile(const vector<string>& argv) out.open(file.c_str()); if(!out) { - ostringstream os; - os << "cannot open`" << file << "': " << IceUtilInternal::errorToString(errno); - throw FileException(__FILE__, __LINE__, os.str()); + ostringstream oss; + oss << "cannot open`" << file << "': " << IceUtilInternal::errorToString(errno); + throw FileException(__FILE__, __LINE__, oss.str()); } FileTracker::instance()->addFile(file); // diff --git a/cpp/src/Slice/RubyUtil.cpp b/cpp/src/Slice/RubyUtil.cpp index b9a2ddbc3ce..b8d1ce043d3 100644 --- a/cpp/src/Slice/RubyUtil.cpp +++ b/cpp/src/Slice/RubyUtil.cpp @@ -340,7 +340,6 @@ Slice::Ruby::CodeVisitor::visitClassDefStart(const ClassDefPtr& p) // // read/write accessors for data members. // - DataMemberList members = p->dataMembers(); if(!members.empty()) { bool prot = p->hasMetaData("protected"); diff --git a/cpp/src/Slice/Scanner.cpp b/cpp/src/Slice/Scanner.cpp index 2c043293cf1..2e2ab307d64 100644 --- a/cpp/src/Slice/Scanner.cpp +++ b/cpp/src/Slice/Scanner.cpp @@ -1249,7 +1249,7 @@ YY_RULE_SETUP case 'U': { string escape = ""; - char c = next; + c = next; int size = (c == 'u') ? 4 : 8; while(size > 0) { diff --git a/cpp/src/Slice/Scanner.l b/cpp/src/Slice/Scanner.l index d7505a2eca3..04c62b7c089 100644 --- a/cpp/src/Slice/Scanner.l +++ b/cpp/src/Slice/Scanner.l @@ -394,7 +394,7 @@ floating_literal (({fractional_constant}{exponent_part}?)|((\+|-)?[[:digit:]] case 'U': { string escape = ""; - char c = next; + c = next; int size = (c == 'u') ? 4 : 8; while(size > 0) { diff --git a/cpp/src/slice2confluence/ConfluenceOutput.cpp b/cpp/src/slice2confluence/ConfluenceOutput.cpp index f095ca9166d..ecee4fa5419 100644 --- a/cpp/src/slice2confluence/ConfluenceOutput.cpp +++ b/cpp/src/slice2confluence/ConfluenceOutput.cpp @@ -13,6 +13,15 @@ #include <sstream> #include <algorithm> +#if defined(__clang__) +# pragma clang diagnostic ignored "-Wshadow" +# pragma clang diagnostic ignored "-Wshadow-field" +# pragma clang diagnostic ignored "-Wunused-parameter" +#elif defined(__GNUC__) +# pragma GCC diagnostic ignored "-Wshadow" +# pragma GCC diagnostic ignored "-Wunused-parameter" +#endif + using namespace std; using namespace IceUtilInternal; diff --git a/cpp/src/slice2confluence/Gen.cpp b/cpp/src/slice2confluence/Gen.cpp index 16629ab5aa5..3eff17700c0 100644 --- a/cpp/src/slice2confluence/Gen.cpp +++ b/cpp/src/slice2confluence/Gen.cpp @@ -27,6 +27,15 @@ #include <string> +#if defined(__clang__) +# pragma clang diagnostic ignored "-Wshadow" +# pragma clang diagnostic ignored "-Wshadow-field" +# pragma clang diagnostic ignored "-Wunused-parameter" +#elif defined(__GNUC__) +# pragma GCC diagnostic ignored "-Wshadow" +# pragma GCC diagnostic ignored "-Wunused-parameter" +#endif + using namespace std; using namespace Slice; using namespace IceUtil; diff --git a/cpp/src/slice2confluence/Gen.h b/cpp/src/slice2confluence/Gen.h index e6558ec3984..abc59399e06 100644 --- a/cpp/src/slice2confluence/Gen.h +++ b/cpp/src/slice2confluence/Gen.h @@ -16,6 +16,11 @@ #include <iterator> +#if defined(__clang__) +// TODO: fix these warnings! +# pragma clang diagnostic ignored "-Wshadow-field" +#endif + namespace Slice { diff --git a/cpp/src/slice2confluence/Main.cpp b/cpp/src/slice2confluence/Main.cpp index 0e6b6c21e56..2d30cada84d 100644 --- a/cpp/src/slice2confluence/Main.cpp +++ b/cpp/src/slice2confluence/Main.cpp @@ -71,7 +71,7 @@ splitCommas(string& str) } void -interruptedCallback(int signal) +interruptedCallback(int) { IceUtilInternal::MutexPtrLock<IceUtil::Mutex> sync(globalMutex); diff --git a/cpp/src/slice2cpp/Gen.cpp b/cpp/src/slice2cpp/Gen.cpp index cf68c8cc12a..bd0a3b15b29 100644 --- a/cpp/src/slice2cpp/Gen.cpp +++ b/cpp/src/slice2cpp/Gen.cpp @@ -981,20 +981,20 @@ Slice::Gen::generate(const UnitPtr& p) StringList globalMetaData = dc->getMetaData(); for(StringList::const_iterator q = globalMetaData.begin(); q != globalMetaData.end();) { - string s = *q++; + string md = *q++; static const string includePrefix = "cpp:include:"; - if(s.find(includePrefix) == 0) + if(md.find(includePrefix) == 0) { - if(s.size() > includePrefix.size()) + if(md.size() > includePrefix.size()) { - H << nl << "#include <" << s.substr(includePrefix.size()) << ">"; + H << nl << "#include <" << md.substr(includePrefix.size()) << ">"; } else { ostringstream ostr; - ostr << "ignoring invalid global metadata `" << s << "'"; + ostr << "ignoring invalid global metadata `" << md << "'"; dc->warning(InvalidMetaData, file, -1, ostr.str()); - globalMetaData.remove(s); + globalMetaData.remove(md); } } } @@ -1793,7 +1793,6 @@ Slice::Gen::TypesVisitor::visitStructEnd(const StructPtr& p) DataMemberList dataMembers = p->dataMembers(); vector<string> params; - vector<string>::const_iterator pi; for(DataMemberList::const_iterator q = dataMembers.begin(); q != dataMembers.end(); ++q) { @@ -2651,7 +2650,6 @@ Slice::Gen::ProxyVisitor::visitOperation(const OperationPtr& p) #endif for(ExceptionList::const_iterator i = throws.begin(); i != throws.end(); ++i) { - string scoped = (*i)->scoped(); C << nl << "catch(const " << fixKwd((*i)->scoped()) << "&)"; C << sb; C << nl << "throw;"; @@ -2714,7 +2712,6 @@ Slice::Gen::ProxyVisitor::visitOperation(const OperationPtr& p) #endif for(ExceptionList::const_iterator i = throws.begin(); i != throws.end(); ++i) { - string scoped = (*i)->scoped(); C << nl << "catch(const " << fixKwd((*i)->scoped()) << "&)"; C << sb; C << nl << "throw;"; @@ -3814,7 +3811,6 @@ Slice::Gen::ObjectVisitor::visitOperation(const OperationPtr& p) vector<string> paramsDeclAMI; vector<string> outParamsDeclAMI; - ParamDeclList paramList = p->parameters(); for(ParamDeclList::const_iterator r = paramList.begin(); r != paramList.end(); ++r) { string paramName = fixKwd((*r)->name()); @@ -4841,8 +4837,6 @@ Slice::Gen::ImplVisitor::visitClassDefStart(const ClassDefPtr& p) } H.restoreIndent(); - string isConst = ((op->mode() == Operation::Nonmutating) || op->hasMetaData("cpp:const")) ? " const" : ""; - H << ")" << isConst << ';'; C << sp << nl << retS << nl; @@ -5500,8 +5494,8 @@ Slice::Gen::MetaDataVisitor::visitOperation(const OperationPtr& p) StringList metaData = p->getMetaData(); - const UnitPtr unit = p->unit(); - const DefinitionContextPtr dc = unit->findDefinitionContext(p->file()); + const UnitPtr ut = p->unit(); + const DefinitionContextPtr dc = ut->findDefinitionContext(p->file()); assert(dc); if(!cl->isLocal() && p->hasMetaData("cpp:noexcept")) { @@ -5582,8 +5576,8 @@ Slice::Gen::MetaDataVisitor::validate(const SyntaxTreeBasePtr& cont, const Strin static const string cpp11Prefix = "cpp11:"; static const string cpp98Prefix = "cpp98:"; - const UnitPtr unit = cont->unit(); - const DefinitionContextPtr dc = unit->findDefinitionContext(file); + const UnitPtr ut = cont->unit(); + const DefinitionContextPtr dc = ut->findDefinitionContext(file); assert(dc); StringList newMetaData = metaData; for(StringList::const_iterator p = newMetaData.begin(); p != newMetaData.end();) @@ -5716,7 +5710,7 @@ Slice::Gen::NormalizeMetaDataVisitor::NormalizeMetaDataVisitor(bool cpp11) : } bool -Slice::Gen::NormalizeMetaDataVisitor::visitUnitStart(const UnitPtr& p) +Slice::Gen::NormalizeMetaDataVisitor::visitUnitStart(const UnitPtr&) { return true; } @@ -5970,11 +5964,11 @@ Slice::Gen::resetUseWstring(list<int>& hist) } string -Slice::Gen::getHeaderExt(const string& file, const UnitPtr& unit) +Slice::Gen::getHeaderExt(const string& file, const UnitPtr& ut) { string ext; static const string headerExtPrefix = "cpp:header-ext:"; - DefinitionContextPtr dc = unit->findDefinitionContext(file); + DefinitionContextPtr dc = ut->findDefinitionContext(file); assert(dc); string meta = dc->findMetaData(headerExtPrefix); if(meta.size() > headerExtPrefix.size()) @@ -5985,11 +5979,11 @@ Slice::Gen::getHeaderExt(const string& file, const UnitPtr& unit) } string -Slice::Gen::getSourceExt(const string& file, const UnitPtr& unit) +Slice::Gen::getSourceExt(const string& file, const UnitPtr& ut) { string ext; static const string sourceExtPrefix = "cpp:source-ext:"; - DefinitionContextPtr dc = unit->findDefinitionContext(file); + DefinitionContextPtr dc = ut->findDefinitionContext(file); assert(dc); string meta = dc->findMetaData(sourceExtPrefix); if(meta.size() > sourceExtPrefix.size()) @@ -6017,7 +6011,7 @@ Slice::Gen::Cpp11DeclVisitor::visitUnitStart(const UnitPtr& p) } void -Slice::Gen::Cpp11DeclVisitor::visitUnitEnd(const UnitPtr& p) +Slice::Gen::Cpp11DeclVisitor::visitUnitEnd(const UnitPtr&) { C << sp << nl << "}"; } @@ -6679,7 +6673,7 @@ Slice::Gen::Cpp11ProxyVisitor::Cpp11ProxyVisitor(Output& h, Output& c, const str } bool -Slice::Gen::Cpp11ProxyVisitor::visitUnitStart(const UnitPtr& p) +Slice::Gen::Cpp11ProxyVisitor::visitUnitStart(const UnitPtr&) { return true; } diff --git a/cpp/src/slice2cs/CsUtil.cpp b/cpp/src/slice2cs/CsUtil.cpp index 8a50432423d..cd3d5239b7c 100644 --- a/cpp/src/slice2cs/CsUtil.cpp +++ b/cpp/src/slice2cs/CsUtil.cpp @@ -135,9 +135,9 @@ Slice::CsGenerator::getNamespacePrefix(const ContainedPtr& cont) } string -Slice::CsGenerator::getCustomTypeIdNamespace(const UnitPtr& unit) +Slice::CsGenerator::getCustomTypeIdNamespace(const UnitPtr& ut) { - DefinitionContextPtr dc = unit->findDefinitionContext(unit->topLevelFile()); + DefinitionContextPtr dc = ut->findDefinitionContext(ut->topLevelFile()); assert(dc); static const string typeIdNsPrefix = "cs:typeid-namespace:"; @@ -480,23 +480,23 @@ Slice::CsGenerator::typeToString(const TypePtr& type, const string& package, boo string meta; if(seq->findMetaData(prefix, meta)) { - string type = meta.substr(prefix.size()); - if(type == "List" || type == "LinkedList" || type == "Queue" || type == "Stack") + string customType = meta.substr(prefix.size()); + if(customType == "List" || customType == "LinkedList" || customType == "Queue" || customType == "Stack") { - return "global::System.Collections.Generic." + type + "<" + + return "global::System.Collections.Generic." + customType + "<" + typeToString(seq->type(), package, optional, local) + ">"; } else { - return "global::" + type + "<" + typeToString(seq->type(), package, optional, local) + ">"; + return "global::" + customType + "<" + typeToString(seq->type(), package, optional, local) + ">"; } } prefix = "cs:serializable:"; if(seq->findMetaData(prefix, meta)) { - string type = meta.substr(prefix.size()); - return "global::" + type; + string customType = meta.substr(prefix.size()); + return "global::" + customType; } return typeToString(seq->type(), package, optional, local) + "[]"; @@ -561,7 +561,6 @@ Slice::CsGenerator::resultType(const OperationPtr& op, const string& package, bo } else if(op->returnType() || outParams.size() > 1) { - ClassDefPtr cl = ClassDefPtr::dynamicCast(op->container()); t = getUnqualified(cl, package, "", resultStructName("", op->name())); } else @@ -2185,7 +2184,7 @@ Slice::CsGenerator::writeSerializeDeserializeCode(Output &out, const string& scope, const string& param, bool optional, - int tag, + int /*tag*/, bool serialize) { // @@ -2617,8 +2616,8 @@ Slice::CsGenerator::MetaDataVisitor::validate(const ContainedPtr& cont) StringList localMetaData = cont->getMetaData(); StringList newLocalMetaData; - const UnitPtr unit = cont->unit(); - const DefinitionContextPtr dc = unit->findDefinitionContext(cont->file()); + const UnitPtr ut = cont->unit(); + const DefinitionContextPtr dc = ut->findDefinitionContext(cont->file()); assert(dc); for(StringList::iterator p = localMetaData.begin(); p != localMetaData.end(); ++p) diff --git a/cpp/src/slice2cs/Gen.cpp b/cpp/src/slice2cs/Gen.cpp index ed7f4eea4f7..9ad2e55561d 100644 --- a/cpp/src/slice2cs/Gen.cpp +++ b/cpp/src/slice2cs/Gen.cpp @@ -1835,7 +1835,7 @@ Slice::CsVisitor::writeDocCommentAMD(const OperationPtr& p, const string& extraP } void -Slice::CsVisitor::writeDocCommentParam(const OperationPtr& p, ParamDir paramType, bool amd) +Slice::CsVisitor::writeDocCommentParam(const OperationPtr& p, ParamDir paramType, bool /*amd*/) { // // Collect the names of the in- or -out parameters to be documented. @@ -2195,7 +2195,7 @@ Slice::Gen::CompactIdVisitor::visitUnitStart(const UnitPtr& p) } void -Slice::Gen::CompactIdVisitor::visitUnitEnd(const UnitPtr& p) +Slice::Gen::CompactIdVisitor::visitUnitEnd(const UnitPtr&) { _out << eb; } @@ -2676,7 +2676,7 @@ Slice::Gen::TypesVisitor::visitOperation(const OperationPtr& p) } void -Slice::Gen::TypesVisitor::visitSequence(const SequencePtr& p) +Slice::Gen::TypesVisitor::visitSequence(const SequencePtr&) { // // No need to generate anything for sequences. @@ -2810,8 +2810,8 @@ Slice::Gen::TypesVisitor::visitExceptionEnd(const ExceptionPtr& p) _out << sb; for(DataMemberList::const_iterator q = dataMembers.begin(); q != dataMembers.end(); ++q) { - string name = fixId((*q)->name(), DotNet::Exception, false); - writeSerializeDeserializeCode(_out, (*q)->type(), ns, name, (*q)->optional(), (*q)->tag(), false); + string memberName = fixId((*q)->name(), DotNet::Exception, false); + writeSerializeDeserializeCode(_out, (*q)->type(), ns, memberName, (*q)->optional(), (*q)->tag(), false); } _out << eb; @@ -2825,8 +2825,8 @@ Slice::Gen::TypesVisitor::visitExceptionEnd(const ExceptionPtr& p) _out << sb; for(DataMemberList::const_iterator q = dataMembers.begin(); q != dataMembers.end(); ++q) { - string name = fixId((*q)->name(), DotNet::Exception, false); - _out << nl << "this." << name << " = " << fixId((*q)->name()) << ';'; + string memberName = fixId((*q)->name(), DotNet::Exception, false); + _out << nl << "this." << memberName << " = " << fixId((*q)->name()) << ';'; } _out << eb; } @@ -2931,8 +2931,8 @@ Slice::Gen::TypesVisitor::visitExceptionEnd(const ExceptionPtr& p) _out << sb; for(DataMemberList::const_iterator q = dataMembers.begin(); q != dataMembers.end(); ++q) { - string name = fixId((*q)->name(), DotNet::Exception, false); - writeSerializeDeserializeCode(_out, (*q)->type(), ns, name, (*q)->optional(), (*q)->tag(), true); + string memberName = fixId((*q)->name(), DotNet::Exception, false); + writeSerializeDeserializeCode(_out, (*q)->type(), ns, memberName, (*q)->optional(), (*q)->tag(), true); } _out << sp << nl << "base.GetObjectData(info, context);"; _out << eb; @@ -3314,7 +3314,7 @@ Slice::Gen::TypesVisitor::visitStructEnd(const StructPtr& p) } void -Slice::Gen::TypesVisitor::visitDictionary(const DictionaryPtr& p) +Slice::Gen::TypesVisitor::visitDictionary(const DictionaryPtr&) { } @@ -4122,7 +4122,7 @@ Slice::Gen::OpsVisitor::visitClassDefStart(const ClassDefPtr& p) bool amd = !p->isLocal() && (p->hasMetaData("amd") || op->hasMetaData("amd")); string retS; vector<string> params, args; - string name = getDispatchParams(op, retS, params, args, ns); + string opName = getDispatchParams(op, retS, params, args, ns); _out << sp; if(amd) { @@ -4137,7 +4137,7 @@ Slice::Gen::OpsVisitor::visitClassDefStart(const ClassDefPtr& p) emitAttributes(op); emitDeprecate(op, op, _out, "operation"); emitGeneratedCodeAttribute(); - _out << nl << retS << " " << name << spar << params << epar << ";"; + _out << nl << retS << " " << opName << spar << params << epar << ";"; } _out << eb; @@ -5053,10 +5053,10 @@ Slice::Gen::HelperVisitor::visitDictionary(const DictionaryPtr& p) else { _out << nl << valueS << " v;"; - StructPtr st = StructPtr::dynamicCast(value); - if(st) + StructPtr stv = StructPtr::dynamicCast(value); + if(stv) { - if(isValueType(st)) + if(isValueType(stv)) { _out << nl << "v = new " << typeToString(value, ns) << "();"; } @@ -5160,8 +5160,8 @@ Slice::Gen::DispatcherVisitor::visitClassDefStart(const ClassDefPtr& p) { string retS; vector<string> params, args; - string name = getDispatchParams(*i, retS, params, args, ns); - _out << sp << nl << "public abstract " << retS << " " << name << spar << params << epar << ';'; + string opName = getDispatchParams(*i, retS, params, args, ns); + _out << sp << nl << "public abstract " << retS << " " << opName << spar << params << epar << ';'; } if(!ops.empty()) @@ -5275,11 +5275,11 @@ Slice::Gen::DispatcherVisitor::writeTieOperations(const ClassDefPtr& p, NameSet* if(!opNames) { - NameSet opNames; + NameSet opNamesTmp; ClassList bases = p->bases(); for(ClassList::const_iterator i = bases.begin(); i != bases.end(); ++i) { - writeTieOperations(*i, &opNames); + writeTieOperations(*i, &opNamesTmp); } } else @@ -5330,7 +5330,6 @@ Slice::Gen::BaseImplVisitor::writeOperation(const OperationPtr& op, bool comment if(!cl->isLocal() && (cl->hasMetaData("amd") || op->hasMetaData("amd"))) { - ParamDeclList::const_iterator i; vector<string> pDecl = getInParams(op, ns); string resultType = CsGenerator::resultType(op, ns, true); diff --git a/cpp/src/slice2cs/Main.cpp b/cpp/src/slice2cs/Main.cpp index fc965cc529b..cd07739a508 100644 --- a/cpp/src/slice2cs/Main.cpp +++ b/cpp/src/slice2cs/Main.cpp @@ -230,8 +230,8 @@ compile(const vector<string>& argv) // // Ignore duplicates. // - vector<string>::iterator p = find(args.begin(), args.end(), *i); - if(p != i) + vector<string>::iterator j = find(args.begin(), args.end(), *i); + if(j != i) { continue; } diff --git a/cpp/src/slice2html/Gen.cpp b/cpp/src/slice2html/Gen.cpp index 3a4f1e54314..6e1440dd9c5 100644 --- a/cpp/src/slice2html/Gen.cpp +++ b/cpp/src/slice2html/Gen.cpp @@ -25,6 +25,15 @@ #include <iterator> #include <string.h> +#if defined(__clang__) +# pragma clang diagnostic ignored "-Wshadow" +# pragma clang diagnostic ignored "-Wshadow-field" +# pragma clang diagnostic ignored "-Wunused-parameter" +#elif defined(__GNUC__) +# pragma GCC diagnostic ignored "-Wshadow" +# pragma GCC diagnostic ignored "-Wunused-parameter" +#endif + using namespace std; using namespace Slice; using namespace IceUtil; diff --git a/cpp/src/slice2html/Gen.h b/cpp/src/slice2html/Gen.h index c4f9d922ae1..7cc3faa3dd1 100644 --- a/cpp/src/slice2html/Gen.h +++ b/cpp/src/slice2html/Gen.h @@ -13,6 +13,11 @@ #include <Slice/Parser.h> #include <IceUtil/OutputUtil.h> +#if defined(__clang__) +// TODO: fix these warnings! +# pragma clang diagnostic ignored "-Wshadow-field" +#endif + namespace Slice { diff --git a/cpp/src/slice2java/Gen.cpp b/cpp/src/slice2java/Gen.cpp index 2db53d50907..e937de14f11 100644 --- a/cpp/src/slice2java/Gen.cpp +++ b/cpp/src/slice2java/Gen.cpp @@ -18,6 +18,13 @@ #include <limits> +// TODO: fix this warning! +#if defined(__clang__) +# pragma clang diagnostic ignored "-Wshadow" +#elif defined(__GNUC__) +# pragma GCC diagnostic ignored "-Wshadow" +#endif + using namespace std; using namespace Slice; using namespace IceUtil; diff --git a/cpp/src/slice2java/GenCompat.cpp b/cpp/src/slice2java/GenCompat.cpp index 2e50562471f..8c69fdd574f 100644 --- a/cpp/src/slice2java/GenCompat.cpp +++ b/cpp/src/slice2java/GenCompat.cpp @@ -18,6 +18,13 @@ #include <limits> +// TODO: fix this warning! +#if defined(__clang__) +# pragma clang diagnostic ignored "-Wshadow" +#elif defined(__GNUC__) +# pragma GCC diagnostic ignored "-Wshadow" +#endif + using namespace std; using namespace Slice; using namespace IceUtil; @@ -596,7 +603,7 @@ Slice::JavaCompatVisitor::getParamsAsyncLambda(const OperationPtr& op, const str } vector<string> -Slice::JavaCompatVisitor::getArgsAsyncLambda(const OperationPtr& op, const string& package, bool context, bool sentCB) +Slice::JavaCompatVisitor::getArgsAsyncLambda(const OperationPtr& op, const string& /*package*/, bool context, bool sentCB) { vector<string> args = getInOutArgs(op, InParam); diff --git a/cpp/src/slice2java/Main.cpp b/cpp/src/slice2java/Main.cpp index 207b24d1e35..82aa7646157 100644 --- a/cpp/src/slice2java/Main.cpp +++ b/cpp/src/slice2java/Main.cpp @@ -23,6 +23,13 @@ using namespace std; using namespace Slice; using namespace IceUtilInternal; +// TODO: fix this warning! +#if defined(__clang__) +# pragma clang diagnostic ignored "-Wshadow" +#elif defined(__GNUC__) +# pragma GCC diagnostic ignored "-Wshadow" +#endif + namespace { diff --git a/cpp/src/slice2js/Gen.cpp b/cpp/src/slice2js/Gen.cpp index 10b571b6d83..58c6ee1e51b 100644 --- a/cpp/src/slice2js/Gen.cpp +++ b/cpp/src/slice2js/Gen.cpp @@ -17,6 +17,13 @@ #include <Slice/FileTracker.h> #include <Slice/Util.h> +// TODO: fix this warning! +#if defined(__clang__) +# pragma clang diagnostic ignored "-Wshadow" +#elif defined(__GNUC__) +# pragma GCC diagnostic ignored "-Wshadow" +#endif + using namespace std; using namespace Slice; using namespace IceUtil; @@ -419,7 +426,7 @@ Slice::JsVisitor::writeInitDataMembers(const DataMemberList& dataMembers) } string -Slice::JsVisitor::getValue(const string& scope, const TypePtr& type) +Slice::JsVisitor::getValue(const string& /*scope*/, const TypePtr& type) { assert(type); @@ -479,7 +486,7 @@ Slice::JsVisitor::getValue(const string& scope, const TypePtr& type) } string -Slice::JsVisitor::writeConstantValue(const string& scope, const TypePtr& type, const SyntaxTreeBasePtr& valueType, +Slice::JsVisitor::writeConstantValue(const string& /*scope*/, const TypePtr& type, const SyntaxTreeBasePtr& valueType, const string& value) { ostringstream os; @@ -642,7 +649,7 @@ Slice::Gen::Gen(const string& base, const vector<string>& includePaths, const st printGeneratedHeader(_out, _fileBase + ".ice"); } -Slice::Gen::Gen(const string& base, const vector<string>& includePaths, const string& dir, bool typeScript, +Slice::Gen::Gen(const string& base, const vector<string>& includePaths, const string& /*dir*/, bool typeScript, ostream& out) : _out(out), _includePaths(includePaths), @@ -815,14 +822,14 @@ Slice::Gen::RequireVisitor::visitClassDefStart(const ClassDefPtr& p) } bool -Slice::Gen::RequireVisitor::visitStructStart(const StructPtr& p) +Slice::Gen::RequireVisitor::visitStructStart(const StructPtr&) { _seenStruct = true; // Set regardless of whether p->isLocal() return false; } void -Slice::Gen::RequireVisitor::visitOperation(const OperationPtr& p) +Slice::Gen::RequireVisitor::visitOperation(const OperationPtr&) { _seenOperation = true; } @@ -879,7 +886,7 @@ Slice::Gen::RequireVisitor::visitDictionary(const DictionaryPtr& dict) } void -Slice::Gen::RequireVisitor::visitEnum(const EnumPtr& p) +Slice::Gen::RequireVisitor::visitEnum(const EnumPtr&) { _seenEnum = true; } @@ -1156,7 +1163,7 @@ Slice::Gen::TypesVisitor::visitModuleStart(const ModulePtr& p) } void -Slice::Gen::TypesVisitor::visitModuleEnd(const ModulePtr& p) +Slice::Gen::TypesVisitor::visitModuleEnd(const ModulePtr&) { } @@ -2437,7 +2444,7 @@ Slice::Gen::TypeScriptAliasVisitor::addAlias(const string& type, const string& p } bool -Slice::Gen::TypeScriptAliasVisitor::visitModuleStart(const ModulePtr& p) +Slice::Gen::TypeScriptAliasVisitor::visitModuleStart(const ModulePtr&) { return true; } @@ -2539,7 +2546,7 @@ Slice::Gen::TypeScriptAliasVisitor::visitDictionary(const DictionaryPtr& dict) } void -Slice::Gen::TypeScriptAliasVisitor::writeAlias(const UnitPtr& p) +Slice::Gen::TypeScriptAliasVisitor::writeAlias(const UnitPtr&) { if(!_aliases.empty()) { diff --git a/cpp/src/slice2js/JsUtil.cpp b/cpp/src/slice2js/JsUtil.cpp index 55e47de850b..607c7bc9339 100644 --- a/cpp/src/slice2js/JsUtil.cpp +++ b/cpp/src/slice2js/JsUtil.cpp @@ -23,6 +23,13 @@ #include <unistd.h> #endif +// TODO: fix this warning! +#if defined(__clang__) +# pragma clang diagnostic ignored "-Wshadow" +#elif defined(__GNUC__) +# pragma GCC diagnostic ignored "-Wshadow" +#endif + using namespace std; using namespace Slice; using namespace IceUtil; diff --git a/cpp/src/slice2matlab/Main.cpp b/cpp/src/slice2matlab/Main.cpp index c673feb482b..c1af189ccd0 100644 --- a/cpp/src/slice2matlab/Main.cpp +++ b/cpp/src/slice2matlab/Main.cpp @@ -38,6 +38,13 @@ using namespace std; using namespace Slice; using namespace IceUtilInternal; +// TODO: fix this warning! +#if defined(__clang__) +# pragma clang diagnostic ignored "-Wshadow" +#elif defined(__GNUC__) +# pragma GCC diagnostic ignored "-Wshadow" +#endif + namespace { diff --git a/cpp/src/slice2objc/Gen.cpp b/cpp/src/slice2objc/Gen.cpp index 108d4c8da1a..d753073e370 100644 --- a/cpp/src/slice2objc/Gen.cpp +++ b/cpp/src/slice2objc/Gen.cpp @@ -28,6 +28,13 @@ using namespace std; using namespace Slice; using namespace IceUtilInternal; +// TODO: fix this warning! +#if defined(__clang__) +# pragma clang diagnostic ignored "-Wshadow" +#elif defined(__GNUC__) +# pragma GCC diagnostic ignored "-Wshadow" +#endif + namespace { @@ -661,7 +668,7 @@ Slice::ObjCVisitor::getServerArgs(const OperationPtr& op) const return result; } -Slice::Gen::Gen(const string& name, const string& base, const string& include, const vector<string>& includePaths, +Slice::Gen::Gen(const string& /*name*/, const string& base, const string& include, const vector<string>& includePaths, const string& dir, const string& dllExport) : _base(base), _include(include), @@ -901,7 +908,7 @@ Slice::Gen::UnitVisitor::visitModuleStart(const ModulePtr& p) } void -Slice::Gen::UnitVisitor::visitUnitEnd(const UnitPtr& unit) +Slice::Gen::UnitVisitor::visitUnitEnd(const UnitPtr&) { string uuid = IceUtil::generateUUID(); for(string::size_type pos = 0; pos < uuid.size(); ++pos) @@ -1624,7 +1631,7 @@ Slice::Gen::TypesVisitor::writeConstantValue(IceUtilInternal::Output& out, const } void -Slice::Gen::TypesVisitor::writeInit(const ContainedPtr& p, const DataMemberList& dataMembers, +Slice::Gen::TypesVisitor::writeInit(const ContainedPtr&, const DataMemberList& dataMembers, const DataMemberList& baseDataMembers, const DataMemberList& allDataMembers, bool requiresMemberInit, int baseType, ContainerType ct) const { @@ -1778,7 +1785,7 @@ Slice::Gen::TypesVisitor::writeMembers(const DataMemberList& dataMembers, int ba } void -Slice::Gen::TypesVisitor::writeMemberSignature(const DataMemberList& dataMembers, int baseType, +Slice::Gen::TypesVisitor::writeMemberSignature(const DataMemberList& dataMembers, int /*baseType*/, ContainerType ct) const { if(ct == LocalException) @@ -2671,7 +2678,7 @@ Slice::Gen::DelegateMVisitor::DelegateMVisitor(Output& H, Output& M, const strin } bool -Slice::Gen::DelegateMVisitor::visitModuleStart(const ModulePtr& p) +Slice::Gen::DelegateMVisitor::visitModuleStart(const ModulePtr&) { return true; } @@ -3019,7 +3026,7 @@ Slice::Gen::DelegateMVisitor::visitClassDefStart(const ClassDefPtr& p) } void -Slice::Gen::DelegateMVisitor::visitClassDefEnd(const ClassDefPtr& p) +Slice::Gen::DelegateMVisitor::visitClassDefEnd(const ClassDefPtr&) { _H << nl << "@end"; _M << nl << "@end"; diff --git a/cpp/src/slice2objc/Main.cpp b/cpp/src/slice2objc/Main.cpp index c0f09d940ee..a191491fa5e 100644 --- a/cpp/src/slice2objc/Main.cpp +++ b/cpp/src/slice2objc/Main.cpp @@ -48,7 +48,7 @@ Init init; } void -interruptedCallback(int signal) +interruptedCallback(int) { IceUtilInternal::MutexPtrLock<IceUtil::Mutex> sync(globalMutex); interrupted = true; diff --git a/cpp/src/slice2objc/ObjCUtil.cpp b/cpp/src/slice2objc/ObjCUtil.cpp index 242ed701287..b1e49e69464 100644 --- a/cpp/src/slice2objc/ObjCUtil.cpp +++ b/cpp/src/slice2objc/ObjCUtil.cpp @@ -148,7 +148,7 @@ Slice::ObjCGenerator::moduleName(const ModulePtr& m) } ModulePtr -Slice::ObjCGenerator::findModule(const ContainedPtr& cont, int baseTypes, bool mangleCasts) +Slice::ObjCGenerator::findModule(const ContainedPtr& cont, int /*baseTypes*/, bool /*mangleCasts*/) { ModulePtr m = ModulePtr::dynamicCast(cont); ContainerPtr container = cont->container(); @@ -244,13 +244,13 @@ Slice::ObjCGenerator::getFactoryMethod(const ContainedPtr& p, bool deprecated) } else { - for(string::iterator p = name.begin(); p != name.end() && isalpha(*p); ++p) + for(string::iterator q = name.begin(); q != name.end() && isalpha(*q); ++q) { - if(p != name.end() - 1 && isalpha(*(p + 1)) && !isupper(*(p + 1))) + if(q != name.end() - 1 && isalpha(*(q + 1)) && !isupper(*(q + 1))) { break; } - *p = tolower(*p); + *q = tolower(*q); } } return name; diff --git a/cpp/src/slice2php/Main.cpp b/cpp/src/slice2php/Main.cpp index 980f8853e8c..c0ccdd26fd8 100644 --- a/cpp/src/slice2php/Main.cpp +++ b/cpp/src/slice2php/Main.cpp @@ -34,6 +34,13 @@ # include <unistd.h> #endif +// TODO: fix this warning! +#if defined(__clang__) +# pragma clang diagnostic ignored "-Wshadow" +#elif defined(__GNUC__) +# pragma GCC diagnostic ignored "-Wshadow" +#endif + using namespace std; using namespace Slice; using namespace Slice::PHP; diff --git a/cpp/test/Ice/acm/AllTests.cpp b/cpp/test/Ice/acm/AllTests.cpp index cbe654b2d4c..6df4319364c 100644 --- a/cpp/test/Ice/acm/AllTests.cpp +++ b/cpp/test/Ice/acm/AllTests.cpp @@ -130,7 +130,7 @@ class TestCase : public: TestCase(const string& name, const RemoteCommunicatorPrxPtr& com) : - _name(name), _com(com), _logger(new LoggerI()), + _testCaseName(name), _com(com), _logger(new LoggerI()), _clientACMTimeout(-1), _clientACMClose(-1), _clientACMHeartbeat(-1), _serverACMTimeout(-1), _serverACMClose(-1), _serverACMHeartbeat(-1), _heartbeat(0), _closed(false) @@ -176,7 +176,7 @@ public: void join() #endif { - cout << "testing " << _name << "... " << flush; + cout << "testing " << _testCaseName << "... " << flush; _logger->start(); #ifdef ICE_CPP11_MAPPING t.join(); @@ -279,7 +279,7 @@ public: protected: - const string _name; + const string _testCaseName; const RemoteCommunicatorPrxPtr _com; string _msg; LoggerIPtr _logger; @@ -309,7 +309,7 @@ public: setServerACM(1, -1, -1); // Faster ACM to make sure we receive enough ACM heartbeats } - virtual void runTestCase(const RemoteObjectAdapterPrxPtr& adapter, const TestIntfPrxPtr& proxy) + virtual void runTestCase(const RemoteObjectAdapterPrxPtr&, const TestIntfPrxPtr& proxy) { proxy->sleep(4); @@ -358,7 +358,7 @@ public: setServerACM(2, 2, 0); // Disable heartbeat on invocations } - virtual void runTestCase(const RemoteObjectAdapterPrxPtr& adapter, const TestIntfPrxPtr& proxy) + virtual void runTestCase(const RemoteObjectAdapterPrxPtr&, const TestIntfPrxPtr& proxy) { try { @@ -391,7 +391,7 @@ public: setServerACM(1, 2, 0); // Disable heartbeat on invocations } - virtual void runTestCase(const RemoteObjectAdapterPrxPtr& adapter, const TestIntfPrxPtr& proxy) + virtual void runTestCase(const RemoteObjectAdapterPrxPtr&, const TestIntfPrxPtr& proxy) { // No close on invocation, the call should succeed this time. proxy->sleep(3); @@ -411,7 +411,7 @@ public: setClientACM(1, 1, 0); // Only close on idle } - virtual void runTestCase(const RemoteObjectAdapterPrxPtr& adapter, const TestIntfPrxPtr& proxy) + virtual void runTestCase(const RemoteObjectAdapterPrxPtr&, const TestIntfPrxPtr&) { IceUtil::ThreadControl::sleep(IceUtil::Time::milliSeconds(3000)); // Idle for 3 seconds @@ -431,7 +431,7 @@ public: setClientACM(1, 2, 0); // Only close on invocation } - virtual void runTestCase(const RemoteObjectAdapterPrxPtr& adapter, const TestIntfPrxPtr& proxy) + virtual void runTestCase(const RemoteObjectAdapterPrxPtr&, const TestIntfPrxPtr&) { IceUtil::ThreadControl::sleep(IceUtil::Time::milliSeconds(3000)); // Idle for 3 seconds @@ -450,7 +450,7 @@ public: setClientACM(1, 3, 0); // Only close on idle and invocation } - virtual void runTestCase(const RemoteObjectAdapterPrxPtr& adapter, const TestIntfPrxPtr& proxy) + virtual void runTestCase(const RemoteObjectAdapterPrxPtr& adapter, const TestIntfPrxPtr&) { // // Put the adapter on hold. The server will not respond to @@ -483,7 +483,7 @@ public: setClientACM(1, 4, 0); // Only close on idle and invocation } - virtual void runTestCase(const RemoteObjectAdapterPrxPtr& adapter, const TestIntfPrxPtr& proxy) + virtual void runTestCase(const RemoteObjectAdapterPrxPtr& adapter, const TestIntfPrxPtr&) { adapter->hold(); IceUtil::ThreadControl::sleep(IceUtil::Time::milliSeconds(3000)); // Idle for 3 seconds @@ -504,7 +504,7 @@ public: setServerACM(1, -1, 2); // Enable server heartbeats. } - virtual void runTestCase(const RemoteObjectAdapterPrxPtr& adapter, const TestIntfPrxPtr& proxy) + virtual void runTestCase(const RemoteObjectAdapterPrxPtr&, const TestIntfPrxPtr&) { IceUtil::ThreadControl::sleep(IceUtil::Time::milliSeconds(3000)); @@ -522,7 +522,7 @@ public: setServerACM(1, -1, 3); // Enable server heartbeats. } - virtual void runTestCase(const RemoteObjectAdapterPrxPtr& adapter, const TestIntfPrxPtr& proxy) + virtual void runTestCase(const RemoteObjectAdapterPrxPtr&, const TestIntfPrxPtr& proxy) { for(int i = 0; i < 10; ++i) { @@ -548,7 +548,7 @@ public: setServerACM(10, -1, 0); } - virtual void runTestCase(const RemoteObjectAdapterPrxPtr& adapter, const TestIntfPrxPtr& proxy) + virtual void runTestCase(const RemoteObjectAdapterPrxPtr&, const TestIntfPrxPtr& proxy) { proxy->startHeartbeatCount(); Ice::ConnectionPtr con = proxy->ice_getConnection(); @@ -614,7 +614,7 @@ public: setClientACM(15, 4, 0); } - virtual void runTestCase(const RemoteObjectAdapterPrxPtr& adapter, const TestIntfPrxPtr& proxy) + virtual void runTestCase(const RemoteObjectAdapterPrxPtr&, const TestIntfPrxPtr& proxy) { Ice::ConnectionPtr con = proxy->ice_getConnection(); diff --git a/cpp/test/Ice/acm/TestI.cpp b/cpp/test/Ice/acm/TestI.cpp index cbbada92dfb..82a6b9eadfb 100644 --- a/cpp/test/Ice/acm/TestI.cpp +++ b/cpp/test/Ice/acm/TestI.cpp @@ -105,7 +105,7 @@ RemoteObjectAdapterI::deactivate(const Ice::Current&) } void -TestI::sleep(int delay, const Ice::Current& current) +TestI::sleep(int delay, const Ice::Current&) { Lock sync(*this); timedWait(IceUtil::Time::seconds(delay)); @@ -120,7 +120,7 @@ TestI::sleepAndHold(int delay, const Ice::Current& current) } void -TestI::interruptSleep(const Ice::Current& current) +TestI::interruptSleep(const Ice::Current&) { Lock sync(*this); notifyAll(); diff --git a/cpp/test/Ice/ami/AllTests.cpp b/cpp/test/Ice/ami/AllTests.cpp index c60ca2f6d67..f1de69154ef 100644 --- a/cpp/test/Ice/ami/AllTests.cpp +++ b/cpp/test/Ice/ami/AllTests.cpp @@ -62,7 +62,7 @@ struct Cookie : public Ice::LocalObject }; typedef IceUtil::Handle<Cookie> CookiePtr; -class CallbackBase : public Ice::LocalObject +class CallbackBase : public virtual Ice::LocalObject { public: @@ -781,7 +781,7 @@ public: { } - virtual void closed(const Ice::ConnectionPtr& con) + virtual void closed(const Ice::ConnectionPtr&) { called(); } @@ -906,16 +906,16 @@ allTests(Test::TestHelper* helper, bool collocated) #ifdef ICE_CPP11_MAPPING string sref = "test:" + helper->getTestEndpoint(); - auto obj = communicator->stringToProxy(sref); - test(obj); + auto prx = communicator->stringToProxy(sref); + test(prx); - auto p = Ice::uncheckedCast<Test::TestIntfPrx>(obj); + auto p = Ice::uncheckedCast<Test::TestIntfPrx>(prx); sref = "testController:" + helper->getTestEndpoint(1); - obj = communicator->stringToProxy(sref); - test(obj); + prx = communicator->stringToProxy(sref); + test(prx); - auto testController = Ice::uncheckedCast<Test::TestIntfControllerPrx>(obj); + auto testController = Ice::uncheckedCast<Test::TestIntfControllerPrx>(prx); Ice::Context ctx; cout << "testing lambda API... " << flush; @@ -1796,7 +1796,7 @@ allTests(Test::TestHelper* helper, bool collocated) promise.set_value(); thrower(throwEx[i]); }, - [&](const exception_ptr& ex) + [&](const exception_ptr&) { test(false); }); @@ -2190,7 +2190,7 @@ allTests(Test::TestHelper* helper, bool collocated) auto con = p->ice_getConnection(); auto sc = make_shared<promise<void>>(); con->setCloseCallback( - [sc](Ice::ConnectionPtr connection) + [sc](Ice::ConnectionPtr) { sc->set_value(); }); @@ -2245,13 +2245,13 @@ allTests(Test::TestHelper* helper, bool collocated) for(int i = 0; i < maxQueue; i++) { auto s = make_shared<promise<void>>(); - atomic_flag sent = ATOMIC_FLAG_INIT; + atomic_flag sent2 = ATOMIC_FLAG_INIT; p->opWithPayloadAsync(seq, [s]() { s->set_value(); }, [s](exception_ptr ex) { s->set_exception(ex); }, - [&sent](bool) { sent.test_and_set(); }); + [&sent2](bool) { sent2.test_and_set(); }); results.push_back(s->get_future()); - if(sent.test_and_set()) + if(sent2.test_and_set()) { done = false; maxQueue *= 2; @@ -2265,11 +2265,11 @@ allTests(Test::TestHelper* helper, bool collocated) done = false; } - for(vector<future<void>>::iterator p = results.begin(); p != results.end(); ++p) + for(vector<future<void>>::iterator r = results.begin(); r != results.end(); ++r) { try { - p->get(); + r->get(); } catch(const Ice::LocalException&) { @@ -2293,7 +2293,7 @@ allTests(Test::TestHelper* helper, bool collocated) auto sent = make_shared<promise<void>>(); p->startDispatchAsync([s]() { s->set_value(); }, [s](exception_ptr ex) { s->set_exception(ex); }, - [sent](bool ss) { sent->set_value(); }); + [sent](bool) { sent->set_value(); }); auto f = s->get_future(); sent->get_future().get(); // Ensure the request was sent before we close the connection. con->close(Ice::ConnectionClose::Gracefully); @@ -2315,7 +2315,7 @@ allTests(Test::TestHelper* helper, bool collocated) con = p->ice_getConnection(); auto sc = make_shared<promise<void>>(); con->setCloseCallback( - [sc](Ice::ConnectionPtr connection) + [sc](Ice::ConnectionPtr) { sc->set_value(); }); @@ -2350,7 +2350,7 @@ allTests(Test::TestHelper* helper, bool collocated) auto sent = make_shared<promise<void>>(); p->startDispatchAsync([s]() { s->set_value(); }, [s](exception_ptr ex) { s->set_exception(ex); }, - [sent](bool ss) { sent->set_value(); }); + [sent](bool) { sent->set_value(); }); auto f = s->get_future(); sent->get_future().get(); // Ensure the request was sent before we close the connection. con->close(Ice::ConnectionClose::Forcefully); @@ -2702,7 +2702,7 @@ allTests(Test::TestHelper* helper, bool collocated) Ice::InitializationData initData; initData.properties = communicator->getProperties()->clone(); Ice::CommunicatorPtr ic = Ice::initialize(initData); - Ice::ObjectPrx obj = ic->stringToProxy(p->ice_toString()); + obj = ic->stringToProxy(p->ice_toString()); Test::TestIntfPrx p2 = Test::TestIntfPrx::checkedCast(obj); ic->destroy(); @@ -3982,12 +3982,12 @@ allTests(Test::TestHelper* helper, bool collocated) done = false; } - for(vector<Ice::AsyncResultPtr>::const_iterator p = results.begin(); p != results.end(); ++p) + for(vector<Ice::AsyncResultPtr>::const_iterator r = results.begin(); r != results.end(); ++r) { - (*p)->waitForCompleted(); + (*r)->waitForCompleted(); try { - (*p)->throwLocalException(); + (*r)->throwLocalException(); } catch(const Ice::LocalException&) { diff --git a/cpp/test/Ice/ami/TestI.cpp b/cpp/test/Ice/ami/TestI.cpp index 2893a408cd0..0e3f5f9bed6 100644 --- a/cpp/test/Ice/ami/TestI.cpp +++ b/cpp/test/Ice/ami/TestI.cpp @@ -99,7 +99,7 @@ TestIntfI::close(Test::CloseMode mode, const Ice::Current& current) } void -TestIntfI::sleep(Ice::Int ms, const Ice::Current& current) +TestIntfI::sleep(Ice::Int ms, const Ice::Current&) { IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this); timedWait(IceUtil::Time::milliSeconds(ms)); @@ -107,7 +107,7 @@ TestIntfI::sleep(Ice::Int ms, const Ice::Current& current) #ifdef ICE_CPP11_MAPPING void -TestIntfI::startDispatchAsync(std::function<void()> response, std::function<void(std::exception_ptr)> ex, +TestIntfI::startDispatchAsync(std::function<void()> response, std::function<void(std::exception_ptr)>, const Ice::Current&) { IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this); @@ -143,7 +143,7 @@ TestIntfI::startDispatch_async(const Test::AMD_TestIntf_startDispatchPtr& cb, co #endif void -TestIntfI::finishDispatch(const Ice::Current& current) +TestIntfI::finishDispatch(const Ice::Current&) { IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this); if(_shutdown) diff --git a/cpp/test/Ice/background/AllTests.cpp b/cpp/test/Ice/background/AllTests.cpp index 61cb5b11afe..de2d989f7ed 100644 --- a/cpp/test/Ice/background/AllTests.cpp +++ b/cpp/test/Ice/background/AllTests.cpp @@ -456,8 +456,7 @@ connectTests(const ConfigurationPtr& configuration, const Test::BackgroundPrxPtr } background->ice_getConnection()->close(Ice::ICE_SCOPED_ENUM(ConnectionClose, GracefullyWithWait)); - int i; - for(i = 0; i < 4; ++i) + for(int i = 0; i < 4; ++i) { if(i == 0 || i == 2) { @@ -550,7 +549,7 @@ connectTests(const ConfigurationPtr& configuration, const Test::BackgroundPrxPtr OpThreadPtr thread1 = new OpThread(background); OpThreadPtr thread2 = new OpThread(background); - for(i = 0; i < 5; i++) + for(int i = 0; i < 5; i++) { try { @@ -598,8 +597,7 @@ initializeTests(const ConfigurationPtr& configuration, } background->ice_getConnection()->close(Ice::ICE_SCOPED_ENUM(ConnectionClose, GracefullyWithWait)); - int i; - for(i = 0; i < 4; i++) + for(int i = 0; i < 4; i++) { if(i == 0 || i == 2) { @@ -760,7 +758,7 @@ initializeTests(const ConfigurationPtr& configuration, OpThreadPtr thread1 = new OpThread(background); OpThreadPtr thread2 = new OpThread(background); - for(i = 0; i < 5; i++) + for(int i = 0; i < 5; i++) { try { @@ -882,8 +880,7 @@ validationTests(const ConfigurationPtr& configuration, test(false); } - int i; - for(i = 0; i < 2; i++) + for(int i = 0; i < 2; i++) { configuration->readException(new Ice::SocketException(__FILE__, __LINE__)); BackgroundPrxPtr prx = i == 0 ? background : background->ice_oneway(); @@ -1228,8 +1225,7 @@ readWriteTests(const ConfigurationPtr& configuration, test(false); } - int i; - for(i = 0; i < 2; i++) + for(int i = 0; i < 2; i++) { BackgroundPrxPtr prx = i == 0 ? background : background->ice_oneway(); @@ -1308,28 +1304,30 @@ readWriteTests(const ConfigurationPtr& configuration, configuration->readReady(false); // Required in C# to make sure beginRead() doesn't throw too soon. configuration->readException(new Ice::SocketException(__FILE__, __LINE__)); #ifdef ICE_CPP11_MAPPING - promise<void> completed; - background->opAsync( - []() - { - test(false); - }, - [&completed](exception_ptr e) - { - try - { - rethrow_exception(e); - } - catch(const Ice::SocketException&) - { - completed.set_value(); - } - catch(...) + { + promise<void> completed; + background->opAsync( + []() { test(false); - } - }); - completed.get_future().get(); + }, + [&completed](exception_ptr e) + { + try + { + rethrow_exception(e); + } + catch(const Ice::SocketException&) + { + completed.set_value(); + } + catch(...) + { + test(false); + } + }); + completed.get_future().get(); + } #else Ice::AsyncResultPtr r = background->begin_op(); try @@ -1390,7 +1388,7 @@ readWriteTests(const ConfigurationPtr& configuration, configuration->writeException(0); } - for(i = 0; i < 2; ++i) + for(int i = 0; i < 2; ++i) { BackgroundPrxPtr prx = i == 0 ? background : background->ice_oneway(); @@ -1427,7 +1425,7 @@ readWriteTests(const ConfigurationPtr& configuration, test(sent.get_future().wait_for(chrono::milliseconds(0)) != future_status::ready); completed.get_future().get(); #else - Ice::AsyncResultPtr r = prx->begin_op(); + r = prx->begin_op(); test(!r->sentSynchronously()); try { @@ -1486,7 +1484,7 @@ readWriteTests(const ConfigurationPtr& configuration, completed.get_future().get(); #else - Ice::AsyncResultPtr r = background->begin_op(); + r = background->begin_op(); try { background->end_op(r); @@ -1530,7 +1528,7 @@ readWriteTests(const ConfigurationPtr& configuration, }); completed.get_future().get(); #else - Ice::AsyncResultPtr r = background->begin_op(); + r = background->begin_op(); // The read exception might propagate before the message send is seen as completed on IOCP. # ifndef ICE_USE_IOCP r->waitForSent(); @@ -1591,7 +1589,7 @@ readWriteTests(const ConfigurationPtr& configuration, { c1.set_value(); }, - [](exception_ptr err) + [](exception_ptr) { test(false); }, @@ -1609,7 +1607,7 @@ readWriteTests(const ConfigurationPtr& configuration, { c2.set_value(); }, - [](exception_ptr err) + [](exception_ptr) { test(false); }, @@ -1775,7 +1773,7 @@ readWriteTests(const ConfigurationPtr& configuration, OpThreadPtr thread1 = new OpThread(background); OpThreadPtr thread2 = new OpThread(background); - for(i = 0; i < 5; i++) + for(int i = 0; i < 5; i++) { try { diff --git a/cpp/test/Ice/background/Transceiver.cpp b/cpp/test/Ice/background/Transceiver.cpp index f6b044b864f..13cfba89aea 100644 --- a/cpp/test/Ice/background/Transceiver.cpp +++ b/cpp/test/Ice/background/Transceiver.cpp @@ -24,8 +24,9 @@ Transceiver::getNativeInfo() IceInternal::SocketOperation Transceiver::initialize(IceInternal::Buffer& readBuffer, IceInternal::Buffer& writeBuffer) { + IceInternal::SocketOperation status = IceInternal::SocketOperationNone; #ifndef ICE_USE_IOCP - IceInternal::SocketOperation status = _configuration->initializeSocketOperation(); + status = _configuration->initializeSocketOperation(); if(status == IceInternal::SocketOperationConnect) { return status; @@ -52,7 +53,7 @@ Transceiver::initialize(IceInternal::Buffer& readBuffer, IceInternal::Buffer& wr _configuration->checkInitializeException(); if(!_initialized) { - IceInternal::SocketOperation status = _transceiver->initialize(readBuffer, writeBuffer); + status = _transceiver->initialize(readBuffer, writeBuffer); if(status != IceInternal::SocketOperationNone) { return status; diff --git a/cpp/test/Ice/binding/AllTests.cpp b/cpp/test/Ice/binding/AllTests.cpp index ca2a64f2c41..dd358dc6465 100644 --- a/cpp/test/Ice/binding/AllTests.cpp +++ b/cpp/test/Ice/binding/AllTests.cpp @@ -1009,10 +1009,10 @@ allTests(Test::TestHelper* helper) Ice::InitializationData clientInitData; clientInitData.properties = *q; Ice::CommunicatorHolder clientCommunicator(clientInitData); - Ice::ObjectPrxPtr prx = clientCommunicator->stringToProxy(strPrx); + Ice::ObjectPrxPtr clientPrx = clientCommunicator->stringToProxy(strPrx); try { - prx->ice_ping(); + clientPrx->ice_ping(); test(false); } catch(const Ice::ObjectNotExistException&) diff --git a/cpp/test/Ice/binding/TestI.cpp b/cpp/test/Ice/binding/TestI.cpp index ecadd92171b..2975993180b 100644 --- a/cpp/test/Ice/binding/TestI.cpp +++ b/cpp/test/Ice/binding/TestI.cpp @@ -91,7 +91,7 @@ RemoteObjectAdapterI::getTestIntf(const Ice::Current&) } void -RemoteObjectAdapterI::deactivate(const Ice::Current& current) +RemoteObjectAdapterI::deactivate(const Ice::Current&) { try { diff --git a/cpp/test/Ice/custom/AllTests.cpp b/cpp/test/Ice/custom/AllTests.cpp index 39877b6960a..ffb0b379dd9 100644 --- a/cpp/test/Ice/custom/AllTests.cpp +++ b/cpp/test/Ice/custom/AllTests.cpp @@ -3366,10 +3366,10 @@ allTests(Test::TestHelper* helper) cout << "testing class mapped structs with AMI... " << flush; { - Test::ClassStructPtr cs2; - Test::ClassStructSeq csseq2; + cs2 = 0; + csseq2.clear(); Ice::AsyncResultPtr r = t->begin_opClassStruct(cs, csseq1); - Test::ClassStructPtr cs3 = t->end_opClassStruct(cs2, csseq2, r); + cs3 = t->end_opClassStruct(cs2, csseq2, r); assert(cs3 == cs); assert(csseq1.size() == csseq2.size()); assert(csseq1[0] == csseq2[0]); @@ -3424,8 +3424,7 @@ allTests(Test::TestHelper* helper) test(r.returnValue == wstr); #else Ice::AsyncResultPtr r = wsc1->begin_opString(wstr); - wstring out; - wstring ret = wsc1->end_opString(out, r); + ret = wsc1->end_opString(out, r); test(out == wstr); test(ret == wstr); #endif @@ -3436,10 +3435,10 @@ allTests(Test::TestHelper* helper) promise<bool> done; wsc1->opStringAsync(wstr, - [&](wstring ret, wstring out) + [&](wstring retP, wstring outP) { - test(out == wstr); - test(ret == wstr); + test(outP == wstr); + test(retP == wstr); done.set_value(true); }, [&](std::exception_ptr) @@ -3467,8 +3466,7 @@ allTests(Test::TestHelper* helper) test(r.returnValue == wstr); #else Ice::AsyncResultPtr r = wsc2->begin_opString(wstr); - wstring out; - wstring ret = wsc2->end_opString(out, r); + ret = wsc2->end_opString(out, r); test(out == wstr); test(ret == wstr); #endif @@ -3479,10 +3477,10 @@ allTests(Test::TestHelper* helper) promise<bool> done; wsc2->opStringAsync(wstr, - [&](wstring ret, wstring out) + [&](wstring retP, wstring outP) { - test(out == wstr); - test(ret == wstr); + test(outP == wstr); + test(retP == wstr); done.set_value(true); }, [&](std::exception_ptr) diff --git a/cpp/test/Ice/defaultValue/Client.cpp b/cpp/test/Ice/defaultValue/Client.cpp index 3057e93e872..215966e95f0 100644 --- a/cpp/test/Ice/defaultValue/Client.cpp +++ b/cpp/test/Ice/defaultValue/Client.cpp @@ -22,7 +22,7 @@ public: }; void -Client::run(int argc, char** argv) +Client::run(int, char**) { void allTests(); allTests(); diff --git a/cpp/test/Ice/exceptions/TestAMDI.cpp b/cpp/test/Ice/exceptions/TestAMDI.cpp index c423a8381fb..b098008c430 100644 --- a/cpp/test/Ice/exceptions/TestAMDI.cpp +++ b/cpp/test/Ice/exceptions/TestAMDI.cpp @@ -200,7 +200,7 @@ ThrowerI::throwCasCAsync(int a, int b, int c, void ThrowerI::throwModAAsync(int a, int a2, function<void()>, - function<void(exception_ptr)> exception, + function<void(exception_ptr)>, const Ice::Current&) { Mod::A ex; diff --git a/cpp/test/Ice/faultTolerance/AllTests.cpp b/cpp/test/Ice/faultTolerance/AllTests.cpp index e1917b4ea11..3d0a2ffadcf 100644 --- a/cpp/test/Ice/faultTolerance/AllTests.cpp +++ b/cpp/test/Ice/faultTolerance/AllTests.cpp @@ -89,9 +89,9 @@ public: catch(const Ice::ConnectFailedException&) { } - catch(const Ice::Exception& ex) + catch(const Ice::Exception& e) { - cout << ex << endl; + cout << e << endl; test(false); } called(); diff --git a/cpp/test/Ice/gc/Client.cpp b/cpp/test/Ice/gc/Client.cpp index 49425be3f7d..126084f473a 100644 --- a/cpp/test/Ice/gc/Client.cpp +++ b/cpp/test/Ice/gc/Client.cpp @@ -525,7 +525,7 @@ public: }; void -Client::run(int argc, char** argv) +Client::run(int, char**) { allTests(); } diff --git a/cpp/test/Ice/hold/AllTests.cpp b/cpp/test/Ice/hold/AllTests.cpp index 4db7f187534..f316bcebddf 100644 --- a/cpp/test/Ice/hold/AllTests.cpp +++ b/cpp/test/Ice/hold/AllTests.cpp @@ -109,20 +109,19 @@ allTests(Test::TestHelper* helper) cout << "ok" << endl; cout << "changing state between active and hold rapidly... " << flush; - int i; - for(i = 0; i < 100; ++i) + for(int i = 0; i < 100; ++i) { hold->putOnHold(0); } - for(i = 0; i < 100; ++i) + for(int i = 0; i < 100; ++i) { hold->ice_oneway()->putOnHold(0); } - for(i = 0; i < 100; ++i) + for(int i = 0; i < 100; ++i) { holdSerialized->putOnHold(0); } - for(i = 0; i < 100; ++i) + for(int i = 0; i < 100; ++i) { holdSerialized->ice_oneway()->putOnHold(0); } @@ -140,9 +139,9 @@ allTests(Test::TestHelper* helper) auto sent = make_shared<promise<bool>>(); auto expected = value; hold->setAsync(value + 1, IceUtilInternal::random(5), - [cond, expected, completed](int value) + [cond, expected, completed](int val) { - if(value != expected) + if(val != expected) { cond->set(false); } @@ -215,9 +214,9 @@ allTests(Test::TestHelper* helper) holdSerialized->setAsync( value + 1, IceUtilInternal::random(1), - [cond, expected, completed](int value) + [cond, expected, completed](int val) { - if(value != expected) + if(val != expected) { cond->set(false); } @@ -282,7 +281,7 @@ allTests(Test::TestHelper* helper) [](exception_ptr) { }, - [completed](bool sentSynchronously) + [completed](bool /*sentSynchronously*/) { completed->set_value(); }); @@ -318,7 +317,7 @@ allTests(Test::TestHelper* helper) { hold->waitForHold(); hold->waitForHold(); - for(i = 0; i < 1000; ++i) + for(int i = 0; i < 1000; ++i) { hold->ice_oneway()->ice_ping(); if((i % 20) == 0) diff --git a/cpp/test/Ice/impl/Makefile.mk b/cpp/test/Ice/impl/Makefile.mk index 5c5d0feaba6..a4e19bae6e9 100644 --- a/cpp/test/Ice/impl/Makefile.mk +++ b/cpp/test/Ice/impl/Makefile.mk @@ -18,7 +18,7 @@ define make-impl-with-config ifneq ($$($2_impl),) $5_sources += $$($5_objdir)/$$($2_impl)I.cpp $5_objects += $$(addprefix $$($5_objdir)/,$$(call source-to-object,$$($5_objdir)/$$($2_impl)I.cpp)) -$5_cppflags += -I$$($5_objdir) +$5_cppflags += -I$$($5_objdir) $(nounusedparameter-cppflags) $$($5_objects): $$($5_objdir)/$$($2_impl)I.cpp diff --git a/cpp/test/Ice/info/AllTests.cpp b/cpp/test/Ice/info/AllTests.cpp index 40addf59a37..75680954a2c 100644 --- a/cpp/test/Ice/info/AllTests.cpp +++ b/cpp/test/Ice/info/AllTests.cpp @@ -194,14 +194,14 @@ allTests(Test::TestHelper* helper) test(ctx["host"] == tcpinfo->host); test(ctx["compress"] == "false"); istringstream is(ctx["port"]); - int port; - is >> port; - test(port > 0); + int portCtx; + is >> portCtx; + test(portCtx > 0); info = base->ice_datagram()->ice_getConnection()->getEndpoint()->getInfo(); Ice::UDPEndpointInfoPtr udp = ICE_DYNAMIC_CAST(Ice::UDPEndpointInfo, info); test(udp); - test(udp->port == port); + test(udp->port == portCtx); test(udp->host == defaultHost); } cout << "ok" << endl; diff --git a/cpp/test/Ice/interceptor/AMDInterceptorI.cpp b/cpp/test/Ice/interceptor/AMDInterceptorI.cpp index 647e7e62d88..204fc5d3305 100644 --- a/cpp/test/Ice/interceptor/AMDInterceptorI.cpp +++ b/cpp/test/Ice/interceptor/AMDInterceptorI.cpp @@ -97,9 +97,9 @@ AMDInterceptorI::dispatch(Ice::Request& request) { rethrow_exception(ex); } - catch(const IceUtil::Exception& ex) + catch(const IceUtil::Exception& e) { - setException(ex); + setException(e); } catch(...) { diff --git a/cpp/test/Ice/invoke/AllTests.cpp b/cpp/test/Ice/invoke/AllTests.cpp index d56d47b60f8..168834a3e68 100644 --- a/cpp/test/Ice/invoke/AllTests.cpp +++ b/cpp/test/Ice/invoke/AllTests.cpp @@ -12,7 +12,6 @@ #include <Test.h> using namespace std; -using namespace Ice; static string testString = "This is a test string"; @@ -302,15 +301,15 @@ allTests(Test::TestHelper* helper) { Ice::ByteSeq inEncaps, outEncaps; - if(!oneway->ice_invoke("opOneway", ICE_ENUM(OperationMode, Normal), inEncaps, outEncaps)) + if(!oneway->ice_invoke("opOneway", Ice::ICE_ENUM(OperationMode, Normal), inEncaps, outEncaps)) { test(false); } - test(batchOneway->ice_invoke("opOneway", ICE_ENUM(OperationMode, Normal), inEncaps, outEncaps)); - test(batchOneway->ice_invoke("opOneway", ICE_ENUM(OperationMode, Normal), inEncaps, outEncaps)); - test(batchOneway->ice_invoke("opOneway", ICE_ENUM(OperationMode, Normal), inEncaps, outEncaps)); - test(batchOneway->ice_invoke("opOneway", ICE_ENUM(OperationMode, Normal), inEncaps, outEncaps)); + test(batchOneway->ice_invoke("opOneway", Ice::ICE_ENUM(OperationMode, Normal), inEncaps, outEncaps)); + test(batchOneway->ice_invoke("opOneway", Ice::ICE_ENUM(OperationMode, Normal), inEncaps, outEncaps)); + test(batchOneway->ice_invoke("opOneway", Ice::ICE_ENUM(OperationMode, Normal), inEncaps, outEncaps)); + test(batchOneway->ice_invoke("opOneway", Ice::ICE_ENUM(OperationMode, Normal), inEncaps, outEncaps)); batchOneway->ice_flushBatchRequests(); Ice::OutputStream out(communicator); @@ -320,7 +319,7 @@ allTests(Test::TestHelper* helper) out.finished(inEncaps); // ice_invoke - if(cl->ice_invoke("opString", ICE_ENUM(OperationMode, Normal), inEncaps, outEncaps)) + if(cl->ice_invoke("opString", Ice::ICE_ENUM(OperationMode, Normal), inEncaps, outEncaps)) { Ice::InputStream in(communicator, out.getEncoding(), outEncaps); in.startEncapsulation(); @@ -338,7 +337,7 @@ allTests(Test::TestHelper* helper) // ice_invoke with array mapping pair<const ::Ice::Byte*, const ::Ice::Byte*> inPair(&inEncaps[0], &inEncaps[0] + inEncaps.size()); - if(cl->ice_invoke("opString", ICE_ENUM(OperationMode, Normal), inPair, outEncaps)) + if(cl->ice_invoke("opString", Ice::ICE_ENUM(OperationMode, Normal), inPair, outEncaps)) { Ice::InputStream in(communicator, out.getEncoding(), outEncaps); in.startEncapsulation(); @@ -363,7 +362,7 @@ allTests(Test::TestHelper* helper) { ctx["raise"] = ""; } - if(cl->ice_invoke("opException", ICE_ENUM(OperationMode, Normal), inEncaps, outEncaps, ctx)) + if(cl->ice_invoke("opException", Ice::ICE_ENUM(OperationMode, Normal), inEncaps, outEncaps, ctx)) { test(false); } @@ -393,7 +392,7 @@ allTests(Test::TestHelper* helper) { Ice::ByteSeq inEncaps; - batchOneway->ice_invokeAsync("opOneway", ICE_ENUM(OperationMode, Normal), inEncaps, + batchOneway->ice_invokeAsync("opOneway", Ice::ICE_ENUM(OperationMode, Normal), inEncaps, [](bool, const vector<Ice::Byte>) { test(false); @@ -413,10 +412,10 @@ allTests(Test::TestHelper* helper) // { Ice::ByteSeq inEncaps; - test(batchOneway->ice_invokeAsync("opOneway", ICE_ENUM(OperationMode, Normal), inEncaps).get().returnValue); - test(batchOneway->ice_invokeAsync("opOneway", ICE_ENUM(OperationMode, Normal), inEncaps).get().returnValue); - test(batchOneway->ice_invokeAsync("opOneway", ICE_ENUM(OperationMode, Normal), inEncaps).get().returnValue); - test(batchOneway->ice_invokeAsync("opOneway", ICE_ENUM(OperationMode, Normal), inEncaps).get().returnValue); + test(batchOneway->ice_invokeAsync("opOneway", Ice::ICE_ENUM(OperationMode, Normal), inEncaps).get().returnValue); + test(batchOneway->ice_invokeAsync("opOneway", Ice::ICE_ENUM(OperationMode, Normal), inEncaps).get().returnValue); + test(batchOneway->ice_invokeAsync("opOneway", Ice::ICE_ENUM(OperationMode, Normal), inEncaps).get().returnValue); + test(batchOneway->ice_invokeAsync("opOneway", Ice::ICE_ENUM(OperationMode, Normal), inEncaps).get().returnValue); batchOneway->ice_flushBatchRequests(); } @@ -425,7 +424,7 @@ allTests(Test::TestHelper* helper) Ice::ByteSeq inEncaps, outEncaps; oneway->ice_invokeAsync( "opOneway", - OperationMode::Normal, + Ice::OperationMode::Normal, inEncaps, nullptr, [&](exception_ptr ex) @@ -446,7 +445,7 @@ allTests(Test::TestHelper* helper) { Ice::ByteSeq inEncaps, outEncaps; - auto completed = oneway->ice_invokeAsync("opOneway", OperationMode::Normal, inEncaps); + auto completed = oneway->ice_invokeAsync("opOneway", Ice::OperationMode::Normal, inEncaps); test(completed.get().returnValue); } @@ -459,7 +458,7 @@ allTests(Test::TestHelper* helper) out.endEncapsulation(); out.finished(inEncaps); - cl->ice_invokeAsync("opString", OperationMode::Normal, inEncaps, + cl->ice_invokeAsync("opString", Ice::OperationMode::Normal, inEncaps, [&](bool ok, vector<Ice::Byte> outParams) { outEncaps = move(outParams); @@ -491,7 +490,7 @@ allTests(Test::TestHelper* helper) out.endEncapsulation(); out.finished(inEncaps); - auto result = cl->ice_invokeAsync("opString", OperationMode::Normal, inEncaps).get(); + auto result = cl->ice_invokeAsync("opString", Ice::OperationMode::Normal, inEncaps).get(); test(result.returnValue); Ice::InputStream in(communicator, result.outParams); @@ -516,7 +515,7 @@ allTests(Test::TestHelper* helper) auto inPair = make_pair(inEncaps.data(), inEncaps.data() + inEncaps.size()); - cl->ice_invokeAsync("opString", OperationMode::Normal, inPair, + cl->ice_invokeAsync("opString", Ice::OperationMode::Normal, inPair, [&](bool ok, pair<const Ice::Byte*, const Ice::Byte*> outParams) { vector<Ice::Byte>(outParams.first, outParams.second).swap(outEncaps); @@ -556,7 +555,7 @@ allTests(Test::TestHelper* helper) auto inPair = make_pair(inEncaps.data(), inEncaps.data() + inEncaps.size()); - auto result = cl->ice_invokeAsync("opString", OperationMode::Normal, inPair).get(); + auto result = cl->ice_invokeAsync("opString", Ice::OperationMode::Normal, inPair).get(); test(result.returnValue); Ice::InputStream in(communicator, result.outParams); @@ -574,7 +573,7 @@ allTests(Test::TestHelper* helper) promise<void> sent; Ice::ByteSeq inEncaps, outEncaps; - cl->ice_invokeAsync("opException", OperationMode::Normal, inEncaps, + cl->ice_invokeAsync("opException", Ice::OperationMode::Normal, inEncaps, [&](bool ok, vector<Ice::Byte> outParams) { outEncaps = move(outParams); @@ -611,7 +610,7 @@ allTests(Test::TestHelper* helper) // { Ice::ByteSeq inEncaps; - auto result = cl->ice_invokeAsync("opException", OperationMode::Normal, inEncaps).get(); + auto result = cl->ice_invokeAsync("opException", Ice::OperationMode::Normal, inEncaps).get(); test(!result.returnValue); Ice::InputStream in(communicator, result.outParams); @@ -636,10 +635,10 @@ allTests(Test::TestHelper* helper) { Ice::ByteSeq inEncaps, outEncaps; - test(batchOneway->end_ice_invoke(outEncaps, batchOneway->begin_ice_invoke("opOneway", ICE_ENUM(OperationMode, Normal), inEncaps))); - test(batchOneway->end_ice_invoke(outEncaps, batchOneway->begin_ice_invoke("opOneway", ICE_ENUM(OperationMode, Normal), inEncaps))); - test(batchOneway->end_ice_invoke(outEncaps, batchOneway->begin_ice_invoke("opOneway", ICE_ENUM(OperationMode, Normal), inEncaps))); - test(batchOneway->end_ice_invoke(outEncaps, batchOneway->begin_ice_invoke("opOneway", ICE_ENUM(OperationMode, Normal), inEncaps))); + test(batchOneway->end_ice_invoke(outEncaps, batchOneway->begin_ice_invoke("opOneway", Ice::ICE_ENUM(OperationMode, Normal), inEncaps))); + test(batchOneway->end_ice_invoke(outEncaps, batchOneway->begin_ice_invoke("opOneway", Ice::ICE_ENUM(OperationMode, Normal), inEncaps))); + test(batchOneway->end_ice_invoke(outEncaps, batchOneway->begin_ice_invoke("opOneway", Ice::ICE_ENUM(OperationMode, Normal), inEncaps))); + test(batchOneway->end_ice_invoke(outEncaps, batchOneway->begin_ice_invoke("opOneway", Ice::ICE_ENUM(OperationMode, Normal), inEncaps))); batchOneway->ice_flushBatchRequests(); } diff --git a/cpp/test/Ice/invoke/Server.cpp b/cpp/test/Ice/invoke/Server.cpp index ccee3948daf..42cc9a9d960 100644 --- a/cpp/test/Ice/invoke/Server.cpp +++ b/cpp/test/Ice/invoke/Server.cpp @@ -77,13 +77,6 @@ private: Ice::ObjectPtr _blobject; }; -int -run(int argc, char* argv[], const Ice::CommunicatorPtr& communicator) -{ - - return EXIT_SUCCESS; -} - class Server : public Test::TestHelper { public: diff --git a/cpp/test/Ice/location/AllTests.cpp b/cpp/test/Ice/location/AllTests.cpp index fe309e7358d..1bd242a73f2 100644 --- a/cpp/test/Ice/location/AllTests.cpp +++ b/cpp/test/Ice/location/AllTests.cpp @@ -587,7 +587,7 @@ allTests(Test::TestHelper* helper, const string& ref) registry->setAdapterDirectProxy("TestAdapter5", locator->findAdapterById("TestAdapter")); registry->addObject(communicator->stringToProxy("test3@TestAdapter")); - int count = locator->getRequestCount(); + count = locator->getRequestCount(); ic->stringToProxy("test@TestAdapter5")->ice_locatorCacheTimeout(0)->ice_ping(); // No locator cache. ic->stringToProxy("test3")->ice_locatorCacheTimeout(0)->ice_ping(); // No locator cache. count += 3; diff --git a/cpp/test/Ice/logger/Client5.cpp b/cpp/test/Ice/logger/Client5.cpp index 2d7442a98c6..60a3edc3975 100644 --- a/cpp/test/Ice/logger/Client5.cpp +++ b/cpp/test/Ice/logger/Client5.cpp @@ -45,7 +45,7 @@ public: }; void -Client5::run(int argc, char** argv) +Client5::run(int, char**) { // // Run Client application 20 times, each times it generate 512 bytes of log messages, diff --git a/cpp/test/Ice/metrics/AllTests.cpp b/cpp/test/Ice/metrics/AllTests.cpp index fab844de98f..7e67d887a47 100644 --- a/cpp/test/Ice/metrics/AllTests.cpp +++ b/cpp/test/Ice/metrics/AllTests.cpp @@ -278,7 +278,7 @@ struct Void struct Connect { - Connect(const Ice::ObjectPrxPtr& proxy) : proxy(proxy) + Connect(const Ice::ObjectPrxPtr& proxyP) : proxy(proxyP) { } @@ -307,7 +307,7 @@ struct Connect struct InvokeOp { - InvokeOp(const Test::MetricsPrxPtr& proxy) : proxy(proxy) + InvokeOp(const Test::MetricsPrxPtr& proxyP) : proxy(proxyP) { } diff --git a/cpp/test/Ice/metrics/InstrumentationI.h b/cpp/test/Ice/metrics/InstrumentationI.h index ce6cdfaa053..faa192eaa32 100644 --- a/cpp/test/Ice/metrics/InstrumentationI.h +++ b/cpp/test/Ice/metrics/InstrumentationI.h @@ -227,7 +227,7 @@ public: } virtual Ice::Instrumentation::RemoteObserverPtr - getRemoteObserver(const Ice::ConnectionInfoPtr& c, const Ice::EndpointPtr& e, Ice::Int, Ice::Int) + getRemoteObserver(const Ice::ConnectionInfoPtr&, const Ice::EndpointPtr&, Ice::Int, Ice::Int) { IceUtil::Mutex::Lock sync(*this); if(!remoteObserver) diff --git a/cpp/test/Ice/objects/AllTests.cpp b/cpp/test/Ice/objects/AllTests.cpp index 7633f3732bb..19f19cf13a6 100644 --- a/cpp/test/Ice/objects/AllTests.cpp +++ b/cpp/test/Ice/objects/AllTests.cpp @@ -64,10 +64,10 @@ testUOE(const Ice::CommunicatorPtr& communicator) void clear(const CPtr&); +#ifdef ICE_CPP11_MAPPING void clear(const BPtr& b) { -#ifdef ICE_CPP11_MAPPING // No GC with the C++11 mapping if(dynamic_pointer_cast<B>(b->theA)) { @@ -82,23 +82,33 @@ clear(const BPtr& b) clear(dynamic_pointer_cast<B>(tmp)); } b->theC = nullptr; -#endif } +#else +void +clear(const BPtr&) +{ +} +#endif +#ifdef ICE_CPP11_MAPPING void clear(const CPtr& c) { -#ifdef ICE_CPP11_MAPPING // No GC with the C++11 mapping clear(c->theB); c->theB = nullptr; -#endif } +#else +void +clear(const CPtr&) +{ +} +#endif +#ifdef ICE_CPP11_MAPPING void clear(const DPtr& d) { -#ifdef ICE_CPP11_MAPPING // No GC with the C++11 mapping if(dynamic_pointer_cast<B>(d->theA)) { @@ -107,8 +117,13 @@ clear(const DPtr& d) d->theA = nullptr; clear(d->theB); d->theB = nullptr; -#endif } +#else +void +clear(const DPtr&) +{ +} +#endif } @@ -341,10 +356,12 @@ allTests(Test::TestHelper* helper) cout << "ok" << endl; cout << "getting K... " << flush; - KPtr k = initial->getK(); - LPtr l = ICE_DYNAMIC_CAST(L, k->value); - test(l); - test(l->data == "l"); + { + KPtr k = initial->getK(); + LPtr l = ICE_DYNAMIC_CAST(L, k->value); + test(l); + test(l->data == "l"); + } cout << "ok" << endl; cout << "testing Value as parameter..." << flush; @@ -434,10 +451,10 @@ allTests(Test::TestHelper* helper) cout << "testing recursive type... " << flush; RecursivePtr top = ICE_MAKE_SHARED(Recursive); - RecursivePtr p = top; int depth = 0; try { + RecursivePtr p = top; #if defined(NDEBUG) || !defined(__APPLE__) const int maxDepth = 2000; #else @@ -513,9 +530,9 @@ allTests(Test::TestHelper* helper) cout << "testing Object factory registration... " << flush; { - BasePtr base = p->opDerived(); - test(base); - test(base->ice_id() == "::Test::Derived"); + BasePtr basePtr = p->opDerived(); + test(basePtr); + test(basePtr->ice_id() == "::Test::Derived"); } cout << "ok" << endl; diff --git a/cpp/test/Ice/objects/Client.cpp b/cpp/test/Ice/objects/Client.cpp index 677d60e32a8..763dcffa4e1 100644 --- a/cpp/test/Ice/objects/Client.cpp +++ b/cpp/test/Ice/objects/Client.cpp @@ -98,7 +98,7 @@ public: assert(_destroyed); } - virtual Ice::ValuePtr create(const string& type) + virtual Ice::ValuePtr create(const string&) { return ICE_NULLPTR; } diff --git a/cpp/test/Ice/objects/Collocated.cpp b/cpp/test/Ice/objects/Collocated.cpp index 01a2e3c99a8..a8780f5a166 100644 --- a/cpp/test/Ice/objects/Collocated.cpp +++ b/cpp/test/Ice/objects/Collocated.cpp @@ -91,7 +91,7 @@ public: assert(_destroyed); } - virtual Ice::ValuePtr create(const string& type) + virtual Ice::ValuePtr create(const string&) { return ICE_NULLPTR; } diff --git a/cpp/test/Ice/operations/BatchOneways.cpp b/cpp/test/Ice/operations/BatchOneways.cpp index 63a4e7ed63b..2f1c180867d 100644 --- a/cpp/test/Ice/operations/BatchOneways.cpp +++ b/cpp/test/Ice/operations/BatchOneways.cpp @@ -141,15 +141,16 @@ batchOneways(const Test::MyClassPrxPtr& p) Ice::Identity identity; identity.name = "invalid"; - Ice::ObjectPrxPtr batch3 = batch->ice_identity(identity); - batch3->ice_ping(); - batch3->ice_flushBatchRequests(); - - // Make sure that a bogus batch request doesn't cause troubles to other ones. - batch3->ice_ping(); - batch->ice_ping(); - batch->ice_flushBatchRequests(); - batch->ice_ping(); + { + Ice::ObjectPrxPtr batch3 = batch->ice_identity(identity); + batch3->ice_ping(); + batch3->ice_flushBatchRequests(); + // Make sure that a bogus batch request doesn't cause troubles to other ones. + batch3->ice_ping(); + batch->ice_ping(); + batch->ice_flushBatchRequests(); + batch->ice_ping(); + } if(batch->ice_getConnection() && p->ice_getCommunicator()->getProperties()->getProperty("Ice.Default.Protocol") != "bt") @@ -159,41 +160,41 @@ batchOneways(const Test::MyClassPrxPtr& p) BatchRequestInterceptorIPtr interceptor = ICE_MAKE_SHARED(BatchRequestInterceptorI); #if defined(ICE_CPP11_MAPPING) - initData.batchRequestInterceptor = [=](const Ice::BatchRequest& request, int count, int size) + initData.batchRequestInterceptor = [=](const Ice::BatchRequest& request, int countP, int size) { - interceptor->enqueue(request, count, size); + interceptor->enqueue(request, countP, size); }; #else initData.batchRequestInterceptor = interceptor; #endif Ice::CommunicatorPtr ic = Ice::initialize(initData); - Test::MyClassPrxPtr batch = + Test::MyClassPrxPtr batch4 = ICE_UNCHECKED_CAST(Test::MyClassPrx, ic->stringToProxy(p->ice_toString()))->ice_batchOneway(); test(interceptor->count() == 0); - batch->ice_ping(); - batch->ice_ping(); - batch->ice_ping(); + batch4->ice_ping(); + batch4->ice_ping(); + batch4->ice_ping(); test(interceptor->count() == 0); interceptor->enqueue(true); - batch->ice_ping(); - batch->ice_ping(); - batch->ice_ping(); + batch4->ice_ping(); + batch4->ice_ping(); + batch4->ice_ping(); test(interceptor->count() == 3); - batch->ice_flushBatchRequests(); - batch->ice_ping(); + batch4->ice_flushBatchRequests(); + batch4->ice_ping(); test(interceptor->count() == 1); - batch->opByteSOneway(bs1); + batch4->opByteSOneway(bs1); test(interceptor->count() == 2); - batch->opByteSOneway(bs1); + batch4->opByteSOneway(bs1); test(interceptor->count() == 3); - batch->opByteSOneway(bs1); // This should trigger the flush - batch->ice_ping(); + batch4->opByteSOneway(bs1); // This should trigger the flush + batch4->ice_ping(); test(interceptor->count() == 2); ic->destroy(); diff --git a/cpp/test/Ice/operations/TestI.cpp b/cpp/test/Ice/operations/TestI.cpp index 96651a25d4b..d23f1372a4d 100644 --- a/cpp/test/Ice/operations/TestI.cpp +++ b/cpp/test/Ice/operations/TestI.cpp @@ -65,7 +65,7 @@ MyDerivedClassI::shutdown(const Ice::Current& current) } bool -MyDerivedClassI::supportsCompress(const Ice::Current& current) +MyDerivedClassI::supportsCompress(const Ice::Current&) { #if defined(ICE_OS_UWP) return false; diff --git a/cpp/test/Ice/operations/Twoways.cpp b/cpp/test/Ice/operations/Twoways.cpp index c2222899420..8730e4e7f24 100644 --- a/cpp/test/Ice/operations/Twoways.cpp +++ b/cpp/test/Ice/operations/Twoways.cpp @@ -936,28 +936,28 @@ twoways(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrxPtr& p) } { - Test::MyStruct s11 = { 1, 1 }; - Test::MyStruct s12 = { 1, 2 }; + Test::MyStruct ms11 = { 1, 1 }; + Test::MyStruct ms12 = { 1, 2 }; Test::MyStructMyEnumD di1; - di1[s11] = ICE_ENUM(MyEnum, enum1); - di1[s12] = ICE_ENUM(MyEnum, enum2); + di1[ms11] = ICE_ENUM(MyEnum, enum1); + di1[ms12] = ICE_ENUM(MyEnum, enum2); - Test::MyStruct s22 = { 2, 2 }; - Test::MyStruct s23 = { 2, 3 }; + Test::MyStruct ms22 = { 2, 2 }; + Test::MyStruct ms23 = { 2, 3 }; Test::MyStructMyEnumD di2; - di2[s11] = ICE_ENUM(MyEnum, enum1); - di2[s22] = ICE_ENUM(MyEnum, enum3); - di2[s23] = ICE_ENUM(MyEnum, enum2); + di2[ms11] = ICE_ENUM(MyEnum, enum1); + di2[ms22] = ICE_ENUM(MyEnum, enum3); + di2[ms23] = ICE_ENUM(MyEnum, enum2); Test::MyStructMyEnumD _do; Test::MyStructMyEnumD ro = p->opMyStructMyEnumD(di1, di2, _do); test(_do == di1); test(ro.size() == 4); - test(ro[s11] == ICE_ENUM(MyEnum, enum1)); - test(ro[s12] == ICE_ENUM(MyEnum, enum2)); - test(ro[s22] == ICE_ENUM(MyEnum, enum3)); - test(ro[s23] == ICE_ENUM(MyEnum, enum2)); + test(ro[ms11] == ICE_ENUM(MyEnum, enum1)); + test(ro[ms12] == ICE_ENUM(MyEnum, enum2)); + test(ro[ms22] == ICE_ENUM(MyEnum, enum3)); + test(ro[ms23] == ICE_ENUM(MyEnum, enum2)); } { @@ -1261,21 +1261,21 @@ twoways(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrxPtr& p) Test::MyStructMyEnumDS dsi2; dsi2.resize(1); - Test::MyStruct s11 = { 1, 1 }; - Test::MyStruct s12 = { 1, 2 }; + Test::MyStruct ms11 = { 1, 1 }; + Test::MyStruct ms12 = { 1, 2 }; Test::MyStructMyEnumD di1; - di1[s11] = ICE_ENUM(MyEnum, enum1); - di1[s12] = ICE_ENUM(MyEnum, enum2); + di1[ms11] = ICE_ENUM(MyEnum, enum1); + di1[ms12] = ICE_ENUM(MyEnum, enum2); - Test::MyStruct s22 = { 2, 2 }; - Test::MyStruct s23 = { 2, 3 }; + Test::MyStruct ms22 = { 2, 2 }; + Test::MyStruct ms23 = { 2, 3 }; Test::MyStructMyEnumD di2; - di2[s11] = ICE_ENUM(MyEnum, enum1); - di2[s22] = ICE_ENUM(MyEnum, enum3); - di2[s23] = ICE_ENUM(MyEnum, enum2); + di2[ms11] = ICE_ENUM(MyEnum, enum1); + di2[ms22] = ICE_ENUM(MyEnum, enum3); + di2[ms23] = ICE_ENUM(MyEnum, enum2); Test::MyStructMyEnumD di3; - di3[s23] = ICE_ENUM(MyEnum, enum3); + di3[ms23] = ICE_ENUM(MyEnum, enum3); dsi1[0] = di1; dsi1[1] = di2; @@ -1288,23 +1288,23 @@ twoways(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrxPtr& p) test(ro.size() == 2); test(ro[0].size() == 3); - test(ro[0][s11] == ICE_ENUM(MyEnum, enum1)); - test(ro[0][s22] == ICE_ENUM(MyEnum, enum3)); - test(ro[0][s23] == ICE_ENUM(MyEnum, enum2)); + test(ro[0][ms11] == ICE_ENUM(MyEnum, enum1)); + test(ro[0][ms22] == ICE_ENUM(MyEnum, enum3)); + test(ro[0][ms23] == ICE_ENUM(MyEnum, enum2)); test(ro[1].size() == 2); - test(ro[1][s11] == ICE_ENUM(MyEnum, enum1)); - test(ro[1][s12] == ICE_ENUM(MyEnum, enum2)); + test(ro[1][ms11] == ICE_ENUM(MyEnum, enum1)); + test(ro[1][ms12] == ICE_ENUM(MyEnum, enum2)); test(_do.size() == 3); test(_do[0].size() == 1); - test(_do[0][s23] == ICE_ENUM(MyEnum, enum3)); + test(_do[0][ms23] == ICE_ENUM(MyEnum, enum3)); test(_do[1].size() == 2); - test(_do[1][s11] == ICE_ENUM(MyEnum, enum1)); - test(_do[1][s12] == ICE_ENUM(MyEnum, enum2)); + test(_do[1][ms11] == ICE_ENUM(MyEnum, enum1)); + test(_do[1][ms12] == ICE_ENUM(MyEnum, enum2)); test(_do[2].size() == 3); - test(_do[2][s11] == ICE_ENUM(MyEnum, enum1)); - test(_do[2][s22] == ICE_ENUM(MyEnum, enum3)); - test(_do[2][s23] == ICE_ENUM(MyEnum, enum2)); + test(_do[2][ms11] == ICE_ENUM(MyEnum, enum1)); + test(_do[2][ms22] == ICE_ENUM(MyEnum, enum3)); + test(_do[2][ms23] == ICE_ENUM(MyEnum, enum2)); } catch(const Ice::OperationNotExistException&) { @@ -1710,27 +1710,29 @@ twoways(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrxPtr& p) } { - Ice::Context ctx; - ctx["one"] = "ONE"; - ctx["two"] = "TWO"; - ctx["three"] = "THREE"; { - Test::StringStringD r = p->opContext(); - test(p->ice_getContext().empty()); - test(r != ctx); - } - { - Test::StringStringD r = p->opContext(ctx); - test(p->ice_getContext().empty()); - test(r == ctx); - } - { - Test::MyClassPrxPtr p2 = ICE_CHECKED_CAST(Test::MyClassPrx, p->ice_context(ctx)); - test(p2->ice_getContext() == ctx); - Test::StringStringD r = p2->opContext(); - test(r == ctx); - r = p2->opContext(ctx); - test(r == ctx); + Ice::Context ctx; + ctx["one"] = "ONE"; + ctx["two"] = "TWO"; + ctx["three"] = "THREE"; + { + Test::StringStringD r = p->opContext(); + test(p->ice_getContext().empty()); + test(r != ctx); + } + { + Test::StringStringD r = p->opContext(ctx); + test(p->ice_getContext().empty()); + test(r == ctx); + } + { + Test::MyClassPrxPtr p2 = ICE_CHECKED_CAST(Test::MyClassPrx, p->ice_context(ctx)); + test(p2->ice_getContext() == ctx); + Test::StringStringD r = p2->opContext(); + test(r == ctx); + r = p2->opContext(ctx); + test(r == ctx); + } } if(p->ice_getConnection() && communicator->getProperties()->getProperty("Ice.Default.Protocol") != "bt") @@ -1754,13 +1756,13 @@ twoways(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrxPtr& p) ctx["three"] = "THREE"; Ice::PropertiesPtr properties = ic->getProperties(); - Test::MyClassPrxPtr p = + Test::MyClassPrxPtr q = ICE_UNCHECKED_CAST(Test::MyClassPrx, ic->stringToProxy("test:" + TestHelper::getTestEndpoint(properties, 0))); ic->getImplicitContext()->setContext(ctx); test(ic->getImplicitContext()->getContext() == ctx); - test(p->opContext() == ctx); + test(q->opContext() == ctx); test(ic->getImplicitContext()->containsKey("zero") == false); string r = ic->getImplicitContext()->put("zero", "ZERO"); @@ -1769,7 +1771,7 @@ twoways(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrxPtr& p) test(ic->getImplicitContext()->get("zero") == "ZERO"); ctx = ic->getImplicitContext()->getContext(); - test(p->opContext() == ctx); + test(q->opContext() == ctx); Ice::Context prxContext; prxContext["one"] = "UN"; prxContext["four"] = "QUATRE"; @@ -1778,19 +1780,19 @@ twoways(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrxPtr& p) combined.insert(ctx.begin(), ctx.end()); test(combined["one"] == "UN"); - p = ICE_UNCHECKED_CAST(Test::MyClassPrx, p->ice_context(prxContext)); + q = ICE_UNCHECKED_CAST(Test::MyClassPrx, q->ice_context(prxContext)); ic->getImplicitContext()->setContext(Ice::Context()); - test(p->opContext() == prxContext); + test(q->opContext() == prxContext); ic->getImplicitContext()->setContext(ctx); - test(p->opContext() == combined); + test(q->opContext() == combined); test(ic->getImplicitContext()->remove("one") == "ONE"); if(impls[i] == "PerThread") { - IceUtil::ThreadPtr thread = new PerThreadContextInvokeThread(p->ice_context(Ice::Context())); + IceUtil::ThreadPtr thread = new PerThreadContextInvokeThread(q->ice_context(Ice::Context())); thread->start(); thread->getThreadControl().join(); } diff --git a/cpp/test/Ice/operations/TwowaysAMI.cpp b/cpp/test/Ice/operations/TwowaysAMI.cpp index 47451f5c41a..2dee6c11358 100644 --- a/cpp/test/Ice/operations/TwowaysAMI.cpp +++ b/cpp/test/Ice/operations/TwowaysAMI.cpp @@ -519,23 +519,23 @@ public: void opMyStructMyEnumD(const Test::MyStructMyEnumD& ro, const Test::MyStructMyEnumD& _do) { - Test::MyStruct s11 = { 1, 1 }; - Test::MyStruct s12 = { 1, 2 }; + Test::MyStruct ms11 = { 1, 1 }; + Test::MyStruct ms12 = { 1, 2 }; Test::MyStructMyEnumD di1; - di1[s11] = ICE_ENUM(Test::MyEnum, enum1); - di1[s12] = ICE_ENUM(Test::MyEnum, enum2); + di1[ms11] = ICE_ENUM(Test::MyEnum, enum1); + di1[ms12] = ICE_ENUM(Test::MyEnum, enum2); test(_do == di1); - Test::MyStruct s22 = { 2, 2 }; - Test::MyStruct s23 = { 2, 3 }; + Test::MyStruct ms22 = { 2, 2 }; + Test::MyStruct ms23 = { 2, 3 }; test(ro.size() == 4); - test(ro.find(s11) != ro.end()); - test(ro.find(s11)->second == ICE_ENUM(Test::MyEnum, enum1)); - test(ro.find(s12) != ro.end()); - test(ro.find(s12)->second == ICE_ENUM(Test::MyEnum, enum2)); - test(ro.find(s22) != ro.end()); - test(ro.find(s22)->second == ICE_ENUM(Test::MyEnum, enum3)); - test(ro.find(s23) != ro.end()); - test(ro.find(s23)->second == ICE_ENUM(Test::MyEnum, enum2)); + test(ro.find(ms11) != ro.end()); + test(ro.find(ms11)->second == ICE_ENUM(Test::MyEnum, enum1)); + test(ro.find(ms12) != ro.end()); + test(ro.find(ms12)->second == ICE_ENUM(Test::MyEnum, enum2)); + test(ro.find(ms22) != ro.end()); + test(ro.find(ms22)->second == ICE_ENUM(Test::MyEnum, enum3)); + test(ro.find(ms23) != ro.end()); + test(ro.find(ms23)->second == ICE_ENUM(Test::MyEnum, enum2)); called(); } @@ -737,40 +737,40 @@ public: void opMyStructMyEnumDS(const Test::MyStructMyEnumDS& ro, const Test::MyStructMyEnumDS& _do) { - Test::MyStruct s11 = { 1, 1 }; - Test::MyStruct s12 = { 1, 2 }; - Test::MyStruct s22 = { 2, 2 }; - Test::MyStruct s23 = { 2, 3 }; + Test::MyStruct ms11 = { 1, 1 }; + Test::MyStruct ms12 = { 1, 2 }; + Test::MyStruct ms22 = { 2, 2 }; + Test::MyStruct ms23 = { 2, 3 }; test(ro.size() == 2); test(ro[0].size() == 3); - test(ro[0].find(s11) != ro[0].end()); - test(ro[0].find(s11)->second == ICE_ENUM(Test::MyEnum, enum1)); - test(ro[0].find(s22) != ro[0].end()); - test(ro[0].find(s22)->second == ICE_ENUM(Test::MyEnum, enum3)); - test(ro[0].find(s23) != ro[0].end()); - test(ro[0].find(s23)->second == ICE_ENUM(Test::MyEnum, enum2)); + test(ro[0].find(ms11) != ro[0].end()); + test(ro[0].find(ms11)->second == ICE_ENUM(Test::MyEnum, enum1)); + test(ro[0].find(ms22) != ro[0].end()); + test(ro[0].find(ms22)->second == ICE_ENUM(Test::MyEnum, enum3)); + test(ro[0].find(ms23) != ro[0].end()); + test(ro[0].find(ms23)->second == ICE_ENUM(Test::MyEnum, enum2)); test(ro[1].size() == 2); - test(ro[1].find(s11) != ro[1].end()); - test(ro[1].find(s11)->second == ICE_ENUM(Test::MyEnum, enum1)); - test(ro[1].find(s12) != ro[1].end()); - test(ro[1].find(s12)->second == ICE_ENUM(Test::MyEnum, enum2)); + test(ro[1].find(ms11) != ro[1].end()); + test(ro[1].find(ms11)->second == ICE_ENUM(Test::MyEnum, enum1)); + test(ro[1].find(ms12) != ro[1].end()); + test(ro[1].find(ms12)->second == ICE_ENUM(Test::MyEnum, enum2)); test(_do.size() == 3); test(_do[0].size() == 1); - test(_do[0].find(s23) != _do[0].end()); - test(_do[0].find(s23)->second == ICE_ENUM(Test::MyEnum, enum3)); + test(_do[0].find(ms23) != _do[0].end()); + test(_do[0].find(ms23)->second == ICE_ENUM(Test::MyEnum, enum3)); test(_do[1].size() == 2); - test(_do[1].find(s11) != _do[1].end()); - test(_do[1].find(s11)->second == ICE_ENUM(Test::MyEnum, enum1)); - test(_do[1].find(s12) != _do[1].end()); - test(_do[1].find(s12)->second == ICE_ENUM(Test::MyEnum, enum2)); + test(_do[1].find(ms11) != _do[1].end()); + test(_do[1].find(ms11)->second == ICE_ENUM(Test::MyEnum, enum1)); + test(_do[1].find(ms12) != _do[1].end()); + test(_do[1].find(ms12)->second == ICE_ENUM(Test::MyEnum, enum2)); test(_do[2].size() == 3); - test(_do[2].find(s11) != _do[2].end()); - test(_do[2].find(s11)->second == ICE_ENUM(Test::MyEnum, enum1)); - test(_do[2].find(s22) != _do[2].end()); - test(_do[2].find(s22)->second == ICE_ENUM(Test::MyEnum, enum3)); - test(_do[2].find(s23) != _do[2].end()); - test(_do[2].find(s23)->second == ICE_ENUM(Test::MyEnum, enum2)); + test(_do[2].find(ms11) != _do[2].end()); + test(_do[2].find(ms11)->second == ICE_ENUM(Test::MyEnum, enum1)); + test(_do[2].find(ms22) != _do[2].end()); + test(_do[2].find(ms22)->second == ICE_ENUM(Test::MyEnum, enum3)); + test(_do[2].find(ms23) != _do[2].end()); + test(_do[2].find(ms23)->second == ICE_ENUM(Test::MyEnum, enum2)); called(); } @@ -1191,9 +1191,9 @@ twowaysAMI(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrxPtr& CallbackPtr cb = ICE_MAKE_SHARED(Callback); #ifdef ICE_CPP11_MAPPING p->opShortIntLongAsync(10, 11, 12, - [&](long long int l1, short s1, int i1, long long int l2) + [&](long long int l1, short s1P, int i1, long long int l2) { - cb->opShortIntLong(l1, s1, i1, l2); + cb->opShortIntLong(l1, s1P, i1, l2); }, makeExceptionClosure(cb)); #else @@ -1225,9 +1225,9 @@ twowaysAMI(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrxPtr& CallbackPtr cb = ICE_MAKE_SHARED(Callback); #ifdef ICE_CPP11_MAPPING p->opStringAsync("hello", "world", - [&](string s1, string s2) + [&](string s1P, string s2P) { - cb->opString(move(s1), move(s2)); + cb->opString(move(s1P), move(s2P)); }, makeExceptionClosure(cb)); #else @@ -1729,18 +1729,18 @@ twowaysAMI(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrxPtr& } { - Test::MyStruct s11 = { 1, 1 }; - Test::MyStruct s12 = { 1, 2 }; + Test::MyStruct ms11 = { 1, 1 }; + Test::MyStruct ms12 = { 1, 2 }; Test::MyStructMyEnumD di1; - di1[s11] = ICE_ENUM(Test::MyEnum, enum1); - di1[s12] = ICE_ENUM(Test::MyEnum, enum2); + di1[ms11] = ICE_ENUM(Test::MyEnum, enum1); + di1[ms12] = ICE_ENUM(Test::MyEnum, enum2); - Test::MyStruct s22 = { 2, 2 }; - Test::MyStruct s23 = { 2, 3 }; + Test::MyStruct ms22 = { 2, 2 }; + Test::MyStruct ms23 = { 2, 3 }; Test::MyStructMyEnumD di2; - di2[s11] = ICE_ENUM(Test::MyEnum, enum1); - di2[s22] = ICE_ENUM(Test::MyEnum, enum3); - di2[s23] = ICE_ENUM(Test::MyEnum, enum2); + di2[ms11] = ICE_ENUM(Test::MyEnum, enum1); + di2[ms22] = ICE_ENUM(Test::MyEnum, enum3); + di2[ms23] = ICE_ENUM(Test::MyEnum, enum2); CallbackPtr cb = ICE_MAKE_SHARED(Callback); #ifdef ICE_CPP11_MAPPING @@ -1980,21 +1980,21 @@ twowaysAMI(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrxPtr& Test::MyStructMyEnumDS dsi2; dsi2.resize(1); - Test::MyStruct s11 = { 1, 1 }; - Test::MyStruct s12 = { 1, 2 }; + Test::MyStruct ms11 = { 1, 1 }; + Test::MyStruct ms12 = { 1, 2 }; Test::MyStructMyEnumD di1; - di1[s11] = ICE_ENUM(Test::MyEnum, enum1); - di1[s12] = ICE_ENUM(Test::MyEnum, enum2); + di1[ms11] = ICE_ENUM(Test::MyEnum, enum1); + di1[ms12] = ICE_ENUM(Test::MyEnum, enum2); - Test::MyStruct s22 = { 2, 2 }; - Test::MyStruct s23 = { 2, 3 }; + Test::MyStruct ms22 = { 2, 2 }; + Test::MyStruct ms23 = { 2, 3 }; Test::MyStructMyEnumD di2; - di2[s11] = ICE_ENUM(Test::MyEnum, enum1); - di2[s22] = ICE_ENUM(Test::MyEnum, enum3); - di2[s23] = ICE_ENUM(Test::MyEnum, enum2); + di2[ms11] = ICE_ENUM(Test::MyEnum, enum1); + di2[ms22] = ICE_ENUM(Test::MyEnum, enum3); + di2[ms23] = ICE_ENUM(Test::MyEnum, enum2); Test::MyStructMyEnumD di3; - di3[s23] = ICE_ENUM(Test::MyEnum, enum3); + di3[ms23] = ICE_ENUM(Test::MyEnum, enum3); dsi1[0] = di1; dsi1[1] = di2; @@ -2350,9 +2350,9 @@ twowaysAMI(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrxPtr& CallbackPtr cb = ICE_MAKE_SHARED(Callback); #ifdef ICE_CPP11_MAPPING p->opIntSAsync(s, - [&](Test::IntS s1) + [&](Test::IntS s1P) { - cb->opIntS(s1); + cb->opIntS(s1P); }, makeExceptionClosure(cb)); #else @@ -2365,94 +2365,96 @@ twowaysAMI(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrxPtr& } { - Test::StringStringD ctx; - ctx["one"] = "ONE"; - ctx["two"] = "TWO"; - ctx["three"] = "THREE"; { - test(p->ice_getContext().empty()); + Ice::Context ctx; + ctx["one"] = "ONE"; + ctx["two"] = "TWO"; + ctx["three"] = "THREE"; + { + test(p->ice_getContext().empty()); #ifdef ICE_CPP11_MAPPING - promise<void> prom; - p->opContextAsync( - [&](Ice::Context c) - { - test(c != ctx); - prom.set_value(); - }, - [](exception_ptr) - { - test(false); - }); - prom.get_future().get(); + promise<void> prom; + p->opContextAsync( + [&](Ice::Context c) + { + test(c != ctx); + prom.set_value(); + }, + [](exception_ptr) + { + test(false); + }); + prom.get_future().get(); #else - Ice::AsyncResultPtr r = p->begin_opContext(); - Ice::Context c = p->end_opContext(r); - test(c != ctx); + Ice::AsyncResultPtr r = p->begin_opContext(); + Ice::Context c = p->end_opContext(r); + test(c != ctx); #endif - } - { - test(p->ice_getContext().empty()); + } + { + test(p->ice_getContext().empty()); #ifdef ICE_CPP11_MAPPING - promise<void> prom; - p->opContextAsync( - [&](Ice::Context c) - { - test(c == ctx); - prom.set_value(); - }, - [](exception_ptr) - { - test(false); - }, nullptr, ctx); - prom.get_future().get(); + promise<void> prom; + p->opContextAsync( + [&](Ice::Context c) + { + test(c == ctx); + prom.set_value(); + }, + [](exception_ptr) + { + test(false); + }, nullptr, ctx); + prom.get_future().get(); #else - Ice::AsyncResultPtr r = p->begin_opContext(ctx); - Ice::Context c = p->end_opContext(r); - test(c == ctx); + Ice::AsyncResultPtr r = p->begin_opContext(ctx); + Ice::Context c = p->end_opContext(r); + test(c == ctx); #endif - } - Test::MyClassPrxPtr p2 = ICE_CHECKED_CAST(Test::MyClassPrx, p->ice_context(ctx)); - test(p2->ice_getContext() == ctx); - { + } + { + Test::MyClassPrxPtr p2 = ICE_CHECKED_CAST(Test::MyClassPrx, p->ice_context(ctx)); + test(p2->ice_getContext() == ctx); #ifdef ICE_CPP11_MAPPING - promise<void> prom; - p2->opContextAsync( - [&](Ice::Context c) - { - test(c == ctx); - prom.set_value(); - }, - [](exception_ptr) - { - test(false); - }); - prom.get_future().get(); + promise<void> prom; + p2->opContextAsync( + [&](Ice::Context c) + { + test(c == ctx); + prom.set_value(); + }, + [](exception_ptr) + { + test(false); + }); + prom.get_future().get(); #else - Ice::AsyncResultPtr r = p2->begin_opContext(); - Ice::Context c = p2->end_opContext(r); - test(c == ctx); + Ice::AsyncResultPtr r = p2->begin_opContext(); + Ice::Context c = p2->end_opContext(r); + test(c == ctx); #endif - } - { - Test::MyClassPrxPtr p2 = ICE_CHECKED_CAST(Test::MyClassPrx, p->ice_context(ctx)); + } + { + Test::MyClassPrxPtr p2 = ICE_CHECKED_CAST(Test::MyClassPrx, p->ice_context(ctx)); #ifdef ICE_CPP11_MAPPING - promise<void> prom; - p2->opContextAsync( - [&](Ice::Context c) - { - test(c == ctx); - prom.set_value(); - }, - [](exception_ptr) - { - test(false); - }, nullptr, ctx); - prom.get_future().get(); + promise<void> prom; + p2->opContextAsync( + [&](Ice::Context c) + { + test(c == ctx); + prom.set_value(); + }, + [](exception_ptr) + { + test(false); + }, nullptr, ctx); + prom.get_future().get(); #else - Ice::AsyncResultPtr r = p2->begin_opContext(ctx); - Ice::Context c = p2->end_opContext(r); - test(c == ctx); + Ice::AsyncResultPtr r = p2->begin_opContext(ctx); + Ice::Context c = p2->end_opContext(r); + test(c == ctx); #endif + } } if(p->ice_getConnection() && communicator->getProperties()->getProperty("Ice.Default.Protocol") != "bt") @@ -2476,7 +2478,7 @@ twowaysAMI(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrxPtr& ctx["three"] = "THREE"; Ice::PropertiesPtr properties = ic->getProperties(); - Test::MyClassPrxPtr p = + Test::MyClassPrxPtr q = ICE_UNCHECKED_CAST(Test::MyClassPrx, ic->stringToProxy("test:" + TestHelper::getTestEndpoint(properties))); ic->getImplicitContext()->setContext(ctx); @@ -2484,7 +2486,7 @@ twowaysAMI(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrxPtr& { #ifdef ICE_CPP11_MAPPING promise<void> prom; - p->opContextAsync( + q->opContextAsync( [&](Ice::Context c) { test(c == ctx); @@ -2496,8 +2498,8 @@ twowaysAMI(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrxPtr& }); prom.get_future().get(); #else - Ice::AsyncResultPtr r = p->begin_opContext(); - Ice::Context c = p->end_opContext(r); + Ice::AsyncResultPtr r = q->begin_opContext(); + Ice::Context c = q->end_opContext(r); test(c == ctx); #endif } @@ -2508,7 +2510,7 @@ twowaysAMI(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrxPtr& { #ifdef ICE_CPP11_MAPPING promise<void> prom; - p->opContextAsync( + q->opContextAsync( [&](Ice::Context c) { test(c == ctx); @@ -2528,8 +2530,8 @@ twowaysAMI(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrxPtr& }); prom.get_future().get(); #else - Ice::AsyncResultPtr r = p->begin_opContext(); - Ice::Context c = p->end_opContext(r); + Ice::AsyncResultPtr r = q->begin_opContext(); + Ice::Context c = q->end_opContext(r); test(c == ctx); #endif } @@ -2542,13 +2544,13 @@ twowaysAMI(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrxPtr& combined.insert(ctx.begin(), ctx.end()); test(combined["one"] == "UN"); - p = ICE_UNCHECKED_CAST(Test::MyClassPrx, p->ice_context(prxContext)); + q = ICE_UNCHECKED_CAST(Test::MyClassPrx, q->ice_context(prxContext)); ic->getImplicitContext()->setContext(Ice::Context()); { #ifdef ICE_CPP11_MAPPING promise<void> prom; - p->opContextAsync( + q->opContextAsync( [&](Ice::Context c) { test(c == prxContext); @@ -2560,8 +2562,8 @@ twowaysAMI(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrxPtr& }); prom.get_future().get(); #else - Ice::AsyncResultPtr r = p->begin_opContext(); - Ice::Context c = p->end_opContext(r); + Ice::AsyncResultPtr r = q->begin_opContext(); + Ice::Context c = q->end_opContext(r); test(c == prxContext); #endif } @@ -2570,7 +2572,7 @@ twowaysAMI(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrxPtr& { #ifdef ICE_CPP11_MAPPING promise<void> prom; - p->opContextAsync( + q->opContextAsync( [&](Ice::Context c) { test(c == combined); @@ -2582,8 +2584,8 @@ twowaysAMI(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrxPtr& }); prom.get_future().get(); #else - Ice::AsyncResultPtr r = p->begin_opContext(); - Ice::Context c = p->end_opContext(r); + Ice::AsyncResultPtr r = q->begin_opContext(); + Ice::Context c = q->end_opContext(r); test(c == combined); #endif } @@ -3305,18 +3307,18 @@ twowaysAMI(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrxPtr& } { - Test::MyStruct s11 = { 1, 1 }; - Test::MyStruct s12 = { 1, 2 }; + Test::MyStruct ms11 = { 1, 1 }; + Test::MyStruct ms12 = { 1, 2 }; Test::MyStructMyEnumD di1; - di1[s11] = ICE_ENUM(Test::MyEnum, enum1); - di1[s12] = ICE_ENUM(Test::MyEnum, enum2); + di1[ms11] = ICE_ENUM(Test::MyEnum, enum1); + di1[ms12] = ICE_ENUM(Test::MyEnum, enum2); - Test::MyStruct s22 = { 2, 2 }; - Test::MyStruct s23 = { 2, 3 }; + Test::MyStruct ms22 = { 2, 2 }; + Test::MyStruct ms23 = { 2, 3 }; Test::MyStructMyEnumD di2; - di2[s11] = ICE_ENUM(Test::MyEnum, enum1); - di2[s22] = ICE_ENUM(Test::MyEnum, enum3); - di2[s23] = ICE_ENUM(Test::MyEnum, enum2); + di2[ms11] = ICE_ENUM(Test::MyEnum, enum1); + di2[ms22] = ICE_ENUM(Test::MyEnum, enum3); + di2[ms23] = ICE_ENUM(Test::MyEnum, enum2); CallbackPtr cb = ICE_MAKE_SHARED(Callback); auto f = p->opMyStructMyEnumDAsync(di1, di2); @@ -3569,21 +3571,21 @@ twowaysAMI(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrxPtr& Test::MyStructMyEnumDS dsi2; dsi2.resize(1); - Test::MyStruct s11 = { 1, 1 }; - Test::MyStruct s12 = { 1, 2 }; + Test::MyStruct ms11 = { 1, 1 }; + Test::MyStruct ms12 = { 1, 2 }; Test::MyStructMyEnumD di1; - di1[s11] = ICE_ENUM(Test::MyEnum, enum1); - di1[s12] = ICE_ENUM(Test::MyEnum, enum2); + di1[ms11] = ICE_ENUM(Test::MyEnum, enum1); + di1[ms12] = ICE_ENUM(Test::MyEnum, enum2); - Test::MyStruct s22 = { 2, 2 }; - Test::MyStruct s23 = { 2, 3 }; + Test::MyStruct ms22 = { 2, 2 }; + Test::MyStruct ms23 = { 2, 3 }; Test::MyStructMyEnumD di2; - di2[s11] = ICE_ENUM(Test::MyEnum, enum1); - di2[s22] = ICE_ENUM(Test::MyEnum, enum3); - di2[s23] = ICE_ENUM(Test::MyEnum, enum2); + di2[ms11] = ICE_ENUM(Test::MyEnum, enum1); + di2[ms22] = ICE_ENUM(Test::MyEnum, enum3); + di2[ms23] = ICE_ENUM(Test::MyEnum, enum2); Test::MyStructMyEnumD di3; - di3[s23] = ICE_ENUM(Test::MyEnum, enum3); + di3[ms23] = ICE_ENUM(Test::MyEnum, enum3); dsi1[0] = di1; dsi1[1] = di2; diff --git a/cpp/test/Ice/optional/AllTests.cpp b/cpp/test/Ice/optional/AllTests.cpp index 6a5fb48be57..6d97a4401b3 100644 --- a/cpp/test/Ice/optional/AllTests.cpp +++ b/cpp/test/Ice/optional/AllTests.cpp @@ -907,24 +907,24 @@ allTests(Test::TestHelper* helper, bool) cout << "ok" << endl; cout << "testing tag marshalling... " << flush; - BPtr b = ICE_MAKE_SHARED(B); - BPtr b2 = ICE_DYNAMIC_CAST(B, initial->pingPong(b)); - test(!b2->ma); - test(!b2->mb); - test(!b2->mc); - - b->ma = 10; - b->mb = 11; - b->mc = 12; - b->md = 13; - - b2 = ICE_DYNAMIC_CAST(B, initial->pingPong(b)); - test(b2->ma == 10); - test(b2->mb == 11); - test(b2->mc == 12); - test(b2->md == 13); - { + BPtr b = ICE_MAKE_SHARED(B); + BPtr b2 = ICE_DYNAMIC_CAST(B, initial->pingPong(b)); + test(!b2->ma); + test(!b2->mb); + test(!b2->mc); + + b->ma = 10; + b->mb = 11; + b->mc = 12; + b->md = 13; + + b2 = ICE_DYNAMIC_CAST(B, initial->pingPong(b)); + test(b2->ma == 10); + test(b2->mb == 11); + test(b2->mc == 12); + test(b2->md == 13); + factory->setEnabled(true); Ice::OutputStream out(communicator); out.startEncapsulation(); diff --git a/cpp/test/Ice/optional/TestI.cpp b/cpp/test/Ice/optional/TestI.cpp index 1696df988f2..cfaac265930 100644 --- a/cpp/test/Ice/optional/TestI.cpp +++ b/cpp/test/Ice/optional/TestI.cpp @@ -39,7 +39,7 @@ InitialI::pingPong(shared_ptr<Value> obj, const Current& current) } #else Ice::ValuePtr -InitialI::pingPong(const Ice::ValuePtr& obj, const Current& current) +InitialI::pingPong(const Ice::ValuePtr& obj, const Current&) { return obj; } diff --git a/cpp/test/Ice/plugin/Plugin.cpp b/cpp/test/Ice/plugin/Plugin.cpp index 4ff2f7bccd4..0a2d9d6c900 100644 --- a/cpp/test/Ice/plugin/Plugin.cpp +++ b/cpp/test/Ice/plugin/Plugin.cpp @@ -356,7 +356,7 @@ extern "C" { ICE_DECLSPEC_EXPORT ::Ice::Plugin* -createPlugin(const Ice::CommunicatorPtr& communicator, const string&, const Ice::StringSeq& args) +createPlugin(const Ice::CommunicatorPtr& communicator, const string&, const Ice::StringSeq&) { return new Plugin(communicator); } diff --git a/cpp/test/Ice/proxy/AllTests.cpp b/cpp/test/Ice/proxy/AllTests.cpp index e82b881397b..b1a6e86b336 100644 --- a/cpp/test/Ice/proxy/AllTests.cpp +++ b/cpp/test/Ice/proxy/AllTests.cpp @@ -1122,30 +1122,30 @@ allTests(Test::TestHelper* helper) cout << "ok" << endl; cout << "testing checked cast with context... " << flush; - Ice::Context c = cl->getContext(); - test(c.size() == 0); + Ice::Context ctx = cl->getContext(); + test(ctx.size() == 0); - c["one"] = "hello"; - c["two"] = "world"; + ctx["one"] = "hello"; + ctx["two"] = "world"; #ifdef ICE_CPP11_MAPPING - cl = Ice::checkedCast<Test::MyClassPrx>(base, c); + cl = Ice::checkedCast<Test::MyClassPrx>(base, ctx); #else - cl = Test::MyClassPrx::checkedCast(base, c); + cl = Test::MyClassPrx::checkedCast(base, ctx); #endif Ice::Context c2 = cl->getContext(); - test(c == c2); + test(ctx == c2); // // Now with alternate API // #ifndef ICE_CPP11_MAPPING cl = Ice::checkedCast<Test::MyClassPrx>(base); - c = cl->getContext(); - test(c.size() == 0); + ctx = cl->getContext(); + test(ctx.size() == 0); - cl = Ice::checkedCast<Test::MyClassPrx>(base, c); + cl = Ice::checkedCast<Test::MyClassPrx>(base, ctx); c2 = cl->getContext(); - test(c == c2); + test(ctx == c2); #endif cout << "ok" << endl; @@ -1161,7 +1161,7 @@ allTests(Test::TestHelper* helper) test(cl->ice_secure(true)->ice_fixed(connection)->ice_isSecure()); test(cl->ice_facet("facet")->ice_fixed(connection)->ice_getFacet() == "facet"); test(cl->ice_oneway()->ice_fixed(connection)->ice_isOneway()); - Ice::Context ctx; + ctx.clear(); ctx["one"] = "hello"; ctx["two"] = "world"; test(cl->ice_fixed(connection)->ice_getContext().empty()); @@ -1432,8 +1432,10 @@ allTests(Test::TestHelper* helper) test(pstr == "test -t -e 1.1:tcp -h 127.0.0.1 -p 12010 -t 10000"); // Opaque endpoint encoded with 1.1 encoding. - Ice::ObjectPrxPtr p2 = communicator->stringToProxy("test -e 1.1:opaque -e 1.1 -t 1 -v CTEyNy4wLjAuMeouAAAQJwAAAA=="); - test(communicator->proxyToString(p2) == "test -t -e 1.1:tcp -h 127.0.0.1 -p 12010 -t 10000"); + { + Ice::ObjectPrxPtr p2 = communicator->stringToProxy("test -e 1.1:opaque -e 1.1 -t 1 -v CTEyNy4wLjAuMeouAAAQJwAAAA=="); + test(communicator->proxyToString(p2) == "test -t -e 1.1:tcp -h 127.0.0.1 -p 12010 -t 10000"); + } if(communicator->getProperties()->getPropertyAsInt("Ice.IPv6") == 0 && communicator->getProperties()->getProperty("Ice.Default.Host") == "127.0.0.1") diff --git a/cpp/test/Ice/retry/TestI.cpp b/cpp/test/Ice/retry/TestI.cpp index ed4e611790f..05d4516b89f 100644 --- a/cpp/test/Ice/retry/TestI.cpp +++ b/cpp/test/Ice/retry/TestI.cpp @@ -32,7 +32,7 @@ RetryI::op(bool kill, const Ice::Current& current) } int -RetryI::opIdempotent(int nRetry, const Ice::Current& current) +RetryI::opIdempotent(int nRetry, const Ice::Current&) { if(nRetry < 0) { @@ -51,7 +51,7 @@ RetryI::opIdempotent(int nRetry, const Ice::Current& current) } void -RetryI::opNotIdempotent(const Ice::Current& current) +RetryI::opNotIdempotent(const Ice::Current&) { throw Ice::ConnectionLostException(__FILE__, __LINE__); } diff --git a/cpp/test/Ice/scope/AllTests.cpp b/cpp/test/Ice/scope/AllTests.cpp index 2c2977da6d2..703db8fe69f 100644 --- a/cpp/test/Ice/scope/AllTests.cpp +++ b/cpp/test/Ice/scope/AllTests.cpp @@ -63,7 +63,7 @@ public: called(); } - void error(const Ice::Exception& ex) + void error(const Ice::Exception&) { test(false); } @@ -139,7 +139,7 @@ public: called(); } - void error(const Ice::Exception& ex) + void error(const Ice::Exception&) { test(false); } @@ -215,7 +215,7 @@ public: called(); } - void error(const Ice::Exception& ex) + void error(const Ice::Exception&) { test(false); } @@ -303,7 +303,7 @@ public: called(); } - void error(const Ice::Exception& ex) + void error(const Ice::Exception&) { test(false); } diff --git a/cpp/test/Ice/servantLocator/TestAMDI.cpp b/cpp/test/Ice/servantLocator/TestAMDI.cpp index d3522bd5f30..483312ec2fd 100644 --- a/cpp/test/Ice/servantLocator/TestAMDI.cpp +++ b/cpp/test/Ice/servantLocator/TestAMDI.cpp @@ -142,7 +142,7 @@ TestAMDI::asyncResponseAsync(function<void()> response, } void -TestAMDI::asyncExceptionAsync(function<void()> response, +TestAMDI::asyncExceptionAsync(function<void()>, function<void(exception_ptr)> error, const Current&) { @@ -159,7 +159,7 @@ TestAMDI::asyncExceptionAsync(function<void()> response, void TestAMDI::shutdownAsync(function<void()> response, - function<void(exception_ptr)> error, + function<void(exception_ptr)>, const Current& current) { current.adapter->deactivate(); diff --git a/cpp/test/Ice/services/AllTests.cpp b/cpp/test/Ice/services/AllTests.cpp index c88a66a0fdc..8df1aae6499 100644 --- a/cpp/test/Ice/services/AllTests.cpp +++ b/cpp/test/Ice/services/AllTests.cpp @@ -55,12 +55,12 @@ public: } virtual void - connectFailed(const Glacier2::SessionHelperPtr&, const Ice::Exception& ex) + connectFailed(const Glacier2::SessionHelperPtr&, const Ice::Exception&) { } virtual void - createdCommunicator(const Glacier2::SessionHelperPtr& session) + createdCommunicator(const Glacier2::SessionHelperPtr&) { } }; @@ -69,7 +69,7 @@ class SessionHelperClient { public: - int run(int argc, char* argv[]) + int run(int, char*[]) { _factory = ICE_MAKE_SHARED(Glacier2::SessionFactoryHelper, ICE_MAKE_SHARED(SessionCallbackI)); return EXIT_SUCCESS; diff --git a/cpp/test/Ice/slicing/objects/AllTests.cpp b/cpp/test/Ice/slicing/objects/AllTests.cpp index 9ca6c17e42b..06e00e7a24d 100644 --- a/cpp/test/Ice/slicing/objects/AllTests.cpp +++ b/cpp/test/Ice/slicing/objects/AllTests.cpp @@ -3137,8 +3137,7 @@ allTests(Test::TestHelper* helper) // // Sending more than 254 objects exercises the encoding for object ids. // - int i; - for(i = 0; i < 300; ++i) + for(int i = 0; i < 300; ++i) { PCDerived2Ptr p2 = ICE_MAKE_SHARED(PCDerived2); p2->pi = i; diff --git a/cpp/test/Ice/slicing/objects/TestI.cpp b/cpp/test/Ice/slicing/objects/TestI.cpp index b7ab0719ecc..9b423b9d7f4 100644 --- a/cpp/test/Ice/slicing/objects/TestI.cpp +++ b/cpp/test/Ice/slicing/objects/TestI.cpp @@ -441,15 +441,21 @@ TestI::returnTest2(BPtr& p1, BPtr& p2, const ::Ice::Current&) return p1; } +#ifdef ICE_CPP11_MAPPING BPtr TestI::returnTest3(ICE_IN(BPtr) p1, ICE_IN(BPtr) p2, const ::Ice::Current&) { -#ifdef ICE_CPP11_MAPPING _values.push_back(p1); _values.push_back(p2); -#endif return p1; } +#else +BPtr +TestI::returnTest3(ICE_IN(BPtr) p1, ICE_IN(BPtr), const ::Ice::Current&) +{ + return p1; +} +#endif SS3 TestI::sequenceTest(ICE_IN(SS1Ptr) p1, ICE_IN(SS2Ptr) p2, const ::Ice::Current&) diff --git a/cpp/test/Ice/stream/Client.cpp b/cpp/test/Ice/stream/Client.cpp index a88f05ea86e..eddc65c0062 100644 --- a/cpp/test/Ice/stream/Client.cpp +++ b/cpp/test/Ice/stream/Client.cpp @@ -83,22 +83,22 @@ namespace Ice template<class S> struct StreamWriter<TestObjectWriter, S> { - static void write(S* ostr, const TestObjectWriter&) { assert(false); } + static void write(S*, const TestObjectWriter&) { assert(false); } }; template<class S> struct StreamReader<TestObjectWriter, S> { - static void read(S* istr, TestObjectWriter&) { assert(false); } + static void read(S*, TestObjectWriter&) { assert(false); } }; template<class S> struct StreamWriter<TestObjectReader, S> { - static void write(S* ostr, const TestObjectReader&) { assert(false); } + static void write(S*, const TestObjectReader&) { assert(false); } }; template<class S> struct StreamReader<TestObjectReader, S> { - static void read(S* istr, TestObjectReader&) { assert(false); } + static void read(S*, TestObjectReader&) { assert(false); } }; } #endif @@ -900,8 +900,8 @@ allTests(Test::TestHelper* helper) test(arr2S[2].size() == arrS[2].size()); #ifdef ICE_CPP11_MAPPING - auto clearS = [](MyClassS& arr) { - for(MyClassS::iterator p = arr.begin(); p != arr.end(); ++p) + auto clearS = [](MyClassS& arr3) { + for(MyClassS::iterator p = arr3.begin(); p != arr3.end(); ++p) { if(*p) { @@ -911,8 +911,8 @@ allTests(Test::TestHelper* helper) } } }; - auto clearSS = [clearS](MyClassSS& arr) { - for(MyClassSS::iterator p = arr.begin(); p != arr.end(); ++p) + auto clearSS = [clearS](MyClassSS& arr3) { + for(MyClassSS::iterator p = arr3.begin(); p != arr3.end(); ++p) { clearS(*p); } diff --git a/cpp/test/Ice/timeout/AllTests.cpp b/cpp/test/Ice/timeout/AllTests.cpp index a9787193bc1..f29c4da7839 100644 --- a/cpp/test/Ice/timeout/AllTests.cpp +++ b/cpp/test/Ice/timeout/AllTests.cpp @@ -192,8 +192,8 @@ allTests(Test::TestHelper* helper) controller->holdAdapter(100); try { - ByteSeq seq(1000000); - to->sendData(seq); + ByteSeq seq2(1000000); + to->sendData(seq2); } catch(const Ice::TimeoutException&) { @@ -485,7 +485,7 @@ allTests(Test::TestHelper* helper) Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapter("TimeoutCollocated"); adapter->activate(); - TimeoutPrxPtr timeout = ICE_UNCHECKED_CAST(TimeoutPrx, adapter->addWithUUID(ICE_MAKE_SHARED(TimeoutI))); + timeout = ICE_UNCHECKED_CAST(TimeoutPrx, adapter->addWithUUID(ICE_MAKE_SHARED(TimeoutI))); timeout = timeout->ice_invocationTimeout(100); try { diff --git a/cpp/test/Ice/timeout/TestI.cpp b/cpp/test/Ice/timeout/TestI.cpp index 1c3daf4fa93..6b8cb63baaa 100644 --- a/cpp/test/Ice/timeout/TestI.cpp +++ b/cpp/test/Ice/timeout/TestI.cpp @@ -47,7 +47,7 @@ TimeoutI::sendData(ICE_IN(Test::ByteSeq), const Ice::Current&) } void -TimeoutI::sleep(Ice::Int to, const Ice::Current& c) +TimeoutI::sleep(Ice::Int to, const Ice::Current&) { IceUtil::ThreadControl::sleep(IceUtil::Time::milliSeconds(to)); } diff --git a/cpp/test/IceBridge/simple/AllTests.cpp b/cpp/test/IceBridge/simple/AllTests.cpp index d73576dae3d..a5b5ee29b1f 100644 --- a/cpp/test/IceBridge/simple/AllTests.cpp +++ b/cpp/test/IceBridge/simple/AllTests.cpp @@ -87,10 +87,10 @@ allTests(Test::TestHelper* helper) { Ice::CommunicatorPtr communicator = helper->communicator(); cout << "testing connection to bridge... " << flush; - Ice::ObjectPrx base = communicator->stringToProxy("test:" + helper->getTestEndpoint(1) + ":" + + Ice::ObjectPrx prx = communicator->stringToProxy("test:" + helper->getTestEndpoint(1) + ":" + helper->getTestEndpoint(1, "udp")); - test(base); - Test::MyClassPrx cl = Ice::checkedCast<Test::MyClassPrx>(base); + test(prx); + Test::MyClassPrx cl = Ice::checkedCast<Test::MyClassPrx>(prx); cl->ice_ping(); cout << "ok" << endl; @@ -133,7 +133,7 @@ allTests(Test::TestHelper* helper) // The bridge forwards the CloseConnectionException from the server as an // UnknownLocalException. It eventually closes the connection when notified // of the connection close. - test(ex.unknown.find("CloseConnectionException") >= 0); + test(ex.unknown.find("CloseConnectionException") != string::npos); } IceUtil::ThreadControl::sleep(IceUtil::Time::milliSeconds(1)); } diff --git a/cpp/test/IceBridge/simple/TestI.cpp b/cpp/test/IceBridge/simple/TestI.cpp index 558323dda5e..8049c6d2702 100644 --- a/cpp/test/IceBridge/simple/TestI.cpp +++ b/cpp/test/IceBridge/simple/TestI.cpp @@ -146,7 +146,7 @@ MyClassI::incCounter(int expected, const Ice::Current& c) } void -MyClassI::waitCounter(int value, const Ice::Current& c) +MyClassI::waitCounter(int value, const Ice::Current&) { IceUtil::Monitor<IceUtil::Mutex>::Lock sync(_monitor); while(_counter != value) diff --git a/cpp/test/IceDiscovery/simple/TestI.cpp b/cpp/test/IceDiscovery/simple/TestI.cpp index 5c38cf0c801..909aefc8020 100644 --- a/cpp/test/IceDiscovery/simple/TestI.cpp +++ b/cpp/test/IceDiscovery/simple/TestI.cpp @@ -36,7 +36,7 @@ ControllerI::activateObjectAdapter(ICE_IN(string) name, } void -ControllerI::deactivateObjectAdapter(ICE_IN(string) name, const Ice::Current& current) +ControllerI::deactivateObjectAdapter(ICE_IN(string) name, const Ice::Current&) { _adapters[name]->destroy(); _adapters.erase(name); diff --git a/cpp/test/IceGrid/activation/AllTests.cpp b/cpp/test/IceGrid/activation/AllTests.cpp index 61503746c05..7eb967f9b82 100644 --- a/cpp/test/IceGrid/activation/AllTests.cpp +++ b/cpp/test/IceGrid/activation/AllTests.cpp @@ -96,13 +96,13 @@ allTests(Test::TestHelper* helper) IceGrid::QueryPrx query = IceGrid::QueryPrx::checkedCast( communicator->stringToProxy(communicator->getDefaultLocator()->ice_getIdentity().category + "/Query")); - IceGrid::AdminSessionPrx session = registry->createAdminSession("foo", "bar"); + IceGrid::AdminSessionPrx adminSession = registry->createAdminSession("foo", "bar"); - session->ice_getConnection()->setACM(registry->getACMTimeout(), + adminSession->ice_getConnection()->setACM(registry->getACMTimeout(), IceUtil::None, Ice::ICE_ENUM(ACMHeartbeat, HeartbeatAlways)); - IceGrid::AdminPrx admin = session->getAdmin(); + IceGrid::AdminPrx admin = adminSession->getAdmin(); test(admin); admin->startServer("node-1"); @@ -741,5 +741,5 @@ allTests(Test::TestHelper* helper) admin->stopServer("node-1"); admin->stopServer("node-2"); - session->destroy(); + adminSession->destroy(); } diff --git a/cpp/test/IceGrid/allocation/AllTests.cpp b/cpp/test/IceGrid/allocation/AllTests.cpp index f8ed209c2f6..09bd0d024ef 100644 --- a/cpp/test/IceGrid/allocation/AllTests.cpp +++ b/cpp/test/IceGrid/allocation/AllTests.cpp @@ -1003,8 +1003,8 @@ allTests(Test::TestHelper* helper) cout << "ok" << endl; cout << "testing application updates with allocated objects... " << flush; { - SessionPrx session1 = registry->createSession("Client1", ""); - SessionPrx session2 = registry->createSession("Client2", ""); + session1 = registry->createSession("Client1", ""); + session2 = registry->createSession("Client2", ""); ServerDescriptorPtr objectAllocOriginal = admin->getServerInfo("ObjectAllocation").descriptor; ServerDescriptorPtr objectAllocUpdate = ServerDescriptorPtr::dynamicCast(objectAllocOriginal->ice_clone()); @@ -1100,7 +1100,6 @@ allTests(Test::TestHelper* helper) test(session1); session1->ice_ping(); - Ice::ObjectPrx obj; obj = session1->allocateObjectById(allocatable)->ice_connectionId("client1")->ice_router(router1); obj->ice_ping(); session1->releaseObject(allocatable); diff --git a/cpp/test/IceGrid/deployer/Service.cpp b/cpp/test/IceGrid/deployer/Service.cpp index 53304a60142..854896094b3 100644 --- a/cpp/test/IceGrid/deployer/Service.cpp +++ b/cpp/test/IceGrid/deployer/Service.cpp @@ -35,7 +35,7 @@ extern "C" // Factory function // ICE_DECLSPEC_EXPORT ::IceBox::Service* -create(CommunicatorPtr communicator) +create(CommunicatorPtr) { return new ServiceI; } diff --git a/cpp/test/IceGrid/noRestartUpdate/Service.cpp b/cpp/test/IceGrid/noRestartUpdate/Service.cpp index 6e1d3e7b991..af091a86b53 100644 --- a/cpp/test/IceGrid/noRestartUpdate/Service.cpp +++ b/cpp/test/IceGrid/noRestartUpdate/Service.cpp @@ -35,7 +35,7 @@ extern "C" // Factory function // ICE_DECLSPEC_EXPORT ::IceBox::Service* -create(CommunicatorPtr communicator) +create(CommunicatorPtr) { return new ServiceI; } diff --git a/cpp/test/IceGrid/replicaGroup/RegistryPlugin.cpp b/cpp/test/IceGrid/replicaGroup/RegistryPlugin.cpp index e759070b0ee..7fc9d0c8929 100644 --- a/cpp/test/IceGrid/replicaGroup/RegistryPlugin.cpp +++ b/cpp/test/IceGrid/replicaGroup/RegistryPlugin.cpp @@ -80,11 +80,11 @@ public: string server = p->second; Ice::StringSeq filteredAdapters; - for(Ice::StringSeq::const_iterator p = adpts.begin(); p != adpts.end(); ++p) + for(Ice::StringSeq::const_iterator q = adpts.begin(); q != adpts.end(); ++q) { - if(_facade->getAdapterServer(*p) == server) + if(_facade->getAdapterServer(*q) == server) { - filteredAdapters.push_back(*p); + filteredAdapters.push_back(*q); } } return filteredAdapters; @@ -105,7 +105,7 @@ public: } virtual Ice::ObjectProxySeq - filter(const string& type, const Ice::ObjectProxySeq& objects, const Ice::ConnectionPtr&, const Ice::Context& ctx) + filter(const string& /*type*/, const Ice::ObjectProxySeq& objects, const Ice::ConnectionPtr&, const Ice::Context& ctx) { Ice::Context::const_iterator p = ctx.find("server"); if(p == ctx.end()) @@ -115,11 +115,11 @@ public: string server = p->second; Ice::ObjectProxySeq filteredObjects; - for(Ice::ObjectProxySeq::const_iterator p = objects.begin(); p != objects.end(); ++p) + for(Ice::ObjectProxySeq::const_iterator q = objects.begin(); q != objects.end(); ++q) { - if(_facade->getAdapterServer((*p)->ice_getAdapterId()) == server) + if(_facade->getAdapterServer((*q)->ice_getAdapterId()) == server) { - filteredObjects.push_back(*p); + filteredObjects.push_back(*q); } } return filteredObjects; @@ -140,7 +140,7 @@ public: } virtual Ice::StringSeq - filter(const string& id, const Ice::StringSeq& adapters, const Ice::ConnectionPtr& con, const Ice::Context& ctx) + filter(const string& /*id*/, const Ice::StringSeq& adapters, const Ice::ConnectionPtr& /*con*/, const Ice::Context& ctx) { Ice::Context::const_iterator p = ctx.find("server"); if(p == ctx.end() || p->second == _exclude) diff --git a/cpp/test/IceGrid/replicaGroup/Service.cpp b/cpp/test/IceGrid/replicaGroup/Service.cpp index f77a1323d48..fe01f8e57b9 100644 --- a/cpp/test/IceGrid/replicaGroup/Service.cpp +++ b/cpp/test/IceGrid/replicaGroup/Service.cpp @@ -35,7 +35,7 @@ extern "C" // Factory function // ICE_DECLSPEC_EXPORT ::IceBox::Service* -create(CommunicatorPtr communicator) +create(CommunicatorPtr) { return new ServiceI; } diff --git a/cpp/test/IceGrid/replication/AllTests.cpp b/cpp/test/IceGrid/replication/AllTests.cpp index 681b22656be..3a1c011e2fc 100644 --- a/cpp/test/IceGrid/replication/AllTests.cpp +++ b/cpp/test/IceGrid/replication/AllTests.cpp @@ -253,13 +253,13 @@ allTests(Test::TestHelper* helper) IceGrid::RegistryPrx registry = IceGrid::RegistryPrx::checkedCast( comm->stringToProxy(comm->getDefaultLocator()->ice_getIdentity().category + "/Registry")); - AdminSessionPrx session = registry->createAdminSession("foo", "bar"); + AdminSessionPrx adminSession = registry->createAdminSession("foo", "bar"); - session->ice_getConnection()->setACM(registry->getACMTimeout(), + adminSession->ice_getConnection()->setACM(registry->getACMTimeout(), IceUtil::None, Ice::ICE_ENUM(ACMHeartbeat, HeartbeatAlways)); - AdminPrx admin = session->getAdmin(); + AdminPrx admin = adminSession->getAdmin(); test(admin); map<string, string> params; @@ -782,24 +782,26 @@ allTests(Test::TestHelper* helper) params["id"] = "Node1"; instantiateServer(admin, "IceGridNode", params); - // - // Add an application which is using Node1. Otherwise, when a - // registry restarts it would throw aways the proxy of the nodes - // because the node isn't used by any application. - // - ApplicationDescriptor app; - app.name = "DummyApp"; - app.nodes["Node1"].description = "dummy node"; - try - { - masterAdmin->addApplication(app); - } - catch(const Ice::Exception& ex) { - cerr << ex << endl; - test(false); + // + // Add an application which is using Node1. Otherwise, when a + // registry restarts it would throw aways the proxy of the nodes + // because the node isn't used by any application. + // + ApplicationDescriptor app; + app.name = "DummyApp"; + app.nodes["Node1"].description = "dummy node"; + try + { + masterAdmin->addApplication(app); + } + catch(const Ice::Exception& ex) + { + cerr << ex << endl; + test(false); + } } - + // // Test node session establishment. // @@ -995,8 +997,8 @@ allTests(Test::TestHelper* helper) { cerr << ex << endl; - ApplicationInfo app = admin->getApplicationInfo("Test"); - cerr << "properties-override = " << app.descriptor.variables["properties-override"] << endl; + ApplicationInfo appInfo = admin->getApplicationInfo("Test"); + cerr << "properties-override = " << appInfo.descriptor.variables["properties-override"] << endl; PropertyDescriptorSeq& seq = admin->getServerInfo("Node1").descriptor->propertySet.properties; for(PropertyDescriptorSeq::const_iterator p = seq.begin(); p != seq.end(); ++p) diff --git a/cpp/test/IceGrid/session/AllTests.cpp b/cpp/test/IceGrid/session/AllTests.cpp index 742e2331f10..5448cfc3307 100644 --- a/cpp/test/IceGrid/session/AllTests.cpp +++ b/cpp/test/IceGrid/session/AllTests.cpp @@ -108,7 +108,7 @@ public: } virtual void - applicationInit(int serial, const ApplicationInfoSeq& apps, const Ice::Current&) + applicationInit(int serialP, const ApplicationInfoSeq& apps, const Ice::Current&) { Lock sync(*this); for(ApplicationInfoSeq::const_iterator p = apps.begin(); p != apps.end(); ++p) @@ -118,27 +118,27 @@ public: this->applications.insert(make_pair(p->descriptor.name, *p)); } } - updated(updateSerial(serial, "init update")); + updated(updateSerial(serialP, "init update")); } virtual void - applicationAdded(int serial, const ApplicationInfo& app, const Ice::Current&) + applicationAdded(int serialP, const ApplicationInfo& app, const Ice::Current&) { Lock sync(*this); this->applications.insert(make_pair(app.descriptor.name, app)); - updated(updateSerial(serial, "application added `" + app.descriptor.name + "'")); + updated(updateSerial(serialP, "application added `" + app.descriptor.name + "'")); } virtual void - applicationRemoved(int serial, const std::string& name, const Ice::Current&) + applicationRemoved(int serialP, const std::string& name, const Ice::Current&) { Lock sync(*this); this->applications.erase(name); - updated(updateSerial(serial, "application removed `" + name + "'")); + updated(updateSerial(serialP, "application removed `" + name + "'")); } virtual void - applicationUpdated(int serial, const ApplicationUpdateInfo& info, const Ice::Current&) + applicationUpdated(int serialP, const ApplicationUpdateInfo& info, const Ice::Current&) { Lock sync(*this); const ApplicationUpdateDescriptor& desc = info.descriptor; @@ -150,7 +150,7 @@ public: { this->applications[desc.name].descriptor.variables[p->first] = p->second; } - updated(updateSerial(serial, "application updated `" + desc.name + "'")); + updated(updateSerial(serialP, "application updated `" + desc.name + "'")); } int serial; @@ -159,9 +159,9 @@ public: private: string - updateSerial(int serial, const string& update) + updateSerial(int serialP, const string& update) { - this->serial = serial; + serial = serialP; ostringstream os; os << update << " (serial = " << serial << ")"; return os.str(); @@ -178,12 +178,12 @@ public: } virtual void - adapterInit(const AdapterInfoSeq& adapters, const Ice::Current&) + adapterInit(const AdapterInfoSeq& adaptersP, const Ice::Current&) { Lock sync(*this); - for(AdapterInfoSeq::const_iterator q = adapters.begin(); q != adapters.end(); ++q) + for(AdapterInfoSeq::const_iterator q = adaptersP.begin(); q != adaptersP.end(); ++q) { - this->adapters.insert(make_pair(q->id, *q)); + adapters.insert(make_pair(q->id, *q)); } updated(updateSerial(0, "init update")); } @@ -192,7 +192,7 @@ public: adapterAdded(const AdapterInfo& info, const Ice::Current&) { Lock sync(*this); - this->adapters.insert(make_pair(info.id, info)); + adapters.insert(make_pair(info.id, info)); updated(updateSerial(0, "adapter added `" + info.id + "'")); } @@ -200,7 +200,7 @@ public: adapterUpdated(const AdapterInfo& info, const Ice::Current&) { Lock sync(*this); - this->adapters[info.id] = info; + adapters[info.id] = info; updated(updateSerial(0, "adapter updated `" + info.id + "'")); } @@ -208,7 +208,7 @@ public: adapterRemoved(const string& id, const Ice::Current&) { Lock sync(*this); - this->adapters.erase(id); + adapters.erase(id); updated(updateSerial(0, "adapter removed `" + id + "'")); } @@ -218,9 +218,9 @@ public: private: string - updateSerial(int serial, const string& update) + updateSerial(int serialP, const string& update) { - this->serial = serial; + serial = serialP; ostringstream os; os << update << " (serial = " << serial << ")"; return os.str(); @@ -237,12 +237,12 @@ public: } virtual void - objectInit(const ObjectInfoSeq& objects, const Ice::Current&) + objectInit(const ObjectInfoSeq& objectsP, const Ice::Current&) { Lock sync(*this); - for(ObjectInfoSeq::const_iterator r = objects.begin(); r != objects.end(); ++r) + for(ObjectInfoSeq::const_iterator r = objectsP.begin(); r != objectsP.end(); ++r) { - this->objects.insert(make_pair(r->proxy->ice_getIdentity(), *r)); + objects.insert(make_pair(r->proxy->ice_getIdentity(), *r)); } updated(updateSerial(0, "init update")); } @@ -251,7 +251,7 @@ public: objectAdded(const ObjectInfo& info, const Ice::Current&) { Lock sync(*this); - this->objects.insert(make_pair(info.proxy->ice_getIdentity(), info)); + objects.insert(make_pair(info.proxy->ice_getIdentity(), info)); updated(updateSerial(0, "object added `" + info.proxy->ice_toString() + "'")); } @@ -259,7 +259,7 @@ public: objectUpdated(const ObjectInfo& info, const Ice::Current&) { Lock sync(*this); - this->objects[info.proxy->ice_getIdentity()] = info; + objects[info.proxy->ice_getIdentity()] = info; updated(updateSerial(0, "object updated `" + info.proxy->ice_toString() + "'")); } @@ -267,7 +267,7 @@ public: objectRemoved(const Ice::Identity& id, const Ice::Current& current) { Lock sync(*this); - this->objects.erase(id); + objects.erase(id); updated(updateSerial(0, "object removed `" + current.adapter->getCommunicator()->identityToString(id) + "'")); } @@ -278,9 +278,9 @@ public: private: string - updateSerial(int serial, const string& update) + updateSerial(int serialP, const string& update) { - this->serial = serial; + serial = serialP; ostringstream os; os << update << " (serial = " << serial << ")"; return os.str(); diff --git a/cpp/test/IceSSL/configuration/AllTests.cpp b/cpp/test/IceSSL/configuration/AllTests.cpp index 5955947676e..851f7ffe0c9 100644 --- a/cpp/test/IceSSL/configuration/AllTests.cpp +++ b/cpp/test/IceSSL/configuration/AllTests.cpp @@ -392,7 +392,7 @@ class ImportCerts { public: - ImportCerts(const string& defaultDir, const char* certificates[]) + ImportCerts(const string& /*defaultDir*/, const char* /*certificates*/[]) { // Nothing to do. } @@ -1634,9 +1634,9 @@ allTests(Test::TestHelper* helper, const string& testDir, bool p12) test(fact); { - Test::Properties d = createServerProps(defaultProps, p12, "s_rsa_ca1", ""); + d = createServerProps(defaultProps, p12, "s_rsa_ca1", ""); d["IceSSL.VerifyPeer"] = "0"; - Test::ServerPrxPtr server = fact->createServer(d); + server = fact->createServer(d); try { info = ICE_DYNAMIC_CAST(IceSSL::ConnectionInfo, server->ice_getConnection()->getInfo()); @@ -1670,9 +1670,9 @@ allTests(Test::TestHelper* helper, const string& testDir, bool p12) test(fact); { - Test::Properties d = createServerProps(defaultProps, p12, "s_rsa_cai1", ""); + d = createServerProps(defaultProps, p12, "s_rsa_cai1", ""); d["IceSSL.VerifyPeer"] = "0"; - Test::ServerPrxPtr server = fact->createServer(d); + server = fact->createServer(d); try { server->ice_getConnection()->getInfo(); @@ -1704,9 +1704,9 @@ allTests(Test::TestHelper* helper, const string& testDir, bool p12) fact = ICE_CHECKED_CAST(Test::ServerFactoryPrx, comm->stringToProxy(factoryRef)); test(fact); { - Test::Properties d = createServerProps(defaultProps, p12, "s_rsa_cai1", ""); + d = createServerProps(defaultProps, p12, "s_rsa_cai1", ""); d["IceSSL.VerifyPeer"] = "0"; - Test::ServerPrxPtr server = fact->createServer(d); + server = fact->createServer(d); try { info = ICE_DYNAMIC_CAST(IceSSL::ConnectionInfo, server->ice_getConnection()->getInfo()); @@ -1723,9 +1723,9 @@ allTests(Test::TestHelper* helper, const string& testDir, bool p12) } { - Test::Properties d = createServerProps(defaultProps, p12, "s_rsa_cai2", ""); + d = createServerProps(defaultProps, p12, "s_rsa_cai2", ""); d["IceSSL.VerifyPeer"] = "0"; - Test::ServerPrxPtr server = fact->createServer(d); + server = fact->createServer(d); try { server->ice_getConnection()->getInfo(); @@ -1752,9 +1752,9 @@ allTests(Test::TestHelper* helper, const string& testDir, bool p12) test(fact); { - Test::Properties d = createServerProps(defaultProps, p12, "s_rsa_cai2", ""); + d = createServerProps(defaultProps, p12, "s_rsa_cai2", ""); d["IceSSL.VerifyPeer"] = "0"; - Test::ServerPrxPtr server = fact->createServer(d); + server = fact->createServer(d); try { info = ICE_DYNAMIC_CAST(IceSSL::ConnectionInfo, server->ice_getConnection()->getInfo()); @@ -1784,9 +1784,9 @@ allTests(Test::TestHelper* helper, const string& testDir, bool p12) test(fact); { - Test::Properties d = createServerProps(defaultProps, p12, "s_rsa_cai2", "cacert1"); + d = createServerProps(defaultProps, p12, "s_rsa_cai2", "cacert1"); d["IceSSL.VerifyPeer"] = "2"; - Test::ServerPrxPtr server = fact->createServer(d); + server = fact->createServer(d); try { server->ice_getConnection(); @@ -1811,10 +1811,10 @@ allTests(Test::TestHelper* helper, const string& testDir, bool p12) } { - Test::Properties d = createServerProps(defaultProps, p12, "s_rsa_cai2", "cacert1"); + d = createServerProps(defaultProps, p12, "s_rsa_cai2", "cacert1"); d["IceSSL.VerifyPeer"] = "2"; d["IceSSL.VerifyDepthMax"] = "4"; - Test::ServerPrxPtr server = fact->createServer(d); + server = fact->createServer(d); try { server->ice_getConnection(); @@ -1937,8 +1937,8 @@ allTests(Test::TestHelper* helper, const string& testDir, bool p12) CertificateVerifierIPtr verifier = ICE_MAKE_SHARED(CertificateVerifierI); #ifdef ICE_CPP11_MAPPING - plugin->setCertificateVerifier([verifier](const shared_ptr<IceSSL::ConnectionInfo>& info) - { return verifier->verify(info); }); + plugin->setCertificateVerifier([verifier](const shared_ptr<IceSSL::ConnectionInfo>& infoP) + { return verifier->verify(infoP); }); #else plugin->setCertificateVerifier(verifier); #endif @@ -2013,8 +2013,8 @@ allTests(Test::TestHelper* helper, const string& testDir, bool p12) CertificateVerifierIPtr verifier = ICE_MAKE_SHARED(CertificateVerifierI); #ifdef ICE_CPP11_MAPPING - plugin->setCertificateVerifier([verifier](const shared_ptr<IceSSL::ConnectionInfo>& info) - { return verifier->verify(info); }); + plugin->setCertificateVerifier([verifier](const shared_ptr<IceSSL::ConnectionInfo>& infoP) + { return verifier->verify(infoP); }); #else plugin->setCertificateVerifier(verifier); #endif @@ -2046,72 +2046,74 @@ allTests(Test::TestHelper* helper, const string& testDir, bool p12) cout << "testing protocols... " << flush; { # ifndef ICE_USE_SECURE_TRANSPORT - // - // This should fail because the client and server have no protocol - // in common. - // - InitializationData initData; - initData.properties = createClientProps(defaultProps, p12, "c_rsa_ca1", "cacert1"); - initData.properties->setProperty("IceSSL.VerifyPeer", "0"); - initData.properties->setProperty("IceSSL.Protocols", "tls1_1"); - CommunicatorPtr comm = initialize(initData); - - Test::ServerFactoryPrxPtr fact = ICE_CHECKED_CAST(Test::ServerFactoryPrx, comm->stringToProxy(factoryRef)); - test(fact); - Test::Properties d = createServerProps(defaultProps, p12, "s_rsa_ca1", "cacert1"); - d["IceSSL.VerifyPeer"] = "0"; - d["IceSSL.Protocols"] = "tls1_2"; - Test::ServerPrxPtr server = fact->createServer(d); - try - { - server->ice_ping(); - test(false); - } - catch(const ProtocolException&) - { - // Expected on some platforms. - } - catch(const ConnectionLostException&) - { - // Expected on some platforms. - } - catch(const LocalException& ex) - { - cerr << ex << endl; - test(false); - } - fact->destroyServer(server); - comm->destroy(); - - // - // This should succeed. - // - comm = initialize(initData); - fact = ICE_CHECKED_CAST(Test::ServerFactoryPrx, comm->stringToProxy(factoryRef)); - test(fact); - d = createServerProps(defaultProps, p12, "s_rsa_ca1", "cacert1"); - d["IceSSL.VerifyPeer"] = "0"; - d["IceSSL.Protocols"] = "tls1_1, tls1_2"; - server = fact->createServer(d); - try - { - server->ice_ping(); - } - catch(const LocalException& ex) { // - // OpenSSL < 1.0 doesn't support tls 1.1 so it will fail, we ignore the error in this case. + // This should fail because the client and server have no protocol + // in common. // -#ifdef ICE_USE_OPENSSL - if(openSSLVersion < 0x1000000) -#endif + InitializationData initData; + initData.properties = createClientProps(defaultProps, p12, "c_rsa_ca1", "cacert1"); + initData.properties->setProperty("IceSSL.VerifyPeer", "0"); + initData.properties->setProperty("IceSSL.Protocols", "tls1_1"); + CommunicatorPtr comm = initialize(initData); + + Test::ServerFactoryPrxPtr fact = ICE_CHECKED_CAST(Test::ServerFactoryPrx, comm->stringToProxy(factoryRef)); + test(fact); + Test::Properties d = createServerProps(defaultProps, p12, "s_rsa_ca1", "cacert1"); + d["IceSSL.VerifyPeer"] = "0"; + d["IceSSL.Protocols"] = "tls1_2"; + Test::ServerPrxPtr server = fact->createServer(d); + try + { + server->ice_ping(); + test(false); + } + catch(const ProtocolException&) + { + // Expected on some platforms. + } + catch(const ConnectionLostException&) + { + // Expected on some platforms. + } + catch(const LocalException& ex) { cerr << ex << endl; test(false); } + fact->destroyServer(server); + comm->destroy(); + + // + // This should succeed. + // + comm = initialize(initData); + fact = ICE_CHECKED_CAST(Test::ServerFactoryPrx, comm->stringToProxy(factoryRef)); + test(fact); + d = createServerProps(defaultProps, p12, "s_rsa_ca1", "cacert1"); + d["IceSSL.VerifyPeer"] = "0"; + d["IceSSL.Protocols"] = "tls1_1, tls1_2"; + server = fact->createServer(d); + try + { + server->ice_ping(); + } + catch(const LocalException& ex) + { + // + // OpenSSL < 1.0 doesn't support tls 1.1 so it will fail, we ignore the error in this case. + // +#ifdef ICE_USE_OPENSSL + if(openSSLVersion < 0x1000000) +#endif + { + cerr << ex << endl; + test(false); + } + } + fact->destroyServer(server); + comm->destroy(); } - fact->destroyServer(server); - comm->destroy(); // // This should fail because the client only accept SSLv3 and the server @@ -2187,69 +2189,71 @@ allTests(Test::TestHelper* helper, const string& testDir, bool p12) // enabled protocol versions. See the test bellow. // - // - // This should fail because the client and server have no protocol - // in common. - // - InitializationData initData; - initData.properties = createClientProps(defaultProps, p12); - initData.properties->setProperty("IceSSL.Ciphers", "(DH_anon*)"); - initData.properties->setProperty("IceSSL.VerifyPeer", "0"); - initData.properties->setProperty("IceSSL.ProtocolVersionMax", "tls1"); - initData.properties->setProperty("IceSSL.ProtocolVersionMin", "tls1"); - CommunicatorPtr comm = initialize(initData); - Test::ServerFactoryPrxPtr fact = ICE_CHECKED_CAST(Test::ServerFactoryPrx, comm->stringToProxy(factoryRef)); - test(fact); - Test::Properties d = createServerProps(defaultProps, p12); - d["IceSSL.Ciphers"] = "(DH_anon*)"; - d["IceSSL.VerifyPeer"] = "0"; - d["IceSSL.ProtocolVersionMax"] = "tls1_2"; - d["IceSSL.ProtocolVersionMin"] = "tls1_2"; - Test::ServerPrxPtr server = fact->createServer(d); - try - { - server->ice_ping(); - test(false); - } - catch(const ProtocolException&) - { - // Expected on some platforms. - } - catch(const ConnectionLostException&) { - // Expected on some platforms. - } - catch(const LocalException& ex) - { - cerr << ex << endl; - test(false); - } - fact->destroyServer(server); - comm->destroy(); + // + // This should fail because the client and server have no protocol + // in common. + // + InitializationData initData; + initData.properties = createClientProps(defaultProps, p12); + initData.properties->setProperty("IceSSL.Ciphers", "(DH_anon*)"); + initData.properties->setProperty("IceSSL.VerifyPeer", "0"); + initData.properties->setProperty("IceSSL.ProtocolVersionMax", "tls1"); + initData.properties->setProperty("IceSSL.ProtocolVersionMin", "tls1"); + CommunicatorPtr comm = initialize(initData); + Test::ServerFactoryPrxPtr fact = ICE_CHECKED_CAST(Test::ServerFactoryPrx, comm->stringToProxy(factoryRef)); + test(fact); + Test::Properties d = createServerProps(defaultProps, p12); + d["IceSSL.Ciphers"] = "(DH_anon*)"; + d["IceSSL.VerifyPeer"] = "0"; + d["IceSSL.ProtocolVersionMax"] = "tls1_2"; + d["IceSSL.ProtocolVersionMin"] = "tls1_2"; + Test::ServerPrxPtr server = fact->createServer(d); + try + { + server->ice_ping(); + test(false); + } + catch(const ProtocolException&) + { + // Expected on some platforms. + } + catch(const ConnectionLostException&) + { + // Expected on some platforms. + } + catch(const LocalException& ex) + { + cerr << ex << endl; + test(false); + } + fact->destroyServer(server); + comm->destroy(); - // - // This should succeed. - // - comm = initialize(initData); - fact = ICE_CHECKED_CAST(Test::ServerFactoryPrx, comm->stringToProxy(factoryRef)); - test(fact); - d = createServerProps(defaultProps, p12); - d["IceSSL.Ciphers"] = "(DH_anon*)"; - d["IceSSL.VerifyPeer"] = "0"; - d["IceSSL.ProtocolVersionMax"] = "tls1"; - d["IceSSL.ProtocolVersionMin"] = "ssl3"; - server = fact->createServer(d); - try - { - server->ice_ping(); - } - catch(const LocalException& ex) - { - cerr << ex << endl; - test(false); + // + // This should succeed. + // + comm = initialize(initData); + fact = ICE_CHECKED_CAST(Test::ServerFactoryPrx, comm->stringToProxy(factoryRef)); + test(fact); + d = createServerProps(defaultProps, p12); + d["IceSSL.Ciphers"] = "(DH_anon*)"; + d["IceSSL.VerifyPeer"] = "0"; + d["IceSSL.ProtocolVersionMax"] = "tls1"; + d["IceSSL.ProtocolVersionMin"] = "ssl3"; + server = fact->createServer(d); + try + { + server->ice_ping(); + } + catch(const LocalException& ex) + { + cerr << ex << endl; + test(false); + } + fact->destroyServer(server); + comm->destroy(); } - fact->destroyServer(server); - comm->destroy(); // // This should fail because the client only accept SSLv3 and the server @@ -4254,9 +4258,9 @@ allTests(Test::TestHelper* helper, const string& testDir, bool p12) { try { - Ice::WSConnectionInfoPtr info = + Ice::WSConnectionInfoPtr wsinfo = ICE_DYNAMIC_CAST(Ice::WSConnectionInfo, p->ice_getConnection()->getInfo()); - IceSSL::ConnectionInfoPtr sslInfo = ICE_DYNAMIC_CAST(IceSSL::ConnectionInfo, info->underlying); + IceSSL::ConnectionInfoPtr sslInfo = ICE_DYNAMIC_CAST(IceSSL::ConnectionInfo, wsinfo->underlying); test(sslInfo->verified); break; } diff --git a/cpp/test/IceStorm/stress/Subscriber.cpp b/cpp/test/IceStorm/stress/Subscriber.cpp index 59cfb0fabcd..4aef857a90b 100644 --- a/cpp/test/IceStorm/stress/Subscriber.cpp +++ b/cpp/test/IceStorm/stress/Subscriber.cpp @@ -169,7 +169,7 @@ public: current.adapter->deactivate(); _count = _total; { - IceUtilInternal::MutexPtrLock<IceUtil::Mutex> sync(_remainingMutex); + IceUtilInternal::MutexPtrLock<IceUtil::Mutex> sync2(_remainingMutex); --_remaining; if(_remaining == 0) { diff --git a/cpp/test/IceUtil/ctrlCHandler/Client.cpp b/cpp/test/IceUtil/ctrlCHandler/Client.cpp index 05be89e95a2..a1f8514bd07 100644 --- a/cpp/test/IceUtil/ctrlCHandler/Client.cpp +++ b/cpp/test/IceUtil/ctrlCHandler/Client.cpp @@ -28,7 +28,7 @@ public: }; void -Client::run(int argc, char** argv) +Client::run(int, char**) { { cout << "First ignore CTRL+C and the like for 10 seconds (try it!)" << endl; diff --git a/cpp/test/IceUtil/priority/Client.cpp b/cpp/test/IceUtil/priority/Client.cpp index 47112d2f4ea..f613aa1925c 100644 --- a/cpp/test/IceUtil/priority/Client.cpp +++ b/cpp/test/IceUtil/priority/Client.cpp @@ -43,7 +43,7 @@ public: }; void -Client::run(int argc, char** argv) +Client::run(int, char**) { initializeTestSuite(); diff --git a/cpp/test/IceUtil/sha1/Client.cpp b/cpp/test/IceUtil/sha1/Client.cpp index 6e47a29045a..c03fb34713e 100644 --- a/cpp/test/IceUtil/sha1/Client.cpp +++ b/cpp/test/IceUtil/sha1/Client.cpp @@ -83,7 +83,7 @@ public: }; void -Client::run(int argc, char* argv[]) +Client::run(int, char*[]) { cout << "Testing sha1 hash computation... "; for(int i = 0; i < itemsSize; ++i) diff --git a/cpp/test/IceUtil/stacktrace/Client.cpp b/cpp/test/IceUtil/stacktrace/Client.cpp index 7a5d2a50aa1..9055a00ef41 100644 --- a/cpp/test/IceUtil/stacktrace/Client.cpp +++ b/cpp/test/IceUtil/stacktrace/Client.cpp @@ -104,7 +104,7 @@ public: }; void -Client::run(int argc, char* argv[]) +Client::run(int, char*[]) { if(IceUtilInternal::stackTraceImpl() == IceUtilInternal::STNone) { diff --git a/cpp/test/IceUtil/thread/Client.cpp b/cpp/test/IceUtil/thread/Client.cpp index 23464f642d0..574bb220424 100644 --- a/cpp/test/IceUtil/thread/Client.cpp +++ b/cpp/test/IceUtil/thread/Client.cpp @@ -23,7 +23,7 @@ public: }; void -Client::run(int argc, char** argv) +Client::run(int, char**) { initializeTestSuite(); diff --git a/cpp/test/IceUtil/thread/StartTest.cpp b/cpp/test/IceUtil/thread/StartTest.cpp index eef50038b47..6f32a98bf41 100644 --- a/cpp/test/IceUtil/thread/StartTest.cpp +++ b/cpp/test/IceUtil/thread/StartTest.cpp @@ -64,8 +64,8 @@ StartTest::run() { for(int j = 0; j < 40; j++) { - Thread* t = new StartTestThread; - t->start().detach(); + Thread* thread = new StartTestThread; + thread->start().detach(); } ThreadControl::sleep(Time::milliSeconds(5)); } diff --git a/cpp/test/IceUtil/timer/Client.cpp b/cpp/test/IceUtil/timer/Client.cpp index 1c8a1c5166a..41e528f8c38 100644 --- a/cpp/test/IceUtil/timer/Client.cpp +++ b/cpp/test/IceUtil/timer/Client.cpp @@ -161,7 +161,7 @@ public: }; void -Client::run(int, char* argv[]) +Client::run(int, char*[]) { cout << "testing timer... " << flush; { diff --git a/cpp/test/Slice/macros/Client.cpp b/cpp/test/Slice/macros/Client.cpp index 308a5e53e70..7ef1075ee13 100644 --- a/cpp/test/Slice/macros/Client.cpp +++ b/cpp/test/Slice/macros/Client.cpp @@ -22,7 +22,7 @@ public: }; void -Client::run(int argc, char** argv) +Client::run(int, char**) { cout << "testing Slice predefined macros... " << flush; DefaultPtr d = ICE_MAKE_SHARED(Default); |