After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 95581 - subnames for unions with fall through?
subnames for unions with fall through?
Status: RESOLVED FIXED
Product: ORBit2
Classification: Deprecated
Component: IDL compiler
2.4.X
Other All
: Urgent major
: ---
Assigned To: ORBit maintainers
ORBit maintainers
Depends on:
Blocks:
 
 
Reported: 2002-10-12 03:36 UTC by James Henstridge
Modified: 2004-12-22 21:47 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
patch to fix union subnames (3.31 KB, patch)
2002-10-16 12:05 UTC, James Henstridge
none Details | Review

Description James Henstridge 2002-10-12 03:36:52 UTC
I don't know if this is a limitation of the spec or not, but it makes it
difficult to use tc->subnames for a union.  For example, one of the unions
in the everything.idl test included with ORBit2 looks like this:

        union FixedLengthUnion switch (char) {
        case 'a': long x;
        case 'b': char y;
        case 'c': 
        case 'd': boolean z;
        case 'e': FixedLengthStruct v;
        };

For this union, we have the following information in the typecode:
  tc.sub_parts = 5
  tc.subnames = [ "x", "y", "z", "v" ]
  tc.subtypes = [ long, char, boolean, boolean, FixedLengthStruct ]
  tc.sublabels = [ 'a', 'b', 'c', 'd', 'e' ]

So the subnames array doesn't have any indication of the "case 'c':"
branch.  There doesn't seem to be any indication that the 'c' branch even
falls through.  I would have expected the subnames array to look like this:
  tc.subnames = [ "x", "y", "z", "z", "v" ]

Does this sound sensible?  What does the spec say about it?
Comment 1 Michael Meeks 2002-10-14 08:37:02 UTC
We should do as you suggest; havn't looked at the spec. but our code
internally relies on the fact that these arrays are the same length;
and  ultimately the spec can't advocate loosing information - which is
what we do now.

Good catch; thanks.
Comment 2 James Henstridge 2002-10-16 12:05:18 UTC
Created attachment 11585 [details] [review]
patch to fix union subnames
Comment 3 James Henstridge 2002-10-16 12:08:50 UTC
The above patch gets the idl compiler to repeat the subname once for
each label associated with each case statement in the union.  With the
patch, I get the doubled "z" in the subnames array for the union
mentioned earlier.

It should probably go on both HEAD and gnome-2-0 branches.
Comment 4 Michael Meeks 2002-10-16 14:28:48 UTC
Looks great; please commit - and wonderful to have a regression test -
excellent.
Comment 5 James Henstridge 2002-10-16 14:53:14 UTC
Patch ommitted to both HEAD and gnome-2-0 branches.