OSDN Git Service

in libiberty/ChangeLog:
authorsamuel <samuel@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 30 Jun 2000 15:25:33 +0000 (15:25 +0000)
committersamuel <samuel@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 30 Jun 2000 15:25:33 +0000 (15:25 +0000)
* cp-demangle.c (demangle_encoding): Accept no substitutions.
(demangle_name): Handle <substitution> followed by
<unqualified-template-name>.
(demangle_type): Follow special substitutions with
<class-enum-type>
(demangle_subtitution): Set template_p for special substitutions.
(main): Fix typos.

in gcc/cp/ChangeLog:

* mangle.c (find_substitution): Use same_type_p.
(write_encoding): Don't check for substitutions.

in libio/ChangeLog:

* libioP.h (VTABLE_LABEL): Update for new vtable mangling.
* stdstrbufs.cc (filebuf_vtable): Likewise.
(stdiobuf_vtable): Likewise.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@34811 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/cp/ChangeLog
gcc/cp/mangle.c
libiberty/ChangeLog
libiberty/cp-demangle.c
libio/ChangeLog
libio/libioP.h
libio/stdstrbufs.cc

index c98bf63..6d75cde 100644 (file)
@@ -1,3 +1,8 @@
+2000-06-28  Alex Samuel  <samuel@codesourcery.com>
+
+       * mangle.c (find_substitution): Use same_type_p.
+       (write_encoding): Don't check for substitutions.
+
 2000-06-30  Nathan Sidwell  <nathan@codesourcery.com>
 
        * parse.y (expr_no_comma_rangle): New non-terminal.
@@ -78,6 +83,7 @@
        (overloaded_template_name): Adjust.
        * semantics.c (finish_template_template_parm): Adjust.
 
+>>>>>>> 1.1867
 2000-06-28  Mark Mitchell  <mark@codesourcery.com>
 
        * cp-tree.h (CLEAR_BINFO_NEW_VTABLE_MARKED): Remove.
