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

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

[Dotgnu-pnet-commits] CVS: pnet/codegen cg_decls.tc,1.45,1.46


From: Rhys Weatherley <address@hidden>
Subject: [Dotgnu-pnet-commits] CVS: pnet/codegen cg_decls.tc,1.45,1.46
Date: Sat, 11 Jan 2003 16:16:38 -0500

Update of /cvsroot/dotgnu-pnet/pnet/codegen
In directory subversions:/tmp/cvs-serv3858/codegen

Modified Files:
        cg_decls.tc 
Log Message:


Structs with no instance fields should be 1-sized instead of 0-sized,
even if there are statics.


Index: cg_decls.tc
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/codegen/cg_decls.tc,v
retrieving revision 1.45
retrieving revision 1.46
diff -C2 -r1.45 -r1.46
*** cg_decls.tc 28 Dec 2002 17:17:02 -0000      1.45
--- cg_decls.tc 11 Jan 2003 21:16:36 -0000      1.46
***************
*** 68,71 ****
--- 68,89 ----
  }
  
+ /*
+  * Determine if a class has no instance fields.
+  */
+ static int ClassIsEmpty(ILClass *classInfo)
+ {
+       ILField *field = 0;
+       while((field = (ILField *)ILClassNextMemberByKind
+                                       (classInfo, (ILMember *)field,
+                                        IL_META_MEMBERKIND_FIELD)) != 0)
+       {
+               if(!ILField_IsStatic(field))
+               {
+                       return 0;
+               }
+       }
+       return 1;
+ }
+ 
  %}
  
***************
*** 169,175 ****
                        }
                }
!               else if(!ILClassNextMemberByKind
!                                       (classInfo, 0, 
IL_META_MEMBERKIND_FIELD) &&
!                           ILClassIsValueType(classInfo))
                {
                        /* Make sure that "struct"'s are never zero-sized */
--- 187,191 ----
                        }
                }
!               else if(ClassIsEmpty(classInfo) && 
ILClassIsValueType(classInfo))
                {
                        /* Make sure that "struct"'s are never zero-sized */





reply via email to

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