diff options
Diffstat (limited to 'cpp/src/slice2cs/Gen.cpp')
-rwxr-xr-x | cpp/src/slice2cs/Gen.cpp | 43 |
1 files changed, 36 insertions, 7 deletions
diff --git a/cpp/src/slice2cs/Gen.cpp b/cpp/src/slice2cs/Gen.cpp index 68dc7e94259..7c8eb1a42e6 100755 --- a/cpp/src/slice2cs/Gen.cpp +++ b/cpp/src/slice2cs/Gen.cpp @@ -289,7 +289,18 @@ Slice::CsVisitor::writeDispatch(const ClassDefPtr& p) ExceptionList throws = op->throws(); throws.sort(); throws.unique(); - remove_if(throws.begin(), throws.end(), IceUtil::constMemFun(&Exception::isLocal)); + + // + // Arrange exceptions into most-derived to least-derived order. If we don't + // do this, a base exception handler can appear before a derived exception + // handler, causing compiler warnings and resulting in the base exception + // being marshaled instead of the derived exception. + // +#if defined(__SUNPRO_CC) + throws.sort(Slice::derivedToBaseCompare); +#else + throws.sort(Slice::DerivedToBaseCompare()); +#endif TypeStringList::const_iterator q; @@ -3155,7 +3166,6 @@ Slice::Gen::DelegateMVisitor::visitClassDefStart(const ClassDefPtr& p) ExceptionList throws = op->throws(); throws.sort(); throws.unique(); - throws.erase(remove_if(throws.begin(), throws.end(), IceUtil::constMemFun(&Exception::isLocal)), throws.end()); // // Arrange exceptions into most-derived to least-derived order. If we don't @@ -3359,11 +3369,6 @@ Slice::Gen::DelegateDVisitor::visitClassDefStart(const ClassDefPtr& p) string retS = typeToString(ret); ClassDefPtr containingClass = ClassDefPtr::dynamicCast(op->container()); - ExceptionList throws = op->throws(); - throws.sort(); - throws.unique(); - throws.erase(remove_if(throws.begin(), throws.end(), IceUtil::constMemFun(&Exception::isLocal)), throws.end()); - vector<string> params = getParams(op); vector<string> args = getArgs(op); @@ -3599,6 +3604,18 @@ Slice::Gen::AsyncVisitor::visitOperation(const OperationPtr& p) throws.sort(); throws.unique(); + // + // Arrange exceptions into most-derived to least-derived order. If we don't + // do this, a base exception handler can appear before a derived exception + // handler, causing compiler warnings and resulting in the base exception + // being marshaled instead of the derived exception. + // +#if defined(__SUNPRO_CC) + throws.sort(Slice::derivedToBaseCompare); +#else + throws.sort(Slice::DerivedToBaseCompare()); +#endif + TypeStringList::const_iterator q; vector<string> params = getParamsAsyncCB(p); @@ -3764,6 +3781,18 @@ Slice::Gen::AsyncVisitor::visitOperation(const OperationPtr& p) throws.sort(); throws.unique(); + // + // Arrange exceptions into most-derived to least-derived order. If we don't + // do this, a base exception handler can appear before a derived exception + // handler, causing compiler warnings and resulting in the base exception + // being marshaled instead of the derived exception. + // +#if defined(__SUNPRO_CC) + throws.sort(Slice::derivedToBaseCompare); +#else + throws.sort(Slice::DerivedToBaseCompare()); +#endif + TypeStringList::const_iterator q; _out << sp << nl << "class " << classNameAMDI << '_' << name << " : IceInternal.IncomingAsync, " << classNameAMD << '_' << name; |