OSDN Git Service

69th Cygnus<->FSF merge
authormrs <mrs@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 10 May 1995 02:58:06 +0000 (02:58 +0000)
committermrs <mrs@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 10 May 1995 02:58:06 +0000 (02:58 +0000)
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@9606 138bc75d-0d04-0410-961f-82ee72b054a4

12 files changed:
gcc/cp/ChangeLog
gcc/cp/Make-lang.in
gcc/cp/call.c
gcc/cp/cp-tree.h
gcc/cp/cvt.c
gcc/cp/decl.c
gcc/cp/decl2.c
gcc/cp/init.c
gcc/cp/parse.y
gcc/cp/pt.c
gcc/cp/tree.c
gcc/cp/typeck.c

index 8347b18..93af15d 100644 (file)
@@ -1,3 +1,69 @@
+Tue May  9 19:10:33 1995  Mike Stump  <mrs@cygnus.com>
+
+       * decl2.c: Add flag_new_for_scope for new -ffor-scope flag.
+       * parse.y (FOR): Conditionalize the pushing and poping of scope for
+       the for-init-statement upon the new flag_new_for_scope.
+       * parse.y (try_block): Simplify and use compstmt.
+
+Mon May  8 12:41:52 1995  Jason Merrill  <jason@phydeaux.cygnus.com>
+
+       * decl.c (define_function): Mark function decl artificial.
+
+Sun May  7 00:51:28 1995  Jason Merrill  <jason@phydeaux.cygnus.com>
+
+       * parse.y (simple_stmt, FOR): Put back push/pop for condition scope.
+
+       * decl2.c (grokclassfn): DECLs don't have cv-qualified types.
+       * tree.c (build_cplus_method_type): Ditto.
+
+       * cp-tree.h (SET_DECL_ARTIFICIAL): Just set DECL_ARTIFICIAL to 1.
+
+       * typeck.c (build_function_call_real): If convert_arguments failed,
+       just bail.
+       (convert_arguments): If one of the arguments is error_mark_node,
+       just bail.
+
+Sat May  6 02:39:41 1995  Jason Merrill  <jason@phydeaux.cygnus.com>
+
+       * decl.c (duplicate_decls): Don't check DECL_NOT_REALLY_EXTERN for
+       decls that don't include it.
+
+Fri May  5 14:23:30 1995  Jason Merrill  <jason@phydeaux.cygnus.com>
+
+       * decl.c (duplicate_decls): Decls that have DECL_INTERFACE_KNOWN or
+       DECL_NOT_REALLY_EXTERN set aren't extern decls.
+
+       * typeck.c (build_indirect_ref): Don't call default_conversion for a
+       parameter of reference_type.
+       * cvt.c (convert_from_reference): Just use build_indirect_ref.
+
+       * pt.c (do_type_instantiation): Only instantiate member functions
+       that actually come from templates.
+
+Fri May  5 09:46:05 1995  Mike Stump  <mrs@cygnus.com>
+
+       * parse.y: Generalized cleanup of poplevels, and compound statements
+       and compound statements in try blocks.  Rewritten `for' rule so that
+       the scope of variables declared in the for clause is shortened to
+       span just to the end of the statement, instead of the whole
+       containing block.
+
+Fri May  5 00:37:14 1995  Jason Merrill  <jason@phydeaux.cygnus.com>
+
+       * call.c (convert_harshness): Handle pointers to members better.
+
+Thu May  4 16:00:26 1995  Jason Merrill  <jason@phydeaux.cygnus.com>
+
+       * decl2.c (delete_sanity): Do access control here.
+       * init.c (build_delete): Instead of here.
+
+       * Make-lang.in: Build c++filt.
+
+Wed May  3 02:59:53 1995  Jason Merrill  <jason@phydeaux.cygnus.com>
+
+       * decl2.c (cplus_decl_attributes): If we just modified a TYPE_DECL,
+       update our IDENTIFIER_TYPE_VALUE.
+
 Fri Apr 28 07:58:41 1995  Jason Merrill  <jason@phydeaux.cygnus.com>
 
        * lex.c (cons_up_default_function): Fix linkage of #pragma
index 455fc42..79da7ec 100644 (file)
@@ -49,6 +49,8 @@ GXX_INSTALL_NAME = `t='$(program_transform_name)'; echo g++ | sed $$t`
 CXX_CROSS_NAME = `t='$(program_transform_cross_name)'; echo c++ | sed $$t`
 GXX_CROSS_NAME = `t='$(program_transform_cross_name)'; echo g++ | sed $$t`
 
+# The name to use for the demangler program.
+DEMANGLER_PROG = c++filt
 \f
 # Define the names for selecting c++ in LANGUAGES.
 # Note that it would be nice to move the dependency on g++
@@ -68,6 +70,17 @@ g++-cross: $(srcdir)/cp/g++.c version.o $(LIBDEPS)
        $(CC) $(ALL_CFLAGS) $(INCLUDES) $(LDFLAGS) -o g++-cross \
           -DGCC_NAME=\"$(GCC_CROSS_NAME)\" $(srcdir)/cp/g++.c version.o $(LIBS)
 
+cxxmain.o: cplus-dem.c demangle.h
+       rm -f cxxmain.c
+       ln -s $(srcdir)/cplus-dem.c cxxmain.c
+       $(CC) -c -DMAIN $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
+         -DVERSION='"$(version)"' cxxmain.c
+       rm -f cxxmain.c
+
+$(DEMANGLER_PROG): cxxmain.o underscore.o getopt.o getopt1.o
+       $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $(DEMANGLER_PROG) \
+         cxxmain.o underscore.o getopt.o getopt1.o
+
 CXX_SRCS = $(srcdir)/cp/call.c $(srcdir)/cp/decl2.c \
  $(srcdir)/cp/except.c $(srcdir)/cp/input.c $(srcdir)/cp/pt.c \
  $(srcdir)/cp/spew.c $(srcdir)/cp/xref.c $(srcdir)/cp/class.c \
@@ -83,10 +96,10 @@ cc1plus: $(P) $(CXX_SRCS) $(LIBDEPS) stamp-objlist c-common.o c-pragma.o
 \f
 # Build hooks:
 
-c++.all.build: g++
-c++.all.cross: g++-cross
+c++.all.build: g++ $(DEMANGLER_PROG)
+c++.all.cross: g++-cross $(DEMANGLER_PROG)
 c++.start.encap: g++
-c++.rest.encap:
+c++.rest.encap: $(DEMANGLER_PROG)
 
 c++.info:
 c++.dvi:
index 6779c84..9695968 100644 (file)
@@ -172,10 +172,33 @@ convert_harshness (type, parmtype, parm)
       if (coder != TREE_CODE (type))
        return EVIL_RETURN (h);
 
+      if (type != parmtype && coder == METHOD_TYPE)
+       {
+         tree ttl = TYPE_METHOD_BASETYPE (type);
+         tree ttr = TYPE_METHOD_BASETYPE (parmtype);
+
+         int b_or_d = get_base_distance (ttr, ttl, 0, 0);
+         if (b_or_d < 0)
+           {
+             b_or_d = get_base_distance (ttl, ttr, 0, 0);
+             if (b_or_d < 0)
+               return EVIL_RETURN (h);
+             h.distance = -b_or_d;
+           }
+         else
+           h.distance = b_or_d;
+         h.code = STD_CODE;
+
+         type = build_function_type
+           (TREE_TYPE (type), TREE_CHAIN (TYPE_ARG_TYPES (type)));
+         parmtype = build_function_type
+           (TREE_TYPE (parmtype), TREE_CHAIN (TYPE_ARG_TYPES (parmtype)));
+       }
+
       /* We allow the default conversion between function type
         and pointer-to-function type for free.  */
       if (type == parmtype)
-       return ZERO_RETURN (h);
+       return h;
 
       if (pedantic)
        return EVIL_RETURN (h);
@@ -272,28 +295,34 @@ convert_harshness (type, parmtype, parm)
     }
   else if (codel == POINTER_TYPE && coder == OFFSET_TYPE)
     {
+      tree ttl, ttr;
+
       /* Get to the OFFSET_TYPE that this might be.  */
       type = TREE_TYPE (type);
 
       if (coder != TREE_CODE (type))
        return EVIL_RETURN (h);
 
-      if (TYPE_OFFSET_BASETYPE (type) == TYPE_OFFSET_BASETYPE (parmtype))
+      ttl = TYPE_OFFSET_BASETYPE (type);
+      ttr = TYPE_OFFSET_BASETYPE (parmtype);
+
+      if (ttl == ttr)
        h.code = 0;
-      else if (UNIQUELY_DERIVED_FROM_P (TYPE_OFFSET_BASETYPE (type),
-                              TYPE_OFFSET_BASETYPE (parmtype)))
-       {
-         h.code = STD_CODE;
-         h.distance = 1;
-       }
-      else if (UNIQUELY_DERIVED_FROM_P (TYPE_OFFSET_BASETYPE (parmtype),
-                              TYPE_OFFSET_BASETYPE (type)))
+      else
        {
+         int b_or_d = get_base_distance (ttr, ttl, 0, 0);
+         if (b_or_d < 0)
+           {
+             b_or_d = get_base_distance (ttl, ttr, 0, 0);
+             if (b_or_d < 0)
+               return EVIL_RETURN (h);
+             h.distance = -b_or_d;
+           }
+         else
+           h.distance = b_or_d;
          h.code = STD_CODE;
-         h.distance = -1;
        }
-      else
-       return EVIL_RETURN (h);
+
       /* Now test the OFFSET_TYPE's target compatibility.  */
       type = TREE_TYPE (type);
       parmtype = TREE_TYPE (parmtype);
index 22dd9c4..828e3f4 100644 (file)
@@ -1141,8 +1141,7 @@ struct lang_decl
 #endif
 
 /* This _DECL represents a compiler-generated entity.  */
-#define DECL_ARTIFICIAL(NODE) (DECL_SOURCE_LINE (NODE) == 0)
-#define SET_DECL_ARTIFICIAL(NODE) (DECL_SOURCE_LINE (NODE) = 0)
+#define SET_DECL_ARTIFICIAL(NODE) (DECL_ARTIFICIAL (NODE) = 1)
 
 /* Record whether a typedef for type `int' was actually `signed int'.  */
 #define C_TYPEDEF_EXPLICITLY_SIGNED(exp) DECL_LANG_FLAG_1 ((exp))
