Commit bece74bd by Alex Samuel

in libiberty/ChangeLog:

	* 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.

From-SVN: r34811
parent af80d489
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> 2000-06-30 Nathan Sidwell <nathan@codesourcery.com>
* parse.y (expr_no_comma_rangle): New non-terminal. * parse.y (expr_no_comma_rangle): New non-terminal.
...@@ -78,6 +83,7 @@ ...@@ -78,6 +83,7 @@
(overloaded_template_name): Adjust. (overloaded_template_name): Adjust.
* semantics.c (finish_template_template_parm): Adjust. * semantics.c (finish_template_template_parm): Adjust.
>>>>>>> 1.1867
2000-06-28 Mark Mitchell <mark@codesourcery.com> 2000-06-28 Mark Mitchell <mark@codesourcery.com>
* cp-tree.h (CLEAR_BINFO_NEW_VTABLE_MARKED): Remove. * cp-tree.h (CLEAR_BINFO_NEW_VTABLE_MARKED): Remove.
......
...@@ -463,7 +463,7 @@ find_substitution (node) ...@@ -463,7 +463,7 @@ find_substitution (node)
{ {
tree args = CLASSTYPE_TI_ARGS (type); tree args = CLASSTYPE_TI_ARGS (type);
if (TREE_VEC_LENGTH (args) == 3 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), && is_std_substitution_char (TREE_VEC_ELT (args, 1),
SUBID_CHAR_TRAITS) SUBID_CHAR_TRAITS)
&& is_std_substitution_char (TREE_VEC_ELT (args, 2), && is_std_substitution_char (TREE_VEC_ELT (args, 2),
...@@ -493,7 +493,7 @@ find_substitution (node) ...@@ -493,7 +493,7 @@ find_substitution (node)
args <char, std::char_traits<char> > . */ args <char, std::char_traits<char> > . */
tree args = CLASSTYPE_TI_ARGS (type); tree args = CLASSTYPE_TI_ARGS (type);
if (TREE_VEC_LENGTH (args) == 2 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), && is_std_substitution_char (TREE_VEC_ELT (args, 1),
SUBID_CHAR_TRAITS)) SUBID_CHAR_TRAITS))
{ {
...@@ -570,8 +570,7 @@ write_mangled_name (decl) ...@@ -570,8 +570,7 @@ write_mangled_name (decl)
} }
/* <encoding> ::= <function name> <bare-function-type> /* <encoding> ::= <function name> <bare-function-type>
::= <data name> ::= <data name> */
::= <substitution> */
static void static void
write_encoding (decl) write_encoding (decl)
...@@ -579,9 +578,6 @@ write_encoding (decl) ...@@ -579,9 +578,6 @@ write_encoding (decl)
{ {
MANGLE_TRACE_TREE ("encoding", decl); MANGLE_TRACE_TREE ("encoding", decl);
if (find_substitution (decl))
return;
if (DECL_LANG_SPECIFIC (decl) && DECL_EXTERN_C_FUNCTION_P (decl)) if (DECL_LANG_SPECIFIC (decl) && DECL_EXTERN_C_FUNCTION_P (decl))
{ {
write_source_name (DECL_NAME (decl)); write_source_name (DECL_NAME (decl));
...@@ -600,8 +596,6 @@ write_encoding (decl) ...@@ -600,8 +596,6 @@ write_encoding (decl)
write_bare_function_type (fn_type, DECL_TEMPLATE_ID_P (decl)); write_bare_function_type (fn_type, DECL_TEMPLATE_ID_P (decl));
} }
add_substitution (decl);
} }
/* <name> ::= <unscoped-name> /* <name> ::= <unscoped-name>
......
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> 2000-06-27 Alex Samuel <samuel@codesourcery.com>
* cp-demangle.c (demangle_special_name): Swap base and derived * cp-demangle.c (demangle_special_name): Swap base and derived
......
...@@ -902,16 +902,14 @@ demangle_mangled_name (dm) ...@@ -902,16 +902,14 @@ demangle_mangled_name (dm)
<encoding> ::= <function name> <bare-function-type> <encoding> ::= <function name> <bare-function-type>
::= <data name> ::= <data name>
::= <substitution> */ ::= <special-name> */
static status_t static status_t
demangle_encoding (dm) demangle_encoding (dm)
demangling_t dm; demangling_t dm;
{ {
int template_p; int template_p;
int special_std_substitution;
int start_position; int start_position;
int start = substitution_start (dm);
template_arg_list_t old_arg_list = current_template_arg_list (dm); template_arg_list_t old_arg_list = current_template_arg_list (dm);
char peek = peek_char (dm); char peek = peek_char (dm);
...@@ -921,18 +919,7 @@ demangle_encoding (dm) ...@@ -921,18 +919,7 @@ demangle_encoding (dm)
function, we'll have to insert the return type here. */ function, we'll have to insert the return type here. */
start_position = result_length (dm); start_position = result_length (dm);
if (peek == 'S') if (peek == 'G' || peek == 'T')
{
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')
RETURN_IF_ERROR (demangle_special_name (dm)); RETURN_IF_ERROR (demangle_special_name (dm));
else else
{ {
...@@ -955,9 +942,6 @@ demangle_encoding (dm) ...@@ -955,9 +942,6 @@ demangle_encoding (dm)
RETURN_IF_ERROR RETURN_IF_ERROR
(demangle_bare_function_type (dm, BFT_NO_RETURN_TYPE)); (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 /* Pop off template argument lists that were built during the
...@@ -1004,8 +988,7 @@ demangle_name (dm, template_p) ...@@ -1004,8 +988,7 @@ demangle_name (dm, template_p)
case 'S': case 'S':
/* The `St' substitution allows a name nested in std:: to appear /* The `St' substitution allows a name nested in std:: to appear
without being enclosed in a nested name. without being enclosed in a nested name. */
<name> ::= St <unqualified-name> # ::std:: */
if (peek_char_next (dm) == 't') if (peek_char_next (dm) == 't')
{ {
(void) next_char (dm); (void) next_char (dm);
...@@ -1026,6 +1009,14 @@ demangle_name (dm, template_p) ...@@ -1026,6 +1009,14 @@ demangle_name (dm, template_p)
RETURN_IF_ERROR (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; break;
default: default:
...@@ -1947,6 +1938,7 @@ demangle_type (dm) ...@@ -1947,6 +1938,7 @@ demangle_type (dm)
{ {
int start = substitution_start (dm); int start = substitution_start (dm);
char peek = peek_char (dm); char peek = peek_char (dm);
char peek_next;
int template_p = 0; int template_p = 0;
int special_std_substitution; int special_std_substitution;
int is_builtin_type = 0; int is_builtin_type = 0;
...@@ -2016,15 +2008,16 @@ demangle_type (dm) ...@@ -2016,15 +2008,16 @@ demangle_type (dm)
break; break;
case 'S': case 'S':
RETURN_IF_ERROR (demangle_substitution (dm, &template_p, /* First check if this is a special substitution. If it is,
&special_std_substitution)); this is a <class-enum-type>. Special substitutions have a
if (special_std_substitution) letter following the `S'; other substitutions have a digit
{ or underscore. */
/* This was the magic `std::' substitution. What follows peek_next = peek_char_next (dm);
must be a class name in that namespace. */ if (IS_DIGIT (peek_next) || peek_next == '_')
RETURN_IF_ERROR (result_append (dm, "::")); RETURN_IF_ERROR (demangle_substitution (dm, &template_p,
RETURN_IF_ERROR (demangle_class_enum_type (dm, &template_p)); &special_std_substitution));
} else
demangle_class_enum_type (dm, &template_p);
break; break;
case 'P': case 'P':
...@@ -2792,11 +2785,13 @@ demangle_substitution (dm, template_p, special_std_substitution) ...@@ -2792,11 +2785,13 @@ demangle_substitution (dm, template_p, special_std_substitution)
case 'a': case 'a':
RETURN_IF_ERROR (result_append (dm, "std::allocator")); RETURN_IF_ERROR (result_append (dm, "std::allocator"));
new_last_source_name = "allocator"; new_last_source_name = "allocator";
*template_p = 1;
break; break;
case 'b': case 'b':
RETURN_IF_ERROR (result_append (dm, "std::basic_string")); RETURN_IF_ERROR (result_append (dm, "std::basic_string"));
new_last_source_name = "basic_string"; new_last_source_name = "basic_string";
*template_p = 1;
break; break;
case 's': case 's':
...@@ -2810,6 +2805,7 @@ demangle_substitution (dm, template_p, special_std_substitution) ...@@ -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> >")); RETURN_IF_ERROR (result_append (dm, "std::basic_string<char, std::char_traits<char>, std::allocator<char> >"));
new_last_source_name = "basic_string"; new_last_source_name = "basic_string";
} }
*template_p = 0;
break; break;
case 'i': case 'i':
...@@ -2823,6 +2819,7 @@ demangle_substitution (dm, template_p, special_std_substitution) ...@@ -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> >")); RETURN_IF_ERROR (result_append (dm, "std::basic_istream<char, std::char_traints<char> >"));
new_last_source_name = "basic_istream"; new_last_source_name = "basic_istream";
} }
*template_p = 0;
break; break;
case 'o': case 'o':
...@@ -2836,6 +2833,7 @@ demangle_substitution (dm, template_p, special_std_substitution) ...@@ -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> >")); RETURN_IF_ERROR (result_append (dm, "std::basic_ostream<char, std::char_traits<char> >"));
new_last_source_name = "basic_ostream"; new_last_source_name = "basic_ostream";
} }
*template_p = 0;
break; break;
case 'd': case 'd':
...@@ -2849,6 +2847,7 @@ demangle_substitution (dm, template_p, special_std_substitution) ...@@ -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> >")); RETURN_IF_ERROR (result_append (dm, "std::basic_iostream<char, std::char_traits<char> >"));
new_last_source_name = "basic_iostream"; new_last_source_name = "basic_iostream";
} }
*template_p = 0;
break; break;
default: default:
...@@ -2872,7 +2871,7 @@ demangle_substitution (dm, template_p, special_std_substitution) ...@@ -2872,7 +2871,7 @@ demangle_substitution (dm, template_p, special_std_substitution)
substitution, `S0_' is the second-most-recent, etc., shift the substitution, `S0_' is the second-most-recent, etc., shift the
numbering by one. */ numbering by one. */
text = substitution_get (dm, seq_id + 1, template_p); text = substitution_get (dm, seq_id + 1, template_p);
if (text == NULL) if (text == NULL)
return "Substitution number out of range."; return "Substitution number out of range.";
/* Emit the substitution text. */ /* Emit the substitution text. */
...@@ -3390,10 +3389,10 @@ main (argc, argv) ...@@ -3390,10 +3389,10 @@ main (argc, argv)
if (STATUS_NO_ERROR (status)) if (STATUS_NO_ERROR (status))
printf ("%s\n", dyn_string_buf (result)); printf ("%s\n", dyn_string_buf (result));
/* Abort on allocaiton failures. */ /* Abort on allocaiton failures. */
if (status == STATUS_ALLOCATION_FAILED) else if (status == STATUS_ALLOCATION_FAILED)
{ {
fprintf (stderr, "Memory allocaiton failed.\n"); fprintf (stderr, "Memory allocaiton failed.\n");
abort (): abort ();
} }
/* If not, print the error message to stderr instead. */ /* If not, print the error message to stderr instead. */
else else
......
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> 2000-06-04 Mark Mitchell <mark@codesourcery.com>
* libioP.h: Handle new ABI mangling. * libioP.h: Handle new ABI mangling.
......
/* 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 file is part of the GNU IO Library.
This library is free software; you can redistribute it and/or 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)); ...@@ -603,7 +603,7 @@ extern int _IO_vscanf __P ((const char *, _IO_va_list));
# endif # endif
# else # else
# define VTABLE_LABEL(NAME, CLASS, CNLENGTH) \ # 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 /* (!defined(__GXX_ABI_VERSION) || __GXX_ABI_VERSION < 100) */
#endif /* __GNUC__ */ #endif /* __GNUC__ */
......
/* /*
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 This file is part of the GNU IO Library. This library is free
software; you can redistribute it and/or modify it under the software; you can redistribute it and/or modify it under the
...@@ -42,7 +42,7 @@ extern char filebuf_vtable[] ...@@ -42,7 +42,7 @@ extern char filebuf_vtable[]
#endif #endif
"filebuf"); "filebuf");
#else #else
asm ( "_ZN7filebufTVE" ); asm ( "_ZTV7filebuf" );
#endif /* (!defined(__GXX_ABI_VERSION) || __GXX_ABI_VERSION < 100) */ #endif /* (!defined(__GXX_ABI_VERSION) || __GXX_ABI_VERSION < 100) */
#else /* !__GNUC__ */ #else /* !__GNUC__ */
#if _G_VTABLE_LABEL_HAS_LENGTH #if _G_VTABLE_LABEL_HAS_LENGTH
...@@ -98,7 +98,7 @@ extern struct _IO_jump_t stdiobuf_vtable ...@@ -98,7 +98,7 @@ extern struct _IO_jump_t stdiobuf_vtable
#endif #endif
"stdiobuf"); "stdiobuf");
#else #else
asm ( "_ZN15stdiobuf_vtableTVE" ); asm ( "_ZTV15stdiobuf_vtable" );
#endif /* (!defined(__GXX_ABI_VERSION) || __GXX_ABI_VERSION < 100) */ #endif /* (!defined(__GXX_ABI_VERSION) || __GXX_ABI_VERSION < 100) */
#else /* !__GNUC__ */ #else /* !__GNUC__ */
#if _G_VTABLE_LABEL_HAS_LENGTH #if _G_VTABLE_LABEL_HAS_LENGTH
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment