summaryrefslogtreecommitdiff
path: root/cpp
diff options
context:
space:
mode:
authorBenoit Foucher <benoit@zeroc.com>2012-09-17 10:17:54 +0200
committerBenoit Foucher <benoit@zeroc.com>2012-09-17 10:17:54 +0200
commit44e2e0e70a84afe351a281b68843e140ddc4fc91 (patch)
tree0079a3d9061bb5845b6ce8aaa995e710c55df600 /cpp
parentMoved some MX classes to IceInternal (diff)
parentPython support for optionals (diff)
downloadice-44e2e0e70a84afe351a281b68843e140ddc4fc91.tar.bz2
ice-44e2e0e70a84afe351a281b68843e140ddc4fc91.tar.xz
ice-44e2e0e70a84afe351a281b68843e140ddc4fc91.zip
Merge remote-tracking branch 'origin/encoding11' into mx
Conflicts: py/python/Ice.py
Diffstat (limited to 'cpp')
-rwxr-xr-xcpp/allTests.py1
-rw-r--r--cpp/include/Ice/BasicStream.h15
-rw-r--r--cpp/include/Ice/SlicedData.h2
-rw-r--r--cpp/include/Ice/Stream.h9
-rwxr-xr-xcpp/src/Ice/BasicStream.cpp39
-rw-r--r--cpp/src/Ice/SlicedData.cpp6
-rw-r--r--cpp/src/Ice/StreamI.cpp16
-rw-r--r--cpp/src/Ice/StreamI.h5
-rw-r--r--cpp/src/Slice/CPlusPlusUtil.cpp5
-rwxr-xr-xcpp/src/Slice/PythonUtil.cpp47
-rw-r--r--cpp/src/Slice/Scanner.cpp59
-rw-r--r--cpp/src/Slice/Scanner.l7
-rw-r--r--cpp/test/Ice/Makefile1
-rw-r--r--cpp/test/Ice/Makefile.mak1
-rw-r--r--cpp/test/Ice/optional/AllTests.cpp8
-rw-r--r--cpp/test/Ice/optional/Test.ice2
16 files changed, 170 insertions, 53 deletions
diff --git a/cpp/allTests.py b/cpp/allTests.py
index 55b94eccb10..340a1772e85 100755
--- a/cpp/allTests.py
+++ b/cpp/allTests.py
@@ -44,6 +44,7 @@ tests = [
("Ice/inheritance", ["core"]),
("Ice/facets", ["core"]),
("Ice/objects", ["core"]),
+ ("Ice/optional", ["core"]),
("Ice/binding", ["core"]),
("Ice/faultTolerance", ["core", "novalgrind"]), # valgrind reports leak with aborted servers
("Ice/location", ["core"]),
diff --git a/cpp/include/Ice/BasicStream.h b/cpp/include/Ice/BasicStream.h
index 69bfc1a2e53..fcffd268000 100644
--- a/cpp/include/Ice/BasicStream.h
+++ b/cpp/include/Ice/BasicStream.h
@@ -457,6 +457,19 @@ public:
Ice::Int readAndCheckSeqSize(int);
+ void startSize()
+ {
+ _sizePos = static_cast<int>(b.size());
+ write(Ice::Int(0));
+ }
+
+ void endSize()
+ {
+ assert(_sizePos >= 0);
+ rewrite(b.size() - _sizePos - 4, _sizePos);
+ _sizePos = -1;
+ }
+
void writeBlob(const std::vector<Ice::Byte>&);
void readBlob(std::vector<Ice::Byte>&, Ice::Int);
@@ -1126,6 +1139,8 @@ private:
int _startSeq;
int _minSeqSize;
+ int _sizePos;
+
static const Ice::Byte FLAG_HAS_TYPE_ID_STRING;
static const Ice::Byte FLAG_HAS_TYPE_ID_INDEX;
static const Ice::Byte FLAG_HAS_OPTIONAL_MEMBERS;
diff --git a/cpp/include/Ice/SlicedData.h b/cpp/include/Ice/SlicedData.h
index 974cf001472..54542c12c52 100644
--- a/cpp/include/Ice/SlicedData.h
+++ b/cpp/include/Ice/SlicedData.h
@@ -85,6 +85,8 @@ public:
const std::string& getUnknownTypeId() const;
+ SlicedDataPtr getSlicedData() const;
+
virtual void __addObject(::IceInternal::GCCountMap&);
virtual bool __usesGC();
virtual void __gcReachable(::IceInternal::GCCountMap&) const;
diff --git a/cpp/include/Ice/Stream.h b/cpp/include/Ice/Stream.h
index 0edf80e97f0..5bb16919321 100644
--- a/cpp/include/Ice/Stream.h
+++ b/cpp/include/Ice/Stream.h
@@ -67,7 +67,7 @@ public:
virtual void usesClasses(bool) = 0;
virtual ::std::string ice_name() const = 0;
- virtual UserExceptionReader* ice_clone() const = 0;
+ virtual UserException* ice_clone() const = 0;
virtual void ice_throw() const = 0;
virtual void __write(IceInternal::BasicStream*) const;
@@ -332,7 +332,10 @@ public:
virtual void write(const Float*, const Float*) = 0;
virtual void write(const Double*, const Double*) = 0;
- virtual void writeOptional(Int, OptionalType) = 0;
+ virtual bool writeOptional(Int, OptionalType) = 0;
+
+ virtual void startSize() = 0;
+ virtual void endSize() = 0;
//
// COMPILER FIX: clang using libc++ cannot use the StreamHelper to write
@@ -423,7 +426,7 @@ public:
virtual bool usesClasses() const = 0;
virtual ::std::string ice_name() const = 0;
- virtual UserExceptionWriter* ice_clone() const = 0;
+ virtual UserException* ice_clone() const = 0;
virtual void ice_throw() const = 0;
virtual void __write(IceInternal::BasicStream*) const;
diff --git a/cpp/src/Ice/BasicStream.cpp b/cpp/src/Ice/BasicStream.cpp
index d8cf31ff20e..07fa34c50b0 100755
--- a/cpp/src/Ice/BasicStream.cpp
+++ b/cpp/src/Ice/BasicStream.cpp
@@ -97,7 +97,8 @@ IceInternal::BasicStream::BasicStream(Instance* instance, const EncodingVersion&
_unlimited(unlimited),
_stringConverter(instance->initializationData().stringConverter),
_wstringConverter(instance->initializationData().wstringConverter),
- _startSeq(-1)
+ _startSeq(-1),
+ _sizePos(-1)
{
//
// Initialize the encoding members of our pre-allocated encapsulations, in case
@@ -126,6 +127,8 @@ IceInternal::BasicStream::clear()
_startSeq = -1;
+ _sizePos = -1;
+
_sliceObjects = true;
}
@@ -163,6 +166,7 @@ IceInternal::BasicStream::swap(BasicStream& other)
std::swap(_unlimited, other._unlimited);
std::swap(_startSeq, other._startSeq);
std::swap(_minSeqSize, other._minSeqSize);
+ std::swap(_sizePos, other._sizePos);
}
void
@@ -2754,12 +2758,39 @@ IceInternal::BasicStream::EncapsDecoder::readInstance()
skipSlice();
//
- // If this is the last slice, keep the object as an opaque
- // UnknownSlicedData object.
+ // If this is the last slice, keep the object as an opaque UnknownSlicedObject.
//
if(_sliceFlags & FLAG_IS_LAST_SLICE)
{
- v = new UnknownSlicedObject(mostDerivedId);
+ //
+ // Provide a factory with an opportunity to supply the object.
+ // We pass the "::Ice::Object" ID to indicate that this is the
+ // last chance to preserve the object.
+ //
+ userFactory = servantFactoryManager->find(Object::ice_staticId());
+ if(userFactory)
+ {
+ v = userFactory->create(Object::ice_staticId());
+ }
+
+ //
+ // If that fails, invoke the default factory if one has been
+ // registered.
+ //
+ if(!v)
+ {
+ userFactory = servantFactoryManager->find("");
+ if(userFactory)
+ {
+ v = userFactory->create(Object::ice_staticId());
+ }
+ }
+
+ if(!v)
+ {
+ v = new UnknownSlicedObject(mostDerivedId);
+ }
+
break;
}
diff --git a/cpp/src/Ice/SlicedData.cpp b/cpp/src/Ice/SlicedData.cpp
index 9b2e88b609c..5332719eec9 100644
--- a/cpp/src/Ice/SlicedData.cpp
+++ b/cpp/src/Ice/SlicedData.cpp
@@ -82,6 +82,12 @@ Ice::UnknownSlicedObject::getUnknownTypeId() const
return _unknownTypeId;
}
+SlicedDataPtr
+Ice::UnknownSlicedObject::getSlicedData() const
+{
+ return _slicedData;
+}
+
void
Ice::UnknownSlicedObject::__addObject(IceInternal::GCCountMap& _c)
{
diff --git a/cpp/src/Ice/StreamI.cpp b/cpp/src/Ice/StreamI.cpp
index e1e73f94617..431926d64b0 100644
--- a/cpp/src/Ice/StreamI.cpp
+++ b/cpp/src/Ice/StreamI.cpp
@@ -570,10 +570,10 @@ OutputStreamI::write(const Double* begin, const Double* end)
_os->write(begin, end);
}
-void
+bool
OutputStreamI::writeOptional(Int tag, OptionalType type)
{
- _os->writeOpt(tag, type);
+ return _os->writeOpt(tag, type);
}
void
@@ -677,6 +677,18 @@ OutputStreamI::rewrite(Int sz, size_type p)
_os->rewrite(sz, p);
}
+void
+OutputStreamI::startSize()
+{
+ _os->startSize();
+}
+
+void
+OutputStreamI::endSize()
+{
+ _os->endSize();
+}
+
//
// ObjectReader
//
diff --git a/cpp/src/Ice/StreamI.h b/cpp/src/Ice/StreamI.h
index 8d9bba4e977..ba0d103a640 100644
--- a/cpp/src/Ice/StreamI.h
+++ b/cpp/src/Ice/StreamI.h
@@ -147,7 +147,7 @@ public:
using OutputStream::write;
#endif
- virtual void writeOptional(Int, OptionalType);
+ virtual bool writeOptional(Int, OptionalType);
virtual void startObject(const SlicedDataPtr&);
virtual void endObject();
@@ -173,6 +173,9 @@ public:
virtual size_type pos();
virtual void rewrite(Int, size_type);
+ virtual void startSize();
+ virtual void endSize();
+
private:
const CommunicatorPtr _communicator;
diff --git a/cpp/src/Slice/CPlusPlusUtil.cpp b/cpp/src/Slice/CPlusPlusUtil.cpp
index c14476148c2..9eaed2ebcc5 100644
--- a/cpp/src/Slice/CPlusPlusUtil.cpp
+++ b/cpp/src/Slice/CPlusPlusUtil.cpp
@@ -310,6 +310,11 @@ writeMarshalUnmarshalParams(Output& out, const ParamDeclList& params, const Oper
writeMarshalUnmarshalCode(out, (*p)->type(), true, (*p)->tag(), fixKwd((*p)->name()), marshal,
(*p)->getMetaData(), typeCtx);
}
+ if(checkReturnType)
+ {
+ writeMarshalUnmarshalCode(out, op->returnType(), true, op->returnTag(), "__ret", marshal, op->getMetaData(),
+ typeCtx);
+ }
}
}
diff --git a/cpp/src/Slice/PythonUtil.cpp b/cpp/src/Slice/PythonUtil.cpp
index 4e363c17d18..45ded5d48bc 100755
--- a/cpp/src/Slice/PythonUtil.cpp
+++ b/cpp/src/Slice/PythonUtil.cpp
@@ -565,7 +565,7 @@ Slice::Python::CodeVisitor::visitClassDefStart(const ClassDefPtr& p)
string fixedOpName = fixIdent((*oli)->name());
if(!p->isLocal() && (p->hasMetaData("amd") || (*oli)->hasMetaData("amd")))
{
- _out << sp << nl << "def " << fixedOpName << "_async(self, _cb";
+ _out << sp << nl << "def " << (*oli)->name() << "_async(self, _cb";
ParamDeclList params = (*oli)->parameters();
@@ -749,7 +749,7 @@ Slice::Python::CodeVisitor::visitClassDefStart(const ClassDefPtr& p)
{
_out << nl << comment;
}
- _out << nl << "def " << fixedOpName << "_async(self, _cb";
+ _out << nl << "def " << (*oli)->name() << "_async(self, _cb";
if(!inParams.empty())
{
_out << ", " << inParams;
@@ -832,7 +832,7 @@ Slice::Python::CodeVisitor::visitClassDefStart(const ClassDefPtr& p)
//
// Data members are represented as a tuple:
//
- // ('MemberName', MemberMetaData, MemberType)
+ // ('MemberName', MemberMetaData, MemberType, Optional, Tag)
//
// where MemberType is either a primitive type constant (T_INT, etc.) or the id of a constructed type.
//
@@ -858,7 +858,8 @@ Slice::Python::CodeVisitor::visitClassDefStart(const ClassDefPtr& p)
writeMetaData((*r)->getMetaData());
_out << ", ";
writeType((*r)->type());
- _out << ')';
+ _out << ", " << ((*r)->optional() ? "True" : "False") << ", "
+ << ((*r)->optional() ? (*r)->tag() : 0) << ')';
}
if(members.size() == 1)
{
@@ -875,7 +876,7 @@ Slice::Python::CodeVisitor::visitClassDefStart(const ClassDefPtr& p)
//
// Define each operation. The arguments to the IcePy.Operation constructor are:
//
- // 'opName', Mode, SendMode, AMD, (MetaData), (InParams), (OutParams), ReturnType, (Exceptions)
+ // 'opName', Mode, SendMode, AMD, Format, MetaData, (InParams), (OutParams), ReturnParam, (Exceptions)
//
// where InParams and OutParams are tuples of type descriptions, and Exceptions
// is a tuple of exception type ids.
@@ -923,7 +924,8 @@ Slice::Python::CodeVisitor::visitClassDefStart(const ClassDefPtr& p)
writeMetaData((*t)->getMetaData());
_out << ", ";
writeType((*t)->type());
- _out << ')';
+ _out << ", " << ((*t)->optional() ? "True" : "False") << ", "
+ << ((*t)->optional() ? (*t)->tag() : 0) << ')';
++count;
}
}
@@ -944,7 +946,8 @@ Slice::Python::CodeVisitor::visitClassDefStart(const ClassDefPtr& p)
writeMetaData((*t)->getMetaData());
_out << ", ";
writeType((*t)->type());
- _out << ')';
+ _out << ", " << ((*t)->optional() ? "True" : "False") << ", "
+ << ((*t)->optional() ? (*t)->tag() : 0) << ')';
++count;
}
}
@@ -956,7 +959,15 @@ Slice::Python::CodeVisitor::visitClassDefStart(const ClassDefPtr& p)
TypePtr returnType = (*s)->returnType();
if(returnType)
{
+ //
+ // The return type has the same format as an in/out parameter:
+ //
+ // MetaData, Type, Optional?, OptionalTag
+ //
+ _out << "((), ";
writeType(returnType);
+ _out << ", " << ((*s)->returnIsOptional() ? "True" : "False") << ", "
+ << ((*s)->returnIsOptional() ? (*s)->returnTag() : 0) << ')';
}
else
{
@@ -1125,7 +1136,7 @@ Slice::Python::CodeVisitor::visitExceptionStart(const ExceptionPtr& p)
//
// Data members are represented as a tuple:
//
- // ('MemberName', MemberMetaData, MemberType)
+ // ('MemberName', MemberMetaData, MemberType, Optional, Tag)
//
// where MemberType is either a primitive type constant (T_INT, etc.) or the id of a constructed type.
//
@@ -1139,7 +1150,8 @@ Slice::Python::CodeVisitor::visitExceptionStart(const ExceptionPtr& p)
writeMetaData((*dmli)->getMetaData());
_out << ", ";
writeType((*dmli)->type());
- _out << ')';
+ _out << ", " << ((*dmli)->optional() ? "True" : "False") << ", "
+ << ((*dmli)->optional() ? (*dmli)->tag() : 0) << ')';
}
if(members.size() == 1)
{
@@ -1762,24 +1774,27 @@ Slice::Python::CodeVisitor::writeMetaData(const StringList& meta)
void
Slice::Python::CodeVisitor::writeAssign(const MemberInfo& info)
{
+ string paramName = info.fixedName;
+ string memberName = info.fixedName;
+
//
// Structures are treated differently (see bug 3676).
//
StructPtr st = StructPtr::dynamicCast(info.dataMember->type());
- if(st)
+ if(st && !info.dataMember->optional())
{
- _out << nl << "if " << info.fixedName << " is Ice._struct_marker:";
+ _out << nl << "if " << paramName << " is Ice._struct_marker:";
_out.inc();
- _out << nl << "self." << info.fixedName << " = " << getSymbol(st) << "()";
+ _out << nl << "self." << memberName << " = " << getSymbol(st) << "()";
_out.dec();
_out << nl << "else:";
_out.inc();
- _out << nl << "self." << info.fixedName << " = " << info.fixedName;
+ _out << nl << "self." << memberName << " = " << paramName;
_out.dec();
}
else
{
- _out << nl << "self." << info.fixedName << " = " << info.fixedName;
+ _out << nl << "self." << memberName << " = " << paramName;
}
}
@@ -1933,6 +1948,10 @@ Slice::Python::CodeVisitor::writeConstructorParams(const MemberInfoList& members
{
writeConstantValue(member->type(), member->defaultValueType(), member->defaultValue());
}
+ else if(member->optional())
+ {
+ _out << "Ice.Unset";
+ }
else
{
writeInitializer(member->type());
diff --git a/cpp/src/Slice/Scanner.cpp b/cpp/src/Slice/Scanner.cpp
index 87667e38132..9399b80a741 100644
--- a/cpp/src/Slice/Scanner.cpp
+++ b/cpp/src/Slice/Scanner.cpp
@@ -1,4 +1,4 @@
-#include <IceUtil/ScannerConfig.h>
+#include "IceUtil/ScannerConfig.h"
#line 2 "lex.yy.c"
#line 4 "lex.yy.c"
@@ -574,6 +574,13 @@ char *slice_text;
# pragma warning( 4 : 4244 )
#endif
+#if defined(_MSC_VER) && defined(ICE_32)
+//
+// '<' : signed/unsigned mismatch
+//
+# pragma warning( 4 : 4018 )
+#endif
+
#ifdef _MSC_VER
# ifdef slice_wrap
# undef slice_wrap
@@ -613,7 +620,7 @@ int checkKeyword(string&);
-#line 616 "lex.yy.c"
+#line 623 "lex.yy.c"
#define INITIAL 0
#define BOMSCAN 1
@@ -800,10 +807,10 @@ YY_DECL
register char *yy_cp, *yy_bp;
register int yy_act;
-#line 85 "Scanner.l"
+#line 92 "Scanner.l"
-#line 806 "lex.yy.c"
+#line 813 "lex.yy.c"
if ( !(yy_init) )
{
@@ -888,7 +895,7 @@ case 1:
(yy_c_buf_p) = yy_cp -= 1;
YY_DO_BEFORE_ACTION; /* set up slice_text again */
YY_RULE_SETUP
-#line 87 "Scanner.l"
+#line 94 "Scanner.l"
{
if(unit->scanPosition(slice_text))
{
@@ -902,7 +909,7 @@ case 2:
(yy_c_buf_p) = yy_cp -= 1;
YY_DO_BEFORE_ACTION; /* set up slice_text again */
YY_RULE_SETUP
-#line 94 "Scanner.l"
+#line 101 "Scanner.l"
{
if(unit->scanPosition(slice_text))
{
@@ -915,7 +922,7 @@ case 3:
(yy_c_buf_p) = yy_cp -= 1;
YY_DO_BEFORE_ACTION; /* set up slice_text again */
YY_RULE_SETUP
-#line 101 "Scanner.l"
+#line 108 "Scanner.l"
{
if(unit->scanPosition(slice_text))
{
@@ -929,7 +936,7 @@ case 4:
(yy_c_buf_p) = yy_cp -= 1;
YY_DO_BEFORE_ACTION; /* set up slice_text again */
YY_RULE_SETUP
-#line 108 "Scanner.l"
+#line 115 "Scanner.l"
{
if(unit->scanPosition(slice_text))
{
@@ -939,7 +946,7 @@ YY_RULE_SETUP
YY_BREAK
case 5:
YY_RULE_SETUP
-#line 115 "Scanner.l"
+#line 122 "Scanner.l"
{
// C++-style comment
BEGIN(MAINSCAN);
@@ -957,7 +964,7 @@ YY_RULE_SETUP
YY_BREAK
case 6:
YY_RULE_SETUP
-#line 130 "Scanner.l"
+#line 137 "Scanner.l"
{
// C-style comment
BEGIN(MAINSCAN);
@@ -1001,7 +1008,7 @@ YY_RULE_SETUP
YY_BREAK
case 7:
YY_RULE_SETUP
-#line 171 "Scanner.l"
+#line 178 "Scanner.l"
{
BEGIN(MAINSCAN);
return ICE_SCOPE_DELIMITER;
@@ -1009,7 +1016,7 @@ YY_RULE_SETUP
YY_BREAK
case 8:
YY_RULE_SETUP
-#line 176 "Scanner.l"
+#line 183 "Scanner.l"
{
BEGIN(MAINSCAN);
return ICE_METADATA_OPEN;
@@ -1017,7 +1024,7 @@ YY_RULE_SETUP
YY_BREAK
case 9:
YY_RULE_SETUP
-#line 181 "Scanner.l"
+#line 188 "Scanner.l"
{
BEGIN(MAINSCAN);
return ICE_METADATA_CLOSE;
@@ -1025,7 +1032,7 @@ YY_RULE_SETUP
YY_BREAK
case 10:
YY_RULE_SETUP
-#line 186 "Scanner.l"
+#line 193 "Scanner.l"
{
BEGIN(MAINSCAN);
return ICE_GLOBAL_METADATA_OPEN;
@@ -1033,7 +1040,7 @@ YY_RULE_SETUP
YY_BREAK
case 11:
YY_RULE_SETUP
-#line 191 "Scanner.l"
+#line 198 "Scanner.l"
{
BEGIN(MAINSCAN);
return ICE_GLOBAL_METADATA_CLOSE;
@@ -1042,7 +1049,7 @@ YY_RULE_SETUP
case 12:
/* rule 12 can match eol */
YY_RULE_SETUP
-#line 196 "Scanner.l"
+#line 203 "Scanner.l"
{
BEGIN(MAINSCAN);
StringTokPtr ident = new StringTok;
@@ -1070,7 +1077,7 @@ YY_RULE_SETUP
YY_BREAK
case 13:
YY_RULE_SETUP
-#line 221 "Scanner.l"
+#line 228 "Scanner.l"
{
BEGIN(MAINSCAN);
StringTokPtr ident = new StringTok;
@@ -1081,7 +1088,7 @@ YY_RULE_SETUP
YY_BREAK
case 14:
YY_RULE_SETUP
-#line 229 "Scanner.l"
+#line 236 "Scanner.l"
{
BEGIN(MAINSCAN);
StringTokPtr str = new StringTok;
@@ -1245,7 +1252,7 @@ YY_RULE_SETUP
YY_BREAK
case 15:
YY_RULE_SETUP
-#line 390 "Scanner.l"
+#line 397 "Scanner.l"
{
BEGIN(MAINSCAN);
IntegerTokPtr itp = new IntegerTok;
@@ -1264,7 +1271,7 @@ YY_RULE_SETUP
YY_BREAK
case 16:
YY_RULE_SETUP
-#line 406 "Scanner.l"
+#line 413 "Scanner.l"
{
BEGIN(MAINSCAN);
errno = 0;
@@ -1298,7 +1305,7 @@ YY_RULE_SETUP
case 17:
/* rule 17 can match eol */
YY_RULE_SETUP
-#line 436 "Scanner.l"
+#line 443 "Scanner.l"
{
// Ignore white-space
@@ -1314,7 +1321,7 @@ YY_RULE_SETUP
YY_BREAK
case 18:
YY_RULE_SETUP
-#line 449 "Scanner.l"
+#line 456 "Scanner.l"
{
// Ignore UTF-8 BOM, rule only active when parsing start of file.
@@ -1323,7 +1330,7 @@ YY_RULE_SETUP
YY_BREAK
case 19:
YY_RULE_SETUP
-#line 455 "Scanner.l"
+#line 462 "Scanner.l"
{
BEGIN(MAINSCAN);
if(slice_text[0] < 32 || slice_text[0] > 126)
@@ -1342,10 +1349,10 @@ YY_RULE_SETUP
YY_BREAK
case 20:
YY_RULE_SETUP
-#line 471 "Scanner.l"
+#line 478 "Scanner.l"
ECHO;
YY_BREAK
-#line 1348 "lex.yy.c"
+#line 1355 "lex.yy.c"
case YY_STATE_EOF(INITIAL):
case YY_STATE_EOF(BOMSCAN):
case YY_STATE_EOF(MAINSCAN):
@@ -2345,7 +2352,7 @@ void slice_free (void * ptr )
#define YYTABLES_NAME "yytables"
-#line 471 "Scanner.l"
+#line 478 "Scanner.l"
diff --git a/cpp/src/Slice/Scanner.l b/cpp/src/Slice/Scanner.l
index 1d981e3e567..5e2b93df079 100644
--- a/cpp/src/Slice/Scanner.l
+++ b/cpp/src/Slice/Scanner.l
@@ -29,6 +29,13 @@
# pragma warning( 4 : 4244 )
#endif
+#if defined(_MSC_VER) && defined(ICE_32)
+//
+// '<' : signed/unsigned mismatch
+//
+# pragma warning( 4 : 4018 )
+#endif
+
#ifdef _MSC_VER
# ifdef slice_wrap
# undef slice_wrap
diff --git a/cpp/test/Ice/Makefile b/cpp/test/Ice/Makefile
index 733e54498d5..8d24b725a6f 100644
--- a/cpp/test/Ice/Makefile
+++ b/cpp/test/Ice/Makefile
@@ -19,6 +19,7 @@ SUBDIRS = proxy \
inheritance \
facets \
objects \
+ optional \
faultTolerance \
location \
adapterDeactivation \
diff --git a/cpp/test/Ice/Makefile.mak b/cpp/test/Ice/Makefile.mak
index 984a1120a33..db9800af705 100644
--- a/cpp/test/Ice/Makefile.mak
+++ b/cpp/test/Ice/Makefile.mak
@@ -49,6 +49,7 @@ SUBDIRS = $(SUBDIRS) \
defaultServant \
interceptor \
defaultValue \
+ optional
!endif
diff --git a/cpp/test/Ice/optional/AllTests.cpp b/cpp/test/Ice/optional/AllTests.cpp
index dff7d6a6d52..994bab81bc9 100644
--- a/cpp/test/Ice/optional/AllTests.cpp
+++ b/cpp/test/Ice/optional/AllTests.cpp
@@ -154,6 +154,10 @@ class FactoryI : public Ice::ObjectFactory
public:
+ FactoryI() : _enabled(false)
+ {
+ }
+
Ice::ObjectPtr
create(const string& typeId)
{
@@ -938,7 +942,7 @@ allTests(const Ice::CommunicatorPtr& communicator, bool collocated)
StringSeq ss(10);
fill(ss.begin(), ss.end(), "test1");
- p1 = make_pair(&ss[0], &ss[0] + ss.size());
+ p1 = make_pair(ss.begin(), ss.end());
p2 = initial->opStringSeq(p1, p3);
test(p2 && p3);
test(p2 == ss && p3 == ss);
@@ -999,7 +1003,7 @@ allTests(const Ice::CommunicatorPtr& communicator, bool collocated)
test(!p2 && !p3);
VarStructSeq ss(10);
- p1 = make_pair(&ss[0], &ss[0] + ss.size());
+ p1 = make_pair(ss.begin(), ss.end());
p2 = initial->opVarStructSeq(p1, p3);
test(p2 && p3);
test(p2 == ss && p3 == ss);
diff --git a/cpp/test/Ice/optional/Test.ice b/cpp/test/Ice/optional/Test.ice
index 32142d8df71..ab306459ab1 100644
--- a/cpp/test/Ice/optional/Test.ice
+++ b/cpp/test/Ice/optional/Test.ice
@@ -144,7 +144,7 @@ class Initial
optional(1) byte opByte(optional(2) byte p1, out optional(3) byte p3);
- optional(1) long opLong(optional(2) long p1, out optional(3) long p3);
+ optional(3) long opLong(optional(1) long p1, out optional(2) long p3);
optional(1) string opString(optional(2) string p1, out optional(3) string p3);