index 8cee211..3bde08d 100644 (file)
@@ -855,30 +855,8 @@ convert_from_reference (val)
 
   if (TREE_CODE (type) == OFFSET_TYPE)
     type = TREE_TYPE (type);
- if (TREE_CODE (type) == REFERENCE_TYPE)
-    {
-      tree target_type = TREE_TYPE (type);
-      tree nval;
-
-      /* This can happen if we cast to a reference type.  */
-      if (TREE_CODE (val) == ADDR_EXPR)
-       {
-         nval = build1 (NOP_EXPR, build_pointer_type (target_type), val);
-         nval = build_indirect_ref (nval, NULL_PTR);
-         /* The below was missing, are other important flags missing too? */
-         TREE_SIDE_EFFECTS (nval) = TREE_SIDE_EFFECTS (val);
-         return nval;
-       }
-
-      nval = build1 (INDIRECT_REF, target_type, val);
-
-      TREE_THIS_VOLATILE (nval) = TYPE_VOLATILE (target_type);
-      TREE_SIDE_EFFECTS (nval) = TYPE_VOLATILE (target_type);
-      TREE_READONLY (nval) = TYPE_READONLY (target_type);
-      /* The below was missing, are other important flags missing too? */
-      TREE_SIDE_EFFECTS (nval) |= TREE_SIDE_EFFECTS (val);
-      return nval;
-    }
+  if (TREE_CODE (type) == REFERENCE_TYPE)
+    return build_indirect_ref (val, NULL_PTR);
   return val;
 }
 \f