index a1d1d55..594e25c 100644 (file)
@@ -463,7 +463,7 @@ find_substitution (node)
            {
              tree args = CLASSTYPE_TI_ARGS (type);
              if (TREE_VEC_LENGTH (args) == 3
-                 && TREE_VEC_ELT (args, 0) == char_type_node
+                 && same_type_p (TREE_VEC_ELT (args, 0), char_type_node)
                  && is_std_substitution_char (TREE_VEC_ELT (args, 1),
                                               SUBID_CHAR_TRAITS)
                  && is_std_substitution_char (TREE_VEC_ELT (args, 2),
@@ -493,7 +493,7 @@ find_substitution (node)
         args <char, std::char_traits<char> > .  */
       tree args = CLASSTYPE_TI_ARGS (type);
       if (TREE_VEC_LENGTH (args) == 2
-         && TREE_VEC_ELT (args, 0) == char_type_node
+         && same_type_p (TREE_VEC_ELT (args, 0), char_type_node)
          && is_std_substitution_char (TREE_VEC_ELT (args, 1),
                                       SUBID_CHAR_TRAITS))
        {
@@ -570,8 +570,7 @@ write_mangled_name (decl)
 }
 
 /*   <encoding>                ::= <function name> <bare-function-type>
-                       ::= <data name>
-                       ::= <substitution>  */
+                       ::= <data name>  */
 
 static void
 write_encoding (decl)
@@ -579,9 +578,6 @@ write_encoding (decl)
 {
   MANGLE_TRACE_TREE ("encoding", decl);
 
-  if (find_substitution (decl))
-    return;
-
   if (DECL_LANG_SPECIFIC (decl) && DECL_EXTERN_C_FUNCTION_P (decl))
     {
       write_source_name (DECL_NAME (decl));
@@ -600,8 +596,6 @@ write_encoding (decl)
 
       write_bare_function_type (fn_type, DECL_TEMPLATE_ID_P (decl));
     }
-
-  add_substitution (decl);
 }
 
 /* <name> ::= <unscoped-name>
index ad5c214..323a691 100644 (file)
@@ -1,3 +1,13 @@
+2000-06-28  Alex Samuel  <samuel@codesourcery.com>
+
+       * cp-demangle.c (demangle_encoding): Accept no substitutions.
+       (demangle_name): Handle <substitution> followed by
+       <unqualified-template-name>.
+       (demangle_type): Follow special substitutions with
+       <class-enum-type>
+       (demangle_subtitution): Set template_p for special substitutions.
+       (main): Fix typos.
+       
 2000-06-27  Alex Samuel  <samuel@codesourcery.com>
 
        * cp-demangle.c (demangle_special_name): Swap base and derived
index b658b40..de70b89 100644 (file)
@@ -902,16 +902,14 @@ demangle_mangled_name (dm)
 
     <encoding>         ::= <function name> <bare-function-type>
                        ::= <data name>
-                       ::= <substitution>  */
+                       ::= <special-name>  */
 
 static status_t
 demangle_encoding (dm)
      demangling_t dm;
 {
   int template_p;
-  int special_std_substitution;
   int start_position;
-  int start = substitution_start (dm);
   template_arg_list_t old_arg_list = current_template_arg_list (dm);
   char peek = peek_char (dm);
 
@@ -921,18 +919,7 @@ demangle_encoding (dm)
      function, we'll have to insert the return type here.  */
   start_position = result_length (dm);
 
-  if (peek == 'S')
-    {
-      RETURN_IF_ERROR (demangle_substitution (dm, &template_p,
-                                             &special_std_substitution));
-      if (special_std_substitution)
-       {
-         /* This was the magic `std::' substitution.  */
-         RETURN_IF_ERROR (result_append (dm, "::"));
-         RETURN_IF_ERROR (demangle_encoding (dm));
-       }
-    }
-  else if (peek == 'G' || peek == 'T')
+  if (peek == 'G' || peek == 'T')
     RETURN_IF_ERROR (demangle_special_name (dm));
   else
     {
@@ -955,9 +942,6 @@ demangle_encoding (dm)
            RETURN_IF_ERROR 
              (demangle_bare_function_type (dm, BFT_NO_RETURN_TYPE)); 
        }
-
-      RETURN_IF_ERROR (substitution_add (dm, start, template_p, 
-                                        NOT_TEMPLATE_PARM));
     }
 
   /* Pop off template argument lists that were built during the
@@ -1004,8 +988,7 @@ demangle_name (dm, template_p)
 
     case 'S':
       /* The `St' substitution allows a name nested in std:: to appear
-        without being enclosed in a nested name.
-          <name> ::= St <unqualified-name>     # ::std::  */
+        without being enclosed in a nested name.  */
       if (peek_char_next (dm) == 't') 
        {
          (void) next_char (dm);
@@ -1026,6 +1009,14 @@ demangle_name (dm, template_p)
              RETURN_IF_ERROR (demangle_name (dm, template_p));
            }
        }
+      /* Check if a template argument list immediately follows.
+        If so, then we just demangled an <unqualified-template-name>.  */
+      if (peek_char (dm) == 'I') 
+       {
+         RETURN_IF_ERROR (substitution_add (dm, start, 0, 
+                                            NOT_TEMPLATE_PARM));
+         RETURN_IF_ERROR (demangle_template_args (dm));
+       }
       break;
 
     default:
@@ -1947,6 +1938,7 @@ demangle_type (dm)
 {
   int start = substitution_start (dm);
   char peek = peek_char (dm);
+  char peek_next;
   int template_p = 0;
   int special_std_substitution;
   int is_builtin_type = 0;
@@ -2016,15 +2008,16 @@ demangle_type (dm)
        break;
 
       case 'S':
-       RETURN_IF_ERROR (demangle_substitution (dm, &template_p,
-                                               &special_std_substitution));
-       if (special_std_substitution)
-         {
-           /* This was the magic `std::' substitution.  What follows
-              must be a class name in that namespace.  */
-           RETURN_IF_ERROR (result_append (dm, "::"));
-           RETURN_IF_ERROR (demangle_class_enum_type (dm, &template_p));
-         }
+       /* First check if this is a special substitution.  If it is,
+          this is a <class-enum-type>.  Special substitutions have a
+          letter following the `S'; other substitutions have a digit
+          or underscore.  */
+       peek_next = peek_char_next (dm);
+       if (IS_DIGIT (peek_next) || peek_next == '_')
+         RETURN_IF_ERROR (demangle_substitution (dm, &template_p,
+                                                 &special_std_substitution));
+       else
+         demangle_class_enum_type (dm, &template_p);
        break;
 
       case 'P':
@@ -2792,11 +2785,13 @@ demangle_substitution (dm, template_p, special_std_substitution)
        case 'a':
          RETURN_IF_ERROR (result_append (dm, "std::allocator"));
          new_last_source_name = "allocator";
+         *template_p = 1;
          break;
 
        case 'b':
          RETURN_IF_ERROR (result_append (dm, "std::basic_string"));
          new_last_source_name = "basic_string";
+         *template_p = 1;
          break;
          
        case 's':
@@ -2810,6 +2805,7 @@ demangle_substitution (dm, template_p, special_std_substitution)
              RETURN_IF_ERROR (result_append (dm, "std::basic_string<char, std::char_traits<char>, std::allocator<char> >"));
              new_last_source_name = "basic_string";
            }
+         *template_p = 0;
          break;
 
        case 'i':
@@ -2823,6 +2819,7 @@ demangle_substitution (dm, template_p, special_std_substitution)
              RETURN_IF_ERROR (result_append (dm, "std::basic_istream<char, std::char_traints<char> >"));
              new_last_source_name = "basic_istream";
            }
+         *template_p = 0;
          break;
 
        case 'o':
@@ -2836,6 +2833,7 @@ demangle_substitution (dm, template_p, special_std_substitution)
              RETURN_IF_ERROR (result_append (dm, "std::basic_ostream<char, std::char_traits<char> >"));
              new_last_source_name = "basic_ostream";
            }
