92th Cygnus<->FSF quick merge
authorMike Stump <mrs@gcc.gnu.org>
Fri, 1 Aug 1997 17:21:46 +0000 (17:21 +0000)
committerMike Stump <mrs@gcc.gnu.org>
Fri, 1 Aug 1997 17:21:46 +0000 (17:21 +0000)
From-SVN: r14576

gcc/cp/ChangeLog
gcc/cp/Make-lang.in
gcc/cp/Makefile.in
gcc/cp/method.c
gcc/cp/parse.y
gcc/cp/tree.c

index 303c72a1c691fd7e899354eb92c66c0ce29848e7..6d4c3447b50b4966ec16595546e7f4a51f5c10ad 100644 (file)
@@ -1,3 +1,23 @@
+Fri Aug  1 03:18:15 1997  Jason Merrill  <jason@yorick.cygnus.com>
+
+       * parse.y: Break out eat_saved_input, handle errors.
+
+Thu Jul 31 17:14:04 1997  Jason Merrill  <jason@yorick.cygnus.com>
+
+       * tree.c (build_cplus_new): Don't set TREE_ADDRESSABLE.
+
+Fri Jul  4 01:45:16 1997  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>
+
+       * Make-lang.in (cplib2.txt, cplib2.ready): Instead of checking for
+       existence of cc1plus check whether $(LANGUAGES) contains C++.
+
+Wed Jul 30 13:04:21 1997  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>
+
+       * method.c (do_build_copy_constructor): When copying an anonymous
+       union member loop around to handle nested anonymous unions.  Use
+       the offset of the member relative to the outer structure, not the
+       union.
+
 Tue Jul 29 21:17:29 1997  Jason Merrill  <jason@yorick.cygnus.com>
 
        * call.c (resolve_args): New fn.
index 47cf4de18ccdfa6f25c093d4bdfc472767ec6644..6748974820d8b7d2bef58937c1ad63a5c879fbb7 100644 (file)
@@ -157,21 +157,23 @@ new2.o: cc1plus $(srcdir)/cp/new2.cc
 
 # We want to update cplib2.txt if any of the source files change...
 cplib2.txt: $(CXX_LIB2SRCS) $(CXX_EXTRA_HEADERS) cplib2.ready
-       if [ -f cc1plus ]; then \
-         echo $(CXX_LIB2FUNCS) > cplib2.new; \
-       else \
-         echo "" > cplib2.new; \
-       fi
+       case " $(LANGUAGES) " in \
+       *" "[cC]"++ "*) \
+         echo $(CXX_LIB2FUNCS) > cplib2.new;; \
+       *) \
+         echo "" > cplib2.new;; \
+       esac
        mv -f cplib2.new cplib2.txt 
 
 # Or if it would be different.
 cplib2.ready: $(GCC_PASSES) $(LANGUAGES) $(LIBGCC2_DEPS) stmp-int-hdrs
        @if [ -r cplib2.txt ]; then \
-         if [ -f cc1plus ]; then \
-           echo $(CXX_LIB2FUNCS) > cplib2.new; \
-         else \
-           echo "" > cplib2.new; \
-         fi; \
+         case " $(LANGUAGES) " in \
+         *" "[cC]"++ "*) \
+           echo $(CXX_LIB2FUNCS) > cplib2.new;; \
+         *) \
+           echo "" > cplib2.new;; \
+         esac; \
          if cmp -s cplib2.new cplib2.txt; then true; else \
            touch cplib2.ready; \
          fi; \
index b7f3826bdaba206c8e771d0c7598e118a9f6d516..cf40fb4d96d23ce70e2b6ff31b19b365df74386d 100644 (file)
@@ -195,7 +195,7 @@ parse.o : $(PARSE_C) $(CONFIG_H) $(CXX_TREE_H) $(srcdir)/../flags.h lex.h
        $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $(BIG_SWITCHFLAG) \
   `echo $(PARSE_C) | sed 's,^\./,,'`
 
-CONFLICTS = expect 18 shift/reduce conflicts and 39 reduce/reduce conflicts.
+CONFLICTS = expect 20 shift/reduce conflicts and 39 reduce/reduce conflicts.
 $(PARSE_H) : $(PARSE_C)
 $(PARSE_C) : $(srcdir)/parse.y
        @echo $(CONFLICTS)
index 7a3a7228867dcf3148be2f59f2e9b349c1a262ca..fb2abeca255d4150494908675846789283b48022 100644 (file)
@@ -1924,6 +1924,8 @@ do_build_copy_constructor (fndecl)
 
          if (TREE_CODE (field) != FIELD_DECL)
            continue;
+
+         init = parm;
          if (DECL_NAME (field))
            {
              if (VFIELD_NAME_P (DECL_NAME (field)))
@@ -1939,11 +1941,21 @@ do_build_copy_constructor (fndecl)
                   && TREE_CODE (t) == UNION_TYPE
                   && ANON_AGGRNAME_P (TYPE_IDENTIFIER (t))
                   && TYPE_FIELDS (t) != NULL_TREE)
-           field = largest_union_member (t);
+           {
+             do
+               {
+                 init = build (COMPONENT_REF, t, init, field);
+                 field = largest_union_member (t);
+               }
+             while ((t = TREE_TYPE (field)) != NULL_TREE
+                    && TREE_CODE (t) == UNION_TYPE
+                    && ANON_AGGRNAME_P (TYPE_IDENTIFIER (t))
+                    && TYPE_FIELDS (t) != NULL_TREE);
+           }
          else
            continue;
 