index dcabbd2..2471c15 100644 (file)
@@ -2507,7 +2507,8 @@ duplicate_decls (newdecl, olddecl)
     }
 
   /* Merge the storage class information.  */
-  if (DECL_EXTERNAL (newdecl))
+  if (DECL_EXTERNAL (newdecl) && ! DECL_INTERFACE_KNOWN (newdecl)
+      && ! (DECL_LANG_SPECIFIC (newdecl) && DECL_NOT_REALLY_EXTERN (newdecl)))
     {
       TREE_STATIC (newdecl) = TREE_STATIC (olddecl);
       DECL_EXTERNAL (newdecl) = DECL_EXTERNAL (olddecl);
@@ -5261,6 +5262,7 @@ define_function (name, type, function_code, pfn, library_name)
   DECL_EXTERNAL (decl) = 1;
   TREE_PUBLIC (decl) = 1;
   DECL_INTERFACE_KNOWN (decl) = 1;
+  DECL_ARTIFICIAL (decl) = 1;
 
   /* Since `pushdecl' relies on DECL_ASSEMBLER_NAME instead of DECL_NAME,
      we cannot change DECL_ASSEMBLER_NAME until we have installed this
index 6e4ad20..5909f87 100644 (file)
@@ -359,6 +359,11 @@ int flag_operator_names;
 
 int flag_check_new;
 
+/* Nonzero if we want the new ANSI rules for pushing a new scope for `for'
+   initialization variables.  Default to on.  */
+
+int flag_new_for_scope = 1;
+
 /* Table of language-dependent -f options.
    STRING is the option name.  VARIABLE is the address of the variable.
    ON_VALUE is the value to store in VARIABLE
@@ -405,7 +410,8 @@ static struct { char *string; int *variable; int on_value;} lang_f_options[] =
   {"gnu-keywords", &flag_no_gnu_keywords, 0},
   {"operator-names", &flag_operator_names, 1},
   {"check-new", &flag_check_new, 1},
-  {"repo", &flag_use_repository, 1}
+  {"repo", &flag_use_repository, 1},
+  {"for-scope", &flag_new_for_scope, 1}
 };
 
 /* Decode the string P as a language-specific option.
@@ -418,7 +424,7 @@ lang_decode_option (p)
 {
   if (!strcmp (p, "-ftraditional") || !strcmp (p, "-traditional"))
     flag_traditional = 1, dollars_in_ident = 1, flag_writable_strings = 1,
-    flag_this_is_variable = 1;
+    flag_this_is_variable = 1, flag_new_for_scope = 0;
   /* The +e options are for cfront compatibility.  They come in as
      `-+eN', to kludge around gcc.c's argument handling.  */
   else if (p[0] == '-' && p[1] == '+' && p[2] == 'e')
@@ -872,10 +878,11 @@ grokclassfn (ctype, cname, function, flags, quals)
       /* Right now we just make this a pointer.  But later
         we may wish to make it special.  */
       tree type = TREE_VALUE (arg_types);
+      int constp = 1;
 
       if ((flag_this_is_variable > 0)
          && (flags == DTOR_FLAG || DECL_CONSTRUCTOR_P (function)))
-       type = TYPE_MAIN_VARIANT (type);
+       constp = 0;
 
       if (DECL_CONSTRUCTOR_P (function))
        {
@@ -902,7 +909,7 @@ grokclassfn (ctype, cname, function, flags, quals)
       /* We can make this a register, so long as we don't
         accidentally complain if someone tries to take its address.  */
       DECL_REGISTER (parm) = 1;
-      if (TYPE_READONLY (type))
+      if (constp)
        TREE_READONLY (parm) = 1;
       TREE_CHAIN (parm) = last_function_parms;
       last_function_parms = parm;
@@ -1178,9 +1185,22 @@ delete_sanity (exp, size, doing_vec, use_global_delete)
     return build_vec_delete (t, maxindex, elt_size, integer_one_node,
                             integer_two_node, use_global_delete);
   else
-    return build_delete (type, t, integer_three_node,
-                        LOOKUP_NORMAL|LOOKUP_HAS_IN_CHARGE,
-                        use_global_delete);
+    {
+      if (IS_AGGR_TYPE (TREE_TYPE (type))
+         && TYPE_GETS_REG_DELETE (TREE_TYPE (type)))
+       {
+         /* Only do access checking here; we'll be calling op delete
+            from the destructor.  */
+         tree tmp = build_opfncall (DELETE_EXPR, LOOKUP_NORMAL, t,
+                                    size_zero_node, NULL_TREE);
+         if (tmp == error_mark_node)
+           return error_mark_node;
+       }
+
+      return build_delete (type, t, integer_three_node,
+                          LOOKUP_NORMAL|LOOKUP_HAS_IN_CHARGE,
+                          use_global_delete);
+    }
 }
 
 /* Sanity check: report error if this function FUNCTION is not
@@ -1956,6 +1976,9 @@ cplus_decl_attributes (decl, attributes, prefix_attributes)
     decl = DECL_TEMPLATE_RESULT (decl);
 
   decl_attributes (decl, attributes, prefix_attributes);
+
+  if (TREE_CODE (decl) == TYPE_DECL)
+    SET_IDENTIFIER_TYPE_VALUE (DECL_NAME (decl), TREE_TYPE (decl));
 }
 \f
 /* CONSTRUCTOR_NAME:
index 61ed7e7..39db644 100644 (file)
@@ -3626,18 +3626,7 @@ build_delete (type, addr, auto_delete, flags, use_global_delete)
                                            auto_delete, integer_two_node));
        }
       else
-       {
-         if (TYPE_GETS_REG_DELETE (type))
-           {
-             /* Only do access checking here; we'll be calling op delete
-                 from the destructor.  */
-             tree t = build_opfncall (DELETE_EXPR, LOOKUP_NORMAL, addr,
-                                      size_zero_node, NULL_TREE);
-             if (t == error_mark_node)
-               return error_mark_node;
-           }
-         passed_auto_delete = auto_delete;
-       }
+       passed_auto_delete = auto_delete;
 
       if (flags & LOOKUP_PROTECT)
        {
index d700592..b66c32a 100644 (file)
@@ -233,12 +233,12 @@ empty_parms ()
 %type <ttype> base_class maybe_base_class_list base_class.1
 %type <ttype> exception_specification_opt ansi_raise_identifier ansi_raise_identifiers
 %type <ttype> component_declarator0
-%type <ttype> forhead.1 operator_name
+%type <ttype> operator_name
 %type <ttype> object aggr
 %type <itype> new delete
 /* %type <ttype> primary_no_id */
 %type <ttype> nonmomentary_expr maybe_parmlist
-%type <itype> forhead.2 initdcl0 notype_initdcl0 member_init_list
+%type <itype> initdcl0 notype_initdcl0 member_init_list
 %type <ttype> template_header template_parm_list template_parm
 %type <ttype> template_type_parm
 %type <ttype> template_type template_arg_list template_arg
@@ -252,7 +252,7 @@ empty_parms ()
 %type <ttype> complex_type_name nested_name_specifier_1
 %type <itype> nomods_initdecls nomods_initdcl0
 %type <ttype> new_initializer new_placement specialization type_specifier_seq
-%type <ttype> using_decl
+%type <ttype> using_decl .poplevel
 
 /* in order to recognize aggr tags as defining and thus shadowing. */
 %token TYPENAME_DEFN IDENTIFIER_DEFN PTYPENAME_DEFN
@@ -262,8 +262,6 @@ empty_parms ()
 %token NSNAME
 %type <ttype> NSNAME
 
-%type <strtype> .pushlevel
-
 /* Used in lex.c for parsing pragmas.  */
 %token END_OF_LINE
 
@@ -983,12 +981,15 @@ condition:
        | expr
        ;
 
+compstmtend:
+         '}'
+       | maybe_label_decls stmts '}'
+       | maybe_label_decls stmts error '}'
+       | maybe_label_decls error '}'
+       ;
+
 already_scoped_stmt:
-         '{' '}'
-               { finish_stmt (); }
-       | '{' maybe_label_decls stmts '}'
-               { finish_stmt (); }
-       | '{' maybe_label_decls error '}'
+         '{' compstmtend
                { finish_stmt (); }
        | simple_stmt
        ;
@@ -3105,6 +3106,12 @@ errstmt:  error ';'
                  expand_start_bindings (0); }
        ;
 
