mangle.c (write_type): Mangle VECTOR_TYPE with "U8__vector".
authorJason Merrill <jason@gcc.gnu.org>
Mon, 4 Dec 2000 17:00:04 +0000 (12:00 -0500)
committerJason Merrill <jason@gcc.gnu.org>
Mon, 4 Dec 2000 17:00:04 +0000 (12:00 -0500)
        * mangle.c (write_type): Mangle VECTOR_TYPE with "U8__vector".
        (write_builtin_type): Pass intSI_type_node and the like through
        type_for_mode.
        * method.c (process_overload_item): Mangle VECTOR_TYPEs with 'o'.
        Pass intSI_type_node and the like through type_for_mode.
        * decl2.c (arg_assoc_type): Handle VECTOR_TYPE like COMPLEX_TYPE.
        * pt.c (tsubst, unify): Likewise.
        * tree.c (walk_tree): Likewise.
        * error.c (dump_type): Likewise.
        (dump_type_prefix, dump_type_suffix): Don't bother with VECTOR_TYPE.

        * Make-lang.in: Tweak top comment for emacs.
        (cp/TAGS): Restore.

        * except.c (expand_throw): Use push_throw_library_fn for _Jv_Throw.

        * pt.c (tsubst_decl): Call clone_function_decl here.
        (do_decl_instantiation): Not here.
        * class.c (clone_function_decl): Robustify.

        * decl.c (store_bindings): Only search in the non modified
        old_bindings for duplicates.

From-SVN: r37999

12 files changed:
gcc/cp/ChangeLog
gcc/cp/Make-lang.in
gcc/cp/class.c
gcc/cp/decl.c
gcc/cp/decl2.c
gcc/cp/error.c
gcc/cp/except.c
gcc/cp/gxxint.texi
gcc/cp/mangle.c
gcc/cp/method.c
gcc/cp/pt.c
gcc/cp/tree.c

index cc40d916682161135feaf739779a2134dc84d4ce..105f04789aa44491a923a35b28b4cd07978d7232 100644 (file)
@@ -1,3 +1,30 @@
+2000-12-04  Jason Merrill  <jason@redhat.com>
+
+       * mangle.c (write_type): Mangle VECTOR_TYPE with "U8__vector".
+       (write_builtin_type): Pass intSI_type_node and the like through 
+       type_for_mode.
+       * method.c (process_overload_item): Mangle VECTOR_TYPEs with 'o'.
+       Pass intSI_type_node and the like through type_for_mode.
+       * decl2.c (arg_assoc_type): Handle VECTOR_TYPE like COMPLEX_TYPE.
+       * pt.c (tsubst, unify): Likewise.
+       * tree.c (walk_tree): Likewise.
+       * error.c (dump_type): Likewise.
+       (dump_type_prefix, dump_type_suffix): Don't bother with VECTOR_TYPE.
+       
+       * Make-lang.in: Tweak top comment for emacs.
+       (cp/TAGS): Restore.
+
+       * except.c (expand_throw): Use push_throw_library_fn for _Jv_Throw.
+
+       * pt.c (tsubst_decl): Call clone_function_decl here.
+       (do_decl_instantiation): Not here.
+       * class.c (clone_function_decl): Robustify.
+
+2000-12-04  Michael Matz  <matzmich@cs.tu-berlin.de>
+
+       * decl.c (store_bindings): Only search in the non modified
+       old_bindings for duplicates.
+
 2000-12-04  Nathan Sidwell  <nathan@codesourcery.com>
 
        * error.c (dump_function_decl): Use DECL_VIRTUAL_P, not
index 75e3b6c9419d68a2dbcf69a3edb7f90e6607e4d7..0c1347a80d834f92dc0d14c6cbc5c165112aa964 100644 (file)
@@ -1,4 +1,4 @@
-# Top level makefile fragment for GNU C++.
+# Top level -*- makefile -*- fragment for GNU C++.
 #   Copyright (C) 1994, 1995, 1997, 1998, 1999, 2000
 #   Free Software Foundation, Inc.
 
