]> gcc.gnu.org Git - gcc.git/commitdiff
call.c (build_call): Still evaluate the actual argument.
authorJason Merrill <jason@yorick.cygnus.com>
Tue, 7 Apr 1998 03:48:22 +0000 (03:48 +0000)
committerJason Merrill <jason@gcc.gnu.org>
Tue, 7 Apr 1998 03:48:22 +0000 (23:48 -0400)
* call.c (build_call): Still evaluate the actual argument.
* class.c (is_empty_class): Update for -fnew-abi.
* decl2.c: -fnew-abi implies -fsquangle.
* method.c (do_build_assign_ref): Don't do anything to copy
an empty class.
(do_build_copy_constructor): Likewise.
* call.c (build_over_call): Likewise.

From-SVN: r19029

gcc/cp/ChangeLog
gcc/cp/call.c
gcc/cp/class.c
gcc/cp/decl2.c
gcc/cp/method.c

index 5da11fb667f7423f406fa2ac2caacace6cebda29..02b3f696a4a7f65a617eb17e64c3aa666dc2832c 100644 (file)
@@ -1,3 +1,15 @@
+Mon Apr  6 02:25:05 1998  Jason Merrill  <jason@yorick.cygnus.com>
+
+       * call.c (build_call): Still evaluate the actual argument.
+       * class.c (is_empty_class): Update for -fnew-abi.
+
+       * decl2.c: -fnew-abi implies -fsquangle.
+
+       * method.c (do_build_assign_ref): Don't do anything to copy
+       an empty class.
+       (do_build_copy_constructor): Likewise.
+       * call.c (build_over_call): Likewise.
+
 Sat Apr  4 18:43:58 1998  Jason Merrill  <jason@yorick.cygnus.com>
 
        * tree.c (avoid_overlap): Return a value.
index 192640c7c656ba7b8c1f48512dba5666af5c49d8..d001331141026e64d2be29532821dd9eb6fdb0bc 100644 (file)
@@ -525,7 +525,8 @@ build_call (function, result_type, parms)
          TREE_TYPE (t) = TREE_TYPE (TREE_VALUE (tmp));
          RTL_EXPR_RTL (t) = const0_rtx;
          RTL_EXPR_SEQUENCE (t) = NULL_RTX;
-         TREE_VALUE (tmp) = t;
+         TREE_VALUE (tmp) = build (COMPOUND_EXPR, TREE_TYPE (t),
+                                   TREE_VALUE (tmp), t);
        }
 
   function = build_nt (CALL_EXPR, function, parms, NULL_TREE);