+.poplevel:   /* empty */
+               { expand_end_bindings (getdecls (), kept_level_p (), 1);
+                 $$ = poplevel (kept_level_p (), 1, 0);
+                 pop_momentary (); }
+       ;
+
 /* Read zero or more forward-declarations for labels
    that nested functions can jump to.  */
 maybe_label_decls:
@@ -3139,22 +3146,8 @@ compstmt_or_error:
        | error compstmt
        ;
 
-compstmt: '{' .pushlevel '}'
-               { expand_end_bindings (getdecls (), kept_level_p(), 1);
-                 $$ = poplevel (kept_level_p (), 1, 0);
-                 pop_momentary (); }
-       | '{' .pushlevel maybe_label_decls stmts '}'
-               { expand_end_bindings (getdecls (), kept_level_p(), 1);
-                 $$ = poplevel (kept_level_p (), 1, 0);
-                 pop_momentary (); }
-       | '{' .pushlevel maybe_label_decls stmts error '}'
-               { expand_end_bindings (getdecls (), kept_level_p(), 1);
-                 $$ = poplevel (kept_level_p (), 0, 0);
-                 pop_momentary (); }
-       | '{' .pushlevel maybe_label_decls error '}'
-               { expand_end_bindings (getdecls (), kept_level_p(), 1);
-                 $$ = poplevel (kept_level_p (), 0, 0);
-                 pop_momentary (); }
+compstmt: '{' .pushlevel compstmtend .poplevel
+               { $$ = $4; }
        ;
 
 simple_if:
