diff options
Diffstat (limited to 'cpp/src')
106 files changed, 602 insertions, 477 deletions
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; |