GNOME Bugzilla – Bug 95581
subnames for unions with fall through?
Last modified: 2004-12-22 21:47:04 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?
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.
Created attachment 11585 [details] [review] patch to fix union subnames
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.
Looks great; please commit - and wonderful to have a regression test - excellent.
Patch ommitted to both HEAD and gnome-2-0 branches.