@@ -3169,10 +3162,8 @@ simple_if:
 implicitly_scoped_stmt:
          compstmt
                { finish_stmt (); }
-       | .pushlevel simple_stmt
-               { expand_end_bindings (getdecls (), kept_level_p (), 1);
-                 $$ = poplevel (kept_level_p (), 1, 0);
-                 pop_momentary (); }
+       | .pushlevel simple_stmt .poplevel
+               { $$ = $3; }
        ;
 
 stmt:
@@ -3201,11 +3192,9 @@ simple_stmt:
        | simple_if ELSE
                { expand_start_else (); }
          implicitly_scoped_stmt
-               { expand_end_cond ();
-                 expand_end_bindings (getdecls (), kept_level_p (), 1);
-                 poplevel (kept_level_p (), 1, 0);
-                 pop_momentary ();
-                 finish_stmt (); }
+               { expand_end_cond (); }
+         .poplevel
+               { finish_stmt (); }
        | simple_if %prec IF
                { expand_end_cond ();
                  expand_end_bindings (getdecls (), kept_level_p (), 1);
@@ -3219,11 +3208,8 @@ simple_stmt:
                  cond_stmt_keyword = "while"; }
          .pushlevel paren_cond_or_null
                { expand_exit_loop_if_false (0, $4); }