@@ -273,3 +273,15 @@ cp/parse.o: cp/parse.c $(CXX_TREE_H) flags.h cp/lex.h except.h output.h \
        system.h toplev.h $(GGC_H)
        $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $(BIG_SWITCHFLAG) \
                $(srcdir)/cp/parse.c $(OUTPUT_OPTION)
+#\f
+# These exist for maintenance purposes.
+
+# Update the tags table.
+cp/TAGS: force
+       cd $(srcdir)/cp ;                       \
+       etags *.c *.h ;                         \
+       echo 'l' | tr 'l' '\f' >> TAGS ;        \
+       echo 'parse.y,0' >> TAGS ;              \
+       etags -a ../*.h ../*.c;
+
+.PHONY: cp/TAGS
index b8d2a915024f88f7d39ae59e811353bf9b118552..9a71203258a4b52777e84ec5c10c9719ecdea007 100644 (file)
@@ -4316,6 +4316,12 @@ clone_function_decl (fn, update_method_vec_p)
 {
   tree clone;
 
+  /* Avoid inappropriate cloning.  */
+  if (! flag_new_abi
+      || (TREE_CHAIN (fn)
+         && DECL_CLONED_FUNCTION (TREE_CHAIN (fn))))
+    return;
+
   if (DECL_MAYBE_IN_CHARGE_CONSTRUCTOR_P (fn))
     {
       /* For each constructor, we need two variants: an in-charge version
index 73684acd67f7b66b2c64ccb074b0e46464b630da..b84e847384a117c86fd6c630e2b41804889b71c6 100644 (file)
@@ -2425,6 +2425,8 @@ store_bindings (names, old_bindings)
      tree names, old_bindings;
 {
   tree t;
+  tree search_bindings = old_bindings;
+
   for (t = names; t; t = TREE_CHAIN (t))
     {
       tree binding, t1, id;
@@ -2441,7 +2443,7 @@ store_bindings (names, old_bindings)
          || !(IDENTIFIER_BINDING (id) || IDENTIFIER_CLASS_VALUE (id)))
        continue;
 
-      for (t1 = old_bindings; t1; t1 = TREE_CHAIN (t1))
+      for (t1 = search_bindings; t1; t1 = TREE_CHAIN (t1))
        if (TREE_VEC_ELT (t1, 0) == id)
          goto skip_it;
 
@@ -11235,7 +11237,7 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, attrlist)
            }
 
          /* Until core issue 180 is resolved, allow 'friend typename A::B'.
-            But don't allow implicit typenames.  */
+            But don't allow implicit typenames except with a class-key.  */
          if (!current_aggr && (TREE_CODE (type) != TYPENAME_TYPE
                                || IMPLICIT_TYPENAME_P (type)))
            {
@@ -13570,7 +13572,8 @@ start_function (declspecs, declarator, attrs, flags)
   /* Initialize RTL machinery.  We cannot do this until
      CURRENT_FUNCTION_DECL and DECL_RESULT are set up.  We do this
      even when processing a template; this is how we get
-     CFUN set up, and our per-function variables initialized.  */
+     CFUN set up, and our per-function variables initialized.
+     FIXME factor out the non-RTL stuff.  */
   bl = current_binding_level;
   init_function_start (decl1, input_filename, lineno);
   current_binding_level = bl;
index 497db613eb3ca6296370c236ff074d39b04846ae..99e5591038f3ea2041fb14df1fd12b6f8cc9e5e9 100644 (file)
@@ -4878,6 +4878,7 @@ arg_assoc_type (k, type)
     case INTEGER_TYPE:
     case REAL_TYPE:
     case COMPLEX_TYPE:
+    case VECTOR_TYPE:
     case CHAR_TYPE:
     case BOOLEAN_TYPE:
       return 0;
@@ -4888,7 +4889,6 @@ arg_assoc_type (k, type)
     case POINTER_TYPE:
     case REFERENCE_TYPE:
     case ARRAY_TYPE:
-    case VECTOR_TYPE:
       return arg_assoc_type (k, TREE_TYPE (type));
     case UNION_TYPE:
     case ENUMERAL_TYPE:
index a77edf5991be27f8d6d22f51728e98e8dfe1c9de..45863e1bd33ef9a03c65f4d76135b9fac89a693f 100644 (file)
@@ -447,6 +447,11 @@ dump_type (t, flags)
       dump_type (TREE_TYPE (t), flags);
       break;
 
+    case VECTOR_TYPE:
+      OB_PUTS ("vector ");
+      dump_type (TREE_TYPE (t), flags);
+      break;
+
     case INTEGER_TYPE:
       if (!TREE_UNSIGNED (TYPE_MAIN_VARIANT (t)) && TREE_UNSIGNED (t))
        output_add_string (scratch_buffer, "unsigned ");
@@ -503,7 +508,6 @@ dump_type (t, flags)
         reduces code size.  */
     case ARRAY_TYPE:
     case POINTER_TYPE:
-    case VECTOR_TYPE:
     case REFERENCE_TYPE:
     case OFFSET_TYPE:
     offset_type:
@@ -662,15 +666,6 @@ dump_type_prefix (t, flags)
 
   switch (TREE_CODE (t))
     {
-    case VECTOR_TYPE:
-      padding = dump_type_prefix (TREE_TYPE (t), flags);
-      if (padding != none)
-       output_add_space (scratch_buffer);
-      output_add_string (scratch_buffer, "vector");
-      dump_qualifiers (t, before);
-      padding = before;
-      break;
-
     case POINTER_TYPE:
     case REFERENCE_TYPE:
       {
@@ -748,6 +743,7 @@ dump_type_prefix (t, flags)
     case VOID_TYPE:
     case TYPENAME_TYPE:
     case COMPLEX_TYPE:
+    case VECTOR_TYPE:
       dump_type (t, flags);
       padding = before;
       break;
@@ -778,7 +774,6 @@ dump_type_suffix (t, flags)
     case POINTER_TYPE:
     case REFERENCE_TYPE:
     case OFFSET_TYPE:
-    case VECTOR_TYPE:
       if (TREE_CODE (TREE_TYPE (t)) == ARRAY_TYPE)
        print_right_paren (scratch_buffer);
       dump_type_suffix (TREE_TYPE (t), flags);
@@ -844,6 +839,7 @@ dump_type_suffix (t, flags)
     case VOID_TYPE:
     case TYPENAME_TYPE:
     case COMPLEX_TYPE:
+    case VECTOR_TYPE:
       break;
 
     default:
index d3c3d169e6791c3aeef21d352e11789aa6cd3694..1c0d06aeef2b70f1b448c9e1cfc8ec6f2f1ee6b6 100644 (file)
@@ -692,8 +692,9 @@ expand_end_eh_spec (raises, try_block)
        {
          tmp = build_function_type (void_type_node, void_list_node);
          fn = push_throw_library_fn (fn, tmp);
-         /* Since the spec doesn't allow any exceptions, this call
-            will never throw.  */
+         /* Since the spec doesn't allow any exceptions, this call will
+            never throw.  We use push_throw_library_fn because we do want
+            TREE_THIS_VOLATILE to be set.  */
          TREE_NOTHROW (fn) = 1;
        }
       tmp = NULL_TREE;
@@ -837,9 +838,7 @@ expand_throw (exp)
             exception.cc.  */
          tree tmp = tree_cons (NULL_TREE, ptr_type_node, void_list_node);
          tmp = build_function_type (ptr_type_node, tmp);
-         fn = push_library_fn (fn, tmp);
-         TREE_THIS_VOLATILE (fn) = 1;
-         TREE_NOTHROW (fn) = 0;
+         fn = push_throw_library_fn (fn, tmp);
        }
 
       exp = build_function_call (fn, args);
@@ -886,17 +885,18 @@ expand_throw (exp)
             user function that exits via an uncaught exception.
 
             So we have to protect the actual initialization of the
-            exception object with terminate(), but evaluate the expression
-            first.  We also expand the call to __eh_alloc
-            first.  Since there could be temps in the expression, we need
-            to handle that, too.  */
+            exception object with terminate(), but evaluate the
+            expression first.  Since there could be temps in the
+            expression, we need to handle that, too.  We also expand
+            the call to __eh_alloc first (which doesn't matter, since
+            it can't throw).  */
 
          my_friendly_assert (stmts_are_full_exprs_p () == 1, 19990926);
 
          /* Store the throw expression into a temp.  This can be less
             efficient than storing it into the allocated space directly, but
-            oh well.  To do this efficiently we would need to insinuate
-            ourselves into expand_call.  */
+            if we allocated the space first we would have to deal with
+            cleaning it up if evaluating this expression throws.  */
          if (TREE_SIDE_EFFECTS (exp))
            {
              tree temp = create_temporary_var (TREE_TYPE (exp));
index 69d187bf04090f8dc1acf730f8eea9ea71b2a8c3..17bb81df6f736155ffb5ab953701636cae7a0944 100644 (file)
@@ -1769,6 +1769,12 @@ followed by the type index of the repeated type. Due to a bug in
 g++ 2.7.2, this is only generated if index is 0. Superceded by
 @samp{n} when squangling.
 
+@item O
+Pointer-to-member type.
+
+@item o
+vector type.
+
 @item P
 Indicates a pointer type.  Followed by the type pointed to.
 
index 33eeefc447af7b10db4db91e10ff7ee19e2ae261..001a9e8f36ffc44c3813fd0f75f47bb4affed522 100644 (file)
@@ -1236,10 +1236,9 @@ write_local_name (function, local_entity, entity)
             ::= <CV-qualifier>
             ::= P <type>    # pointer-to
             ::= R <type>    # reference-to
-            ::= C <type>    # complex pair (C 2000)  [not supported]
+            ::= C <type>    # complex pair (C 2000)
             ::= G <type>    # imaginary (C 2000)     [not supported]
             ::= U <source-name> <type>   # vendor extended type qualifier 
-                                                     [not supported]
 
    TYPE is a type node.  */
 
@@ -1349,6 +1348,11 @@ write_type (type)
          write_pointer_to_member_type (build_pointer_type (type));
          break;
 
+       case VECTOR_TYPE:
+         write_string ("U8__vector");
+         write_type (TREE_TYPE (type));
+         break;
+
        default:
          my_friendly_abort (20000409);
        }
@@ -1416,7 +1420,8 @@ write_CV_qualifiers_for_type (type)
                     ::= f   # float
                     ::= d   # double
                     ::= e   # long double, __float80 
-                    ::= g   # __float128          [not supported]  */
+                    ::= g   # __float128          [not supported]
+                    ::= u <source-name>  # vendor extended type */
 
 static void 
 write_builtin_type (type)
@@ -1446,6 +1451,7 @@ write_builtin_type (type)
          size_t itk;
          /* Assume TYPE is one of the shared integer type nodes.  Find
             it in the array of these nodes.  */
+       iagain:
          for (itk = 0; itk < itk_none; ++itk)
            if (type == integer_types[itk])
              {
@@ -1455,8 +1461,14 @@ write_builtin_type (type)
              }
          
          if (itk == itk_none)
-           /* Couldn't find this type.  */
-           my_friendly_abort (20000408);
+           {
+             tree t = type_for_mode (TYPE_MODE (type), TREE_UNSIGNED (type));
+             if (type == t)
+               /* Couldn't find this type.  */
+               my_friendly_abort (20000408);
+             type = t;
+             goto iagain;
+           }
        }
       break;
 
index 4f2e58d463d9bf638e1e9c19f941baec38ebf651..4c59822b0328881b1745559b78a83f5da43db7ac 100644 (file)
@@ -1313,6 +1313,8 @@ process_overload_item (parmtype, extra_Gcode)
   tree parmtype;
   int extra_Gcode;
 {
+  tree tmp;
+
   numeric_output_need_bar = 0;
 
   /* Our caller should have already handed any qualifiers, so pull out the
@@ -1421,6 +1423,7 @@ process_overload_item (parmtype, extra_Gcode)
       }
 
     case INTEGER_TYPE:
+    iagain:
       if (parmtype == integer_type_node
           || parmtype == unsigned_type_node
          || parmtype == java_int_type_node)
@@ -1450,6 +1453,14 @@ process_overload_item (parmtype, extra_Gcode)
         OB_PUTC ('x');
       else if (parmtype == java_boolean_type_node)
        OB_PUTC ('b');
+      /* Handle intSI_type_node and such like their C++ equivalents.  */
+      else if (tmp = type_for_mode (TYPE_MODE (parmtype),
+                                   TREE_UNSIGNED (parmtype)),
+              parmtype != tmp)
+       {
+         parmtype = tmp;
+         goto iagain;
+       }
 #if HOST_BITS_PER_WIDE_INT >= 64
       else
        {
@@ -1483,6 +1494,11 @@ process_overload_item (parmtype, extra_Gcode)
       build_mangled_name_for_type (TREE_TYPE (parmtype));
       break;
 
+    case VECTOR_TYPE:
+      OB_PUTC ('o');
+      build_mangled_name_for_type (TREE_TYPE (parmtype));
+      break;
+
     case VOID_TYPE:
       OB_PUTC ('v');
       break;
index be82bd579cc973bc5be0a8aa8bd674a6ad12e9c6..8d7f33b32118b89d215b95681b19e2e2c8bca7e6 100644 (file)
@@ -5786,6 +5786,7 @@ tsubst_decl (t, args, type, in_decl)
            maybe_retrofit_in_chrg (r);
            if (DECL_CONSTRUCTOR_P (r))
              grok_ctor_properties (ctx, r);
+           clone_function_decl(r, /*update_method_vec_p=*/0);
          }
        else if (IDENTIFIER_OPNAME_P (DECL_NAME (r)))
          grok_op_properties (r, DECL_VIRTUAL_P (r), DECL_FRIEND_P (r));
@@ -6164,6 +6165,7 @@ tsubst (t, args, complain, in_decl)
     case VOID_TYPE:
     case REAL_TYPE:
     case COMPLEX_TYPE:
+    case VECTOR_TYPE:
     case BOOLEAN_TYPE:
     case INTEGER_CST:
     case REAL_CST:
@@ -8532,6 +8534,7 @@ unify (tparms, targs, parm, arg, strict)
 
     case REAL_TYPE:
     case COMPLEX_TYPE:
+    case VECTOR_TYPE:
     case INTEGER_TYPE:
     case BOOLEAN_TYPE:
     case VOID_TYPE:
@@ -9222,15 +9225,6 @@ do_decl_instantiation (declspecs, declarator, storage)
     cp_error ("storage class `%D' applied to template instantiation",
              storage);
 
-  /* Under the new ABI, we need to make sure to instantiate all the
-     cloned versions of constructors or destructors.  */
-  if (flag_new_abi &&
-      (DECL_MAYBE_IN_CHARGE_CONSTRUCTOR_P (result) || 
-       DECL_MAYBE_IN_CHARGE_DESTRUCTOR_P (result)) &&
-      !(TREE_CHAIN (result) && 
-       DECL_CLONED_FUNCTION (TREE_CHAIN (result))))
-    clone_function_decl(result, /*update_method_vec_p=*/0);
-      
   SET_DECL_EXPLICIT_INSTANTIATION (result);
   mark_decl_instantiated (result, extern_p);
   repo_template_instantiated (result, extern_p);
index 517a5cc3e04d1d45f8e7754c395069cae4bea7f5..653930e423fc72dcad35f513060dd9cdda086a41 100644 (file)
@@ -1319,6 +1319,7 @@ walk_tree (tp, func, data, htab)
     case TEMPLATE_TYPE_PARM:
     case REAL_TYPE:
     case COMPLEX_TYPE:
+    case VECTOR_TYPE:
     case VOID_TYPE:
     case BOOLEAN_TYPE:
     case TYPENAME_TYPE:
@@ -1336,7 +1337,6 @@ walk_tree (tp, func, data, htab)
 
     case POINTER_TYPE:
     case REFERENCE_TYPE:
-    case VECTOR_TYPE:
       WALK_SUBTREE (TREE_TYPE (*tp));
       break;