-         init = build (COMPONENT_REF, TREE_TYPE (field), parm, field);
+         init = build (COMPONENT_REF, TREE_TYPE (field), init, field);
          init = build_tree_list (NULL_TREE, init);
 
          current_member_init_list
@@ -2017,6 +2029,9 @@ do_build_assign_ref (fndecl)
              continue;
            }
 
+         comp = current_class_ref;
+         init = parm;
+
          if (DECL_NAME (field))
            {
              if (VFIELD_NAME_P (DECL_NAME (field)))
@@ -2032,12 +2047,23 @@ do_build_assign_ref (fndecl)
                   && TREE_CODE (t) == UNION_TYPE
                   && ANON_AGGRNAME_P (TYPE_IDENTIFIER (t))
                   && TYPE_FIELDS (t) != NULL_TREE)
-           field = largest_union_member (t);
+           {
+             do
+               {
+                 comp = build (COMPONENT_REF, t, comp, field);
+                 init = build (COMPONENT_REF, t, init, field);
+                 field = largest_union_member (t);
+               }
+             while ((t = TREE_TYPE (field)) != NULL_TREE
+                    && TREE_CODE (t) == UNION_TYPE
+                    && ANON_AGGRNAME_P (TYPE_IDENTIFIER (t))
+                    && TYPE_FIELDS (t) != NULL_TREE);
+           }
          else
            continue;
 
-         comp = build (COMPONENT_REF, TREE_TYPE (field), current_class_ref, field);
-         init = build (COMPONENT_REF, TREE_TYPE (field), parm, field);
+         comp = build (COMPONENT_REF, TREE_TYPE (field), comp, field);
+         init = build (COMPONENT_REF, TREE_TYPE (field), init, field);
 
          expand_expr_stmt (build_modify_expr (comp, NOP_EXPR, init));
        }
index fe519b83e73ef39c5c6339ce2d6ca560dfb24b2a..9c990688b46223e737fcf47fb02e61dd368d7502 100644 (file)
@@ -363,7 +363,7 @@ lang_extdef:
        ;
 
 extdef:
-         fndef
+         fndef eat_saved_input
                { if (pending_inlines) do_pending_inlines (); }
        | datadef
                { if (pending_inlines) do_pending_inlines (); }
@@ -374,7 +374,7 @@ extdef:
                  assemble_asm ($3); }
        | extern_lang_string '{' extdefs_opt '}'
                { pop_lang_context (); }
-       | extern_lang_string .hush_warning fndef .warning_ok
+       | extern_lang_string .hush_warning fndef .warning_ok eat_saved_input
                { if (pending_inlines) do_pending_inlines ();
                  pop_lang_context (); }
        | extern_lang_string .hush_warning datadef .warning_ok
@@ -539,8 +539,9 @@ fndef:
          fn.def1 maybe_return_init ctor_initializer_opt compstmt_or_error
                { finish_function (lineno, (int)$3, 0); }
        | fn.def1 maybe_return_init function_try_block
-               { if ($<ttype>$) process_next_inline ($<ttype>$); }
-         eat_saved_input
+               { }
+       | fn.def1 maybe_return_init error
+               { }
        ;
 
 constructor_declarator:
@@ -2109,19 +2110,23 @@ fn.defpen:
                                  NULL_TREE, 1);
                  reinit_parse_for_function (); }
 
-pending_inlines:
-         /* empty */
-       | pending_inlines fn.defpen maybe_return_init ctor_initializer_opt
-         compstmt_or_error
+pending_inline:
+         fn.defpen maybe_return_init ctor_initializer_opt compstmt_or_error
                {
                  int nested = (hack_decl_function_context
                                (current_function_decl) != NULL_TREE);
-                 finish_function (lineno, (int)$4, nested);
-                 process_next_inline ($2);
+                 finish_function (lineno, (int)$3, nested);
+                 process_next_inline ($1);
                }
-       | pending_inlines fn.defpen maybe_return_init function_try_block
-               { process_next_inline ($2); }
-         eat_saved_input
+       | fn.defpen maybe_return_init function_try_block
+               { process_next_inline ($1); }
+       | fn.defpen maybe_return_init error
+               { process_next_inline ($1); }
+       ;
+
+pending_inlines:
+       /* empty */
+       | pending_inlines pending_inline eat_saved_input
        ;
 
 /* A regurgitated default argument.  The value of DEFARG_MARKER will be
@@ -2129,6 +2134,8 @@ pending_inlines:
 defarg_again:
        DEFARG_MARKER expr_no_commas END_OF_SAVED_INPUT
                { replace_defarg ($1, $2); }
+       | DEFARG_MARKER error END_OF_SAVED_INPUT
+               { replace_defarg ($1, error_mark_node); }
 
 pending_defargs:
          /* empty */ %prec EMPTY
index d212bb223d4c076a0be7248d0ed068f61d5125fb..2843abdd2509663271cd43aef98dc0ed24cfdff2 100644 (file)
@@ -227,10 +227,8 @@ build_cplus_new (type, init)
   rval = build (NEW_EXPR, type,
                TREE_OPERAND (init, 0), TREE_OPERAND (init, 1), slot);
   TREE_SIDE_EFFECTS (rval) = 1;
-  TREE_ADDRESSABLE (rval) = 1;
   rval = build (TARGET_EXPR, type, slot, rval, NULL_TREE, NULL_TREE);
   TREE_SIDE_EFFECTS (rval) = 1;
-  TREE_ADDRESSABLE (rval) = 1;
 
   return rval;
 }