+         *template_p = 0;
          break;
 
        case 'd':
@@ -2849,6 +2847,7 @@ demangle_substitution (dm, template_p, special_std_substitution)
              RETURN_IF_ERROR (result_append (dm, "std::basic_iostream<char, std::char_traits<char> >"));
              new_last_source_name = "basic_iostream";
            }
+         *template_p = 0;
          break;
 
        default:
@@ -2872,7 +2871,7 @@ demangle_substitution (dm, template_p, special_std_substitution)
      substitution, `S0_' is the second-most-recent, etc., shift the
      numbering by one.  */
   text = substitution_get (dm, seq_id + 1, template_p);
-  if (text == NULL)
+  if (text == NULL) 
     return "Substitution number out of range.";
 
   /* Emit the substitution text.  */
@@ -3390,10 +3389,10 @@ main (argc, argv)
          if (STATUS_NO_ERROR (status))
            printf ("%s\n", dyn_string_buf (result));
          /* Abort on allocaiton failures.  */
-         if (status == STATUS_ALLOCATION_FAILED)
+         else if (status == STATUS_ALLOCATION_FAILED)
            {
              fprintf (stderr, "Memory allocaiton failed.\n");
-             abort ():
+             abort ();
            }
          /* If not, print the error message to stderr instead.  */
          else 
index b7b30ea..1ac3f62 100644 (file)
@@ -1,3 +1,9 @@
+2000-06-28  Alex Samuel  <samuel@codesourcery.com>
+
+       * libioP.h (VTABLE_LABEL): Update for new vtable mangling.
+       * stdstrbufs.cc (filebuf_vtable): Likewise.
+       (stdiobuf_vtable): Likewise.
+       
 2000-06-04  Mark Mitchell  <mark@codesourcery.com>
 
        * libioP.h: Handle new ABI mangling.
index 171d9b9..0dee72d 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 1993, 1997 Free Software Foundation, Inc.
+/* Copyright (C) 1993, 1997, 2000 Free Software Foundation, Inc.
    This file is part of the GNU IO Library.
 
    This library is free software; you can redistribute it and/or
@@ -603,7 +603,7 @@ extern int _IO_vscanf __P ((const char *, _IO_va_list));
 #  endif
 # else
 #  define VTABLE_LABEL(NAME, CLASS, CNLENGTH) \
-  extern char NAME[] asm ("_ZN" #CNLENGTH #CLASS "TVE");
+  extern char NAME[] asm ("_ZTV" #CNLENGTH #CLASS);
 # endif /* (!defined(__GXX_ABI_VERSION) || __GXX_ABI_VERSION < 100) */
 #endif /* __GNUC__ */
 
index ee10cdc..2425a56 100644 (file)
@@ -1,5 +1,5 @@
 /*
-Copyright (C) 1994 Free Software Foundation
+Copyright (C) 1994, 2000 Free Software Foundation
 
 This file is part of the GNU IO Library.  This library is free
 software; you can redistribute it and/or modify it under the
@@ -42,7 +42,7 @@ extern char filebuf_vtable[]
 #endif
        "filebuf");
 #else
-  asm ( "_ZN7filebufTVE" );
+  asm ( "_ZTV7filebuf" );
 #endif /* (!defined(__GXX_ABI_VERSION) || __GXX_ABI_VERSION < 100) */
 #else /* !__GNUC__ */
 #if _G_VTABLE_LABEL_HAS_LENGTH
@@ -98,7 +98,7 @@ extern struct _IO_jump_t stdiobuf_vtable
 #endif
        "stdiobuf");
 #else
-  asm ( "_ZN15stdiobuf_vtableTVE" );
+  asm ( "_ZTV15stdiobuf_vtable" );
 #endif /* (!defined(__GXX_ABI_VERSION) || __GXX_ABI_VERSION < 100) */
 #else /* !__GNUC__ */
 #if _G_VTABLE_LABEL_HAS_LENGTH