GNOME Bugzilla – Bug 112220
generates invalid code for enum used as union discriminator
Last modified: 2006-11-23 10:41:50 UTC
As reported on the Debian BTS as #131331 (http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=131331) by Jochen Voss: ======================================================================== Hello, when I use an CORBA <enum_type> as a union discriminator, orbit-idl silently generates code, which does not compile. Example: I use the following IDL file: == testunion.idl starts at next line ================================= module TestUnion { interface Frosch { union MyUnion switch (enum E2 { A, B }) { case A: long x; case B: string s; }; attribute MyUnion U; }; }; == testunion.idl ends at previous line =============================== Now I call orbit-idl: voss@tatonka [~/bugreport/orbit] orbit-idl testunion.idl voss@tatonka [~/bugreport/orbit] grep TestUnion_Frosch_MyUnion_E2 * testunion-common.c:static const TestUnion_Frosch_MyUnion_E2 anon_sublabel_values_array8[] = testunion-common.c: { {(CORBA_TypeCode) & TC_TestUnion_Frosch_MyUnion_E2_struct, testunion-common.c: {(CORBA_TypeCode) & TC_TestUnion_Frosch_MyUnion_E2_struct, testunion-common.c: (CORBA_TypeCode) & TC_TestUnion_Frosch_MyUnion_E2_struct, 0, -1, 0, 0 testunion-skels.c: value._d = *((TestUnion_Frosch_MyUnion_E2 *) _ORBIT_curptr); testunion-stubs.c: *((TestUnion_Frosch_MyUnion_E2 *) _ORBIT_curptr); testunion.h: TestUnion_Frosch_MyUnion_E2 _d; As you can see, TestUnion_Frosch_MyUnion_E2 is never defined, but used in severl places. Consequently the generated files refuse to compile. Jochen
Since I dislike groping in the IDL compiler, and have no need of this myself; it'd be quickest if Jochen (/someone) could hack up a small libIDL/other patch to implement this - should be fairly easy; Thanks for the report though.
> Since I dislike groping in the IDL compiler, and have no need of this > myself; it'd be quickest if Jochen (/someone) could hack up a small > libIDL/other patch to implement this - should be fairly easy; I will look into it.
Is this fixed in ORBit2?
I just checked with ORBit2, which defines TestUnion_Frosch_MyUnion_E2. This bug can be closed.
Thanks Sebastian, marked fixed.