-         already_scoped_stmt
-               { expand_end_bindings (getdecls (), kept_level_p (), 1);
-                 poplevel (kept_level_p (), 1, 0);
-                 pop_momentary ();
-                 expand_end_loop ();
+         already_scoped_stmt .poplevel
+               { expand_end_loop ();
                  finish_stmt (); }
        | DO
                { emit_nop ();
@@ -3238,51 +3224,42 @@ simple_stmt:
                  expand_end_loop ();
                  clear_momentary ();
                  finish_stmt (); }
-       | forhead.1
+       | FOR
+               { extern int flag_new_for_scope;
+                 emit_line_note (input_filename, lineno);
+                 if (flag_new_for_scope)
+                   {
+                     /* Conditionalize .pushlevel */
+                     pushlevel (0);
+                     clear_last_expr ();
+                     push_momentary ();
+                     expand_start_bindings (0);
+                   }
+               }
+         '(' for.init.statement
                { emit_nop ();
                  emit_line_note (input_filename, lineno);
-                 if ($1) cplus_expand_expr_stmt ($1);
                  expand_start_loop_continue_elsewhere (1); }
          .pushlevel xcond ';'
                { emit_line_note (input_filename, lineno);
-                 if ($4) expand_exit_loop_if_false (0, $4); }
+                 if ($7) expand_exit_loop_if_false (0, $7); }
          xexpr ')'
