diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index c98bf630fda..6d75cde691b 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2000-06-28 Alex Samuel + + * mangle.c (find_substitution): Use same_type_p. + (write_encoding): Don't check for substitutions. + 2000-06-30 Nathan Sidwell * 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 * cp-tree.h (CLEAR_BINFO_NEW_VTABLE_MARKED): Remove. diff --git a/gcc/cp/mangle.c b/gcc/cp/mangle.c index a1d1d552dd0..594e25c5a71 100644 --- a/gcc/cp/mangle.c +++ b/gcc/cp/mangle.c @@ -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 > . */ 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) } /* ::= - ::= - ::= */ + ::= */ 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); } /* ::= diff --git a/libiberty/ChangeLog b/libiberty/ChangeLog index ad5c214e647..323a6915a40 100644 --- a/libiberty/ChangeLog +++ b/libiberty/ChangeLog @@ -1,3 +1,13 @@ +2000-06-28 Alex Samuel + + * cp-demangle.c (demangle_encoding): Accept no substitutions. + (demangle_name): Handle followed by + . + (demangle_type): Follow special substitutions with + + (demangle_subtitution): Set template_p for special substitutions. + (main): Fix typos. + 2000-06-27 Alex Samuel * cp-demangle.c (demangle_special_name): Swap base and derived diff --git a/libiberty/cp-demangle.c b/libiberty/cp-demangle.c index b658b40d9ff..de70b8963bd 100644 --- a/libiberty/cp-demangle.c +++ b/libiberty/cp-demangle.c @@ -902,16 +902,14 @@ demangle_mangled_name (dm) ::= ::= - ::= */ + ::= */ 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. - ::= St # ::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 . */ + 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 . 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, std::allocator >")); 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 >")); 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 >")); 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 >")); 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 diff --git a/libio/ChangeLog b/libio/ChangeLog index b7b30ea0e24..1ac3f623145 100644 --- a/libio/ChangeLog +++ b/libio/ChangeLog @@ -1,3 +1,9 @@ +2000-06-28 Alex Samuel + + * libioP.h (VTABLE_LABEL): Update for new vtable mangling. + * stdstrbufs.cc (filebuf_vtable): Likewise. + (stdiobuf_vtable): Likewise. + 2000-06-04 Mark Mitchell * libioP.h: Handle new ABI mangling. diff --git a/libio/libioP.h b/libio/libioP.h index 171d9b9c1da..0dee72d577e 100644 --- a/libio/libioP.h +++ b/libio/libioP.h @@ -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__ */ diff --git a/libio/stdstrbufs.cc b/libio/stdstrbufs.cc index ee10cdc4d00..2425a56eec6 100644 --- a/libio/stdstrbufs.cc +++ b/libio/stdstrbufs.cc @@ -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