diff options
Diffstat (limited to 'cpp')
54 files changed, 431 insertions, 253 deletions
diff --git a/cpp/CHANGES b/cpp/CHANGES index 6eebebd8587..54378bd68f5 100644 --- a/cpp/CHANGES +++ b/cpp/CHANGES @@ -1,6 +1,8 @@ Changes since version 1.0.1 --------------------------- +- Ice now builds on Solaris 9/Sun C++ 5.4 ... but not all tests pass. + - Replaced the Freeze::EvictorPersistenceMode enumeration with the interface Freeze::PersistenceStrategy. diff --git a/cpp/config/Make.rules b/cpp/config/Make.rules index a66ebec165f..944a8722851 100644 --- a/cpp/config/Make.rules +++ b/cpp/config/Make.rules @@ -78,6 +78,18 @@ prefix = /opt/Ice-$(VERSION) #E2FSPROGS_HOME ?= /opt/e2fsprogs + +# +# If readline is not installed in a standard location where the +# compiler can find it, AND you want to use readline, +# set READLINE_HOME to the readline installation directory. +# +# + +USE_READLINE : = 1 +#READLINE_HOME ?= /opt/readline + + # ---------------------------------------------------------------------- # Don't change anything below this line! # ---------------------------------------------------------------------- @@ -148,6 +160,16 @@ else E2FSPROGS_LIBS = -luuid endif +ifneq ($(USE_READLINE),) + ifneq ($(READLINE_HOME),) + + READLINE_FLAGS = -I$(READLINE_HOME)/include + READLINE_LIBS = -L$(READLINE_HOME)/lib -lreadline -lncurses + else + READLINE_FLAGS = + READLINE_LIBS = -lreadline -lncurses + endif +endif # # Platform specific definitions @@ -239,4 +261,9 @@ clean:: $(filter $(SDIR)/%.ice, $(SLICE_SRCS)))))) endif +ifneq ($(TEMPLATE_REPOSITORY),) +clean:: + rm -fr $(TEMPLATE_REPOSITORY) +endif + install:: diff --git a/cpp/config/Make.rules.SunOS b/cpp/config/Make.rules.SunOS index 540f58bea05..360f7cf96f7 100644 --- a/cpp/config/Make.rules.SunOS +++ b/cpp/config/Make.rules.SunOS @@ -19,6 +19,8 @@ CXX = CC CXXFLAGS = -KPIC -mt +w +p +TEMPLATE_REPOSITORY = SunWS_cache + ifeq ($(OPTIMIZE),yes) CXXFLAGS := -O -DNDEBUG $(CXXFLAGS) else diff --git a/cpp/demo/Freeze/bench/Client.cpp b/cpp/demo/Freeze/bench/Client.cpp index fada1bcfb10..de05613147b 100644 --- a/cpp/demo/Freeze/bench/Client.cpp +++ b/cpp/demo/Freeze/bench/Client.cpp @@ -181,7 +181,7 @@ TestApp::IntIntMapTest(const Freeze::DBEnvironmentPtr& dbEnv) _watch.start(); for(i = 0; i < _repetitions; ++i) { - m.insert(make_pair(i, i)); + m.insert(IntIntMap::value_type(i, i)); } double total = _watch.stop(); double perRecord = total / _repetitions; @@ -255,7 +255,7 @@ TestApp::IntIntMapReadTest(const Freeze::DBEnvironmentPtr& dbEnv) _watch.start(); for(i = 0; i < _repetitions; ++i) { - m.insert(make_pair(i, i)); + m.insert(IntIntMap::value_type(i, i)); } double total = _watch.stop(); double perRecord = total / _repetitions; @@ -318,7 +318,7 @@ TestApp::Struct1Struct2MapTest(const Freeze::DBEnvironmentPtr& dbEnv) ostringstream os; os << i; s2.s = os.str(); - m.insert(make_pair(s1, s2)); + m.insert(Struct1Struct2Map::value_type(s1, s2)); } double total = _watch.stop(); double perRecord = total / _repetitions; @@ -382,7 +382,7 @@ TestApp::Struct1Class1MapTest(const Freeze::DBEnvironmentPtr& dbEnv) ostringstream os; os << i; c1->s = os.str(); - m.insert(make_pair(s1, c1)); + m.insert(Struct1Class1Map::value_type(s1, c1)); } double total = _watch.stop(); double perRecord = total / _repetitions; @@ -459,7 +459,7 @@ TestApp::Struct1ObjectMapTest(const Freeze::DBEnvironmentPtr& dbEnv) ostringstream os; os << i; c1->s = os.str(); - m.insert(make_pair(s1, o)); + m.insert(Struct1ObjectMap::value_type(s1, o)); } double total = _watch.stop(); double perRecord = total / _repetitions; diff --git a/cpp/demo/Freeze/library/LibraryI.cpp b/cpp/demo/Freeze/library/LibraryI.cpp index 4e8eacb9d6e..4e96479e7d7 100644 --- a/cpp/demo/Freeze/library/LibraryI.cpp +++ b/cpp/demo/Freeze/library/LibraryI.cpp @@ -121,7 +121,9 @@ BookI::returnBook(const Ice::Current&) rentalCustomerName.clear();; } -static Ice::Identity +// Needs to be extern for the Sun C++ 5.4 compiler +// +extern Ice::Identity createBookIdentity(const string& isbn) { // @@ -213,7 +215,7 @@ LibraryI::createBook(const ::BookDescription& description, const Ice::Current&) } isbnSeq.push_back(description.isbn); - _authors.insert(make_pair(description.authors, isbnSeq)); + _authors.insert(StringIsbnSeqDict::value_type(description.authors, isbnSeq)); return book; } @@ -320,7 +322,7 @@ LibraryI::remove(const BookDescription& description) // // Otherwise, write back the new record. // - _authors.insert(make_pair(description.authors, isbnSeq)); + _authors.insert(StringIsbnSeqDict::value_type(description.authors, isbnSeq)); } // diff --git a/cpp/demo/Freeze/library/Makefile b/cpp/demo/Freeze/library/Makefile index ab5455abff9..05b7fcaaee0 100644 --- a/cpp/demo/Freeze/library/Makefile +++ b/cpp/demo/Freeze/library/Makefile @@ -56,7 +56,7 @@ SLICE2CPPFLAGS := --ice $(SLICE2CPPFLAGS) $(CLIENT): $(OBJS) $(COBJS) rm -f $@ - $(CXX) $(LDFLAGS) -o $@ $(OBJS) $(COBJS) $(LIBS) -lreadline -lncurses + $(CXX) $(LDFLAGS) -o $@ $(OBJS) $(COBJS) $(LIBS) $(READLINE_LIBS) $(SERVER): $(OBJS) $(SOBJS) rm -f $@ @@ -64,7 +64,7 @@ $(SERVER): $(OBJS) $(SOBJS) $(COLLOCATED): $(OBJS) $(COLOBJS) rm -f $@ - $(CXX) $(LDFLAGS) -o $@ $(OBJS) $(COLOBJS) -lFreeze -lIceXML $(LIBS) $(DB_LIBS) -lreadline -lncurses + $(CXX) $(LDFLAGS) -o $@ $(OBJS) $(COLOBJS) -lFreeze -lIceXML $(LIBS) $(DB_LIBS) $(READLINE_LIBS) LibraryTypes.h LibraryTypes.cpp: Library.ice $(SLICE2FREEZE) rm -f LibraryTypes.h LibraryTypes.cpp diff --git a/cpp/demo/Freeze/phonebook/Makefile b/cpp/demo/Freeze/phonebook/Makefile index ca61168b6f9..52726bec970 100644 --- a/cpp/demo/Freeze/phonebook/Makefile +++ b/cpp/demo/Freeze/phonebook/Makefile @@ -1,3 +1,4 @@ + # ********************************************************************** # # Copyright (c) 2003 @@ -55,7 +56,7 @@ CPPFLAGS := -I. $(DB_FLAGS) $(CPPFLAGS) $(CLIENT): $(OBJS) $(COBJS) rm -f $@ - $(CXX) $(LDFLAGS) -o $@ $(OBJS) $(COBJS) $(LIBS) -lreadline -lncurses + $(CXX) $(LDFLAGS) -o $@ $(OBJS) $(COBJS) $(LIBS) $(READLINE_LIBS) $(SERVER): $(OBJS) $(SOBJS) rm -f $@ @@ -63,7 +64,7 @@ $(SERVER): $(OBJS) $(SOBJS) $(COLLOCATED): $(OBJS) $(COLOBJS) rm -f $@ - $(CXX) $(LDFLAGS) -o $@ $(OBJS) $(COLOBJS) -lFreeze -lIceXML $(LIBS) $(DB_LIBS) -lreadline -lncurses + $(CXX) $(LDFLAGS) -o $@ $(OBJS) $(COLOBJS) -lFreeze -lIceXML $(LIBS) $(DB_LIBS) $(READLINE_LIBS) NameIdentitiesDict.h NameIdentitiesDict.cpp: PhoneBook.ice $(SLICE2FREEZE) rm -f NameIdentitiesDict.h NameIdentitiesDict.cpp diff --git a/cpp/demo/Freeze/phonebook/PhoneBookI.cpp b/cpp/demo/Freeze/phonebook/PhoneBookI.cpp index 28be7bd0c33..3d4211e2348 100644 --- a/cpp/demo/Freeze/phonebook/PhoneBookI.cpp +++ b/cpp/demo/Freeze/phonebook/PhoneBookI.cpp @@ -215,7 +215,7 @@ PhoneBookI::createContact(const Ice::Current&) } identities.push_back(ident); - _nameIdentitiesDict.insert(make_pair(string("N"), identities)); + _nameIdentitiesDict.insert(NameIdentitiesDict::value_type(string("N"), identities)); // // Turn the identity into a Proxy and return the Proxy to the @@ -318,7 +318,7 @@ PhoneBookI::move(const Identity& ident, const string& oldName, const string& new identities = p->second; } identities.push_back(ident); - _nameIdentitiesDict.insert(make_pair("N" + newName, identities)); + _nameIdentitiesDict.insert(NameIdentitiesDict::value_type("N" + newName, identities)); } catch(const Freeze::DBNotFoundException&) { @@ -382,7 +382,7 @@ PhoneBookI::getNewIdentity() ids.clear(); ids.push_back(id); - _nameIdentitiesDict.insert(make_pair(string("ID"), ids)); + _nameIdentitiesDict.insert(NameIdentitiesDict::value_type(string("ID"), ids)); id.name = s; id.category = "contact"; @@ -431,6 +431,6 @@ PhoneBookI::removeI(const Identity& ident, const string& name) // See the comment in getNewIdentity why the prefix "N" is // needed. // - _nameIdentitiesDict.insert(make_pair("N" + name, identities)); + _nameIdentitiesDict.insert(NameIdentitiesDict::value_type("N" + name, identities)); } } diff --git a/cpp/include/IceUtil/Algorithm.h b/cpp/include/IceUtil/Algorithm.h new file mode 100644 index 00000000000..167209c5a30 --- /dev/null +++ b/cpp/include/IceUtil/Algorithm.h @@ -0,0 +1,38 @@ +// ********************************************************************** +// +// Copyright (c) 2003 +// ZeroC, Inc. +// Billerica, MA, USA +// +// All Rights Reserved. +// +// Ice is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License version 2 as published by +// the Free Software Foundation. +// +// ********************************************************************** + +#ifndef ICE_UTIL_ALGORITHM_H +#define ICE_UTIL_ALGORITHM_H + +#include <algorithm> + + +// Work-around for a limitation in the standard library provided +// with the Sun C++ 5.x compilers +#if defined(__SUNPRO_CC) && defined(_RWSTD_NO_CLASS_PARTIAL_SPEC) + +template<class InputIterator, class Predicate> +inline typename InputIterator::difference_type +ice_count_if(InputIterator first, InputIterator last, Predicate pred) +{ + InputIterator::difference_type result; + std::count_if(first, last, pred, result); + return result; +} + +#else +#define ice_count_if(x,y,z) std::count_if(x,y,z) +#endif + +#endif diff --git a/cpp/include/IceUtil/Iterator.h b/cpp/include/IceUtil/Iterator.h new file mode 100644 index 00000000000..0024739ab79 --- /dev/null +++ b/cpp/include/IceUtil/Iterator.h @@ -0,0 +1,38 @@ +// ********************************************************************** +// +// Copyright (c) 2003 +// ZeroC, Inc. +// Billerica, MA, USA +// +// All Rights Reserved. +// +// Ice is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License version 2 as published by +// the Free Software Foundation. +// +// ********************************************************************** + +#ifndef ICE_UTIL_ITERATOR_H +#define ICE_UTIL_ITERATOR_H + +#include <iterator> + + +// Work-around for a limitation in the standard library provided +// with the Sun C++ 5.x compilers +#if defined(__SUNPRO_CC) && defined(_RWSTD_NO_CLASS_PARTIAL_SPEC) + +template<class ForwardIterator> +inline typename ForwardIterator::difference_type +ice_distance(ForwardIterator first, ForwardIterator last) +{ + ForwardIterator::difference_type result; + std::distance(first, last, result); + return result; +} + +#else +#define ice_distance(x,y) std::distance(x,y) +#endif + +#endif diff --git a/cpp/src/Freeze/EvictorI.cpp b/cpp/src/Freeze/EvictorI.cpp index 4094cd4a902..ae791ab5f81 100644 --- a/cpp/src/Freeze/EvictorI.cpp +++ b/cpp/src/Freeze/EvictorI.cpp @@ -144,6 +144,7 @@ Freeze::EvictorI::createObject(const Identity& ident, const ObjectPtr& servant) // // Save the Ice object's initial state and add it to the queue. // + save(ident, servant); add(ident, servant); @@ -397,7 +398,7 @@ Freeze::EvictorI::save(const Identity& ident, const ObjectPtr& servant) // NOTE: Do not synchronize on the evictor mutex or else // deadlocks may occur. // - _dict.insert(make_pair(ident, servant)); + _dict.insert(pair<const Identity, const ObjectPtr>(ident, servant)); } void @@ -435,6 +436,7 @@ Freeze::EvictorI::evict() Identity ident = *p; EvictorElementPtr element = q->second; + // // Notify the persistence strategy about the evicted object. // diff --git a/cpp/src/Glacier/StarterI.cpp b/cpp/src/Glacier/StarterI.cpp index 48a251b57fb..f3dcaae308e 100644 --- a/cpp/src/Glacier/StarterI.cpp +++ b/cpp/src/Glacier/StarterI.cpp @@ -16,19 +16,20 @@ # error Sorry, the Glacier Starter is not yet supported on WIN32. #endif -#include <IceUtil/UUID.h> -#include <IceSSL/RSAKeyPair.h> -#include <Glacier/StarterI.h> -#include <fcntl.h> - // // crypt.h is necessary on older Linux distributions, but not with // OpenSSL 0.96x. // -#if defined(__linux__) && OPENSSL_VERSION_NUMBER >= 0x0090700fL +#if (defined(__linux__) || defined(__sun)) # include <crypt.h> #endif + +#include <IceUtil/UUID.h> +#include <IceSSL/RSAKeyPair.h> +#include <Glacier/StarterI.h> +#include <fcntl.h> + using namespace std; using namespace Ice; using namespace Glacier; diff --git a/cpp/src/Ice/Application.cpp b/cpp/src/Ice/Application.cpp index 40ed1359dbd..943514b6f16 100644 --- a/cpp/src/Ice/Application.cpp +++ b/cpp/src/Ice/Application.cpp @@ -14,6 +14,10 @@ #include <Ice/Application.h> +#ifndef _WIN32 +#include <signal.h> +#endif + using namespace std; using namespace Ice; diff --git a/cpp/src/Ice/Connection.cpp b/cpp/src/Ice/Connection.cpp index 21a74876acd..c26a7258c03 100644 --- a/cpp/src/Ice/Connection.cpp +++ b/cpp/src/Ice/Connection.cpp @@ -449,7 +449,7 @@ IceInternal::Connection::sendRequest(Outgoing* out, bool oneway) // if(!_endpoint->datagram() && !oneway) { - _requestsHint = _requests.insert(_requests.end(), make_pair(requestId, out)); + _requestsHint = _requests.insert(_requests.end(), pair<const Int, Outgoing*>(requestId, out)); } if(_acmTimeout > 0) @@ -547,7 +547,7 @@ IceInternal::Connection::sendAsyncRequest(const OutgoingAsyncPtr& out) // // Only add to the request map if there was no exception. // - _asyncRequestsHint = _asyncRequests.insert(_asyncRequests.end(), make_pair(requestId, out)); + _asyncRequestsHint = _asyncRequests.insert(_asyncRequests.end(), pair<const Int, OutgoingAsyncPtr>(requestId, out)); if(_acmTimeout > 0) { diff --git a/cpp/src/Ice/ConnectionFactory.cpp b/cpp/src/Ice/ConnectionFactory.cpp index 1369246940d..ea5086b930f 100644 --- a/cpp/src/Ice/ConnectionFactory.cpp +++ b/cpp/src/Ice/ConnectionFactory.cpp @@ -57,7 +57,7 @@ IceInternal::OutgoingConnectionFactory::destroy() (&Connection::destroy), Connection::CommunicatorDestroyed)); #else for_each(_connections.begin(), _connections.end(), - bind2nd(Ice::secondVoidMemFun1<EndpointPtr, Connection, Connection::DestructionReason> + bind2nd(Ice::secondVoidMemFun1<const EndpointPtr, Connection, Connection::DestructionReason> (&Connection::destroy), Connection::CommunicatorDestroyed)); #endif @@ -83,7 +83,7 @@ IceInternal::OutgoingConnectionFactory::waitUntilFinished() // finished. // for_each(_connections.begin(), _connections.end(), - Ice::secondVoidMemFun<EndpointPtr, Connection>(&Connection::waitUntilFinished)); + Ice::secondVoidMemFun<const EndpointPtr, Connection>(&Connection::waitUntilFinished)); // // We're done, now we can throw away all connections. @@ -144,8 +144,8 @@ IceInternal::OutgoingConnectionFactory::create(const vector<EndpointPtr>& endpts // for(q = endpoints.begin(); q != endpoints.end(); ++q) { - pair<multimap<EndpointPtr, ConnectionPtr>::const_iterator, - multimap<EndpointPtr, ConnectionPtr>::const_iterator> r = _connections.equal_range(*q); + pair<multimap<EndpointPtr, ConnectionPtr>::iterator, + multimap<EndpointPtr, ConnectionPtr>::iterator> r = _connections.equal_range(*q); while(r.first != r.second) { @@ -201,8 +201,8 @@ IceInternal::OutgoingConnectionFactory::create(const vector<EndpointPtr>& endpts { for(q = endpoints.begin(); q != endpoints.end(); ++q) { - pair<multimap<EndpointPtr, ConnectionPtr>::const_iterator, - multimap<EndpointPtr, ConnectionPtr>::const_iterator> r = _connections.equal_range(*q); + pair<multimap<EndpointPtr, ConnectionPtr>::iterator, + multimap<EndpointPtr, ConnectionPtr>::iterator> r = _connections.equal_range(*q); while(r.first != r.second) { @@ -295,7 +295,7 @@ IceInternal::OutgoingConnectionFactory::create(const vector<EndpointPtr>& endpts } else { - _connections.insert(_connections.end(), make_pair(connection->endpoint(), connection)); + _connections.insert(_connections.end(), pair<const EndpointPtr, ConnectionPtr>(connection->endpoint(), connection)); if(_destroyed) { @@ -350,8 +350,8 @@ IceInternal::OutgoingConnectionFactory::setRouter(const RouterPrx& router) endpoint = endpoint->compress(defaultsAndOverrides->overrideCompressValue); } - pair<multimap<EndpointPtr, ConnectionPtr>::const_iterator, - multimap<EndpointPtr, ConnectionPtr>::const_iterator> r = _connections.equal_range(endpoint); + pair<multimap<EndpointPtr, ConnectionPtr>::iterator, + multimap<EndpointPtr, ConnectionPtr>::iterator> r = _connections.equal_range(endpoint); while(r.first != r.second) { diff --git a/cpp/src/Ice/Incoming.cpp b/cpp/src/Ice/Incoming.cpp index b4bf6d7734c..8ee0c45e08c 100644 --- a/cpp/src/Ice/Incoming.cpp +++ b/cpp/src/Ice/Incoming.cpp @@ -143,8 +143,8 @@ IceInternal::Incoming::invoke(const ServantManagerPtr& servantManager) _is.readSize(sz); while(sz--) { - pair<string, string> pr; - _is.read(pr.first); + pair<const string, string> pr; + _is.read(const_cast<string&>(pr.first)); _is.read(pr.second); _current.ctx.insert(_current.ctx.end(), pr); } diff --git a/cpp/src/Ice/Instance.cpp b/cpp/src/Ice/Instance.cpp index c69093250f2..d99564a7a72 100644 --- a/cpp/src/Ice/Instance.cpp +++ b/cpp/src/Ice/Instance.cpp @@ -42,7 +42,7 @@ #endif #ifndef _WIN32 -# include <csignal> +# include <signal.h> # include <syslog.h> # include <pwd.h> # include <sys/types.h> @@ -590,7 +590,7 @@ IceInternal::Instance::finishSetup(int& argc, char* argv[]) LocatorPrx::uncheckedCast(_proxyFactory->stringToProxy(_defaultsAndOverrides->defaultLocator))); } -#ifndef _WIN32 +#if !defined(_WIN32) && !defined(__sun) // // daemon() must be called after any plug-ins have been // installed. For example, an SSL plug-in might want to diff --git a/cpp/src/Ice/LocatorInfo.cpp b/cpp/src/Ice/LocatorInfo.cpp index 32ac46b7b78..358ec4fe298 100644 --- a/cpp/src/Ice/LocatorInfo.cpp +++ b/cpp/src/Ice/LocatorInfo.cpp @@ -48,7 +48,7 @@ IceInternal::LocatorManager::destroy() { IceUtil::Mutex::Lock sync(*this); - for_each(_table.begin(), _table.end(), Ice::secondVoidMemFun<LocatorPrx, LocatorInfo>(&LocatorInfo::destroy)); + for_each(_table.begin(), _table.end(), Ice::secondVoidMemFun<const LocatorPrx, LocatorInfo>(&LocatorInfo::destroy)); _table.clear(); _tableHint = _table.end(); @@ -98,10 +98,10 @@ IceInternal::LocatorManager::get(const LocatorPrx& loc) if(t == _locatorTables.end()) { t = _locatorTables.insert(_locatorTables.begin(), - make_pair(locator->ice_getIdentity(), new LocatorTable())); + pair<const Identity, LocatorTablePtr>(locator->ice_getIdentity(), new LocatorTable())); } - _tableHint = _table.insert(_tableHint, make_pair(locator, new LocatorInfo(locator, t->second))); + _tableHint = _table.insert(_tableHint, pair<const LocatorPrx, LocatorInfoPtr>(locator, new LocatorInfo(locator, t->second))); } else { diff --git a/cpp/src/Ice/Network.cpp b/cpp/src/Ice/Network.cpp index 73c14933493..8809debefba 100644 --- a/cpp/src/Ice/Network.cpp +++ b/cpp/src/Ice/Network.cpp @@ -603,6 +603,10 @@ IceInternal::getAddress(const string& host, int port, struct sockaddr_in& addr) addr.sin_port = htons(port); addr.sin_addr.s_addr = inet_addr(host.c_str()); +#ifdef __sun +#define INADDR_NONE -1 +#endif + if(addr.sin_addr.s_addr == INADDR_NONE) { IceUtil::Mutex::Lock sync(getHostByNameMutex); diff --git a/cpp/src/Ice/Object.cpp b/cpp/src/Ice/Object.cpp index 5e1397a2c9b..b2b8d81a458 100644 --- a/cpp/src/Ice/Object.cpp +++ b/cpp/src/Ice/Object.cpp @@ -164,7 +164,7 @@ string Ice::Object::__all[] = DispatchStatus Ice::Object::__dispatch(Incoming& in, const Current& current) { - pair<const string*, const string*> r = + pair<string*, string*> r = equal_range(__all, __all + sizeof(__all) / sizeof(string), current.operation); if(r.first == r.second) @@ -226,8 +226,8 @@ Ice::Object::__read(::IceInternal::BasicStream* __is) while(sz-- > 0) { - pair<string, ObjectPtr> v; - __is->read(v.first); + pair<const string, ObjectPtr> v; + __is->read(const_cast<string&>(v.first)); __is->read("", 0, v.second); _activeFacetMapHint = _activeFacetMap.insert(_activeFacetMapHint, v); } @@ -263,8 +263,8 @@ Ice::Object::__unmarshal(const ::Ice::StreamPtr& __is) while(sz-- > 0) { __is->startReadDictionaryElement(); - pair<string, ObjectPtr> v; - v.first = __is->readString("ice:key"); + pair<const string, ObjectPtr> v; + const_cast<string&>(v.first) = __is->readString("ice:key"); v.second = __is->readObject("ice:value", "", 0); _activeFacetMapHint = _activeFacetMap.insert(_activeFacetMapHint, v); __is->endReadDictionaryElement(); @@ -298,7 +298,7 @@ Ice::Object::ice_addFacet(const ObjectPtr& facet, const string& name) throw ex; } - _activeFacetMapHint = _activeFacetMap.insert(_activeFacetMapHint, make_pair(name, facet)); + _activeFacetMapHint = _activeFacetMap.insert(_activeFacetMapHint, pair<const string, ObjectPtr>(name, facet)); } ObjectPtr diff --git a/cpp/src/Ice/ObjectAdapterFactory.cpp b/cpp/src/Ice/ObjectAdapterFactory.cpp index e02d3b2ea23..c87ce94bf31 100644 --- a/cpp/src/Ice/ObjectAdapterFactory.cpp +++ b/cpp/src/Ice/ObjectAdapterFactory.cpp @@ -39,7 +39,7 @@ IceInternal::ObjectAdapterFactory::shutdown() } for_each(_adapters.begin(), _adapters.end(), - Ice::secondVoidMemFun<string, ObjectAdapter>(&ObjectAdapter::deactivate)); + IceUtil::secondVoidMemFun<const string, ObjectAdapterI>(&ObjectAdapter::deactivate)); _instance = 0; _communicator = 0; @@ -76,7 +76,7 @@ IceInternal::ObjectAdapterFactory::waitForShutdown() // Now we wait for deactivation of each object adapter. // for_each(_adapters.begin(), _adapters.end(), - Ice::secondVoidMemFun<string, ObjectAdapter>(&ObjectAdapter::waitForDeactivate)); + IceUtil::secondVoidMemFun<const string, ObjectAdapterI>(&ObjectAdapter::waitForDeactivate)); // // We're done, now we can throw away the object adapters. diff --git a/cpp/src/Ice/ObjectFactoryManager.cpp b/cpp/src/Ice/ObjectFactoryManager.cpp index 8414337507b..75b6381d96d 100644 --- a/cpp/src/Ice/ObjectFactoryManager.cpp +++ b/cpp/src/Ice/ObjectFactoryManager.cpp @@ -31,7 +31,7 @@ IceInternal::ObjectFactoryManager::add(const ObjectFactoryPtr& factory, const st { IceUtil::Mutex::Lock sync(*this); - if( (_factoryMapHint != _factoryMap.end() && _factoryMapHint->first == id) + if((_factoryMapHint != _factoryMap.end() && _factoryMapHint->first == id) || _factoryMap.find(id) != _factoryMap.end()) { AlreadyRegisteredException ex(__FILE__, __LINE__); @@ -40,7 +40,7 @@ IceInternal::ObjectFactoryManager::add(const ObjectFactoryPtr& factory, const st throw ex; } - _factoryMapHint = _factoryMap.insert(_factoryMapHint, make_pair(id, factory)); + _factoryMapHint = _factoryMap.insert(_factoryMapHint, pair<const string, ObjectFactoryPtr>(id, factory)); } void @@ -125,7 +125,7 @@ IceInternal::ObjectFactoryManager::destroy() { IceUtil::Mutex::Lock sync(*this); for_each(_factoryMap.begin(), _factoryMap.end(), - Ice::secondVoidMemFun<string, ObjectFactory>(&ObjectFactory::destroy)); + Ice::secondVoidMemFun<const string, ObjectFactory>(&ObjectFactory::destroy)); _factoryMap.clear(); _factoryMapHint = _factoryMap.end(); } diff --git a/cpp/src/Ice/RouterInfo.cpp b/cpp/src/Ice/RouterInfo.cpp index e3847a989c4..b849e285293 100644 --- a/cpp/src/Ice/RouterInfo.cpp +++ b/cpp/src/Ice/RouterInfo.cpp @@ -38,7 +38,7 @@ IceInternal::RouterManager::destroy() { IceUtil::Mutex::Lock sync(*this); - for_each(_table.begin(), _table.end(), Ice::secondVoidMemFun<RouterPrx, RouterInfo>(&RouterInfo::destroy)); + for_each(_table.begin(), _table.end(), Ice::secondVoidMemFun<const RouterPrx, RouterInfo>(&RouterInfo::destroy)); _table.clear(); _tableHint = _table.end(); @@ -73,7 +73,7 @@ IceInternal::RouterManager::get(const RouterPrx& rtr) if(p == _table.end()) { - _tableHint = _table.insert(_tableHint, make_pair(router, new RouterInfo(router))); + _tableHint = _table.insert(_tableHint, pair<const RouterPrx, RouterInfoPtr>(router, new RouterInfo(router))); } else { diff --git a/cpp/src/Ice/RoutingTable.cpp b/cpp/src/Ice/RoutingTable.cpp index b9ed35d9a92..d3016d3b00b 100644 --- a/cpp/src/Ice/RoutingTable.cpp +++ b/cpp/src/Ice/RoutingTable.cpp @@ -65,7 +65,7 @@ IceInternal::RoutingTable::add(const ObjectPrx& prx) if(p == _table.end()) { - _tableHint = _table.insert(_tableHint, make_pair(proxy->ice_getIdentity(), proxy)); + _tableHint = _table.insert(_tableHint, pair<const Identity, ObjectPrx>(proxy->ice_getIdentity(), proxy)); return true; } else diff --git a/cpp/src/Ice/ServantManager.cpp b/cpp/src/Ice/ServantManager.cpp index 544a95a873e..6b01f5f74ae 100644 --- a/cpp/src/Ice/ServantManager.cpp +++ b/cpp/src/Ice/ServantManager.cpp @@ -41,7 +41,7 @@ IceInternal::ServantManager::addServant(const ObjectPtr& object, const Identity& throw ex; } - _servantMapHint = _servantMap.insert(_servantMapHint, make_pair(ident, object)); + _servantMapHint = _servantMap.insert(_servantMapHint, ObjectDict::value_type(ident, object)); } void @@ -71,7 +71,7 @@ IceInternal::ServantManager::findServant(const Identity& ident) const assert(_instance); // Must not be called after destruction. - if(_servantMapHint != _servantMap.end()) + if(_servantMap.end() != _servantMapHint) { if(_servantMapHint->first == ident) { @@ -80,7 +80,7 @@ IceInternal::ServantManager::findServant(const Identity& ident) const } ObjectDict::iterator p = const_cast<Ice::ObjectDict&>(_servantMap).find(ident); - if(p != _servantMap.end()) + if(_servantMap.end() != p) { _servantMapHint = p; return p->second; @@ -106,7 +106,7 @@ IceInternal::ServantManager::addServantLocator(const ServantLocatorPtr& locator, throw ex; } - _locatorMapHint = _locatorMap.insert(_locatorMapHint, make_pair(prefix, locator)); + _locatorMapHint = _locatorMap.insert(_locatorMapHint, pair<const string, ServantLocatorPtr>(prefix, locator)); } void @@ -144,7 +144,7 @@ IceInternal::ServantManager::findServantLocator(const string& prefix) const assert(_instance); // Must not be called after destruction. - if(_locatorMapHint != _locatorMap.end()) + if(_locatorMap.end() != _locatorMapHint) { if(_locatorMapHint->first == prefix) { @@ -153,7 +153,7 @@ IceInternal::ServantManager::findServantLocator(const string& prefix) const } map<string, ServantLocatorPtr>::iterator p = const_cast<map<string, ServantLocatorPtr>&>(_locatorMap).find(prefix); - if(p != _locatorMap.end()) + if(_locatorMap.end() != p) { _locatorMapHint = p; return p->second; diff --git a/cpp/src/Ice/UserExceptionFactoryManager.cpp b/cpp/src/Ice/UserExceptionFactoryManager.cpp index 8153d83a241..c23a485a3d9 100644 --- a/cpp/src/Ice/UserExceptionFactoryManager.cpp +++ b/cpp/src/Ice/UserExceptionFactoryManager.cpp @@ -37,7 +37,7 @@ IceInternal::UserExceptionFactoryManager::add(const UserExceptionFactoryPtr& fac throw ex; } - _factoryMapHint = _factoryMap.insert(_factoryMapHint, make_pair(id, factory)); + _factoryMapHint = _factoryMap.insert(_factoryMapHint, pair<const string, UserExceptionFactoryPtr>(id, factory)); } void @@ -101,7 +101,7 @@ IceInternal::UserExceptionFactoryManager::destroy() { IceUtil::Mutex::Lock sync(*this); for_each(_factoryMap.begin(), _factoryMap.end(), - Ice::secondVoidMemFun<string, UserExceptionFactory>(&UserExceptionFactory::destroy)); + Ice::secondVoidMemFun<const string, UserExceptionFactory>(&UserExceptionFactory::destroy)); _factoryMap.clear(); _factoryMapHint = _factoryMap.end(); } diff --git a/cpp/src/IcePack/AdapterRegistryI.cpp b/cpp/src/IcePack/AdapterRegistryI.cpp index a09cf98b747..3250017201e 100644 --- a/cpp/src/IcePack/AdapterRegistryI.cpp +++ b/cpp/src/IcePack/AdapterRegistryI.cpp @@ -51,7 +51,7 @@ IcePack::AdapterRegistryI::add(const string& id, const AdapterPrx& adapter, cons } throw AdapterExistsException(); } - _dict.insert(make_pair(id, adapter)); + _dict.insert(pair<const string, const Ice::ObjectPrx>(id, adapter)); if(_traceLevels->adapterRegistry > 0) { diff --git a/cpp/src/IcePack/ComponentBuilder.cpp b/cpp/src/IcePack/ComponentBuilder.cpp index 1e745d66eec..33ce7489957 100644 --- a/cpp/src/IcePack/ComponentBuilder.cpp +++ b/cpp/src/IcePack/ComponentBuilder.cpp @@ -12,6 +12,10 @@ // // ********************************************************************** +#ifdef __sun +#define _POSIX_PTHREAD_SEMANTICS +#endif + #include <Ice/Ice.h> #include <IcePack/ComponentBuilder.h> #include <IcePack/Internal.h> @@ -81,51 +85,52 @@ public: // through this task so other directories should be // removed by another task). // - struct dirent **namelist; - int n = ::scandir(_name.c_str(), &namelist, 0, alphasort); - if(n > 0) + + DIR* dir = opendir(_name.c_str()); + + if (dir == 0) { - Ice::StringSeq entries; - entries.reserve(n); - for(int i = 0; i < n; ++i) - { - string name = namelist[i]->d_name; - free(namelist[i]); - entries.push_back(_name + "/" + name); - } - free(namelist); + // TODO: log a warning, throw an exception? + return; + } + + + // TODO: make the allocation/deallocation exception-safe + struct dirent* entry = static_cast<struct dirent*>(malloc(pathconf(_name.c_str(), _PC_NAME_MAX) + 1)); + + Ice::StringSeq entries; + + while(readdir_r(dir, entry, &entry) == 0 && entry != 0) + { + string name = entry->d_name; + entries.push_back(_name + "/" + name); + } + free(entry); + closedir(dir); - for(Ice::StringSeq::iterator p = entries.begin(); p != entries.end(); ++p) + for(Ice::StringSeq::iterator p = entries.begin(); p != entries.end(); ++p) + { + struct stat buf; + + if(::stat(p->c_str(), &buf) != 0) { - struct stat buf; - - if(::stat(p->c_str(), &buf) != 0) + if(errno != ENOENT) { - if(errno != ENOENT) - { - // - // TODO: log error - // - } + // + // TODO: log error + // } - else if(S_ISREG(buf.st_mode)) + } + else if(S_ISREG(buf.st_mode)) + { + if(unlink(p->c_str()) != 0) { - if(unlink(p->c_str()) != 0) - { - // - // TODO: log error - // - } + // + // TODO: log error + // } } } - else if(n < 0) - { - // - // TODO: something seems to be wrong if we can't scan - // the directory. Print a warning. - // - } } if(rmdir(_name.c_str()) != 0) @@ -254,10 +259,10 @@ public: ostringstream os; os << "couldn't remove the object:\n" << ex << ends; - ObjectDeploymentException ex; - ex.reason = os.str(); - ex.proxy = _desc.proxy; - throw ex; + ObjectDeploymentException ode; + ode.reason = os.str(); + ode.proxy = _desc.proxy; + throw ode; } catch(const Ice::LocalException& lex) { @@ -280,7 +285,7 @@ private: } IcePack::DeploySAXParseException::DeploySAXParseException(const string& msg, - const ICE_XERCES_NS Locator*const locator) + const ICE_XERCES_NS Locator* locator) : SAXParseException(ICE_XERCES_NS XMLString::transcode(msg.c_str()), *locator) { } diff --git a/cpp/src/IcePack/Makefile b/cpp/src/IcePack/Makefile index 5cf9d6df36a..f7d4c33e9be 100644 --- a/cpp/src/IcePack/Makefile +++ b/cpp/src/IcePack/Makefile @@ -106,7 +106,7 @@ $(VERSIONED_NAME): $(LIB_OBJS) $(ADMIN): $(ADMIN_OBJS) $(NAME) rm -f $@ - $(CXX) $(LDFLAGS) -o $@ $(ADMIN_OBJS) -lIcePack -lIceBox $(LIBS) -lreadline -lncurses + $(CXX) $(LDFLAGS) -o $@ $(ADMIN_OBJS) -lIcePack -lIceBox $(LIBS) $(READLINE_LIBS) $(REGISTRY_SERVER): $(REGISTRY_SVR_OBJS) $(NAME) rm -f $@ diff --git a/cpp/src/IcePack/NodeRegistryI.cpp b/cpp/src/IcePack/NodeRegistryI.cpp index e4c49ba023d..4816de9caa9 100644 --- a/cpp/src/IcePack/NodeRegistryI.cpp +++ b/cpp/src/IcePack/NodeRegistryI.cpp @@ -74,7 +74,7 @@ IcePack::NodeRegistryI::add(const string& name, const NodePrx& node, const Ice:: } else { - _dict.insert(make_pair(name, node)); + _dict.insert(pair<const string, const Ice::ObjectPrx>(name, node)); if(_traceLevels->nodeRegistry > 0) { diff --git a/cpp/src/IcePack/ObjectRegistryI.cpp b/cpp/src/IcePack/ObjectRegistryI.cpp index c1c7f8d9c78..b26d0c4105e 100644 --- a/cpp/src/IcePack/ObjectRegistryI.cpp +++ b/cpp/src/IcePack/ObjectRegistryI.cpp @@ -42,7 +42,7 @@ IcePack::ObjectRegistryI::add(const ObjectDescription& obj, const Ice::Current&) // // Add the object to the object dictionary. // - _objects.insert(make_pair(id, obj)); + _objects.insert(pair<const Ice::Identity, const ObjectDescription>(id, obj)); // // Add the object to the interface dictionary. @@ -61,7 +61,7 @@ IcePack::ObjectRegistryI::add(const ObjectDescription& obj, const Ice::Current&) if(q == _types.end()) { - _types.insert(make_pair(obj.type, seq)); + _types.insert(pair<const string, const Ice::ObjectProxySeq>(obj.type, seq)); } else { diff --git a/cpp/src/IcePack/Parser.cpp b/cpp/src/IcePack/Parser.cpp index c7a07bd6b17..541c3e5923d 100644 --- a/cpp/src/IcePack/Parser.cpp +++ b/cpp/src/IcePack/Parser.cpp @@ -22,12 +22,13 @@ #include <iterator> +extern FILE* yyin; +extern int yydebug; + using namespace std; using namespace Ice; using namespace IcePack; -extern FILE* yyin; - namespace IcePack { @@ -867,7 +868,6 @@ IcePack::Parser::warning(const string& s) int IcePack::Parser::parse(FILE* file, bool debug) { - extern int yydebug; yydebug = debug ? 1 : 0; assert(!parser); @@ -896,7 +896,6 @@ IcePack::Parser::parse(FILE* file, bool debug) int IcePack::Parser::parse(const std::string& commands, bool debug) { - extern int yydebug; yydebug = debug ? 1 : 0; assert(!parser); diff --git a/cpp/src/IcePack/ServerRegistryI.cpp b/cpp/src/IcePack/ServerRegistryI.cpp index 157a4289125..f6e248f1067 100644 --- a/cpp/src/IcePack/ServerRegistryI.cpp +++ b/cpp/src/IcePack/ServerRegistryI.cpp @@ -52,7 +52,7 @@ IcePack::ServerRegistryI::add(const string& name, const ServerPrx& server, const throw ServerExistsException(); } - _dict.insert(make_pair(name, server)); + _dict.insert(pair<const string, const Ice::ObjectPrx>(name, server)); if(_traceLevels->serverRegistry > 0) { diff --git a/cpp/src/IcePatch/IcePatchI.cpp b/cpp/src/IcePatch/IcePatchI.cpp index ca3b53fb8f5..ffb7490cbc2 100644 --- a/cpp/src/IcePatch/IcePatchI.cpp +++ b/cpp/src/IcePatch/IcePatchI.cpp @@ -124,7 +124,7 @@ IcePatch::DirectoryI::getContents(const Current& current) const { if(ignoreSuffix(*p)) { - pair<StringSeq::const_iterator, StringSeq::const_iterator> r = + pair<StringSeq::iterator, StringSeq::iterator> r = equal_range(paths.begin(), paths.end(), removeSuffix(*p)); if(r.first == r.second) { @@ -134,7 +134,7 @@ IcePatch::DirectoryI::getContents(const Current& current) const syncUpgraded = true; } StringSeq paths2 = readDirectory(path); - pair<StringSeq::const_iterator, StringSeq::const_iterator> r2 = + pair<StringSeq::iterator, StringSeq::iterator> r2 = equal_range(paths2.begin(), paths2.end(), removeSuffix(*p)); if(r2.first == r2.second) { diff --git a/cpp/src/IcePatch/Util.cpp b/cpp/src/IcePatch/Util.cpp index 691fb7c1ad4..48c036586ed 100644 --- a/cpp/src/IcePatch/Util.cpp +++ b/cpp/src/IcePatch/Util.cpp @@ -44,7 +44,7 @@ // // Sun-OS doesn't have scandir() or alphasort(). // -#ifdef SUNOS +#ifdef __sun static int scandir(const char* dir, struct dirent*** namelist, diff --git a/cpp/src/IceStorm/Makefile b/cpp/src/IceStorm/Makefile index 61ff5fd31b8..87847374d9b 100644 --- a/cpp/src/IceStorm/Makefile +++ b/cpp/src/IceStorm/Makefile @@ -78,7 +78,7 @@ $(VERSIONED_SNAME): $(SERVICE_OBJS) $(ADMIN): $(AOBJS) $(NAME) rm -f $@ - $(CXX) $(LDFLAGS) -o $@ $(AOBJS) -lIceStorm $(LIBS) $(XERCESC_LIBS) -lreadline -lncurses + $(CXX) $(LDFLAGS) -o $@ $(AOBJS) -lIceStorm $(XERCESC_LIBS) $(READLINE_LIBS) $(LIBS) StringStringDict.h StringStringDict.cpp: $(SLICE2FREEZE) rm -f StringStringDict.h StringStringDict.cpp diff --git a/cpp/src/IceStorm/Parser.cpp b/cpp/src/IceStorm/Parser.cpp index f7b67b7303f..6d412c0d9e6 100644 --- a/cpp/src/IceStorm/Parser.cpp +++ b/cpp/src/IceStorm/Parser.cpp @@ -22,12 +22,13 @@ # include <readline/history.h> #endif +extern FILE* yyin; +extern int yydebug; + using namespace std; using namespace Ice; using namespace IceStorm; -extern FILE* yyin; - namespace IceStorm { @@ -593,7 +594,6 @@ Parser::warning(const string& s) int Parser::parse(FILE* file, bool debug) { - extern int yydebug; yydebug = debug ? 1 : 0; assert(!parser); @@ -622,7 +622,6 @@ Parser::parse(FILE* file, bool debug) int Parser::parse(const std::string& commands, bool debug) { - extern int yydebug; yydebug = debug ? 1 : 0; assert(!parser); diff --git a/cpp/src/IceStorm/TopicManagerI.cpp b/cpp/src/IceStorm/TopicManagerI.cpp index 90658ba7470..16e3620a1ae 100644 --- a/cpp/src/IceStorm/TopicManagerI.cpp +++ b/cpp/src/IceStorm/TopicManagerI.cpp @@ -88,7 +88,7 @@ TopicManagerI::create(const string& name, const string& type, const Ice::Current } installTopic("create", name, type, true); - _topics.insert(make_pair(name, type)); + _topics.insert(pair<const string, const string>(name, type)); // // The identity is the name of the Topic. diff --git a/cpp/src/IceStorm/WeightedGraph.cpp b/cpp/src/IceStorm/WeightedGraph.cpp index e706e45e75e..6f006893dce 100644 --- a/cpp/src/IceStorm/WeightedGraph.cpp +++ b/cpp/src/IceStorm/WeightedGraph.cpp @@ -386,7 +386,7 @@ WeightedGraph::addEdge(const string& from, const string& to, int cost) _edges.resize(_vertices.size()*_vertices.size(), -1); for(unsigned int i = 0; i < _vertices.size(); ++i) { - _vlookup.insert(make_pair(_vertices[i], i)); + _vlookup.insert(pair<const string, int>(_vertices[i], i)); } } diff --git a/cpp/src/IceXML/StreamI.cpp b/cpp/src/IceXML/StreamI.cpp index bec7a8d81c3..39fe38546ed 100644 --- a/cpp/src/IceXML/StreamI.cpp +++ b/cpp/src/IceXML/StreamI.cpp @@ -1217,7 +1217,7 @@ IceXML::StreamI::readObject(const string& name, const string& signatureType, con // Add the object to the readObjects map, move to the first // child node & unmarshal the object. // - _input->readObjects.insert(map<string, ::Ice::ObjectPtr>::value_type(id, value)); + _input->readObjects.insert(pair<const string, ::Ice::ObjectPtr>(id, value)); _input->current = _input->current->getFirstChild(); value->__unmarshal(this); } diff --git a/cpp/src/Slice/Grammar.y b/cpp/src/Slice/Grammar.y index 4060c569362..01266703ecf 100644 --- a/cpp/src/Slice/Grammar.y +++ b/cpp/src/Slice/Grammar.y @@ -31,7 +31,17 @@ using namespace Slice; void yyerror(const char* s) { - unit->error(s); + // yacc and recent versions of Bison use "syntax error" instead + // of "parse error". + + if (strcmp(s, "parse error") == 0) + { + unit->error("syntax error"); + } + else + { + unit->error(s); + } } %} @@ -1391,7 +1401,7 @@ const_initializer ostringstream sstr; sstr << intVal->v; SyntaxTreeBaseStringTokPtr basestring = new SyntaxTreeBaseStringTok; - basestring->v = make_pair(type, sstr.str()); + basestring->v = pair<SyntaxTreeBasePtr,string>(type, sstr.str()); $$ = basestring; } | ICE_FLOATING_POINT_LITERAL @@ -1401,7 +1411,7 @@ const_initializer ostringstream sstr; sstr << floatVal->v; SyntaxTreeBaseStringTokPtr basestring = new SyntaxTreeBaseStringTok; - basestring->v = make_pair(type, sstr.str()); + basestring->v = pair<SyntaxTreeBasePtr,string>(type, sstr.str()); $$ = basestring; } | scoped_name @@ -1411,7 +1421,7 @@ const_initializer ContainedList cl = unit->currentContainer()->lookupContained(scoped->v); if(cl.empty()) { - basestring->v = make_pair(TypePtr(0), scoped->v); + basestring->v = pair<SyntaxTreeBasePtr,string>(TypePtr(0), scoped->v); } else { @@ -1429,7 +1439,7 @@ const_initializer unit->error(msg); } unit->currentContainer()->checkIntroduced(scoped->v, enumerator); - basestring->v = make_pair(enumerator, scoped->v); + basestring->v = pair<SyntaxTreeBasePtr,string>(enumerator, scoped->v); } $$ = basestring; } @@ -1438,7 +1448,7 @@ const_initializer BuiltinPtr type = unit->builtin(Builtin::KindString); StringTokPtr literal = StringTokPtr::dynamicCast($1); SyntaxTreeBaseStringTokPtr basestring = new SyntaxTreeBaseStringTok; - basestring->v = make_pair(type, literal->v); + basestring->v = pair<SyntaxTreeBasePtr,string>(type, literal->v); $$ = basestring; } | ICE_FALSE @@ -1446,7 +1456,7 @@ const_initializer BuiltinPtr type = unit->builtin(Builtin::KindBool); StringTokPtr literal = StringTokPtr::dynamicCast($1); SyntaxTreeBaseStringTokPtr basestring = new SyntaxTreeBaseStringTok; - basestring->v = make_pair(type, literal->v); + basestring->v = pair<SyntaxTreeBasePtr,string>(type, literal->v); $$ = basestring; } | ICE_TRUE @@ -1454,7 +1464,7 @@ const_initializer BuiltinPtr type = unit->builtin(Builtin::KindBool); StringTokPtr literal = StringTokPtr::dynamicCast($1); SyntaxTreeBaseStringTokPtr basestring = new SyntaxTreeBaseStringTok; - basestring->v = make_pair(type, literal->v); + basestring->v = pair<SyntaxTreeBasePtr,string>(type, literal->v); $$ = basestring; } ; diff --git a/cpp/src/Slice/Parser.cpp b/cpp/src/Slice/Parser.cpp index aa48414bbec..c3d9a1958b1 100644 --- a/cpp/src/Slice/Parser.cpp +++ b/cpp/src/Slice/Parser.cpp @@ -232,7 +232,7 @@ Slice::Contained::Contained(const ContainerPtr& container, const string& name) : void Slice::Container::destroy() { - for_each(_contents.begin(), _contents.end(), ::IceUtil::voidMemFun(&Contained::destroy)); + for_each(_contents.begin(), _contents.end(), ::IceUtil::voidMemFun(&SyntaxTreeBase::destroy)); _contents.clear(); _introducedMap.clear(); SyntaxTreeBase::destroy(); @@ -313,7 +313,7 @@ Slice::Container::createClassDef(const string& name, bool intf, const ClassList& } if(!differsOnlyInCase) { - string msg = "redefinition of "; + msg = "redefinition of "; msg += intf ? "interface" : "class"; msg += " `" + name + "'"; _unit->error(msg); @@ -1535,9 +1535,21 @@ Slice::Constructed::isLocal() const ConstructedList Slice::Constructed::dependencies() { - set<ConstructedPtr> result; - recDependencies(result); - return ConstructedList(result.begin(), result.end()); + set<ConstructedPtr> resultSet; + recDependencies(resultSet); + +#if defined(__SUNPRO_CC) && defined(_RWSTD_NO_MEMBER_TEMPLATES) + // TODO: find a more usable work-around for this std lib limitation + ConstructedList result; + set<ConstructedPtr>::iterator it = resultSet.begin(); + while(it != resultSet.end()) + { + result.push_back(*it++); + } + return result; +#else + return ConstructedList(resultSet.begin(), resultSet.end()); +#endif } Slice::Constructed::Constructed(const ContainerPtr& container, const string& name, bool local) : diff --git a/cpp/src/XMLTransform/XMLTransform.cpp b/cpp/src/XMLTransform/XMLTransform.cpp index c5e20e1b444..4a7e4171c4a 100644 --- a/cpp/src/XMLTransform/XMLTransform.cpp +++ b/cpp/src/XMLTransform/XMLTransform.cpp @@ -12,6 +12,11 @@ // // ********************************************************************** +// For readdir_r +#ifdef __sun +#define _POSIX_PTHREAD_SEMANTICS +#endif + #include <IceUtil/InputUtil.h> #include <Ice/Ice.h> #include <XMLTransform/XMLTransform.h> @@ -1386,8 +1391,10 @@ public: void create(ICE_XERCES_NS DOMDocument*, ICE_XERCES_NS DOMDocument*, const Ice::StringSeq&, const Ice::StringSeq&, const Ice::StringSeq&, const Ice::StringSeq&, TransformMap*, TransformMap*); -private: + + // COMPILERBUG: Should be private but with Sun C++ 5.4, can't use Type in + // StringTypeTable below unless it's public. enum Type { TypeBoolean, @@ -1405,6 +1412,8 @@ private: TypeInternal }; +private: + // // Load all schemas in a list of directories. // @@ -1623,8 +1632,8 @@ XMLTransform::TransformFactory::create(ICE_XERCES_NS DOMDocument* fromDoc, ICE_X assert(toSchema); DocumentInfoPtr toInfo = new DocumentInfo(toDoc, false, toSchema); - _fromDocs.insert(make_pair(fromInfo->getTargetNamespace(), fromInfo)); - _toDocs.insert(make_pair(toInfo->getTargetNamespace(), toInfo)); + _fromDocs.insert(pair<const string, DocumentInfoPtr>(fromInfo->getTargetNamespace(), fromInfo)); + _toDocs.insert(pair<const string, DocumentInfoPtr>(toInfo->getTargetNamespace(), toInfo)); // // Process the import/include declarations for the source schema documents. @@ -1715,26 +1724,30 @@ XMLTransform::TransformFactory::load(DocumentMap& documents, set<string>& import #else - struct dirent **namelist; - int n = ::scandir(path.c_str(), &namelist, 0, alphasort); - if(n < 0) - { - InvalidSchema ex(__FILE__, __LINE__); + DIR* dir = opendir(path.c_str()); + + if (dir == 0) + { + InvalidSchema ex(__FILE__, __LINE__); ex.reason = "cannot read directory `" + path + "': " + strerror(errno); throw ex; - } + } + + + // TODO: make the allocation/deallocation exception-safe + struct dirent* entry = static_cast<struct dirent*>(malloc(pathconf(path.c_str(), _PC_NAME_MAX) + 1)); - for(int i = 0; i < n; ++i) - { - string name = namelist[i]->d_name; + while(readdir_r(dir, entry, &entry) == 0 && entry != 0) + { + string name = entry->d_name; assert(!name.empty()); - free(namelist[i]); - struct stat buf; string fullPath = path + '/' + name; if(::stat(fullPath.c_str(), &buf) == -1) { + free(entry); + closedir(dir); InvalidSchema ex(__FILE__, __LINE__); ex.reason = "cannot stat `" + fullPath + "': " + strerror(errno); throw ex; @@ -1752,8 +1765,9 @@ XMLTransform::TransformFactory::load(DocumentMap& documents, set<string>& import import(documents, importedFiles, "", fullPath, paths); } } - - free(namelist); + + free(entry); + closedir(dir); #endif } @@ -1830,7 +1844,7 @@ XMLTransform::TransformFactory::import(DocumentMap& documents, set<string>& impo parser.adoptDocument(); DocumentInfoPtr info = new DocumentInfo(document, true, schema, ns); - documents.insert(make_pair(info->getTargetNamespace(), info)); + documents.insert(pair<const string, DocumentInfoPtr>(info->getTargetNamespace(), info)); // // Add the file to the list of imported files. @@ -2277,7 +2291,7 @@ XMLTransform::TransformFactory::createTransform(const DocumentInfoPtr& fromTypeI if(_staticClassTransforms->find(type) == _staticClassTransforms->end()) { StructTransform* st = new StructTransform; - _staticClassTransforms->insert(make_pair(type, st)); + _staticClassTransforms->insert(pair<const string, TransformPtr>(type, st)); vector<ElementTransformPtr> v; createClassContentTransform(fromInfo, from, toInfo, to, v); diff --git a/cpp/src/icecpp/config.h b/cpp/src/icecpp/config.h index 1c13ee2855a..b1949ec2d0b 100644 --- a/cpp/src/icecpp/config.h +++ b/cpp/src/icecpp/config.h @@ -17,7 +17,7 @@ // configure script from the gcc-2.8.1 distribution. // -#if defined(__linux__) || defined(__FreeBSD__) +#if defined(__linux__) || defined(__FreeBSD__) || defined(__sun) # define HAVE_INTTYPES_H 1 # define TIME_WITH_SYS_TIME 1 # define HAVE_BCMP 1 @@ -35,6 +35,12 @@ # define alloca _alloca #endif +#if defined(__sun) +#include <alloca.h> +#include <malloc.h> +#include <strings.h> +#endif + #define HAVE_SETRLIMIT 1 #define HAVE_STRERROR 1 #define HAVE_VPRINTF 1 @@ -51,7 +57,7 @@ #define LONG_TYPE_SIZE 4 #if defined(_WIN32) # define WCHAR_TYPE_SIZE 2 -#elif (defined(__linux__) || defined(__FreeBSD__)) && defined(i386) +#elif (defined(__linux__) || defined(__FreeBSD__)) && defined(i386) || defined (__sun) # define WCHAR_TYPE_SIZE 4 #else # error "unsupported operating system or platform" diff --git a/cpp/src/slice2cpp/Gen.cpp b/cpp/src/slice2cpp/Gen.cpp index 9b64c588518..665ec5e59f5 100644 --- a/cpp/src/slice2cpp/Gen.cpp +++ b/cpp/src/slice2cpp/Gen.cpp @@ -16,7 +16,7 @@ #include <Slice/CPlusPlusUtil.h> #include <Gen.h> #include <limits> -#include <iterator> +#include <IceUtil/Iterator.h> #include <sys/stat.h> @@ -398,7 +398,7 @@ Slice::Gen::TypesVisitor::visitExceptionStart(const ExceptionPtr& p) ExceptionList allBases = p->allBases(); StringList exceptionIds; transform(allBases.begin(), allBases.end(), back_inserter(exceptionIds), - ::IceUtil::constMemFun(&Exception::scoped)); + ::IceUtil::constMemFun(&Contained::scoped)); exceptionIds.push_front(p->scoped()); exceptionIds.push_back("::Ice::UserException"); @@ -787,8 +787,9 @@ Slice::Gen::TypesVisitor::visitDictionary(const DictionaryPtr& p) C << nl << "__is->readSize(sz);"; C << nl << "while(sz--)"; C << sb; - C << nl << "::std::pair<" << ks << ", " << vs << "> pair;"; - writeMarshalUnmarshalCode(C, keyType, "pair.first", false); + C << nl << "::std::pair<const " << ks << ", " << vs << "> pair;"; + string pf = string("const_cast<") + ks + "&>(pair.first)"; + writeMarshalUnmarshalCode(C, keyType, pf, false); writeMarshalUnmarshalCode(C, valueType, "pair.second", false); C << nl << "v.insert(v.end(), pair);"; C << eb; @@ -816,9 +817,9 @@ Slice::Gen::TypesVisitor::visitDictionary(const DictionaryPtr& p) C << nl << "::Ice::Int sz = __is->startReadDictionary(__name);"; C << nl << "while(sz--)"; C << sb; - C << nl << "::std::pair<" << ks << ", " << vs << "> pair;"; + C << nl << "::std::pair<const " << ks << ", " << vs << "> pair;"; C << nl << "__is->startReadDictionaryElement();"; - writeGenericMarshalUnmarshalCode(C, keyType, "pair.first", false, "\"key\""); + writeGenericMarshalUnmarshalCode(C, keyType, pf, false, "\"key\""); writeGenericMarshalUnmarshalCode(C, valueType, "pair.second", false, "\"value\""); C << nl << "__is->endReadDictionaryElement();"; C << nl << "v.insert(v.end(), pair);"; @@ -2061,7 +2062,7 @@ Slice::Gen::ObjectVisitor::visitClassDefStart(const ClassDefPtr& p) { ClassList allBases = p->allBases(); StringList ids; - transform(allBases.begin(), allBases.end(), back_inserter(ids), ::IceUtil::constMemFun(&ClassDef::scoped)); + transform(allBases.begin(), allBases.end(), back_inserter(ids), ::IceUtil::constMemFun(&Contained::scoped)); StringList other; other.push_back(p->scoped()); other.push_back("::Ice::Object"); @@ -2071,7 +2072,7 @@ Slice::Gen::ObjectVisitor::visitClassDefStart(const ClassDefPtr& p) StringList::const_iterator firstIter = ids.begin(); StringList::const_iterator scopedIter = find(ids.begin(), ids.end(), p->scoped()); assert(scopedIter != ids.end()); - int scopedPos = distance(firstIter, scopedIter); + int scopedPos = ice_distance(firstIter, scopedIter); StringList::const_iterator q; @@ -2164,7 +2165,7 @@ Slice::Gen::ObjectVisitor::visitClassDefEnd(const ClassDefPtr& p) { StringList allOpNames; transform(allOps.begin(), allOps.end(), back_inserter(allOpNames), - ::IceUtil::constMemFun(&Operation::name)); + ::IceUtil::constMemFun(&Contained::name)); allOpNames.push_back("ice_facets"); allOpNames.push_back("ice_id"); allOpNames.push_back("ice_ids"); @@ -2196,7 +2197,10 @@ Slice::Gen::ObjectVisitor::visitClassDefEnd(const ClassDefPtr& p) C << nl << "::IceInternal::DispatchStatus" << nl << scoped.substr(2) << "::__dispatch(::IceInternal::Incoming& in, const ::Ice::Current& current)"; C << sb; - C << nl << "::std::pair<const ::std::string*, const ::std::string*> r = " + + // COMPILERBUG: Sun C++ 5.4 and GCC 3.2 won't compile without a + // space between < and :: + C << nl << "::std::pair< ::std::string*, ::std::string*> r = " << "::std::equal_range(__all, __all + " << allOpNames.size() << ", current.operation);"; C << nl << "if(r.first == r.second)"; C << sb; diff --git a/cpp/src/slice2java/Gen.cpp b/cpp/src/slice2java/Gen.cpp index d0def6e3a0f..79294d858e9 100644 --- a/cpp/src/slice2java/Gen.cpp +++ b/cpp/src/slice2java/Gen.cpp @@ -15,6 +15,8 @@ #include <IceUtil/Functional.h> #include <Gen.h> #include <limits> +#include <IceUtil/Algorithm.h> +#include <IceUtil/Iterator.h> using namespace std; using namespace Slice; @@ -204,8 +206,8 @@ Slice::JavaVisitor::writeThrowsClause(const string& scope, const ExceptionList& // // Don't include local exceptions in the throws clause // - ExceptionList::size_type localCount = count_if(throws.begin(), throws.end(), - IceUtil::constMemFun(&Exception::isLocal)); + ExceptionList::size_type localCount = ice_count_if(throws.begin(), throws.end(), + IceUtil::constMemFun(&Exception::isLocal)); Output& out = output(); if(throws.size() - localCount > 0) @@ -375,7 +377,7 @@ Slice::JavaVisitor::writeDispatch(Output& out, const ClassDefPtr& p) ClassList allBases = p->allBases(); StringList ids; - transform(allBases.begin(), allBases.end(), back_inserter(ids), ::IceUtil::constMemFun(&ClassDef::scoped)); + transform(allBases.begin(), allBases.end(), back_inserter(ids), ::IceUtil::constMemFun(&Contained::scoped)); StringList other; other.push_back(scoped); other.push_back("::Ice::Object"); @@ -385,7 +387,7 @@ Slice::JavaVisitor::writeDispatch(Output& out, const ClassDefPtr& p) StringList::const_iterator firstIter = ids.begin(); StringList::const_iterator scopedIter = find(ids.begin(), ids.end(), scoped); assert(scopedIter != ids.end()); - int scopedPos = distance(firstIter, scopedIter); + int scopedPos = ice_distance(firstIter, scopedIter); StringList::const_iterator q; @@ -616,7 +618,7 @@ Slice::JavaVisitor::writeDispatch(Output& out, const ClassDefPtr& p) if(!allOps.empty()) { StringList allOpNames; - transform(allOps.begin(), allOps.end(), back_inserter(allOpNames), ::IceUtil::constMemFun(&Operation::name)); + transform(allOps.begin(), allOps.end(), back_inserter(allOpNames), ::IceUtil::constMemFun(&Contained::name)); allOpNames.push_back("ice_facets"); allOpNames.push_back("ice_id"); allOpNames.push_back("ice_ids"); @@ -1370,7 +1372,7 @@ Slice::Gen::TypesVisitor::visitExceptionStart(const ExceptionPtr& p) StringList exceptionIds; transform(allBases.begin(), allBases.end(), back_inserter(exceptionIds), - ::IceUtil::constMemFun(&Exception::scoped)); + ::IceUtil::constMemFun(&Contained::scoped)); exceptionIds.push_front(scoped); exceptionIds.push_back("::Ice::UserException"); diff --git a/cpp/test/Freeze/complex/Client.cpp b/cpp/test/Freeze/complex/Client.cpp index 316fe398c99..b275421d769 100644 --- a/cpp/test/Freeze/complex/Client.cpp +++ b/cpp/test/Freeze/complex/Client.cpp @@ -85,7 +85,7 @@ populate(const DBPtr& db) Complex::Key k; k.expression = expressions[i]; k.result = root->calc(); - m.insert(make_pair(k, root)); + m.insert(pair<const Complex::Key, const Complex::NodePtr>(k, root)); } cout << "ok" << endl; diff --git a/cpp/test/Freeze/dbmap/Client.cpp b/cpp/test/Freeze/dbmap/Client.cpp index aca2d3a08ee..99c0c8a0ba5 100644 --- a/cpp/test/Freeze/dbmap/Client.cpp +++ b/cpp/test/Freeze/dbmap/Client.cpp @@ -27,19 +27,21 @@ using namespace Freeze; static Byte alphabetChars[] = "abcdefghijklmnopqrstuvwxyz"; vector<Byte> alphabet; -static void -ForEachTest(const pair<Byte, Int>&) +// The extern in the following function is due to a Sun C++ template bug +// +extern void +ForEachTest(const pair<const Byte, const Int>&) { } -static bool -FindIfTest(const pair<Byte, Int>& p) +extern bool +FindIfTest(const pair<const Byte, const Int>& p) { return p.first == 'b'; } -static bool -FindFirstOfTest(const pair<Byte, Int>& p, Byte q) +extern bool +FindFirstOfTest(const pair<const Byte, const Int>& p, Byte q) { return p.first == q; } @@ -52,7 +54,11 @@ populateDB(MAP& m) for(vector<Byte>::const_iterator j = alphabet.begin(); j != alphabet.end(); ++j) { - m.insert(make_pair(*j, j-alphabet.begin())); +#ifdef _MSC_VER + m.insert(MAP::value_type(*j, j-alphabet.begin())); +#else + m.insert(typename MAP::value_type(*j, j-alphabet.begin())); +#endif } } @@ -207,7 +213,7 @@ run(int argc, char* argv[], MAP& m) // Verify cloned cursors are independent // test(p->first != 'n' && p->second != 13); - pair<Byte, Int> data = *p; + pair<const Byte, const Int> data = *p; ++p; test(p->first != data.first && p->second != data.second); @@ -295,13 +301,13 @@ run(int argc, char* argv[], MAP& m) // j = find(alphabet.begin(), alphabet.end(), 'n'); map<Byte, const Int> pairs; - pairs.insert(make_pair(*j, j - alphabet.begin())); + pairs.insert(pair<const Byte, const Int>(*j, j - alphabet.begin())); ++j; - pairs.insert(make_pair(*j, j - alphabet.begin())); + pairs.insert(pair<const Byte, const Int>(*j, j - alphabet.begin())); ++j; - pairs.insert(make_pair(*j, j - alphabet.begin())); + pairs.insert(pair<const Byte, const Int>(*j, j - alphabet.begin())); ++j; - pairs.insert(make_pair(*j, j - alphabet.begin())); + pairs.insert(pair<const Byte, const Int>(*j, j - alphabet.begin())); p = find_first_of(m.begin(), m.end(), pairs.begin(), pairs.end()); test(p != m.end()); @@ -315,7 +321,7 @@ run(int argc, char* argv[], MAP& m) pairs.clear(); for(p = m.begin(); p != m.end(); ++p) { - pairs.insert(make_pair(p->first, p->second)); + pairs.insert(pair<const Byte, const Int>(p->first, p->second)); } test(pairs.size() == m.size()); diff --git a/cpp/test/Slice/errorDetection/ClassRedefinition.err b/cpp/test/Slice/errorDetection/ClassRedefinition.err index 344d9e96520..ba6f871e04b 100644 --- a/cpp/test/Slice/errorDetection/ClassRedefinition.err +++ b/cpp/test/Slice/errorDetection/ClassRedefinition.err @@ -1,4 +1,4 @@ ClassRedefinition.ice:17: redefinition of class `Class1' -ClassRedefinition.ice:17: parse error +ClassRedefinition.ice:17: syntax error ClassRedefinition.ice:21: redefinition of class `Class2' -ClassRedefinition.ice:21: parse error +ClassRedefinition.ice:21: syntax error diff --git a/cpp/test/Slice/errorDetection/IdentAsKeyword.err b/cpp/test/Slice/errorDetection/IdentAsKeyword.err index e3bd9918339..80a03b40ca4 100644 --- a/cpp/test/Slice/errorDetection/IdentAsKeyword.err +++ b/cpp/test/Slice/errorDetection/IdentAsKeyword.err @@ -18,11 +18,11 @@ IdentAsKeyword.ice:31: illegal identifier: `MOdule' differs from keyword `module IdentAsKeyword.ice:31: keyword `module' cannot be used as class name IdentAsKeyword.ice:32: keyword `module' cannot be used as class name IdentAsKeyword.ice:32: redefinition of class `module' -IdentAsKeyword.ice:32: parse error +IdentAsKeyword.ice:32: syntax error IdentAsKeyword.ice:34: illegal identifier: `extendS' differs from keyword `extends' only in capitalization IdentAsKeyword.ice:34: keyword `extends' cannot be used as data member name IdentAsKeyword.ice:35: redefinition of class `C' -IdentAsKeyword.ice:35: parse error +IdentAsKeyword.ice:35: syntax error IdentAsKeyword.ice:36: keyword `extends' cannot be used as data member name IdentAsKeyword.ice:38: keyword `local' cannot be used as interface name IdentAsKeyword.ice:39: illegal identifier: `Local' differs from keyword `local' only in capitalization @@ -31,31 +31,31 @@ IdentAsKeyword.ice:41: keyword `Object' cannot be used as interface name IdentAsKeyword.ice:42: illegal identifier: `object' differs from keyword `Object' only in capitalization IdentAsKeyword.ice:42: keyword `Object' cannot be used as interface name IdentAsKeyword.ice:42: redefinition of interface `Object' -IdentAsKeyword.ice:42: parse error +IdentAsKeyword.ice:42: syntax error IdentAsKeyword.ice:43: keyword `long' cannot be used as interface name IdentAsKeyword.ice:45: illegal identifier: `impLEments' differs from keyword `implements' only in capitalization IdentAsKeyword.ice:45: keyword `implements' cannot be used as sequence name IdentAsKeyword.ice:46: redefinition of sequence `implements' as sequence IdentAsKeyword.ice:46: keyword `implements' cannot be used as sequence name IdentAsKeyword.ice:47: keyword `short' cannot be used as sequence name -IdentAsKeyword.ice:49: parse error +IdentAsKeyword.ice:49: syntax error IdentAsKeyword.ice:50: illegal identifier: `moDule' differs from keyword `module' only in capitalization -IdentAsKeyword.ice:50: parse error +IdentAsKeyword.ice:50: syntax error IdentAsKeyword.ice:52: keyword `throws' cannot be used as dictionary name IdentAsKeyword.ice:53: illegal identifier: `thRows' differs from keyword `throws' only in capitalization IdentAsKeyword.ice:53: redefinition of dictionary `throws' as dictionary IdentAsKeyword.ice:53: keyword `throws' cannot be used as dictionary name IdentAsKeyword.ice:54: illegal identifier: `LOCALobject' differs from keyword `LocalObject' only in capitalization IdentAsKeyword.ice:54: keyword `LocalObject' cannot be used as dictionary name -IdentAsKeyword.ice:56: parse error +IdentAsKeyword.ice:56: syntax error IdentAsKeyword.ice:57: illegal identifier: `MODULE' differs from keyword `module' only in capitalization -IdentAsKeyword.ice:57: parse error -IdentAsKeyword.ice:59: parse error +IdentAsKeyword.ice:57: syntax error +IdentAsKeyword.ice:59: syntax error IdentAsKeyword.ice:60: illegal identifier: `OUT' differs from keyword `out' only in capitalization -IdentAsKeyword.ice:60: parse error -IdentAsKeyword.ice:62: parse error +IdentAsKeyword.ice:60: syntax error +IdentAsKeyword.ice:62: syntax error IdentAsKeyword.ice:63: illegal identifier: `VOID' differs from keyword `void' only in capitalization -IdentAsKeyword.ice:63: parse error +IdentAsKeyword.ice:63: syntax error IdentAsKeyword.ice:63: illegal identifier: `VOID' differs from keyword `void' only in capitalization IdentAsKeyword.ice:65: keyword `local' cannot be used as enumeration name IdentAsKeyword.ice:65: redefinition of interface `local' as enumeration @@ -75,9 +75,9 @@ IdentAsKeyword.ice:72: keyword `module' cannot be used as operation name IdentAsKeyword.ice:74: keyword `exception' cannot be used as operation name IdentAsKeyword.ice:75: illegal identifier: `EXception' differs from keyword `exception' only in capitalization IdentAsKeyword.ice:75: keyword `exception' cannot be used as operation name -IdentAsKeyword.ice:77: parse error +IdentAsKeyword.ice:77: syntax error IdentAsKeyword.ice:78: illegal identifier: `OUT' differs from keyword `out' only in capitalization -IdentAsKeyword.ice:78: parse error +IdentAsKeyword.ice:78: syntax error IdentAsKeyword.ice:80: keyword `byte' cannot be used as parameter name IdentAsKeyword.ice:81: illegal identifier: `BYTE' differs from keyword `byte' only in capitalization IdentAsKeyword.ice:81: keyword `byte' cannot be used as parameter name diff --git a/cpp/test/Slice/errorDetection/InterfaceMismatch.err b/cpp/test/Slice/errorDetection/InterfaceMismatch.err index ae710e0e193..96b6c3d2a00 100644 --- a/cpp/test/Slice/errorDetection/InterfaceMismatch.err +++ b/cpp/test/Slice/errorDetection/InterfaceMismatch.err @@ -1,8 +1,8 @@ InterfaceMismatch.ice:16: class `Foo1' was declared as interface InterfaceMismatch.ice:17: class `Foo1' was declared as interface -InterfaceMismatch.ice:17: parse error +InterfaceMismatch.ice:17: syntax error InterfaceMismatch.ice:20: class `Foo2' was defined as interface InterfaceMismatch.ice:23: interface `Foo3' was declared as class InterfaceMismatch.ice:24: interface `Foo3' was declared as class -InterfaceMismatch.ice:24: parse error +InterfaceMismatch.ice:24: syntax error InterfaceMismatch.ice:27: interface `Foo4' was defined as class diff --git a/cpp/test/Slice/errorDetection/InterfaceRedefinition.err b/cpp/test/Slice/errorDetection/InterfaceRedefinition.err index d94d4658598..a35abc30814 100644 --- a/cpp/test/Slice/errorDetection/InterfaceRedefinition.err +++ b/cpp/test/Slice/errorDetection/InterfaceRedefinition.err @@ -1,4 +1,4 @@ InterfaceRedefinition.ice:16: redefinition of interface `Intf1' -InterfaceRedefinition.ice:16: parse error +InterfaceRedefinition.ice:16: syntax error InterfaceRedefinition.ice:20: redefinition of interface `Intf2' -InterfaceRedefinition.ice:20: parse error +InterfaceRedefinition.ice:20: syntax error diff --git a/cpp/test/Slice/errorDetection/LocalMismatch.err b/cpp/test/Slice/errorDetection/LocalMismatch.err index f91cc2209c7..a5b22785fea 100644 --- a/cpp/test/Slice/errorDetection/LocalMismatch.err +++ b/cpp/test/Slice/errorDetection/LocalMismatch.err @@ -1,16 +1,16 @@ LocalMismatch.ice:16: local `Intf1' was declared non-local LocalMismatch.ice:17: local `Intf1' was declared non-local -LocalMismatch.ice:17: parse error +LocalMismatch.ice:17: syntax error LocalMismatch.ice:20: local `Intf2' was defined non-local LocalMismatch.ice:23: non-local `Intf3' was declared local LocalMismatch.ice:24: non-local `Intf3' was declared local -LocalMismatch.ice:24: parse error +LocalMismatch.ice:24: syntax error LocalMismatch.ice:27: non-local `Intf4' was defined local LocalMismatch.ice:30: local `Class1' was declared non-local LocalMismatch.ice:31: local `Class1' was declared non-local -LocalMismatch.ice:31: parse error +LocalMismatch.ice:31: syntax error LocalMismatch.ice:34: local `Class2' was defined non-local LocalMismatch.ice:37: non-local `Class3' was declared local LocalMismatch.ice:38: non-local `Class3' was declared local -LocalMismatch.ice:38: parse error +LocalMismatch.ice:38: syntax error LocalMismatch.ice:41: non-local `Class4' was defined local diff --git a/cpp/test/XMLTransform/transform/Populate.cpp b/cpp/test/XMLTransform/transform/Populate.cpp index 3368d8cdee1..6386cfe6164 100644 --- a/cpp/test/XMLTransform/transform/Populate.cpp +++ b/cpp/test/XMLTransform/transform/Populate.cpp @@ -99,7 +99,7 @@ transformPrimitive(const DBEnvironmentPtr& dbEnv) IntByteMap map(db); for(i = 0; i < NUM_KEYS; i++) { - map.insert(make_pair(i, i)); + map.insert(IntByteMap::value_type(i, i)); } } db->close(); @@ -124,7 +124,7 @@ transformPrimitive(const DBEnvironmentPtr& dbEnv) IntShortMap map(db); for(i = 0; i < NUM_KEYS; i++) { - map.insert(make_pair(i, i)); + map.insert(IntShortMap::value_type(i, i)); } } db->close(); @@ -149,7 +149,7 @@ transformPrimitive(const DBEnvironmentPtr& dbEnv) IntIntMap map(db); for(i = 0; i < NUM_KEYS; i++) { - map.insert(make_pair(i, i)); + map.insert(IntIntMap::value_type(i, i)); } } db->close(); @@ -174,7 +174,7 @@ transformPrimitive(const DBEnvironmentPtr& dbEnv) IntLongMap map(db); for(i = 0; i < NUM_KEYS; i++) { - map.insert(make_pair(i, i)); + map.insert(IntLongMap::value_type(i, i)); } } db->close(); @@ -199,7 +199,7 @@ transformPrimitive(const DBEnvironmentPtr& dbEnv) IntFloatMap map(db); for(i = 0; i < NUM_KEYS; i++) { - map.insert(make_pair(i, static_cast<float>(i))); + map.insert(IntFloatMap::value_type(i, static_cast<float>(i))); } } db->close(); @@ -224,11 +224,11 @@ transformPrimitive(const DBEnvironmentPtr& dbEnv) IntLongMap map(db); Long l; l = SCHAR_MIN; - map.insert(make_pair(0, l)); - map.insert(make_pair(1, l - 1)); // Out of range for byte. + map.insert(IntLongMap::value_type(0, l)); + map.insert(IntLongMap::value_type(1, l - 1)); // Out of range for byte. l = SCHAR_MAX; - map.insert(make_pair(2, l)); - map.insert(make_pair(3, l + 1)); // Out of range for byte. + map.insert(IntLongMap::value_type(2, l)); + map.insert(IntLongMap::value_type(3, l + 1)); // Out of range for byte. } db->close(); db = 0; @@ -258,11 +258,11 @@ transformPrimitive(const DBEnvironmentPtr& dbEnv) IntLongMap map(db); Long l; l = SHRT_MIN; - map.insert(make_pair(0, l)); - map.insert(make_pair(1, l - 1)); // Out of range for short. + map.insert(IntLongMap::value_type(0, l)); + map.insert(IntLongMap::value_type(1, l - 1)); // Out of range for short. l = SHRT_MAX; - map.insert(make_pair(2, l)); - map.insert(make_pair(3, l + 1)); // Out of range for short. + map.insert(IntLongMap::value_type(2, l)); + map.insert(IntLongMap::value_type(3, l + 1)); // Out of range for short. } db->close(); db = 0; @@ -292,11 +292,11 @@ transformPrimitive(const DBEnvironmentPtr& dbEnv) IntLongMap map(db); Long l; l = INT_MIN; - map.insert(make_pair(0, l)); - map.insert(make_pair(1, l - 1)); // Out of range for int. + map.insert(IntLongMap::value_type(0, l)); + map.insert(IntLongMap::value_type(1, l - 1)); // Out of range for int. l = INT_MAX; - map.insert(make_pair(2, l)); - map.insert(make_pair(3, l + 1)); // Out of range for int. + map.insert(IntLongMap::value_type(2, l)); + map.insert(IntLongMap::value_type(3, l + 1)); // Out of range for int. } db->close(); db = 0; @@ -359,7 +359,7 @@ transformPrimitiveSequence(const DBEnvironmentPtr& dbEnv) { seq.push_back(i); } - map.insert(make_pair(0, seq)); + map.insert(IntSeq1Map::value_type(0, seq)); } db->close(); db = 0; @@ -386,7 +386,7 @@ transformPrimitiveSequence(const DBEnvironmentPtr& dbEnv) { seq.push_back(i); } - map.insert(make_pair(0, seq)); + map.insert(IntSeq2Map::value_type(0, seq)); } db->close(); db = 0; @@ -413,7 +413,7 @@ transformPrimitiveSequence(const DBEnvironmentPtr& dbEnv) { seq.push_back(i); } - map.insert(make_pair(0, seq)); + map.insert(IntSeq3Map::value_type(0, seq)); } db->close(); db = 0; @@ -440,7 +440,7 @@ transformPrimitiveSequence(const DBEnvironmentPtr& dbEnv) { seq.push_back(i); } - map.insert(make_pair(0, seq)); + map.insert(IntSeq4Map::value_type(0, seq)); } db->close(); db = 0; @@ -470,7 +470,7 @@ transformPrimitiveSequence(const DBEnvironmentPtr& dbEnv) l = SCHAR_MAX; seq.push_back(l); seq.push_back(l + 1); // Out of range for byte. - map.insert(make_pair(0, seq)); + map.insert(IntSeq4Map::value_type(0, seq)); } db->close(); db = 0; @@ -526,8 +526,8 @@ transformEnum(const DBEnvironmentPtr& dbEnv) { IntE1Map map(db); - map.insert(make_pair(0, Test::one)); - map.insert(make_pair(1, Test::two)); + map.insert(IntE1Map::value_type(0, Test::one)); + map.insert(IntE1Map::value_type(1, Test::two)); } db->close(); db = 0; @@ -549,9 +549,9 @@ transformEnum(const DBEnvironmentPtr& dbEnv) { IntE1Map map(db); - map.insert(make_pair(0, Test::one)); - map.insert(make_pair(1, Test::two)); - map.insert(make_pair(2, Test::three)); + map.insert(IntE1Map::value_type(0, Test::one)); + map.insert(IntE1Map::value_type(1, Test::two)); + map.insert(IntE1Map::value_type(2, Test::three)); } db->close(); db = 0; @@ -610,7 +610,7 @@ transformDictionary(const DBEnvironmentPtr& dbEnv) Test::D1 dict; dict.insert(make_pair(string("one"), Test::one)); dict.insert(make_pair(string("two"), Test::two)); - map.insert(make_pair(0, dict)); + map.insert(IntD1Map::value_type(0, dict)); } db->close(); db = 0; @@ -636,7 +636,7 @@ transformDictionary(const DBEnvironmentPtr& dbEnv) dict.insert(make_pair(string("one"), Test::one)); dict.insert(make_pair(string("two"), Test::two)); dict.insert(make_pair(string("three"), Test::three)); - map.insert(make_pair(0, dict)); + map.insert(IntD1Map::value_type(0, dict)); } db->close(); db = 0; @@ -695,13 +695,13 @@ transformStruct(const DBEnvironmentPtr& dbEnv) Test::S1 s1; s1.b = false; s1.i = 0; - map.insert(make_pair(0, s1)); + map.insert(IntS1Map::value_type(0, s1)); s1.b = true; s1.i = 1; - map.insert(make_pair(1, s1)); + map.insert(IntS1Map::value_type(1, s1)); s1.b = true; s1.i = 2; - map.insert(make_pair(2, s1)); + map.insert(IntS1Map::value_type(2, s1)); } db->close(); db = 0; @@ -726,13 +726,13 @@ transformStruct(const DBEnvironmentPtr& dbEnv) Test::S1 s1; s1.b = false; s1.i = SCHAR_MIN; - map.insert(make_pair(0, s1)); + map.insert(IntS1Map::value_type(0, s1)); s1.b = true; s1.i = SCHAR_MAX; - map.insert(make_pair(1, s1)); + map.insert(IntS1Map::value_type(1, s1)); s1.b = true; s1.i = ((Int)SCHAR_MAX) + 1; // Out of range for byte - map.insert(make_pair(2, s1)); + map.insert(IntS1Map::value_type(2, s1)); } db->close(); db = 0; @@ -811,7 +811,7 @@ transformClass(const DBEnvironmentPtr& dbEnv) c2->i = 0; c2->l = 0; c2->d = 0; - map.insert(make_pair(0, c2)); + map.insert(IntC1Map::value_type(0, c2)); c2 = new Test::C2; c2->s = "1"; c2->f = 1; @@ -819,7 +819,7 @@ transformClass(const DBEnvironmentPtr& dbEnv) c2->i = 1; c2->l = 1; c2->d = 1; - map.insert(make_pair(1, c2)); + map.insert(IntC1Map::value_type(1, c2)); c2 = new Test::C2; c2->s = "2"; c2->f = 2; @@ -827,7 +827,7 @@ transformClass(const DBEnvironmentPtr& dbEnv) c2->i = 2; c2->l = 2; c2->d = 2; - map.insert(make_pair(2, c2)); + map.insert(IntC1Map::value_type(2, c2)); // // Add an object with facets. @@ -864,7 +864,7 @@ transformClass(const DBEnvironmentPtr& dbEnv) c1Facet->b = 0; c2Facet->ice_addFacet(c1Facet, "c2-0"); // Nested facet c2->ice_addFacet(c2Facet, "c1-2"); - map.insert(make_pair(3, c2)); + map.insert(IntC1Map::value_type(3, c2)); } db->close(); db = 0; @@ -894,7 +894,7 @@ transformClass(const DBEnvironmentPtr& dbEnv) c2->i = 0; c2->l = INT_MIN; c2->d = 0; - map.insert(make_pair(0, c2)); + map.insert(IntC1Map::value_type(0, c2)); c2 = new Test::C2; c2->s = "1"; c2->f = 1; @@ -902,7 +902,7 @@ transformClass(const DBEnvironmentPtr& dbEnv) c2->i = 1; c2->l = INT_MAX; c2->d = 1; - map.insert(make_pair(1, c2)); + map.insert(IntC1Map::value_type(1, c2)); c2 = new Test::C2; c2->s = "2"; c2->f = 2; @@ -911,7 +911,7 @@ transformClass(const DBEnvironmentPtr& dbEnv) c2->l = INT_MAX; c2->l++; // Out of range for int c2->d = 2; - map.insert(make_pair(2, c2)); + map.insert(IntC1Map::value_type(2, c2)); } db->close(); db = 0; |