slice2cpp creates cpp files where the exceptions which are caught and thrown/marshalled are not in the same order as they are in the .ice file.
i created the following example code to illustrate my problem:
Code:
module bla {
exception Parent {};
exception Child extends Parent {};
exception XChild extends Parent {};
interface bli {
void testi1() throws Parent, Child;
void testi2() throws Child, Parent;
void testi3() throws Parent, XChild;
void testi4() throws XChild, Parent;
};
};
the cpp file created by slice2cpp contains instructions to catch _each_ of the exceptions thrown by a method.
the problem is, they are caught in alphabetical order, thus i get the following warnings from g++ if i try to compile the generated files:
Code:
test_exception_throwing.cpp: In member function `IceInternal::DispatchStatus
bla::bli::___testi3(IceInternal::Incoming&, const Ice::Current&)':
test_exception_throwing.cpp:859: warning: exception of type `bla::XChild' will
be caught
test_exception_throwing.cpp:854: warning: by earlier handler for `
bla::Parent'
test_exception_throwing.cpp: In member function `IceInternal::DispatchStatus
bla::bli::___testi4(IceInternal::Incoming&, const Ice::Current&)':
test_exception_throwing.cpp:880: warning: exception of type `bla::XChild' will
be caught
test_exception_throwing.cpp:875: warning: by earlier handler for `
bla::Parent'
i think the exceptions are ordered alphabetically in the try{ } catch()... block generated by slice2cpp.
is this done deliberate?
the problem is that XChild will never be caught from a calling function because the exception will never be marshalled because all such exceptions will be interpreted as Parent
i think the order should be the same as given by the programmer.
in my example .ice code, this would mean that the methods testi1 and testi3 would give the warning, but it _would_ be possible to remove the warnings by manually reordering the exceptions.
with an alphabetical sorting, it is not possible to remove the warnings by reordering, the exceptions would have to be renamed.
edit: removed smilies in code