-               /* Don't let the tree nodes for $7 be discarded
+               /* Don't let the tree nodes for $10 be discarded
                   by clear_momentary during the parsing of the next stmt.  */
                { push_momentary (); }
-         already_scoped_stmt
+         already_scoped_stmt .poplevel
                { emit_line_note (input_filename, lineno);
-                 expand_end_bindings (getdecls (), kept_level_p (), 1);
-                 poplevel (kept_level_p (), 1, 0);
-                 pop_momentary ();
                  expand_loop_continue_here ();
-                 if ($7) cplus_expand_expr_stmt ($7);
+                 if ($10) cplus_expand_expr_stmt ($10);
                  pop_momentary ();
                  expand_end_loop ();
+                 if (flag_new_for_scope)
+                   {
+                     expand_end_bindings (getdecls (), kept_level_p (), 1);
+                     poplevel (kept_level_p (), 1, 0);
+                     pop_momentary ();
+                   }
                  finish_stmt (); }
-       | forhead.2
-               { emit_nop ();
-                 emit_line_note (input_filename, lineno);
-                 expand_start_loop_continue_elsewhere (1); }
-         .pushlevel xcond ';'
-               { emit_line_note (input_filename, lineno);
-                 if ($4) expand_exit_loop_if_false (0, $4); }
-         xexpr ')'
-               /* Don't let the tree nodes for $7 be discarded
-                  by clear_momentary during the parsing of the next stmt.  */
-               { push_momentary ();
-                 $<itype>8 = lineno; }
-         already_scoped_stmt
-               { emit_line_note (input_filename, (int) $<itype>8);
-                 expand_end_bindings (getdecls (), kept_level_p (), 1);
-                 poplevel (kept_level_p (), 1, 0);
-                 pop_momentary ();
-                 expand_loop_continue_here ();
-                 if ($7) cplus_expand_expr_stmt ($7);
-                 pop_momentary ();
-                 expand_end_loop ();
-                 finish_stmt ();
-               }
        | SWITCH .pushlevel '(' condition ')'
                { emit_line_note (input_filename, lineno);
                  c_expand_start_case ($4);
@@ -3293,11 +3270,9 @@ simple_stmt:
          implicitly_scoped_stmt
                { expand_end_case ($4);
                  pop_momentary ();
-                 pop_switch ();
-                 expand_end_bindings (getdecls (), kept_level_p (), 1);
-                 poplevel (kept_level_p (), 1, 0);
-                 pop_momentary ();
-                 finish_stmt (); }
+                 pop_switch (); }
+         .poplevel
+               { finish_stmt (); }
        | CASE expr_no_commas ':'
                { register tree value = check_cp_case_value ($2);
                  register tree label
@@ -3442,43 +3417,20 @@ simple_stmt:
        ;
 
 try_block:
-         TRY '{' .pushlevel
+         TRY
                { expand_start_try_stmts (); }
-         ansi_try_stmts
+         compstmt
                { expand_end_try_stmts ();
                  expand_start_all_catch (); }
          handler_seq
                { expand_end_all_catch (); }
        ;
 
-ansi_try_stmts:
-         '}'
-               /* An empty try block is degenerate, but it's better to
-                  do extra work here than to do all the special-case work
-                  everywhere else.  */
-               { expand_end_bindings (0,1,1);
-                 poplevel (2,0,0);
-               }
-       | stmts '}'
-               { expand_end_bindings (0,1,1);
-                 poplevel (2,0,0);
-               }
-       | error '}'
-               { expand_end_bindings (0,1,1);
-                 poplevel (2,0,0);
-               }
-       ;
-
 handler_seq:
          /* empty */
-       | handler_seq CATCH
-               { emit_line_note (input_filename, lineno); }
-          .pushlevel handler_args compstmt
-               { expand_end_catch_block ();
-                 expand_end_bindings (getdecls (), kept_level_p (), 1);
-                 poplevel (kept_level_p (), 1, 0);
-                 pop_momentary ();
-               }
+       | handler_seq CATCH .pushlevel handler_args compstmt
+               { expand_end_catch_block (); }
+         .poplevel
        ;
 
 type_specifier_seq:
@@ -3518,24 +3470,11 @@ label_colon:
                { goto do_label; }
        ;
 
-forhead.1:
-         FOR '(' ';'
-               { $$ = NULL_TREE; }
-       | FOR '(' expr ';'
-               { $$ = $3; }
-       | FOR '(' '{' '}'
-               { $$ = NULL_TREE; }
-       ;
-
-forhead.2:
-         FOR '(' decl
-               { $$ = 0; }
-       | FOR '(' error ';'
-               { $$ = 0; }
-       | FOR '(' '{' .pushlevel stmts '}'
-               { $$ = 1; }
-       | FOR '(' '{' .pushlevel error '}'
-               { $$ = -1; }
+for.init.statement:
+         xexpr ';'
+               { if ($1) cplus_expand_expr_stmt ($1); }
+       | decl
+       | '{' compstmtend
        ;
 
 /* Either a type-qualifier or nothing.  First thing in an `asm' statement.  */
index 8c995a8..fe47d1c 100644 (file)
@@ -2648,10 +2648,11 @@ do_type_instantiation (name, storage)
     /* this should really be done by instantiate_member_templates */
     tmp = TREE_VEC_ELT (CLASSTYPE_METHOD_VEC (t), 0);
     for (; tmp; tmp = TREE_CHAIN (tmp))
-      {
-       mark_function_instantiated (tmp, extern_p);
-       repo_template_instantiated (tmp, extern_p);
-      }
+      if (DECL_TEMPLATE_INSTANTIATION (tmp))
+       {
+         mark_function_instantiated (tmp, extern_p);
+         repo_template_instantiated (tmp, extern_p);
+       }
 
 #if 0
     for (tmp = TYPE_FIELDS (t); tmp; tmp = TREE_CHAIN (tmp))
index 196f1a4..3581348 100644 (file)
@@ -397,10 +397,8 @@ build_cplus_method_type (basetype, rettype, argtypes)
                                          TYPE_READONLY (basetype),
                                          TYPE_VOLATILE (basetype));
   else
