diff options
author | Michi Henning <michi@zeroc.com> | 2004-03-26 04:32:42 +0000 |
---|---|---|
committer | Michi Henning <michi@zeroc.com> | 2004-03-26 04:32:42 +0000 |
commit | 4648cccd154c9fafec5b92664d7175643e0b7665 (patch) | |
tree | d4cb54abc713dc69b9eef7a06a098538c6aeecdd /cpp/src/slice2cpp/Gen.cpp | |
parent | Added initialization for Ice.ProgramName from argv[0]. (diff) | |
download | ice-4648cccd154c9fafec5b92664d7175643e0b7665.tar.bz2 ice-4648cccd154c9fafec5b92664d7175643e0b7665.tar.xz ice-4648cccd154c9fafec5b92664d7175643e0b7665.zip |
Fixed parser bug: if an operation had an exception speficiation with
multiple exceptions, and one of the exceptions was a base of one or
more of the other exceptions, the catch blocks in the marshaling and
dispatch code were emitted in the wrong order.
Diffstat (limited to 'cpp/src/slice2cpp/Gen.cpp')
-rw-r--r-- | cpp/src/slice2cpp/Gen.cpp | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/cpp/src/slice2cpp/Gen.cpp b/cpp/src/slice2cpp/Gen.cpp index 87774fc7602..8616a3848dd 100644 --- a/cpp/src/slice2cpp/Gen.cpp +++ b/cpp/src/slice2cpp/Gen.cpp @@ -1,7 +1,7 @@ // ********************************************************************** // -// Copyright (c) 2003 -// ZeroC, Inc. +// copyright (c) 2003 +// zeroc, inc. // Billerica, MA, USA // // All Rights Reserved. @@ -2357,6 +2357,15 @@ Slice::Gen::ObjectVisitor::visitOperation(const OperationPtr& p) ExceptionList throws = p->throws(); 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. + // + throws.sort(Slice::DerivedToBaseCompare()); + if(!inParams.empty()) { C << nl << "::IceInternal::BasicStream* __is = __in.is();"; @@ -3544,6 +3553,14 @@ Slice::Gen::AsyncImplVisitor::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. + // + throws.sort(Slice::DerivedToBaseCompare()); + TypePtr ret = p->returnType(); string retS = inputTypeToString(ret); |