C++ ABI changes.
authorJason Merrill <jason@redhat.com>
Tue, 18 Jun 2002 16:05:31 +0000 (12:05 -0400)
committerJason Merrill <jason@gcc.gnu.org>
Tue, 18 Jun 2002 16:05:31 +0000 (12:05 -0400)
        * class.c (build_base_field): Set DECL_PACKED.
        (layout_class_type): Don't use tail padding of PODs.
        * mangle.c (write_unqualified_name): Fix template conversion op
        mangling.

From-SVN: r54747

gcc/cp/ChangeLog
gcc/cp/class.c
gcc/cp/mangle.c

index 4da4bd4..21ced62 100644 (file)
@@ -1,3 +1,11 @@
+2002-06-14  Jason Merrill  <jason@redhat.com>
+
+       C++ ABI changes.
+       * class.c (build_base_field): Set DECL_PACKED.
+       (layout_class_type): Don't use tail padding of PODs.
+       * mangle.c (write_unqualified_name): Fix template conversion op
+       mangling.
+
 2002-06-16  Richard Henderson  <rth@redhat.com>
 
        PR opt/6793
index 1be2897..09a0385 100644 (file)
@@ -3837,6 +3837,8 @@ build_base_field (rli, binfo, empty_p, offsets, t)
   DECL_SIZE_UNIT (decl) = CLASSTYPE_SIZE_UNIT (basetype);
   DECL_ALIGN (decl) = CLASSTYPE_ALIGN (basetype);
   DECL_USER_ALIGN (decl) = CLASSTYPE_USER_ALIGN (basetype);
+  /* Tell the backend not to round up to TYPE_ALIGN.  */
+  DECL_PACKED (decl) = 1;
   
   if (!integer_zerop (DECL_SIZE (decl)))
     {
@@ -4978,6 +4980,12 @@ layout_class_type (t, empty_p, vfuns_p,
       CLASSTYPE_SIZE (t) = bitsize_zero_node;
       CLASSTYPE_SIZE_UNIT (t) = size_zero_node;
     }
+  /* If this is a POD, we can't reuse its tail padding.  */
+  else if (!CLASSTYPE_NON_POD_P (t))
+    {
+      CLASSTYPE_SIZE (t) = TYPE_SIZE (t);
+      CLASSTYPE_SIZE_UNIT (t) = TYPE_SIZE_UNIT (t);
+    }
   else
     {
       CLASSTYPE_SIZE (t) = TYPE_BINFO_SIZE (t);
index 12888ac..996b027 100644 (file)
@@ -988,8 +988,17 @@ write_unqualified_name (decl)
     {
       /* Conversion operator. Handle it right here.  
            <operator> ::= cv <type>  */
+      tree type;
+      if (decl_is_template_id (decl, NULL))
+       {
+         tree fn_type = get_mostly_instantiated_function_type (decl, NULL,
+                                                               NULL);
+         type = TREE_TYPE (fn_type);
+       }
+      else
+       type = TREE_TYPE (DECL_NAME (decl));
       write_string ("cv");
-      write_type (TREE_TYPE (DECL_NAME (decl)));
+      write_type (type);
     }
   else if (DECL_OVERLOADED_OPERATOR_P (decl))
     {