Bug Report no. 34

attlogo6876_dk.gif (2280 bytes)

sideHome.gif (2321 bytes) sideDownload.gif (2450 bytes) sideDocumentation.gif (2512 bytes) sideFAQ.gif (2344 bytes) sidePatch.gif (2543 bytes) sideSearch.gif (2403 bytes)

Reported By

 

Date

16 Oct 1998

Platforms

All

Version

omniORB 2.6.0 or earlier  (Fixed in 2.6.1)

Description

In IDL, when a fixed size union branch is followed by an array of union branch, the data member of the fixed sizze branch is not defined in the generated stub. For example:

//IDL
union X switch (boolean) {
  case TRUE: short s;
};

union U switch (long) {
  case 1: long x;
  case 2: X    y[2];
};

The private data member of x is not generated in the stub code.

Patch

This patch fixes the problem (and in a separate text file):

*** omniORB_2.6.0/src/tool/omniidl2/omniORB2_be/o2be_union.cc   Wed Oct 14 15:13:29 1998
--- omniORB_2.6.0_patched/src/tool/omniidl2/omniORB2_be/o2be_union.cc   Fri Oct 16 12:26:24 1998
***************
*** 28,33 ****
--- 28,38 ----
  
  /*
    $Log: 34.html,v $
    Revision 1.4  1999/02/04 18:45:02  sll
    *** empty log message ***

# Revision 1.3  1998/11/19  15:56:48  sll
# *** empty log message ***
#
# Revision 1.2  1998/10/20  18:14:58  sll
# *** empty log message ***
#
    Revision 1.1  1998/10/16 15:05:23  sll
    Initial revision

+   Revision 1.18  1998/10/16 11:26:21  sll
+   Previously, if a fixed size union branch is followed by an array of union
+   branch, the data member of the fixed size branch is not defined in the
+   generated stub. This is now fixed.
+ 
    Revision 1.17  1998/10/14 14:13:28  sll
    Do not put fixed-size struct inside the anonymous union data member in a
    union.
***************
*** 526,532 ****
                ntype != o2be_operation::tAny &&
                ntype != o2be_operation::tTypeCode)
              {
-               has_fix_member = I_TRUE;
                if (ntype == o2be_operation::tArrayFixed) 
                  {
                    // Array of fixed size union is a special case, the data
--- 531,536 ----
***************
*** 543,554 ****
                    while (dd->node_type() == AST_Decl::NT_typedef) {
                      dd = o2be_typedef::narrow_from_decl(dd)->base_type();
                    }
!                   if (dd->node_type() == AST_Decl::NT_union) {
!                     // The element is a union. Do not define the data member
                      // in the anonymous union.
-                     has_fix_member = I_FALSE;
                    }
                  }
              }
  
           switch (ntype)
--- 547,563 ----
                    while (dd->node_type() == AST_Decl::NT_typedef) {
                      dd = o2be_typedef::narrow_from_decl(dd)->base_type();
                    }
!                   if (dd->node_type() == AST_Decl::NT_union ||
!                       dd->node_type() == AST_Decl::NT_struct) {
!                     // The element is a union or a struct. 
!                     // Do not define the data member
                      // in the anonymous union.
                    }
+                   else
+                     has_fix_member = I_TRUE;
                  }
+               else
+                 has_fix_member = I_TRUE;
              }
  

Action

 

For comments, feedback, etc, please see the 'Keeping in touch' page.
Copyright 1999 - AT&T Laboratories Cambridge