@@ -3351,6 +3352,12 @@ build_over_call (fn, convs, args, flags)
        {
          tree to = stabilize_reference
            (build_indirect_ref (TREE_VALUE (args), 0));
+
+         /* Don't copy the padding byte; it might not have been allocated
+            if to is a base subobject.  */
+         if (is_empty_class (DECL_CLASS_CONTEXT (fn)))
+           return to;
+
          val = build (INIT_EXPR, DECL_CONTEXT (fn), to, arg);
          TREE_SIDE_EFFECTS (val) = 1;
          return build_unary_op (ADDR_EXPR, val, 0);
@@ -3358,10 +3365,16 @@ build_over_call (fn, convs, args, flags)
     }
   else if (DECL_NAME (fn) == ansi_opname[MODIFY_EXPR]
           && copy_args_p (fn)
-          && TYPE_HAS_TRIVIAL_ASSIGN_REF (DECL_CONTEXT (fn)))
+          && TYPE_HAS_TRIVIAL_ASSIGN_REF (DECL_CLASS_CONTEXT (fn)))
     {
       tree to = stabilize_reference
        (build_indirect_ref (TREE_VALUE (converted_args), 0));
+
+      /* Don't copy the padding byte; it might not have been allocated
+        if to is a base subobject.  */
+      if (is_empty_class (DECL_CLASS_CONTEXT (fn)))
+       return to;
+
       arg = build_indirect_ref (TREE_VALUE (TREE_CHAIN (converted_args)), 0);
       val = build (MODIFY_EXPR, TREE_TYPE (to), to, arg);
       TREE_SIDE_EFFECTS (val) = 1;
index dc4cc313cf064d425f961158e78c14adbdc72eb8..c2d6b0530b29e128fa27a8c5af8eda8505dbfa4b 100644 (file)
@@ -5486,7 +5486,13 @@ is_empty_class (type)
 {
   tree t;
 
-  if (! IS_AGGR_TYPE (type) || TYPE_BINFO_BASETYPES (type))
+  if (! IS_AGGR_TYPE (type))
+    return 0;
+
+  if (flag_new_abi)
+    return CLASSTYPE_SIZE (type) == integer_zero_node;
+
+  if (TYPE_BINFO_BASETYPES (type))
     return 0;
   t = TYPE_FIELDS (type);
   while (t && TREE_CODE (t) != FIELD_DECL)
index cf9b07680ce6357329a64bcabdf3c00f4b8314a6..42cbba99ac1f5191dce35cc6944699babbb4a60b 100644 (file)
@@ -401,7 +401,9 @@ int flag_new_for_scope = 1;
 
 int flag_weak = 1;
 
-int flag_new_abi = 1;
+/* Nonzero to enable experimental ABI changes.  */
+
+int flag_new_abi;
 
 /* Maximum template instantiation depth. Must be at least 17 for ANSI
    compliance. */
@@ -469,8 +471,7 @@ static struct { char *string; int *variable; int on_value;} lang_f_options[] =
   {"check-new", &flag_check_new, 1},
   {"repo", &flag_use_repository, 1},
   {"for-scope", &flag_new_for_scope, 2},
-  {"weak", &flag_weak, 1},
-  {"new-abi", &flag_new_abi, 1}
+  {"weak", &flag_weak, 1}
 };
 
 /* Decode the string P as a language-specific option.
@@ -562,6 +563,16 @@ lang_decode_option (p)
          error ("-fno-ansi-overloading is no longer supported");
          found = 1;
        }
+      else if (!strcmp (p, "new-abi"))
+       {
+         flag_new_abi = 1;
+         flag_do_squangling = 1;
+       }
+      else if (!strcmp (p, "no-new-abi"))
+       {
+         flag_new_abi = 0;
+         flag_do_squangling = 0;
+       }
       else if (!strncmp (p, "template-depth-", 15))
        {
          char *endp = p + 15;
index 287ce2cbadd3e857e04b9f36ed9e6585026df687..e8ed718d165f6f2311d4faa3b9a11a9713dbf4f2 100644 (file)
@@ -2047,7 +2047,11 @@ do_build_copy_constructor (fndecl)
     parm = TREE_CHAIN (parm);
   parm = convert_from_reference (parm);
 
-  if (TYPE_HAS_TRIVIAL_INIT_REF (current_class_type))
+  if (TYPE_HAS_TRIVIAL_INIT_REF (current_class_type)
+      && is_empty_class (current_class_type))
+    /* Don't copy the padding byte; it might not have been allocated
+       if *this is a base subobject.  */;
+  else if (TYPE_HAS_TRIVIAL_INIT_REF (current_class_type))
     {
       t = build (INIT_EXPR, void_type_node, current_class_ref, parm);
       TREE_SIDE_EFFECTS (t) = 1;
@@ -2159,7 +2163,11 @@ do_build_assign_ref (fndecl)
 
   parm = convert_from_reference (parm);
 
-  if (TYPE_HAS_TRIVIAL_ASSIGN_REF (current_class_type))
+  if (TYPE_HAS_TRIVIAL_ASSIGN_REF (current_class_type)
+      && is_empty_class (current_class_type))
+    /* Don't copy the padding byte; it might not have been allocated
+       if *this is a base subobject.  */;
+  else if (TYPE_HAS_TRIVIAL_ASSIGN_REF (current_class_type))
     {
       tree t = build (MODIFY_EXPR, void_type_node, current_class_ref, parm);
       TREE_SIDE_EFFECTS (t) = 1;
This page took 0.096666 seconds and 5 git commands to generate.