dotgnu-pnet-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Dotgnu-pnet-commits] CVS: pnet/cscc/c c_ainit.tc,1.6,1.7 c_grammar.y,1


From: Rhys Weatherley <address@hidden>
Subject: [Dotgnu-pnet-commits] CVS: pnet/cscc/c c_ainit.tc,1.6,1.7 c_grammar.y,1.59,1.60
Date: Wed, 02 Jul 2003 22:22:42 -0400

Update of /cvsroot/dotgnu-pnet/pnet/cscc/c
In directory subversions:/tmp/cvs-serv6726/cscc/c

Modified Files:
        c_ainit.tc c_grammar.y 
Log Message:


Treat "union" initializers the same as "struct" initializers.


Index: c_ainit.tc
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/cscc/c/c_ainit.tc,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -r1.6 -r1.7
*** c_ainit.tc  28 Jun 2003 05:28:47 -0000      1.6
--- c_ainit.tc  3 Jul 2003 02:22:40 -0000       1.7
***************
*** 116,128 ****
  static int SkipInitializer(ILNode_ListIter *iter, ILType *type)
  {
!       if(CTypeIsStruct(type))
        {
                return SkipStructInitializer(iter, type);
        }
-       else if(CTypeIsUnion(type))
-       {
-               /* Cannot use "union" types within array initializers */
-               return 0;
-       }
        else if(CTypeIsArray(type))
        {
--- 116,123 ----
  static int SkipInitializer(ILNode_ListIter *iter, ILType *type)
  {
!       if(CTypeIsStruct(type) || CTypeIsUnion(type))
        {
                return SkipStructInitializer(iter, type);
        }
        else if(CTypeIsArray(type))
        {
***************
*** 240,246 ****
                }
        }
!       else if(CTypeIsStruct(type))
        {
!               /* Assign to the fields of a structure */
                classInfo = ILType_ToValueType(ILTypeStripPrefixes(type));
                field = 0;
--- 235,241 ----
                }
        }
!       else if(CTypeIsStruct(type) || CTypeIsUnion(type))
        {
!               /* Assign to the fields of a structure or union */
                classInfo = ILType_ToValueType(ILTypeStripPrefixes(type));
                field = 0;
***************
*** 260,268 ****
                }
        }
-       else if(CTypeIsUnion(type))
-       {
-               CCErrorOnLine(yygetfilename(init), yygetlinenum(init),
-                                         _("union initializers are not 
supported"));
-       }
        else
        {
--- 255,258 ----
***************
*** 468,473 ****
        node->type = CSemGetType(value1);
  
!       /* We must have a structure type at this point */
!       if(!CTypeIsStruct(node->type))
        {
                CCErrorOnLine(yygetfilename(node), yygetlinenum(node),
--- 458,463 ----
        node->type = CSemGetType(value1);
  
!       /* We must have a structure or union type at this point */
!       if(!CTypeIsStruct(node->type) && !CTypeIsUnion(node->type))
        {
                CCErrorOnLine(yygetfilename(node), yygetlinenum(node),
***************
*** 647,651 ****
                }
        }
!       else if(CTypeIsStruct(type))
        {
                /* Write the elements of a structure */
--- 637,641 ----
                }
        }
!       else if(CTypeIsStruct(type) || CTypeIsUnion(type))
        {
                /* Write the elements of a structure */

Index: c_grammar.y
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/cscc/c/c_grammar.y,v
retrieving revision 1.59
retrieving revision 1.60
diff -C2 -r1.59 -r1.60
*** c_grammar.y 3 Jul 2003 00:31:56 -0000       1.59
--- c_grammar.y 3 Jul 2003 02:22:40 -0000       1.60
***************
*** 305,309 ****
                        stmt = ILNode_CAssignArray_create(var, init);
                }
!               else if(CTypeIsStruct(type))
                {
                        stmt = ILNode_CAssignStruct_create(var, init);
--- 305,309 ----
                        stmt = ILNode_CAssignArray_create(var, init);
                }
!               else if(CTypeIsStruct(type) || CTypeIsUnion(type))
                {
                        stmt = ILNode_CAssignStruct_create(var, init);





reply via email to

[Prev in Thread] Current Thread [Next in Thread]