-    {
-      ptype = build_pointer_type (basetype);
-      ptype = build_type_variant (ptype, 1, 0);
-    }
+    ptype = build_pointer_type (basetype);
+
   /* The actual arglist for this function includes a "hidden" argument
      which is "this".  Put it into the list of argument types.  */
 
index 8580c9b..0bede44 100644 (file)
@@ -1823,7 +1823,8 @@ build_indirect_ref (ptr, errorstring)
      tree ptr;
      char *errorstring;
 {
-  register tree pointer = default_conversion (ptr);
+  register tree pointer = (TREE_CODE (TREE_TYPE (ptr)) == REFERENCE_TYPE ?
+                          ptr : default_conversion (ptr));
   register tree type = TREE_TYPE (pointer);
 
   if (ptr == current_class_decl)
@@ -2427,6 +2428,9 @@ build_function_call_real (function, params, require_complete, flags)
     coerced_params = convert_arguments (NULL_TREE, TYPE_ARG_TYPES (fntype),
                                        params, fndecl, 0);
 
+  if (coerced_params == error_mark_node)
+    return error_mark_node;
+
   /* Check for errors in format strings.  */
 
   if (warn_format && (name || assembler_name))
@@ -2541,7 +2545,7 @@ convert_arguments (return_loc, typelist, values, fndecl, flags)
       register tree val = TREE_VALUE (valtail);
 
       if (val == error_mark_node)
-       continue;
+       return error_mark_node;
 
       if (type == void_type_node)
        {
@@ -2628,7 +2632,7 @@ convert_arguments (return_loc, typelist, values, fndecl, flags)
        }
 
       if (val == error_mark_node)
-       continue;
+       return error_mark_node;
 
       if (type != 0)
        {