diff options
author | Bernard Normier <bernard@zeroc.com> | 2012-10-11 14:44:58 -0400 |
---|---|---|
committer | Bernard Normier <bernard@zeroc.com> | 2012-10-11 14:44:58 -0400 |
commit | 027e0fe8d3d1a6c4cf2f6ba2e80016c102943ebe (patch) | |
tree | 5a17059ea764321a0b6e43f1083dcd6c7db363f1 /cpp | |
parent | ICE-4829 - Certificate failure on W2003 (diff) | |
download | ice-027e0fe8d3d1a6c4cf2f6ba2e80016c102943ebe.tar.bz2 ice-027e0fe8d3d1a6c4cf2f6ba2e80016c102943ebe.tar.xz ice-027e0fe8d3d1a6c4cf2f6ba2e80016c102943ebe.zip |
Partial fix for ICE-4869: C++ stream read/write for structs (and structs-as-class)
is now generated as templates.
Removed most slice2cpp --stream uses (but not all)
Also fixed various build failures on Solaris.
Diffstat (limited to 'cpp')
60 files changed, 246 insertions, 186 deletions
diff --git a/cpp/demo/Ice/invoke/Makefile b/cpp/demo/Ice/invoke/Makefile index f83009e7e37..f3f39cf1170 100644 --- a/cpp/demo/Ice/invoke/Makefile +++ b/cpp/demo/Ice/invoke/Makefile @@ -30,7 +30,6 @@ SLICE_SRCS = Printer.ice include $(top_srcdir)/config/Make.rules CPPFLAGS := -I. $(CPPFLAGS) -SLICE2CPPFLAGS := --stream $(SLICE2CPPFLAGS) $(CLIENT): $(OBJS) $(COBJS) rm -f $@ diff --git a/cpp/demo/Ice/invoke/Makefile.mak b/cpp/demo/Ice/invoke/Makefile.mak index 7a836775b04..62592ac1b46 100644 --- a/cpp/demo/Ice/invoke/Makefile.mak +++ b/cpp/demo/Ice/invoke/Makefile.mak @@ -27,7 +27,6 @@ SRCS = $(OBJS:.obj=.cpp) \ !include $(top_srcdir)/config/Make.rules.mak
-SLICE2CPPFLAGS = --stream $(SLICE2CPPFLAGS)
CPPFLAGS = -I. $(CPPFLAGS) -DWIN32_LEAN_AND_MEAN
!if "$(GENERATE_PDB)" == "yes"
diff --git a/cpp/include/Ice/BasicStream.h b/cpp/include/Ice/BasicStream.h index 2a74fdf0c0f..015ec76c2f8 100644 --- a/cpp/include/Ice/BasicStream.h +++ b/cpp/include/Ice/BasicStream.h @@ -155,7 +155,7 @@ public: _currentWriteEncaps->start = b.size(); write(Ice::Int(0)); // Placeholder for the encapsulation length. - _currentWriteEncaps->encoding.__write(this); + write(_currentWriteEncaps->encoding); } void endWriteEncaps() { @@ -186,7 +186,7 @@ public: { checkSupportedEncoding(encoding); write(Ice::Int(6)); // Size - encoding.__write(this); + write(encoding); } void writeEncaps(const Ice::Byte* v, Ice::Int sz) { @@ -238,7 +238,7 @@ public: } _currentReadEncaps->sz = sz; - _currentReadEncaps->encoding.__read(this); + read(_currentReadEncaps->encoding); checkSupportedEncoding(_currentReadEncaps->encoding); // Make sure the encoding is supported return _currentReadEncaps->encoding; @@ -311,7 +311,7 @@ public: } Ice::EncodingVersion encoding; - encoding.__read(this); + read(encoding); return encoding; } void endReadEncapsChecked(); // Used by public stream API. @@ -329,7 +329,7 @@ public: throwUnmarshalOutOfBoundsException(__FILE__, __LINE__); } - encoding.__read(this); + read(encoding); i += sz - sizeof(Ice::Int) - 2; return encoding; } diff --git a/cpp/include/Ice/ConnectionAsync.h b/cpp/include/Ice/ConnectionAsync.h index e374d859306..6140b0d60b6 100644 --- a/cpp/include/Ice/ConnectionAsync.h +++ b/cpp/include/Ice/ConnectionAsync.h @@ -11,6 +11,7 @@ #define ICE_CONNECTION_ASYNC_H #include <Ice/Connection.h> +#include <Ice/Proxy.h> namespace Ice { diff --git a/cpp/include/Ice/MetricsAdminI.h b/cpp/include/Ice/MetricsAdminI.h index 9655cce858b..4d27ce237b1 100644 --- a/cpp/include/Ice/MetricsAdminI.h +++ b/cpp/include/Ice/MetricsAdminI.h @@ -349,9 +349,9 @@ public: _subMaps.find(subMapName); if(p != _subMaps.end()) { - return std::make_pair(p->second.second->clone(), p->second.first); + return std::pair<MetricsMapIPtr, SubMapMember>(p->second.second->clone(), p->second.first); } - return std::make_pair(MetricsMapIPtr(), static_cast<SubMapMember>(0)); + return std::pair<MetricsMapIPtr, SubMapMember>(MetricsMapIPtr(), static_cast<SubMapMember>(0)); } EntryTPtr @@ -506,7 +506,7 @@ public: template<class SubMapMetricsType> void registerSubMap(const std::string& subMap, IceMX::MetricsMap MetricsType::* member) { - _subMaps[subMap] = make_pair(member, new MetricsMapFactoryT<SubMapMetricsType>(0)); + _subMaps[subMap] = std::pair<IceMX::MetricsMap MetricsType::*, MetricsMapFactoryPtr>(member, new MetricsMapFactoryT<SubMapMetricsType>(0)); } private: diff --git a/cpp/include/Ice/MetricsFunctional.h b/cpp/include/Ice/MetricsFunctional.h index 120d0579073..cddec14b62b 100644 --- a/cpp/include/Ice/MetricsFunctional.h +++ b/cpp/include/Ice/MetricsFunctional.h @@ -20,7 +20,8 @@ template<typename R> struct ReferenceWrapper return const_cast<R*>(&v); } }; - + +/* template<typename R> struct ReferenceWrapper<IceUtil::Handle<R> > { static R* get(const IceUtil::Handle<R>& v) @@ -36,6 +37,7 @@ template<typename R> struct ReferenceWrapper<const IceUtil::Handle<R>& > return v.get(); } }; +*/ template<typename R> struct ReferenceWrapper<IceInternal::ProxyHandle<R> > { diff --git a/cpp/include/Ice/MetricsObserverI.h b/cpp/include/Ice/MetricsObserverI.h index 1a64e6cfe5b..12d53daf9d5 100644 --- a/cpp/include/Ice/MetricsObserverI.h +++ b/cpp/include/Ice/MetricsObserverI.h @@ -100,25 +100,25 @@ protected: template<typename Y> void add(const std::string& name, Y Helper::*member) { - _attributes.insert(make_pair(name, new HelperMemberResolver<Y>(name, member))); + _attributes.insert(typename std::map<std::string, Resolver*>::value_type(name, new HelperMemberResolver<Y>(name, member))); } template<typename Y> void add(const std::string& name, Y (Helper::*memberFn)() const) { - _attributes.insert(make_pair(name, new HelperMemberFunctionResolver<Y>(name, memberFn))); + _attributes.insert(typename std::map<std::string, Resolver*>::value_type(name, new HelperMemberFunctionResolver<Y>(name, memberFn))); } template<typename I, typename O, typename Y> void add(const std::string& name, O (Helper::*getFn)() const, Y I::*member) { - _attributes.insert(make_pair(name, new MemberResolver<I, O, Y>(name, getFn, member))); + _attributes.insert(typename std::map<std::string, Resolver*>::value_type(name, new MemberResolver<I, O, Y>(name, getFn, member))); } template<typename I, typename O, typename Y> void add(const std::string& name, O (Helper::*getFn)() const, Y (I::*memberFn)() const) { - _attributes.insert(make_pair(name, new MemberFunctionResolver<I, O, Y>(name, getFn, memberFn))); + _attributes.insert(typename std::map<std::string, Resolver*>::value_type(name, new MemberFunctionResolver<I, O, Y>(name, getFn, memberFn))); } private: diff --git a/cpp/include/Ice/StreamHelpers.h b/cpp/include/Ice/StreamHelpers.h index e075276de3d..9e69a02964e 100644 --- a/cpp/include/Ice/StreamHelpers.h +++ b/cpp/include/Ice/StreamHelpers.h @@ -275,38 +275,49 @@ struct StreamHelper<T, StreamHelperCategoryBuiltin> } }; -// Helper for structs, uses generated __read/__write methods +// "helpers" for the StreamHelper<T, StreamHelperCategoryStruct[Class]> below +// We generate specializations, which can be instantiated explicitly and exported from DLLs +// + +template<typename T, typename S> +struct StreamWriter; + +template<typename T, typename S> +struct StreamReader; + +// Helper for structs template<typename T> struct StreamHelper<T, StreamHelperCategoryStruct> { template<class S> static inline void write(S* stream, const T& v) { - v.__write(stream); + StreamWriter<T, S>::write(stream, v); } template<class S> static inline void read(S* stream, T& v) { - v.__read(stream); + StreamReader<T, S>::read(stream, v); } }; -// Helper for class structs, uses generated __read/__write methods + +// Helper for class structs template<typename T> struct StreamHelper<T, StreamHelperCategoryStructClass> { template<class S> static inline void write(S* stream, const T& v) { - v->__write(stream); + StreamWriter<T, S>::write(stream, v); } template<class S> static inline void read(S* stream, T& v) { - v = new typename T::element_type(); - v->__read(stream); + v = new typename T::element_type; + StreamReader<T, S>::read(stream, v); } }; diff --git a/cpp/include/IceUtil/Config.h b/cpp/include/IceUtil/Config.h index fc2b7dda6f5..927964224b2 100644 --- a/cpp/include/IceUtil/Config.h +++ b/cpp/include/IceUtil/Config.h @@ -93,9 +93,10 @@ (defined(__HP_aCC) && defined(__HP_WINDLL)) # define ICE_DECLSPEC_EXPORT __declspec(dllexport) # define ICE_DECLSPEC_IMPORT __declspec(dllimport) -#elif defined(__SUNPRO_CC) && (__SUNPRO_CC >= 0x550) +# define ICE_HAS_DECLSPEC_IMPORT_EXPORT +#elif defined(__SUNPRO_CC) # define ICE_DECLSPEC_EXPORT __global -# define ICE_DECLSPEC_IMPORT +# define ICE_DECLSPEC_IMPORT /**/ #else # define ICE_DECLSPEC_EXPORT /**/ # define ICE_DECLSPEC_IMPORT /**/ diff --git a/cpp/include/Slice/Parser.h b/cpp/include/Slice/Parser.h index cb735d70bcc..40e30b27ce4 100644 --- a/cpp/include/Slice/Parser.h +++ b/cpp/include/Slice/Parser.h @@ -450,6 +450,7 @@ public: ContainedList contents() const; bool hasNonLocalClassDecls() const; bool hasNonLocalClassDefs() const; + bool hasLocalClassDefsWithAsync() const; bool hasNonLocalSequences() const; bool hasNonLocalExceptions() const; bool hasDictionaries() const; diff --git a/cpp/src/Freeze/ObjectStore.cpp b/cpp/src/Freeze/ObjectStore.cpp index 4015ab63eb5..99a09af7b98 100644 --- a/cpp/src/Freeze/ObjectStore.cpp +++ b/cpp/src/Freeze/ObjectStore.cpp @@ -336,7 +336,7 @@ Freeze::ObjectStoreBase::marshal(const Identity& ident, { IceInternal::InstancePtr instance = IceInternal::getInstance(communicator); IceInternal::BasicStream stream(instance.get(), encoding, true); - ident.__write(&stream); + stream.write(ident); vector<Byte>(stream.b.begin(), stream.b.end()).swap(bytes); } @@ -351,7 +351,7 @@ Freeze::ObjectStoreBase::unmarshal(Identity& ident, stream.b.resize(bytes.size()); memcpy(&stream.b[0], &bytes[0], bytes.size()); stream.i = stream.b.begin(); - ident.__read(&stream); + stream.read(ident); } void @@ -366,7 +366,7 @@ Freeze::ObjectStoreBase::marshal(const ObjectRecord& v, stream.startWriteEncaps(); if(keepStats) { - v.__write(&stream); + stream.write(v); } else { @@ -395,7 +395,7 @@ Freeze::ObjectStoreBase::unmarshal(ObjectRecord& v, if(keepStats) { - v.__read(&stream); + stream.read(v); } else { diff --git a/cpp/src/Ice/ConnectionI.cpp b/cpp/src/Ice/ConnectionI.cpp index c984fbab901..947ede7fbed 100644 --- a/cpp/src/Ice/ConnectionI.cpp +++ b/cpp/src/Ice/ConnectionI.cpp @@ -1369,10 +1369,10 @@ Ice::ConnectionI::message(ThreadPoolCurrent& current) throw ex; } ProtocolVersion pv; - pv.__read(&_readStream); + _readStream.read(pv); checkSupportedProtocol(pv); EncodingVersion ev; - ev.__read(&_readStream); + _readStream.read(ev); checkSupportedProtocolEncoding(ev); Byte messageType; @@ -2218,8 +2218,8 @@ Ice::ConnectionI::initiateShutdown() os.write(magic[1]); os.write(magic[2]); os.write(magic[3]); - currentProtocol.__write(&os); - currentProtocolEncoding.__write(&os); + os.write(currentProtocol); + os.write(currentProtocolEncoding); os.write(closeConnectionMsg); os.write((Byte)1); // compression status: compression supported but not used. os.write(headerSize); // Message size. @@ -2280,8 +2280,8 @@ Ice::ConnectionI::validate(SocketOperation operation) _writeStream.write(magic[1]); _writeStream.write(magic[2]); _writeStream.write(magic[3]); - currentProtocol.__write(&_writeStream); - currentProtocolEncoding.__write(&_writeStream); + _writeStream.write(currentProtocol); + _writeStream.write(currentProtocolEncoding); _writeStream.write(validateConnectionMsg); _writeStream.write(static_cast<Byte>(0)); // Compression status (always zero for validate connection). _writeStream.write(headerSize); // Message size. @@ -2345,10 +2345,10 @@ Ice::ConnectionI::validate(SocketOperation operation) throw ex; } ProtocolVersion pv; - pv.__read(&_readStream); + _readStream.read(pv); checkSupportedProtocol(pv); EncodingVersion ev; - ev.__read(&_readStream); + _readStream.read(ev); checkSupportedProtocolEncoding(ev); Byte messageType; _readStream.read(messageType); diff --git a/cpp/src/Ice/DefaultsAndOverrides.h b/cpp/src/Ice/DefaultsAndOverrides.h index d2f624470d1..d043e30bb5d 100644 --- a/cpp/src/Ice/DefaultsAndOverrides.h +++ b/cpp/src/Ice/DefaultsAndOverrides.h @@ -15,6 +15,7 @@ #include <Ice/DefaultsAndOverridesF.h> #include <Ice/PropertiesF.h> #include <Ice/Endpoint.h> +#include <Ice/EndpointTypes.h> #include <Ice/Format.h> namespace IceInternal diff --git a/cpp/src/Ice/ImplicitContextI.cpp b/cpp/src/Ice/ImplicitContextI.cpp index 86118533e67..eb130202eb2 100644 --- a/cpp/src/Ice/ImplicitContextI.cpp +++ b/cpp/src/Ice/ImplicitContextI.cpp @@ -8,6 +8,8 @@ // ********************************************************************** #include <Ice/ImplicitContextI.h> +#include <Ice/BasicStream.h> +#include <Ice/Object.h> #include <IceUtil/Mutex.h> #include <IceUtil/MutexPtrLock.h> diff --git a/cpp/src/Ice/Incoming.cpp b/cpp/src/Ice/Incoming.cpp index 9c0fc36f509..962749a871f 100644 --- a/cpp/src/Ice/Incoming.cpp +++ b/cpp/src/Ice/Incoming.cpp @@ -309,7 +309,7 @@ IceInternal::IncomingBase::__handleException(const std::exception& exc) assert(false); } - rfe->id.__write(&_os); + _os.write(rfe->id); // // For compatibility with the old FacetPath. @@ -548,7 +548,7 @@ IceInternal::Incoming::invoke(const ServantManagerPtr& servantManager, BasicStre // // Read the current. // - _current.id.__read(_is); + _is->read(_current.id); // // For compatibility with the old FacetPath. diff --git a/cpp/src/Ice/Makefile b/cpp/src/Ice/Makefile index f5978fac90b..70edf85aa0b 100644 --- a/cpp/src/Ice/Makefile +++ b/cpp/src/Ice/Makefile @@ -206,14 +206,4 @@ install:: all $(call installlib,$(install_libdir),$(libdir),$(LIBFILENAME),$(SONAME),$(LIBNAME)) endif -$(HDIR)/BuiltinSequences.h BuiltinSequences.cpp: $(SDIR)/BuiltinSequences.ice $(SLICE2CPP) $(SLICEPARSERLIB) - rm -f $(HDIR)/BuiltinSequences.h BuiltinSequences.cpp - $(SLICE2CPP) $(SLICE2CPPFLAGS) --stream $(SDIR)/BuiltinSequences.ice - mv BuiltinSequences.h $(HDIR) - -$(HDIR)/Metrics.h Metrics.cpp: $(SDIR)/Metrics.ice $(SLICE2CPP) $(SLICEPARSERLIB) - rm -f $(HDIR)/Metrics.h Metrics.cpp - $(SLICE2CPP) $(SLICE2CPPFLAGS) --stream $(SDIR)/Metrics.ice - mv Metrics.h $(HDIR) - include .depend diff --git a/cpp/src/Ice/Makefile.mak b/cpp/src/Ice/Makefile.mak index 9383a7ba28d..970653b53d2 100644 --- a/cpp/src/Ice/Makefile.mak +++ b/cpp/src/Ice/Makefile.mak @@ -145,11 +145,6 @@ $(DLLNAME): $(OBJS) Ice.res $(MT) -nologo -manifest $@.manifest -outputresource:$@;#2 && del /q $@.manifest
@if exist $(DLLNAME:.dll=.exp) del /q $(DLLNAME:.dll=.exp)
-$(HDIR)\BuiltinSequences.h BuiltinSequences.cpp: $(SDIR)\BuiltinSequences.ice $(SLICE2CPP) $(SLICEPARSERLIB)
- del /q $(HDIR)\BuiltinSequences.h BuiltinSequences.cpp
- $(SLICE2CPP) $(SLICE2CPPFLAGS) --stream $(SDIR)\BuiltinSequences.ice
- move BuiltinSequences.h $(HDIR)
-
Service.obj: EventLoggerMsg.h
Ice.res: EventLoggerMsg.rc
diff --git a/cpp/src/Ice/MetricsAdminI.cpp b/cpp/src/Ice/MetricsAdminI.cpp index 6e6910224d1..1bde9603020 100644 --- a/cpp/src/Ice/MetricsAdminI.cpp +++ b/cpp/src/Ice/MetricsAdminI.cpp @@ -389,7 +389,7 @@ MetricsAdminI::updateViews() map<string, MetricsViewIPtr>::const_iterator q = _views.find(viewName); if(q == _views.end()) { - q = views.insert(make_pair(viewName, new MetricsViewI(viewName))).first; + q = views.insert(map<string, MetricsViewIPtr>::value_type(viewName, new MetricsViewI(viewName))).first; } else { diff --git a/cpp/src/Ice/Network.cpp b/cpp/src/Ice/Network.cpp index e79fa217e91..513c9505129 100644 --- a/cpp/src/Ice/Network.cpp +++ b/cpp/src/Ice/Network.cpp @@ -444,7 +444,8 @@ getLocalAddresses(ProtocolSupport protocol) struct in_addr* inaddr = &reinterpret_cast<struct sockaddr_in*>(&addr)->sin_addr; if(inaddr->s_addr != 0 && inaddr->s_addr != htonl(INADDR_LOOPBACK)) { - for(unsigned int j = 0; j < result.size(); ++j) + unsigned int j; + for(j = 0; j < result.size(); ++j) { if(compareAddress(addr, result[j]) == 0) { @@ -464,7 +465,8 @@ getLocalAddresses(ProtocolSupport protocol) struct in6_addr* inaddr6 = &reinterpret_cast<struct sockaddr_in6*>(&addr)->sin6_addr; if(!IN6_IS_ADDR_UNSPECIFIED(inaddr6) && !IN6_IS_ADDR_LOOPBACK(inaddr6)) { - for(unsigned int j = 0; j < result.size(); ++j) + unsigned int j; + for(j = 0; j < result.size(); ++j) { if(compareAddress(addr, result[j]) == 0) { diff --git a/cpp/src/Ice/ObjectAdapterFactory.cpp b/cpp/src/Ice/ObjectAdapterFactory.cpp index d0dee1f32f1..a54f45398b7 100644 --- a/cpp/src/Ice/ObjectAdapterFactory.cpp +++ b/cpp/src/Ice/ObjectAdapterFactory.cpp @@ -9,6 +9,7 @@ #include <Ice/ObjectAdapterFactory.h> #include <Ice/ObjectAdapterI.h> +#include <Ice/Object.h> #include <Ice/LocalException.h> #include <Ice/Functional.h> #include <IceUtil/UUID.h> diff --git a/cpp/src/Ice/ObjectAdapterI.h b/cpp/src/Ice/ObjectAdapterI.h index db135a44199..a8c3b703712 100644 --- a/cpp/src/Ice/ObjectAdapterI.h +++ b/cpp/src/Ice/ObjectAdapterI.h @@ -26,8 +26,10 @@ #include <Ice/ConnectorF.h> #include <Ice/LocatorInfoF.h> #include <Ice/ThreadPoolF.h> +#include <Ice/OutgoingAsyncF.h> #include <Ice/Exception.h> #include <Ice/BuiltinSequences.h> +#include <Ice/Proxy.h> #include <list> namespace Ice diff --git a/cpp/src/Ice/Outgoing.cpp b/cpp/src/Ice/Outgoing.cpp index 44571200fdf..3e4d24a563b 100644 --- a/cpp/src/Ice/Outgoing.cpp +++ b/cpp/src/Ice/Outgoing.cpp @@ -112,7 +112,7 @@ IceInternal::Outgoing::Outgoing(RequestHandler* handler, const string& operation try { - _handler->getReference()->getIdentity().__write(&_os); + _os.write(_handler->getReference()->getIdentity()); // // For compatibility with the old FacetPath. @@ -402,7 +402,7 @@ IceInternal::Outgoing::finished(BasicStream& is) // exception, you will have a memory leak. // Identity ident; - ident.__read(&_is); + _is.read(ident); // // For compatibility with the old FacetPath. diff --git a/cpp/src/Ice/OutgoingAsync.cpp b/cpp/src/Ice/OutgoingAsync.cpp index efbc752c897..f608b6f434b 100644 --- a/cpp/src/Ice/OutgoingAsync.cpp +++ b/cpp/src/Ice/OutgoingAsync.cpp @@ -452,7 +452,7 @@ IceInternal::OutgoingAsync::__prepare(const std::string& operation, OperationMod Reference* ref = _proxy->__reference().get(); - ref->getIdentity().__write(&_os); + _os.write(ref->getIdentity()); // // For compatibility with the old FacetPath. @@ -643,7 +643,7 @@ IceInternal::OutgoingAsync::__finished(BasicStream& is) case replyOperationNotExist: { Identity ident; - ident.__read(&_is); + _is.read(ident); // // For compatibility with the old FacetPath. diff --git a/cpp/src/Ice/ProxyFactory.cpp b/cpp/src/Ice/ProxyFactory.cpp index a831145fedf..c28520afcd6 100644 --- a/cpp/src/Ice/ProxyFactory.cpp +++ b/cpp/src/Ice/ProxyFactory.cpp @@ -73,7 +73,7 @@ ObjectPrx IceInternal::ProxyFactory::streamToProxy(BasicStream* s) const { Identity ident; - ident.__read(s); + s->read(ident); ReferencePtr ref = _instance->referenceFactory()->create(ident, s); return referenceToProxy(ref); @@ -84,13 +84,13 @@ IceInternal::ProxyFactory::proxyToStream(const ObjectPrx& proxy, BasicStream* s) { if(proxy) { - proxy->__reference()->getIdentity().__write(s); + s->write(proxy->__reference()->getIdentity()); proxy->__reference()->streamWrite(s); } else { Identity ident; - ident.__write(s); + s->write(ident); } } diff --git a/cpp/src/Ice/RouterInfo.h b/cpp/src/Ice/RouterInfo.h index b3508d7edba..c1b1077a73b 100644 --- a/cpp/src/Ice/RouterInfo.h +++ b/cpp/src/Ice/RouterInfo.h @@ -15,8 +15,10 @@ #include <Ice/RouterInfoF.h> #include <Ice/RouterF.h> #include <Ice/ProxyF.h> +#include <Ice/ReferenceF.h> #include <Ice/EndpointIF.h> #include <Ice/BuiltinSequences.h> +#include <Ice/Identity.h> #include <set> diff --git a/cpp/src/Ice/TcpEndpointI.cpp b/cpp/src/Ice/TcpEndpointI.cpp index 311e4edbaa4..4baa8fed6cb 100644 --- a/cpp/src/Ice/TcpEndpointI.cpp +++ b/cpp/src/Ice/TcpEndpointI.cpp @@ -192,8 +192,8 @@ IceInternal::TcpEndpointI::TcpEndpointI(BasicStream* s) : s->read(const_cast<bool&>(_compress)); if(s->getReadEncoding() > Ice::Encoding_1_0) { - const_cast<Ice::ProtocolVersion&>(_protocol).__read(s); - const_cast<Ice::EncodingVersion&>(_encoding).__read(s); + s->read(const_cast<Ice::ProtocolVersion&>(_protocol)); + s->read(const_cast<Ice::EncodingVersion&>(_encoding)); } else { @@ -214,8 +214,8 @@ IceInternal::TcpEndpointI::streamWrite(BasicStream* s) const s->write(_compress); if(s->getWriteEncoding() > Ice::Encoding_1_0) { - _protocol.__write(s); - _encoding.__write(s); + s->write(_protocol); + s->write(_encoding); } s->endWriteEncaps(); } diff --git a/cpp/src/Ice/TcpEndpointI.h b/cpp/src/Ice/TcpEndpointI.h index 49bd4329ef3..e107904e92d 100644 --- a/cpp/src/Ice/TcpEndpointI.h +++ b/cpp/src/Ice/TcpEndpointI.h @@ -48,6 +48,10 @@ public: virtual bool operator==(const Ice::LocalObject&) const; virtual bool operator<(const Ice::LocalObject&) const; +#ifdef __SUNPRO_CC + using EndpointI::connectionId; +#endif + private: virtual ::Ice::Int hashInit() const; diff --git a/cpp/src/Ice/TraceUtil.cpp b/cpp/src/Ice/TraceUtil.cpp index 3dcd019b209..7d0448b7036 100644 --- a/cpp/src/Ice/TraceUtil.cpp +++ b/cpp/src/Ice/TraceUtil.cpp @@ -29,7 +29,7 @@ static void printIdentityFacetOperation(ostream& s, BasicStream& stream) { Identity identity; - identity.__read(&stream); + stream.read(identity); s << "\nidentity = " << stream.instance()->identityToString(identity); vector<string> facet; diff --git a/cpp/src/Ice/UdpEndpointI.cpp b/cpp/src/Ice/UdpEndpointI.cpp index c20a430bbe6..4be1d98bd77 100644 --- a/cpp/src/Ice/UdpEndpointI.cpp +++ b/cpp/src/Ice/UdpEndpointI.cpp @@ -218,8 +218,8 @@ IceInternal::UdpEndpointI::UdpEndpointI(BasicStream* s) : s->startReadEncaps(); s->read(const_cast<string&>(_host), false); s->read(const_cast<Int&>(_port)); - const_cast<Ice::ProtocolVersion&>(_protocol).__read(s); - const_cast<Ice::EncodingVersion&>(_encoding).__read(s); + s->read(const_cast<Ice::ProtocolVersion&>(_protocol)); + s->read(const_cast<Ice::EncodingVersion&>(_encoding)); // Not transmitted. //s->read(const_cast<bool&>(_connect)); s->read(const_cast<bool&>(_compress)); @@ -233,8 +233,8 @@ IceInternal::UdpEndpointI::streamWrite(BasicStream* s) const s->startWriteEncaps(); s->write(_host, false); s->write(_port); - _protocol.__write(s); - _encoding.__write(s); + s->write(_protocol); + s->write(_encoding); // Not transmitted. //s->write(_connect); s->write(_compress); diff --git a/cpp/src/Ice/UdpEndpointI.h b/cpp/src/Ice/UdpEndpointI.h index 9bfe598f9ad..03b671af62c 100644 --- a/cpp/src/Ice/UdpEndpointI.h +++ b/cpp/src/Ice/UdpEndpointI.h @@ -48,6 +48,10 @@ public: virtual bool operator==(const Ice::LocalObject&) const; virtual bool operator<(const Ice::LocalObject&) const; +#ifdef __SUNPRO_CC + using EndpointI::connectionId; +#endif + private: virtual ::Ice::Int hashInit() const; diff --git a/cpp/src/Ice/winrt/Makefile.mak b/cpp/src/Ice/winrt/Makefile.mak index 1e40c3599ea..4fa485239a4 100644 --- a/cpp/src/Ice/winrt/Makefile.mak +++ b/cpp/src/Ice/winrt/Makefile.mak @@ -197,12 +197,6 @@ RES_FILE = $(SOURCE_DIR)\Ice.res $(LIBNAME): $(LOCAL_OBJS) $(OBJS) $(RES_FILE) sdks $(AR) $(ARFLAGS) $(OBJS) $(LOCAL_OBJS) /out:$(LIBNAME) -$(HDIR)\BuiltinSequences.h ..\BuiltinSequences.cpp: $(slicedir)\Ice\BuiltinSequences.ice $(SLICE2CPP) - del /q $(HDIR)\BuiltinSequences.h ..\BuiltinSequences.cpp - $(SLICE2CPP) $(CORE_SLICE2CPPFLAGS) --stream $(slicedir)\Ice\BuiltinSequences.ice - move BuiltinSequences.cpp .. - move BuiltinSequences.h $(HDIR) - Service.obj: $(SOURCE_DIR)\EventLoggerMsg.h Ice.res: $(SOURCE_DIR)\EventLoggerMsg.rc diff --git a/cpp/src/IceGrid/Database.cpp b/cpp/src/IceGrid/Database.cpp index 52ae52be798..e874b8bf17a 100644 --- a/cpp/src/IceGrid/Database.cpp +++ b/cpp/src/IceGrid/Database.cpp @@ -2120,7 +2120,15 @@ Database::checkUpdate(const ApplicationHelper& oldApp, out << "check for application `" << application << "' update failed:"; if(!unreachableNodes.empty()) { +#if defined(__SUNPRO_CC) && defined(_RWSTD_NO_MEMBER_TEMPLATES) + Ice::StringSeq nodes; + for(set<string>::const_iterator p = unreachableNodes.begin(); p != unreachableNodes.end(); ++p) + { + nodes.push_back(*p); + } +#else Ice::StringSeq nodes(unreachableNodes.begin(), unreachableNodes.end()); +#endif if(nodes.size() == 1) { out << "\nthe node `" << nodes[0] << "' is down"; @@ -2154,7 +2162,16 @@ Database::checkUpdate(const ApplicationHelper& oldApp, } if(!unreachableNodes.empty()) { +#if defined(__SUNPRO_CC) && defined(_RWSTD_NO_MEMBER_TEMPLATES) + Ice::StringSeq nodes; + for(set<string>::const_iterator p = unreachableNodes.begin(); p != unreachableNodes.end\ + (); ++p) + { + nodes.push_back(*p); + } +#else Ice::StringSeq nodes(unreachableNodes.begin(), unreachableNodes.end()); +#endif if(nodes.size() == 1) { os << "\nthe node `" << nodes[0] << "' is down"; diff --git a/cpp/src/IceGrid/FreezeDB/Makefile.mak b/cpp/src/IceGrid/FreezeDB/Makefile.mak index 6e44e3c5c65..c140b1d741b 100644 --- a/cpp/src/IceGrid/FreezeDB/Makefile.mak +++ b/cpp/src/IceGrid/FreezeDB/Makefile.mak @@ -30,12 +30,12 @@ SRCS = $(OBJS:.obj=.cpp) \ HDIR = $(headerdir)/IceGrid
SDIR = $(slicedir)/IceGrid
-SLICE2FREEZECMD = $(SLICE2FREEZE) -I..\.. --ice --include-dir IceGrid\FreezeDB $(ICECPPFLAGS)
+SLICE2FREEZECMD = $(SLICE2FREEZE) -I..\.. --ice --include-dir IceGrid/FreezeDB $(ICECPPFLAGS)
!include $(top_srcdir)\config\Make.rules.mak
CPPFLAGS = -I..\.. -Idummyinclude $(CPPFLAGS) -DWIN32_LEAN_AND_MEAN
-SLICE2CPPFLAGS = -I..\.. --ice --include-dir IceGrid\FreezeDB $(SLICE2CPPFLAGS)
+SLICE2CPPFLAGS = -I..\.. --ice --include-dir IceGrid/FreezeDB $(SLICE2CPPFLAGS)
LINKWITH = icegrid$(LIBSUFFIX).lib glacier2$(LIBSUFFIX).lib icedb$(LIBSUFFIX).lib freeze$(LIBSUFFIX).lib $(LIBS)
MLINKWITH = freeze$(LIBSUFFIX).lib icegrid$(LIBSUFFIX).lib icegriddb$(LIBSUFFIX).lib $(LIBS)
diff --git a/cpp/src/IceGrid/ServerCache.cpp b/cpp/src/IceGrid/ServerCache.cpp index dd94ec2feda..4901b6752b4 100644 --- a/cpp/src/IceGrid/ServerCache.cpp +++ b/cpp/src/IceGrid/ServerCache.cpp @@ -98,6 +98,7 @@ CheckUpdateResult::getResult() os << ex; throw NodeUnreachableException(_node, os.str()); } + return false; } ServerCache::ServerCache(const Ice::CommunicatorPtr& communicator, diff --git a/cpp/src/IceGrid/SqlDB/SqlStringApplicationInfoDict.cpp b/cpp/src/IceGrid/SqlDB/SqlStringApplicationInfoDict.cpp index 2e05d6a4d91..6f2952ac0ec 100644 --- a/cpp/src/IceGrid/SqlDB/SqlStringApplicationInfoDict.cpp +++ b/cpp/src/IceGrid/SqlDB/SqlStringApplicationInfoDict.cpp @@ -106,7 +106,7 @@ SqlStringApplicationInfoDict::put(const DatabaseConnectionPtr& connection, IceInternal::InstancePtr instance = IceInternal::getInstance(_communicator); IceInternal::BasicStream stream(instance.get(), connection->getEncoding()); stream.startWriteEncaps(); - info.descriptor.__write(&stream); + stream.write(info.descriptor); stream.writePendingObjects(); stream.endWriteEncaps(); @@ -256,7 +256,7 @@ SqlStringApplicationInfoDict::find(const DatabaseConnectionPtr& connection, ::memcpy(&stream.b[0], bytes.data(), bytes.size()); stream.i = stream.b.begin(); stream.startReadEncaps(); - info.descriptor.__read(&stream); + stream.read(info.descriptor); stream.readPendingObjects(); stream.endReadEncaps(); @@ -302,7 +302,7 @@ SqlStringApplicationInfoDict::getMap(const DatabaseConnectionPtr& connection, ::memcpy(&stream.b[0], bytes.data(), bytes.size()); stream.i = stream.b.begin(); stream.startReadEncaps(); - info.descriptor.__read(&stream); + stream.read(info.descriptor); stream.readPendingObjects(); stream.endReadEncaps(); diff --git a/cpp/src/IceSSL/Certificate.cpp b/cpp/src/IceSSL/Certificate.cpp index 7479263eb33..1cfb7bce4a0 100644 --- a/cpp/src/IceSSL/Certificate.cpp +++ b/cpp/src/IceSSL/Certificate.cpp @@ -14,6 +14,7 @@ #include <IceSSL/Plugin.h> #include <IceSSL/Util.h> #include <IceSSL/RFC2253.h> +#include <Ice/Object.h> #include <openssl/x509v3.h> #include <openssl/pem.h> diff --git a/cpp/src/IceSSL/EndpointI.cpp b/cpp/src/IceSSL/EndpointI.cpp index ebc0dff0842..6b2b9b0a55b 100644 --- a/cpp/src/IceSSL/EndpointI.cpp +++ b/cpp/src/IceSSL/EndpointI.cpp @@ -16,6 +16,7 @@ #include <Ice/BasicStream.h> #include <Ice/LocalException.h> #include <Ice/DefaultsAndOverrides.h> +#include <Ice/Object.h> #include <Ice/HashUtil.h> using namespace std; @@ -192,8 +193,8 @@ IceSSL::EndpointI::EndpointI(const InstancePtr& instance, IceInternal::BasicStre s->read(const_cast<bool&>(_compress)); if(s->getReadEncoding() > Ice::Encoding_1_0) { - const_cast<Ice::ProtocolVersion&>(_protocol).__read(s); - const_cast<Ice::EncodingVersion&>(_encoding).__read(s); + s->read(const_cast<Ice::ProtocolVersion&>(_protocol)); + s->read(const_cast<Ice::EncodingVersion&>(_encoding)); } else { @@ -214,8 +215,8 @@ IceSSL::EndpointI::streamWrite(IceInternal::BasicStream* s) const s->write(_compress); if(s->getWriteEncoding() > Ice::Encoding_1_0) { - _protocol.__write(s); - _encoding.__write(s); + s->write(_protocol); + s->write(_encoding); } s->endWriteEncaps(); } diff --git a/cpp/src/IceSSL/PluginI.cpp b/cpp/src/IceSSL/PluginI.cpp index 9ba271a2864..d1cfada9660 100644 --- a/cpp/src/IceSSL/PluginI.cpp +++ b/cpp/src/IceSSL/PluginI.cpp @@ -12,6 +12,7 @@ #include <IceSSL/TransceiverI.h> #include <Ice/LocalException.h> +#include <Ice/Object.h> using namespace std; using namespace Ice; diff --git a/cpp/src/IceSSL/RFC2253.cpp b/cpp/src/IceSSL/RFC2253.cpp index 16fdbf6c86c..a0caca6b5fa 100644 --- a/cpp/src/IceSSL/RFC2253.cpp +++ b/cpp/src/IceSSL/RFC2253.cpp @@ -11,6 +11,7 @@ #include <IceSSL/Plugin.h> #include <IceSSL/RFC2253.h> +#include <Ice/Object.h> using namespace std; using namespace IceSSL; diff --git a/cpp/src/IceSSL/Util.cpp b/cpp/src/IceSSL/Util.cpp index f0ddfc86cca..2b7b26e7144 100644 --- a/cpp/src/IceSSL/Util.cpp +++ b/cpp/src/IceSSL/Util.cpp @@ -16,6 +16,7 @@ #include <IceUtil/FileUtil.h> #include <Ice/LocalException.h> #include <Ice/Network.h> +#include <Ice/Object.h> #ifdef _WIN32 # include <direct.h> diff --git a/cpp/src/IceStorm/FreezeDB/Makefile.mak b/cpp/src/IceStorm/FreezeDB/Makefile.mak index 7acf6a95ee7..09b9b995ef6 100644 --- a/cpp/src/IceStorm/FreezeDB/Makefile.mak +++ b/cpp/src/IceStorm/FreezeDB/Makefile.mak @@ -41,12 +41,12 @@ SRCS = $(OBJS:.obj=.cpp) \ HDIR = $(headerdir)/IceStorm
SDIR = $(slicedir)/IceStorm
-SLICE2FREEZECMD = $(SLICE2FREEZE) -I..\.. --ice --include-dir IceStorm\FreezeDB $(ICECPPFLAGS)
+SLICE2FREEZECMD = $(SLICE2FREEZE) -I..\.. --ice --include-dir IceStorm/FreezeDB $(ICECPPFLAGS)
!include $(top_srcdir)\config\Make.rules.mak
CPPFLAGS = -I..\.. -Idummyinclude $(CPPFLAGS) -DWIN32_LEAN_AND_MEAN
-SLICE2CPPFLAGS = -I..\.. --ice --include-dir IceStorm\FreezeDB $(SLICE2CPPFLAGS)
+SLICE2CPPFLAGS = -I..\.. --ice --include-dir IceStorm/FreezeDB $(SLICE2CPPFLAGS)
LINKWITH = icestormservice$(LIBSUFFIX).lib icestorm$(LIBSUFFIX).lib icedb$(LIBSUFFIX).lib freeze$(LIBSUFFIX).lib $(LIBS)
MLINKWITH = freeze$(LIBSUFFIX).lib icestormservice$(LIBSUFFIX).lib icestorm$(LIBSUFFIX).lib $(LIBS)
diff --git a/cpp/src/Slice/Parser.cpp b/cpp/src/Slice/Parser.cpp index 5f5a4d187fa..b96e2f1360c 100755 --- a/cpp/src/Slice/Parser.cpp +++ b/cpp/src/Slice/Parser.cpp @@ -1573,6 +1573,40 @@ Slice::Container::hasNonLocalClassDefs() const } bool +Slice::Container::hasLocalClassDefsWithAsync() const +{ + for(ContainedList::const_iterator p = _contents.begin(); p != _contents.end(); ++p) + { + ClassDefPtr cl = ClassDefPtr::dynamicCast(*p); + if(cl && cl->isLocal()) + { + if(cl->hasMetaData("async")) + { + return true; + } + + OperationList ol = cl->operations(); + for(OperationList::const_iterator q = ol.begin(); q != ol.end(); ++q) + { + cerr << (*q)->name() << endl; + if((*q)->hasMetaData("async")) + { + return true; + } + } + } + + ContainerPtr container = ContainerPtr::dynamicCast(*p); + if(container && container->hasLocalClassDefsWithAsync()) + { + return true; + } + } + + return false; +} + +bool Slice::Container::hasNonLocalSequences() const { for(ContainedList::const_iterator p = _contents.begin(); p != _contents.end(); ++p) diff --git a/cpp/src/slice2cpp/Gen.cpp b/cpp/src/slice2cpp/Gen.cpp index 6738a68f10c..3d89df4997b 100644 --- a/cpp/src/slice2cpp/Gen.cpp +++ b/cpp/src/slice2cpp/Gen.cpp @@ -136,6 +136,12 @@ writeMarshalUnmarshalDataMember(IceUtilInternal::Output& C, const DataMemberPtr& } void +writeMarshalUnmarshalDataMemberInHolder(IceUtilInternal::Output& C, const string& holder, const DataMemberPtr& p, bool marshal) +{ + writeMarshalUnmarshalCode(C, p->type(), p->optional(), p->tag(), holder + fixKwd(p->name()), marshal, p->getMetaData()); +} + +void writeMarshalUnmarshalDataMembers(IceUtilInternal::Output& C, const DataMemberList& dataMembers, const DataMemberList& optionalDataMembers, @@ -374,6 +380,11 @@ Slice::Gen::generate(const UnitPtr& p) C << "\n#include <Ice/LocalException.h>"; C << "\n#include <Ice/ObjectFactory.h>"; } + else if(p->hasLocalClassDefsWithAsync()) + { + H << "\n#include <Ice/Proxy.h>"; + H << "\n#include <Ice/OutgoingAsync.h>"; + } if(p->hasNonLocalDataOnlyClasses() || p->hasNonLocalExceptions()) { @@ -386,13 +397,9 @@ Slice::Gen::generate(const UnitPtr& p) if(p->usesNonLocals()) { C << "\n#include <Ice/BasicStream.h>"; - - if(!p->hasNonLocalClassDefs() && !p->hasNonLocalClassDecls()) - { - C << "\n#include <Ice/Object.h>"; - } + C << "\n#include <Ice/Object.h>"; } - + if(_stream || p->hasNonLocalClassDefs() || p->hasNonLocalExceptions()) { if(!p->hasNonLocalClassDefs()) @@ -479,8 +486,8 @@ Slice::Gen::generate(const UnitPtr& p) TypesVisitor typesVisitor(H, C, _dllExport, _stream); p->visit(&typesVisitor, false); - StreamVisitor streamVistor(H, C); - p->visit(&streamVistor, false); + StreamVisitor streamVisitor(H, C, _dllExport); + p->visit(&streamVisitor, false); AsyncVisitor asyncVisitor(H, C, _dllExport); p->visit(&asyncVisitor, false); @@ -1196,12 +1203,6 @@ Slice::Gen::TypesVisitor::visitStructEnd(const StructPtr& p) params.push_back(fixKwd((*q)->name())); } - string dllExport; - if(findMetaData(p->getMetaData()) != "%class") - { - dllExport = _dllExport; - } - H << sp << nl << "bool operator==(const " << name << "& __rhs) const"; H << sb; H << nl << "if(this == &__rhs)"; @@ -1253,57 +1254,6 @@ Slice::Gen::TypesVisitor::visitStructEnd(const StructPtr& p) H << sb; H << nl << "return !operator<(__rhs);"; H << eb; - - if(!p->isLocal()) - { - // - // None of these member functions are virtual! - // - H << sp << nl << dllExport << "void __write(::IceInternal::BasicStream*) const;"; - H << nl << dllExport << "void __read(::IceInternal::BasicStream*);"; - - if(_stream) - { - H << nl << dllExport << "void __write(const ::Ice::OutputStreamPtr&) const;"; - H << nl << dllExport << "void __read(const ::Ice::InputStreamPtr&);"; - } - - C << sp << nl << "void" << nl << scoped.substr(2) << "::__write(::IceInternal::BasicStream* __os) const"; - C << sb; - for(DataMemberList::const_iterator q = dataMembers.begin(); q != dataMembers.end(); ++q) - { - writeMarshalUnmarshalDataMember(C, *q, true); - } - C << eb; - - C << sp << nl << "void" << nl << scoped.substr(2) << "::__read(::IceInternal::BasicStream* __is)"; - C << sb; - for(DataMemberList::const_iterator q = dataMembers.begin(); q != dataMembers.end(); ++q) - { - writeMarshalUnmarshalDataMember(C, *q, false); - } - C << eb; - - if(_stream) - { - C << sp << nl << "void" << nl << scoped.substr(2) << "::__write(const ::Ice::OutputStreamPtr& __os) const"; - C << sb; - for(DataMemberList::const_iterator q = dataMembers.begin(); q != dataMembers.end(); ++q) - { - C << nl << "__os->write(" << fixKwd((*q)->name()) << ");"; - } - C << eb; - - C << sp << nl << "void" << nl << scoped.substr(2) << "::__read(const ::Ice::InputStreamPtr& __is)"; - C << sb; - for(DataMemberList::const_iterator q = dataMembers.begin(); q != dataMembers.end(); ++q) - { - C << nl << "__is->read(" << fixKwd((*q)->name()) << ");"; - } - C << eb; - } - } - H << eb << ';'; if(findMetaData(p->getMetaData()) == "%class") @@ -6032,10 +5982,11 @@ Slice::Gen::AsyncImplVisitor::visitOperation(const OperationPtr& p) } } -Slice::Gen::StreamVisitor::StreamVisitor(Output& h, Output& c) : - H(h), C(c) +Slice::Gen::StreamVisitor::StreamVisitor(Output& h, Output& c, const string& dllExport) : + H(h), + C(c), + _dllExport(dllExport) { - } bool @@ -6055,6 +6006,9 @@ Slice::Gen::StreamVisitor::visitModuleStart(const ModulePtr& m) // H << sp; H << nl << "namespace Ice" << nl << '{'; + + C << sp; + C << nl << "namespace Ice" << nl << '{'; } return true; @@ -6069,6 +6023,7 @@ Slice::Gen::StreamVisitor::visitModuleEnd(const ModulePtr& m) // Only emit this for the top-level module. // H << nl << '}'; + C << nl << '}'; } } @@ -6094,15 +6049,13 @@ Slice::Gen::StreamVisitor::visitStructStart(const StructPtr& p) { bool classMetaData = findMetaData(p->getMetaData(), false) == "%class"; string scoped = p->scoped(); + + string fullStructName = classMetaData ? fixKwd(scoped + "Ptr") : fixKwd(scoped); + H << nl << "template<>"; - if(classMetaData) - { - H << nl << "struct StreamableTraits< " << fixKwd(scoped + "Ptr") << ">"; - } - else - { - H << nl << "struct StreamableTraits< " << fixKwd(scoped) << ">"; - } + + H << nl << "struct StreamableTraits< " << fullStructName << ">"; + H << sb; if(classMetaData) { @@ -6122,6 +6075,53 @@ Slice::Gen::StreamVisitor::visitStructStart(const StructPtr& p) H << nl << "static const bool fixedLength = true;"; } H << eb << ";" << nl; + + DataMemberList dataMembers = p->dataMembers(); + + string holder = classMetaData ? "v->" : "v."; + + H << nl << "template<class S>"; + H << nl << "struct StreamWriter< " << fullStructName << ", S>"; + H << sb; + H << nl << "static void write(S* __os, const " << fullStructName << "& v)"; + H << sb; + for(DataMemberList::const_iterator q = dataMembers.begin(); q != dataMembers.end(); ++q) + { + writeMarshalUnmarshalDataMemberInHolder(H, holder, *q, true); + } + H << eb; + H << eb << ";" << nl; + + H << nl << "template<class S>"; + H << nl << "struct StreamReader< " << fullStructName << ", S>"; + H << sb; + H << nl << "static void read(S* __is, " << fullStructName << "& v)"; + H << sb; + for(DataMemberList::const_iterator q = dataMembers.begin(); q != dataMembers.end(); ++q) + { + writeMarshalUnmarshalDataMemberInHolder(H, holder, *q, false); + } + H << eb; + H << eb << ";" << nl; + + if(!_dllExport.empty()) + { + // + // We tell "importers" that the implementation exports these instantiations + // + H << nl << "#if defined(ICE_HAS_DECLSPEC_IMPORT_EXPORT) && !defined(" << _dllExport.substr(0, _dllExport.size() - 1) + "_EXPORTS)"; + H << nl << "template struct " << _dllExport << "StreamWriter< " << fullStructName << ", ::IceInternal::BasicStream>;"; + H << nl << "template struct " << _dllExport << "StreamReader< " << fullStructName << ", ::IceInternal::BasicStream>;"; + H << nl << "#endif" << nl; + + // + // The instantations: + // + C << nl << "#ifdef ICE_HAS_DECLSPEC_IMPORT_EXPORT"; + C << nl << "template struct " << _dllExport << "StreamWriter< " << fullStructName << ", ::IceInternal::BasicStream>;"; + C << nl << "template struct " << _dllExport << "StreamReader< " << fullStructName << ", ::IceInternal::BasicStream>;"; + C << nl << "#endif" << nl; + } } return false; } diff --git a/cpp/src/slice2cpp/Gen.h b/cpp/src/slice2cpp/Gen.h index 9d05ca2a8b5..a8377f6fa35 100644 --- a/cpp/src/slice2cpp/Gen.h +++ b/cpp/src/slice2cpp/Gen.h @@ -402,7 +402,7 @@ private: { public: - StreamVisitor(::IceUtilInternal::Output&, ::IceUtilInternal::Output&); + StreamVisitor(::IceUtilInternal::Output&, ::IceUtilInternal::Output&, const std::string&); virtual bool visitModuleStart(const ModulePtr&); virtual void visitModuleEnd(const ModulePtr&); @@ -414,6 +414,7 @@ private: ::IceUtilInternal::Output& H; ::IceUtilInternal::Output& C; + std::string _dllExport; }; private: diff --git a/cpp/test/Ice/admin/run.py b/cpp/test/Ice/admin/run.py index bb34e7d35b7..2989fb41ed9 100755 --- a/cpp/test/Ice/admin/run.py +++ b/cpp/test/Ice/admin/run.py @@ -17,7 +17,7 @@ if len(head) > 0: path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ] if len(path) == 0: raise "can't find toplevel directory!" -sys.path.append(os.path.join(path[0])) -from scripts import * +sys.path.append(os.path.join(path[0], "scripts")) +import TestUtil TestUtil.clientServerTest() diff --git a/cpp/test/Ice/custom/Makefile b/cpp/test/Ice/custom/Makefile index 45b64403cd0..e045afd71c9 100644 --- a/cpp/test/Ice/custom/Makefile +++ b/cpp/test/Ice/custom/Makefile @@ -63,7 +63,6 @@ GENPIC = no include $(top_srcdir)/config/Make.rules CPPFLAGS := -I. -I../../include $(CPPFLAGS) -SLICE2CPPFLAGS := --stream $(SLICE2CPPFLAGS) # # Disables optimization when building with Solaris CC: diff --git a/cpp/test/Ice/custom/Makefile.mak b/cpp/test/Ice/custom/Makefile.mak index 83051789c84..7fdc648d732 100644 --- a/cpp/test/Ice/custom/Makefile.mak +++ b/cpp/test/Ice/custom/Makefile.mak @@ -55,7 +55,6 @@ SRCS = $(COBJS:.obj=.cpp) \ !include $(top_srcdir)/config/Make.rules.mak
-SLICE2CPPFLAGS = --stream $(SLICE2CPPFLAGS)
CPPFLAGS = -I. -I../../include $(CPPFLAGS) -DWIN32_LEAN_AND_MEAN -Zm300 -bigobj
!if "$(GENERATE_PDB)" == "yes"
diff --git a/cpp/test/Ice/exceptions/AllTests.cpp b/cpp/test/Ice/exceptions/AllTests.cpp index 0ebc176792b..6a09297b4d9 100644 --- a/cpp/test/Ice/exceptions/AllTests.cpp +++ b/cpp/test/Ice/exceptions/AllTests.cpp @@ -126,6 +126,11 @@ public: Ice::Identity id = _communicator->stringToIdentity("does not exist"); test(ex.id == id); } + catch(const Ice::Exception& ex) + { + cerr << ex << endl; + test(false); + } catch(...) { test(false); diff --git a/cpp/test/Ice/invoke/Makefile b/cpp/test/Ice/invoke/Makefile index 508e23599c0..a9ed3820225 100644 --- a/cpp/test/Ice/invoke/Makefile +++ b/cpp/test/Ice/invoke/Makefile @@ -30,7 +30,6 @@ SLICE_SRCS = Test.ice include $(top_srcdir)/config/Make.rules CPPFLAGS := -I. -I../../include $(CPPFLAGS) -SLICE2CPPFLAGS := --stream $(SLICE2CPPFLAGS) $(CLIENT): $(COBJS) rm -f $@ diff --git a/cpp/test/Ice/invoke/Makefile.mak b/cpp/test/Ice/invoke/Makefile.mak index 10aa670e23d..d04e9b32533 100644 --- a/cpp/test/Ice/invoke/Makefile.mak +++ b/cpp/test/Ice/invoke/Makefile.mak @@ -36,7 +36,6 @@ SRCS = $(COBJS:.obj=.cpp) \ !include $(top_srcdir)/config/Make.rules.mak
CPPFLAGS = -I. -I../../include $(CPPFLAGS) -DWIN32_LEAN_AND_MEAN
-SLICE2CPPFLAGS = --stream $(SLICE2CPPFLAGS)
!if "$(WINRT)" != "yes"
LD_TESTFLAGS = $(LD_EXEFLAGS) $(SETARGV)
diff --git a/cpp/test/Ice/objects/Makefile b/cpp/test/Ice/objects/Makefile index 24d82401abc..be3dce9f04c 100644 --- a/cpp/test/Ice/objects/Makefile +++ b/cpp/test/Ice/objects/Makefile @@ -36,7 +36,6 @@ SLICE_SRCS = Test.ice include $(top_srcdir)/config/Make.rules CPPFLAGS := -I. -I../../include $(CPPFLAGS) -SLICE2CPPFLAGS := --stream $(SLICE2CPPFLAGS) $(CLIENT): $(OBJS) $(COBJS) rm -f $@ diff --git a/cpp/test/Ice/objects/Makefile.mak b/cpp/test/Ice/objects/Makefile.mak index a03336648fd..e3cf1a7e3f4 100644 --- a/cpp/test/Ice/objects/Makefile.mak +++ b/cpp/test/Ice/objects/Makefile.mak @@ -43,7 +43,6 @@ SRCS = $(COBJS:.obj=.cpp) \ !include $(top_srcdir)/config/Make.rules.mak
-SLICE2CPPFLAGS = --stream $(SLICE2CPPFLAGS)
CPPFLAGS = -I. -I../../include $(CPPFLAGS) -DWIN32_LEAN_AND_MEAN
!if "$(WINRT)" != "yes"
diff --git a/cpp/test/Ice/optional/Makefile b/cpp/test/Ice/optional/Makefile index 575f8aaea22..c56c90d62be 100644 --- a/cpp/test/Ice/optional/Makefile +++ b/cpp/test/Ice/optional/Makefile @@ -31,7 +31,6 @@ SLICE_SRCS = Test.ice include $(top_srcdir)/config/Make.rules CPPFLAGS := -I. -I../../include $(CPPFLAGS) -SLICE2CPPFLAGS := --stream $(SLICE2CPPFLAGS) $(CLIENT): $(OBJS) $(COBJS) rm -f $@ diff --git a/cpp/test/Ice/optional/Makefile.mak b/cpp/test/Ice/optional/Makefile.mak index 7e08d35b94c..6932beaa3e5 100644 --- a/cpp/test/Ice/optional/Makefile.mak +++ b/cpp/test/Ice/optional/Makefile.mak @@ -28,7 +28,6 @@ SRCS = $(COBJS:.obj=.cpp) \ !include $(top_srcdir)/config/Make.rules.mak
-SLICE2CPPFLAGS = --stream $(SLICE2CPPFLAGS)
CPPFLAGS = -I. -I../../include $(CPPFLAGS) -DWIN32_LEAN_AND_MEAN
!if "$(GENERATE_PDB)" == "yes"
diff --git a/cpp/test/IceBox/admin/run.py b/cpp/test/IceBox/admin/run.py index e567e3771bf..8c7cafab49a 100755 --- a/cpp/test/IceBox/admin/run.py +++ b/cpp/test/IceBox/admin/run.py @@ -17,8 +17,8 @@ if len(head) > 0: path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ] if len(path) == 0: raise "can't find toplevel directory!" -sys.path.append(os.path.join(path[0])) -from scripts import * +sys.path.append(os.path.join(path[0], "scripts")) +import TestUtil icebox = TestUtil.getIceBox() diff --git a/cpp/test/IceGrid/deployer/Makefile b/cpp/test/IceGrid/deployer/Makefile index 04cc5ceb398..2650679f661 100644 --- a/cpp/test/IceGrid/deployer/Makefile +++ b/cpp/test/IceGrid/deployer/Makefile @@ -35,8 +35,6 @@ SRCS = $(OBJS:.o=.cpp) \ SLICE_SRCS = Test.ice -GENPIC = no - include $(top_srcdir)/config/Make.rules CPPFLAGS := -I. -I../../include $(CPPFLAGS) diff --git a/cpp/test/IceGrid/noRestartUpdate/Makefile b/cpp/test/IceGrid/noRestartUpdate/Makefile index cbae6293d39..b8373491448 100644 --- a/cpp/test/IceGrid/noRestartUpdate/Makefile +++ b/cpp/test/IceGrid/noRestartUpdate/Makefile @@ -35,8 +35,6 @@ SRCS = $(OBJS:.o=.cpp) \ SLICE_SRCS = Test.ice -GENPIC = no - include $(top_srcdir)/config/Make.rules CPPFLAGS := -I. -I../../include $(CPPFLAGS) diff --git a/cpp/test/IceGrid/noRestartUpdate/run.py b/cpp/test/IceGrid/noRestartUpdate/run.py index d700768b56c..88b551d1a06 100755 --- a/cpp/test/IceGrid/noRestartUpdate/run.py +++ b/cpp/test/IceGrid/noRestartUpdate/run.py @@ -17,8 +17,8 @@ if len(head) > 0: path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ] if len(path) == 0: raise "can't find toplevel directory!" -sys.path.append(os.path.join(path[0])) -from scripts import * +sys.path.append(os.path.join(path[0], "scripts")) +import TestUtil, IceGridAdmin name = os.path.join("IceGrid", "noRestartUpdate") diff --git a/cpp/test/Slice/structure/Makefile b/cpp/test/Slice/structure/Makefile index 6d146747e73..610aa11e53b 100644 --- a/cpp/test/Slice/structure/Makefile +++ b/cpp/test/Slice/structure/Makefile @@ -23,7 +23,6 @@ SLICE_SRCS = Test.ice include $(top_srcdir)/config/Make.rules CPPFLAGS := -I. -I../../include $(CPPFLAGS) -SLICE2CPPFLAGS := --stream $(SLICE2CPPFLAGS) $(CLIENT): $(COBJS) rm -f $@ diff --git a/cpp/test/Slice/structure/Makefile.mak b/cpp/test/Slice/structure/Makefile.mak index 6805a57395e..808573a7bb4 100644 --- a/cpp/test/Slice/structure/Makefile.mak +++ b/cpp/test/Slice/structure/Makefile.mak @@ -21,7 +21,6 @@ SRCS = $(COBJS:.obj=.cpp) !include $(top_srcdir)/config/Make.rules.mak
CPPFLAGS = -I. -I../../include $(CPPFLAGS) -DWIN32_LEAN_AND_MEAN
-SLICE2CPPFLAGS = --stream $(SLICE2CPPFLAGS)
!if "$(GENERATE_PDB)" == "yes"
CPDBFLAGS = /pdb:$(CLIENT:.exe=.pdb)
|