From 7afff7cfb08e971723fee6a6b4ed508a3fdf9c26 Mon Sep 17 00:00:00 2001 From: Neil Booth Date: Wed, 20 Mar 2002 07:58:41 +0000 Subject: [PATCH] Makefile.in: Update. * Makefile.in: Update. * c-common.c: Include langhooks.h. (inline_forbidden_p): Use new hook. * diagnostic.c: Include langhooks.h. (format_with_decl, announce_function, default_print_error_function): Use new hook. * dwarf2out.c (dwarf2_name): Use new hook. * function.c: Include langhooks.h. (init_function_start): Use new hook. * langhooks-def.h (lhd_decl_printable_name): New. (LANGHOOKS_DECL_PRINTABLE_NAME): New. (LANGHOOKS_INITIALIZER): Update. * langhooks.c (lhd_decl_printable_name): New. * langhooks.h (struct lang_hooks): New hook. * toplev.c (decl_name, decl_printable_name): Remove. (open_dump_file): Use new hook. (process_options): Remove old hook. * tree.h (decl_printable_name): Remove. ada: * misc.c (LANG_HOOKS_DECL_PRINTABLE_NAME): Redefine. (gnat_init): Remove old hook. cp: * cp-lang.c (LANG_HOOKS_DECL_PRINTABLE_NAME): Redefine. * cp-tree.h (lang_printable_name): Rename. * error.c (lang_decl_name): Use new hook. * lex.c (cxx_init): Remove old hook. * pt.c (tsubst_expr): Use new hook. * tree.c (lang_printable_name): Rename. f: * com.c (lang_printable_name): Rename. (LANG_HOOKS_DECL_PRINTABLE_NAME): Redefine. (ffe_init): Don't use old hook. java: * decl.c (start_java_method): Use new hook. * lang.c (LANG_HOOKS_DECL_PRINTABLE_NAME): Redefine. (java_init): Remove old hook. objc: * objc-act.c (objc_init): Remove old hook. (objc_printable_name): Export. * objc-act.h (objc_printable_name): New. * objc-lang.c (LANG_HOOKS_DECL_PRINTABLE_NAME): Redefine. From-SVN: r51066 --- gcc/ChangeLog | 26 ++++++++++++++++++++++++++ gcc/Makefile.in | 7 ++++--- gcc/ada/ChangeLog | 5 +++++ gcc/ada/misc.c | 3 ++- gcc/c-common.c | 3 ++- gcc/c-objc-common.c | 3 ++- gcc/cp/ChangeLog | 9 +++++++++ gcc/cp/cp-lang.c | 2 ++ gcc/cp/cp-tree.h | 2 +- gcc/cp/error.c | 4 ++-- gcc/cp/lex.c | 1 - gcc/cp/pt.c | 2 +- gcc/cp/tree.c | 2 +- gcc/diagnostic.c | 9 +++++---- gcc/dwarf2out.c | 8 ++++---- gcc/f/ChangeLog | 6 ++++++ gcc/f/com.c | 7 ++++--- gcc/function.c | 3 ++- gcc/java/ChangeLog | 6 ++++++ gcc/java/decl.c | 2 +- gcc/java/lang.c | 3 ++- gcc/langhooks-def.h | 3 +++ gcc/langhooks.c | 10 ++++++++++ gcc/langhooks.h | 8 ++++++++ gcc/objc/objc-act.c | 5 +---- gcc/objc/objc-act.h | 1 + gcc/objc/objc-lang.c | 2 ++ gcc/toplev.c | 26 +------------------------- gcc/tree.h | 10 ---------- 29 files changed, 113 insertions(+), 65 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 82f99cd2bda..9cf4c2aa34e 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,29 @@ +2002-03-20 Neil Booth + + * Makefile.in: Update. + * c-common.c: Include langhooks.h. + (inline_forbidden_p): Use new hook. + * diagnostic.c: Include langhooks.h. + (format_with_decl, announce_function, + default_print_error_function): Use new hook. + * dwarf2out.c (dwarf2_name): Use new hook. + * function.c: Include langhooks.h. + (init_function_start): Use new hook. + * langhooks-def.h (lhd_decl_printable_name): New. + (LANGHOOKS_DECL_PRINTABLE_NAME): New. + (LANGHOOKS_INITIALIZER): Update. + * langhooks.c (lhd_decl_printable_name): New. + * langhooks.h (struct lang_hooks): New hook. + * toplev.c (decl_name, decl_printable_name): Remove. + (open_dump_file): Use new hook. + (process_options): Remove old hook. + * tree.h (decl_printable_name): Remove. +objc: + * objc-act.c (objc_init): Remove old hook. + (objc_printable_name): Export. + * objc-act.h (objc_printable_name): New. + * objc-lang.c (LANG_HOOKS_DECL_PRINTABLE_NAME): Redefine. + 2002-03-19 Jim Blandy * c-lex.c (cb_file_change): Pass the #inclusion's line number to diff --git a/gcc/Makefile.in b/gcc/Makefile.in index 69bc57d3508..2f967dfe0b1 100644 --- a/gcc/Makefile.in +++ b/gcc/Makefile.in @@ -1157,7 +1157,7 @@ c-lex.o : c-lex.c $(CONFIG_H) $(SYSTEM_H) $(TREE_H) $(RTL_H) c-lex.h \ c-objc-common.o : c-objc-common.c $(CONFIG_H) $(SYSTEM_H) $(TREE_H) \ $(C_TREE_H) $(RTL_H) insn-config.h integrate.h $(EXPR_H) $(C_TREE_H) \ flags.h toplev.h tree-inline.h diagnostic.h integrate.h $(VARRAY_H) \ - $(GGC_H) + langhooks.h $(GGC_H) c-aux-info.o : c-aux-info.c $(CONFIG_H) $(SYSTEM_H) $(TREE_H) $(C_TREE_H) \ flags.h toplev.h c-convert.o : c-convert.c $(CONFIG_H) $(SYSTEM_H) $(TREE_H) flags.h toplev.h @@ -1340,7 +1340,7 @@ fold-const.o : fold-const.c $(CONFIG_H) $(SYSTEM_H) $(TREE_H) flags.h \ toplev.h $(HASHTAB_H) $(EXPR_H) $(RTL_H) $(GGC_H) $(TM_P_H) diagnostic.o : diagnostic.c diagnostic.h real.h diagnostic.def \ $(CONFIG_H) $(SYSTEM_H) $(TREE_H) $(TM_P_H) flags.h $(GGC_H) \ - input.h toplev.h intl.h + input.h toplev.h intl.h langhooks.h toplev.o : toplev.c $(CONFIG_H) $(SYSTEM_H) $(TREE_H) $(RTL_H) function.h \ flags.h xcoffout.h input.h $(INSN_ATTR_H) output.h diagnostic.h \ debug.h insn-config.h intl.h $(RECOG_H) Makefile toplev.h \ @@ -1375,7 +1375,8 @@ varasm.o : varasm.c $(CONFIG_H) $(SYSTEM_H) $(TREE_H) $(RTL_H) flags.h \ $(HASHTAB_H) $(TARGET_H) langhooks.h function.o : function.c $(CONFIG_H) $(SYSTEM_H) $(RTL_H) $(TREE_H) flags.h \ function.h $(EXPR_H) libfuncs.h $(REGS_H) hard-reg-set.h \ - insn-config.h $(RECOG_H) output.h toplev.h except.h hash.h $(GGC_H) $(TM_P_H) + insn-config.h $(RECOG_H) output.h toplev.h except.h hash.h $(GGC_H) \ + $(TM_P_H) langhooks.h stmt.o : stmt.c $(CONFIG_H) $(SYSTEM_H) $(RTL_H) $(TREE_H) flags.h function.h \ insn-config.h hard-reg-set.h $(EXPR_H) libfuncs.h except.h \ $(LOOP_H) $(RECOG_H) toplev.h output.h varray.h $(GGC_H) $(TM_P_H) diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 9b062a7c0b8..4512729f4c7 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,8 @@ +2002-03-20 Neil Booth + + * misc.c (LANG_HOOKS_DECL_PRINTABLE_NAME): Redefine. + (gnat_init): Remove old hook. + 2002-03-17 Neil Booth * misc.c (LANG_HOOKS_PARSE_FILE): Redefine. diff --git a/gcc/ada/misc.c b/gcc/ada/misc.c index 46e28021359..7073c8969f0 100644 --- a/gcc/ada/misc.c +++ b/gcc/ada/misc.c @@ -109,6 +109,8 @@ static void gnat_parse_file PARAMS ((void)); #define LANG_HOOKS_PRINT_DECL gnat_print_decl #undef LANG_HOOKS_PRINT_TYPE #define LANG_HOOKS_PRINT_TYPE gnat_print_type +#undef LANG_HOOKS_DECL_PRINTABLE_NAME +#define LANG_HOOKS_DECL_PRINTABLE_NAME gnat_printable_name const struct lang_hooks lang_hooks = LANG_HOOKS_INITIALIZER; @@ -358,7 +360,6 @@ gnat_init (filename) it, but it's where g++ does it. */ lang_expand_expr = gnat_expand_expr; - decl_printable_name = gnat_printable_name; gnat_init_decl_processing (); diff --git a/gcc/c-common.c b/gcc/c-common.c index 4b2350e8cc4..91f2a20476b 100644 --- a/gcc/c-common.c +++ b/gcc/c-common.c @@ -37,6 +37,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA #include "c-lex.h" #include "cpplib.h" #include "target.h" +#include "langhooks.h" cpp_reader *parse_in; /* Declared in c-lex.h. */ #undef WCHAR_TYPE_SIZE @@ -483,7 +484,7 @@ fname_as_string (pretty_p) if (pretty_p) name = (current_function_decl - ? (*decl_printable_name) (current_function_decl, 2) + ? (*lang_hooks.decl_printable_name) (current_function_decl, 2) : "top level"); else if (current_function_decl && DECL_NAME (current_function_decl)) name = IDENTIFIER_POINTER (DECL_NAME (current_function_decl)); diff --git a/gcc/c-objc-common.c b/gcc/c-objc-common.c index 3baa0835e23..7e6ecad2671 100644 --- a/gcc/c-objc-common.c +++ b/gcc/c-objc-common.c @@ -33,6 +33,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA #include "tree-inline.h" #include "varray.h" #include "ggc.h" +#include "langhooks.h" static int c_tree_printer PARAMS ((output_buffer *)); static tree inline_forbidden_p PARAMS ((tree *, int *, void *)); @@ -392,7 +393,7 @@ c_tree_printer (buffer) case 'T': { const char *n = DECL_NAME (t) - ? (*decl_printable_name) (t, 2) + ? (*lang_hooks.decl_printable_name) (t, 2) : "({anonymous})"; output_add_string (buffer, n); } diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 4d3e3094962..7dd27a413ff 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,12 @@ +2002-03-20 Neil Booth + + * cp-lang.c (LANG_HOOKS_DECL_PRINTABLE_NAME): Redefine. + * cp-tree.h (lang_printable_name): Rename. + * error.c (lang_decl_name): Use new hook. + * lex.c (cxx_init): Remove old hook. + * pt.c (tsubst_decl): Use new hook. + * tree.c (lang_printable_name): Rename. + 2002-03-18 Eric Botcazou PR c++/3882 diff --git a/gcc/cp/cp-lang.c b/gcc/cp/cp-lang.c index 40defa57e95..619e4f06ff8 100644 --- a/gcc/cp/cp-lang.c +++ b/gcc/cp/cp-lang.c @@ -67,6 +67,8 @@ static bool ok_to_generate_alias_set_for_type PARAMS ((tree)); #define LANG_HOOKS_PRINT_TYPE cxx_print_type #undef LANG_HOOKS_PRINT_IDENTIFIER #define LANG_HOOKS_PRINT_IDENTIFIER cxx_print_identifier +#undef LANG_HOOKS_DECL_PRINTABLE_NAME +#define LANG_HOOKS_DECL_PRINTABLE_NAME cxx_printable_name #undef LANG_HOOKS_SET_YYDEBUG #define LANG_HOOKS_SET_YYDEBUG cxx_set_yydebug diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h index 6da6811ef45..35e1da9d9f5 100644 --- a/gcc/cp/cp-tree.h +++ b/gcc/cp/cp-tree.h @@ -4263,7 +4263,7 @@ extern tree build_overload PARAMS ((tree, tree)); extern tree function_arg_chain PARAMS ((tree)); extern int promotes_to_aggr_type PARAMS ((tree, enum tree_code)); extern int is_aggr_type_2 PARAMS ((tree, tree)); -extern const char *lang_printable_name PARAMS ((tree, int)); +extern const char *cxx_printable_name PARAMS ((tree, int)); extern tree build_exception_variant PARAMS ((tree, tree)); extern tree bind_template_template_parm PARAMS ((tree, tree)); extern tree array_type_nelts_total PARAMS ((tree)); diff --git a/gcc/cp/error.c b/gcc/cp/error.c index d4b1ff859a2..20352e01b54 100644 --- a/gcc/cp/error.c +++ b/gcc/cp/error.c @@ -2132,7 +2132,7 @@ context_as_string (context, flags) return output_finalize_message (scratch_buffer); } -/* Generate the three forms of printable names for lang_printable_name. */ +/* Generate the three forms of printable names for cxx_printable_name. */ const char * lang_decl_name (decl, v) @@ -2436,7 +2436,7 @@ cp_print_error_function (buffer, dc) else output_printf (buffer, "In %s `%s':", function_category (current_function_decl), - (*decl_printable_name) (current_function_decl, 2)); + cxx_printable_name (current_function_decl, 2)); output_add_newline (buffer); record_last_error_function (); diff --git a/gcc/cp/lex.c b/gcc/cp/lex.c index 7290a360db6..593f3121474 100644 --- a/gcc/cp/lex.c +++ b/gcc/cp/lex.c @@ -642,7 +642,6 @@ const char * cxx_init (filename) const char *filename; { - decl_printable_name = lang_printable_name; input_filename = ""; init_reswords (); diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 67da22daa9a..e1b6c375113 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -7364,7 +7364,7 @@ tsubst_expr (t, args, complain, in_decl) /* For __PRETTY_FUNCTION__ we have to adjust the initializer. */ const char *const name - = (*decl_printable_name) (current_function_decl, 2); + = cxx_printable_name (current_function_decl, 2); init = cp_fname_init (name); TREE_TYPE (decl) = TREE_TYPE (init); } diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c index 1d99df02965..c547209d943 100644 --- a/gcc/cp/tree.c +++ b/gcc/cp/tree.c @@ -1049,7 +1049,7 @@ cp_statement_code_p (code) #define PRINT_RING_SIZE 4 const char * -lang_printable_name (decl, v) +cxx_printable_name (decl, v) tree decl; int v; { diff --git a/gcc/diagnostic.c b/gcc/diagnostic.c index 4ff157d7ecb..7cb9c9bbea7 100644 --- a/gcc/diagnostic.c +++ b/gcc/diagnostic.c @@ -34,6 +34,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA #include "toplev.h" #include "intl.h" #include "diagnostic.h" +#include "langhooks.h" #define obstack_chunk_alloc xmalloc #define obstack_chunk_free free @@ -867,7 +868,7 @@ format_with_decl (buffer, decl) if (*p == '%') /* Print the name. */ { const char *const n = (DECL_NAME (decl) - ? (*decl_printable_name) (decl, 2) + ? (*lang_hooks.decl_printable_name) (decl, 2) : _("((anonymous))")); output_add_string (buffer, n); while (*p) @@ -1075,7 +1076,7 @@ announce_function (decl) if (rtl_dump_and_exit) verbatim ("%s ", IDENTIFIER_POINTER (DECL_NAME (decl))); else - verbatim (" %s", (*decl_printable_name) (decl, 2)); + verbatim (" %s", (*lang_hooks.decl_printable_name) (decl, 2)); fflush (stderr); output_needs_newline (diagnostic_buffer) = 1; record_last_error_function (); @@ -1105,11 +1106,11 @@ default_print_error_function (context, file) if (TREE_CODE (TREE_TYPE (current_function_decl)) == METHOD_TYPE) output_printf ((output_buffer *) context, "In member function `%s':", - (*decl_printable_name) (current_function_decl, 2)); + (*lang_hooks.decl_printable_name) (current_function_decl, 2)); else output_printf ((output_buffer *) context, "In function `%s':", - (*decl_printable_name) (current_function_decl, 2)); + (*lang_hooks.decl_printable_name) (current_function_decl, 2)); } output_add_newline ((output_buffer *) context); diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c index 19b3c4647c2..3528bc8ed21 100644 --- a/gcc/dwarf2out.c +++ b/gcc/dwarf2out.c @@ -6493,16 +6493,16 @@ output_comp_unit (die) unmark_dies (die); } -/* The DWARF2 pubname for a nested thingy looks like "A::f". The output - of decl_printable_name for C++ looks like "A::f(int)". Let's drop the - argument list, and maybe the scope. */ +/* The DWARF2 pubname for a nested thingy looks like "A::f". The + output of lang_hooks.decl_printable_name for C++ looks like + "A::f(int)". Let's drop the argument list, and maybe the scope. */ static const char * dwarf2_name (decl, scope) tree decl; int scope; { - return (*decl_printable_name) (decl, scope ? 1 : 0); + return (*lang_hooks.decl_printable_name) (decl, scope ? 1 : 0); } /* Add a new entry to .debug_pubnames if appropriate. */ diff --git a/gcc/f/ChangeLog b/gcc/f/ChangeLog index 5423463608d..690a4ee5d5e 100644 --- a/gcc/f/ChangeLog +++ b/gcc/f/ChangeLog @@ -1,3 +1,9 @@ +Wed Mar 20 08:03:42 2002 Neil Booth + + * com.c (lang_printable_name): Rename. + (LANG_HOOKS_DECL_PRINTABLE_NAME): Redefine. + (ffe_init): Don't use old hook. + Sun Mar 17 18:50:15 2002 Kaveh R. Ghazi * com.h (ffe_parse_file): Prototype. diff --git a/gcc/f/com.c b/gcc/f/com.c index 016b422db25..fa64b99ce94 100644 --- a/gcc/f/com.c +++ b/gcc/f/com.c @@ -364,7 +364,7 @@ static void delete_block (tree block); static int duplicate_decls (tree newdecl, tree olddecl); static void finish_decl (tree decl, tree init, bool is_top_level); static void finish_function (int nested); -static const char *lang_printable_name (tree decl, int v); +static const char *ffe_printable_name (tree decl, int v); static tree lookup_name_current_level (tree name); static struct binding_level *make_binding_level (void); static void pop_f_function_context (void); @@ -13630,7 +13630,7 @@ finish_function (int nested) nested function and all). */ static const char * -lang_printable_name (tree decl, int v) +ffe_printable_name (tree decl, int v) { /* Just to keep GCC quiet about the unused variable. In theory, differing values of V should produce different @@ -14215,6 +14215,8 @@ static void ffe_print_identifier PARAMS ((FILE *, tree, int)); #define LANG_HOOKS_PARSE_FILE ffe_parse_file #undef LANG_HOOKS_PRINT_IDENTIFIER #define LANG_HOOKS_PRINT_IDENTIFIER ffe_print_identifier +#undef LANG_HOOKS_DECL_PRINTABLE_NAME +#define LANG_HOOKS_DECL_PRINTABLE_NAME ffe_printable_name /* We do not wish to use alias-set based aliasing at all. Used in the extreme (every object with its own set, with equivalences recorded) it @@ -14277,7 +14279,6 @@ ffe_init (filename) #endif ffecom_init_decl_processing (); - decl_printable_name = lang_printable_name; print_error_function = lang_print_error_function; /* If the file is output from cpp, it should contain a first line diff --git a/gcc/function.c b/gcc/function.c index b451eefcc89..e7facd453b7 100644 --- a/gcc/function.c +++ b/gcc/function.c @@ -59,6 +59,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA #include "ggc.h" #include "tm_p.h" #include "integrate.h" +#include "langhooks.h" #ifndef TRAMPOLINE_ALIGNMENT #define TRAMPOLINE_ALIGNMENT FUNCTION_BOUNDARY @@ -6259,7 +6260,7 @@ init_function_start (subr, filename, line) { prepare_function_start (); - current_function_name = (*decl_printable_name) (subr, 2); + current_function_name = (*lang_hooks.decl_printable_name) (subr, 2); cfun->decl = subr; /* Nonzero if this is a nested function that uses a static chain. */ diff --git a/gcc/java/ChangeLog b/gcc/java/ChangeLog index efdbde5d0f9..dc59c8323db 100644 --- a/gcc/java/ChangeLog +++ b/gcc/java/ChangeLog @@ -1,3 +1,9 @@ +2002-03-20 Neil Booth + + * decl.c (start_java_method): Use new hook. + * lang.c (LANG_HOOKS_DECL_PRINTABLE_NAME): Redefine. + (java_init): Remove old hook. + 2002-03-18 Alexandre Petit-Bianco * builtins.c (define_builtin): Do nothing if `type' is null. diff --git a/gcc/java/decl.c b/gcc/java/decl.c index ddba14ff274..ffcccb28229 100644 --- a/gcc/java/decl.c +++ b/gcc/java/decl.c @@ -1775,7 +1775,7 @@ start_java_method (fndecl) type_map = (tree *) xrealloc (type_map, i * sizeof (tree)); #if defined(DEBUG_JAVA_BINDING_LEVELS) - fprintf (stderr, "%s:\n", (*decl_printable_name) (fndecl, 2)); + fprintf (stderr, "%s:\n", lang_printable_name (fndecl, 2)); current_pc = 0; #endif /* defined(DEBUG_JAVA_BINDING_LEVELS) */ pushlevel (1); /* Push parameters. */ diff --git a/gcc/java/lang.c b/gcc/java/lang.c index d9e5847a63e..c612b491b4a 100644 --- a/gcc/java/lang.c +++ b/gcc/java/lang.c @@ -225,6 +225,8 @@ static int dependency_tracking = 0; #define LANG_HOOKS_PARSE_FILE java_parse_file #undef LANG_HOOKS_DUP_LANG_SPECIFIC_DECL #define LANG_HOOKS_DUP_LANG_SPECIFIC_DECL java_dup_lang_specific_decl +#undef LANG_HOOKS_DECL_PRINTABLE_NAME +#define LANG_HOOKS_DECL_PRINTABLE_NAME lang_printable_name /* Each front end provides its own. */ const struct lang_hooks lang_hooks = LANG_HOOKS_INITIALIZER; @@ -506,7 +508,6 @@ java_init (filename) jcf_path_init (); jcf_path_seal (version_flag); - decl_printable_name = lang_printable_name; print_error_function = lang_print_error; lang_expand_expr = java_lang_expand_expr; diff --git a/gcc/langhooks-def.h b/gcc/langhooks-def.h index abd28471f8f..404b4bc3689 100644 --- a/gcc/langhooks-def.h +++ b/gcc/langhooks-def.h @@ -46,6 +46,7 @@ extern int lhd_safe_from_p PARAMS ((rtx, tree)); extern int lhd_staticp PARAMS ((tree)); extern void lhd_clear_binding_stack PARAMS ((void)); extern void lhd_print_tree_nothing PARAMS ((FILE *, tree, int)); +extern const char *lhd_decl_printable_name PARAMS ((tree, int)); extern void lhd_set_yydebug PARAMS ((int)); /* Declarations of default tree inlining hooks. */ @@ -86,6 +87,7 @@ tree lhd_tree_inlining_convert_parm_for_inlining PARAMS ((tree, tree, tree)); #define LANG_HOOKS_PRINT_DECL lhd_print_tree_nothing #define LANG_HOOKS_PRINT_TYPE lhd_print_tree_nothing #define LANG_HOOKS_PRINT_IDENTIFIER lhd_print_tree_nothing +#define LANG_HOOKS_DECL_PRINTABLE_NAME lhd_decl_printable_name #define LANG_HOOKS_SET_YYDEBUG lhd_set_yydebug /* Tree inlining hooks. */ @@ -160,6 +162,7 @@ int lhd_tree_dump_type_quals PARAMS ((tree)); LANG_HOOKS_PRINT_DECL, \ LANG_HOOKS_PRINT_TYPE, \ LANG_HOOKS_PRINT_IDENTIFIER, \ + LANG_HOOKS_DECL_PRINTABLE_NAME, \ LANG_HOOKS_SET_YYDEBUG, \ LANG_HOOKS_TREE_INLINING_INITIALIZER, \ LANG_HOOKS_TREE_DUMP_INITIALIZER \ diff --git a/gcc/langhooks.c b/gcc/langhooks.c index 6be5304a328..cd36889a322 100644 --- a/gcc/langhooks.c +++ b/gcc/langhooks.c @@ -134,6 +134,16 @@ hook_get_alias_set_0 (t) return 0; } +/* This is the default decl_printable_name function. */ + +const char * +lhd_decl_printable_name (decl, verbosity) + tree decl; + int verbosity ATTRIBUTE_UNUSED; +{ + return IDENTIFIER_POINTER (DECL_NAME (decl)); +} + /* lang_hooks.tree_inlining.walk_subtrees is called by walk_tree() after handling common cases, but before walking code-specific sub-trees. If this hook is overridden for a language, it should diff --git a/gcc/langhooks.h b/gcc/langhooks.h index 902bb55bc8c..49c2c6803a1 100644 --- a/gcc/langhooks.h +++ b/gcc/langhooks.h @@ -160,6 +160,14 @@ struct lang_hooks lang_print_tree_hook print_type; lang_print_tree_hook print_identifier; + /* Computes the name to use to print a declaration. DECL is the + non-NULL declaration in question. VERBOSITY determines what + information will be printed: 0: DECL_NAME, demangled as + necessary. 1: and scope information. 2: and any other + information that might be interesting, such as function parameter + types in C++. */ + const char *(*decl_printable_name) PARAMS ((tree decl, int verbosity)); + /* Set yydebug for bison-based parsers, when -dy is given on the command line. By default, if the parameter is non-zero, prints a warning that the front end does not use such a parser. */ diff --git a/gcc/objc/objc-act.c b/gcc/objc/objc-act.c index 0c9e9fd27f8..2d689a25eb8 100644 --- a/gcc/objc/objc-act.c +++ b/gcc/objc/objc-act.c @@ -165,7 +165,6 @@ static int check_methods_accessible PARAMS ((tree, tree, static void encode_aggregate_within PARAMS ((tree, int, int, int, int)); static const char *objc_demangle PARAMS ((const char *)); -static const char *objc_printable_name PARAMS ((tree, int)); static void objc_expand_function_end PARAMS ((void)); /* Hash tables to manage the global pool of method prototypes. */ @@ -477,8 +476,6 @@ objc_init (filename) { filename = c_objc_common_init (filename); - decl_printable_name = objc_printable_name; - /* Force the line number back to 0; check_newline will have raised it to 1, which will make the builtin functions appear not to be built in. */ @@ -8028,7 +8025,7 @@ objc_demangle (mangled) return mangled; /* not an objc mangled name */ } -static const char * +const char * objc_printable_name (decl, kind) tree decl; int kind ATTRIBUTE_UNUSED; diff --git a/gcc/objc/objc-act.h b/gcc/objc/objc-act.h index 72b8b3e34b9..b4917f7a9e4 100644 --- a/gcc/objc/objc-act.h +++ b/gcc/objc/objc-act.h @@ -25,6 +25,7 @@ Boston, MA 02111-1307, USA. */ const char *objc_init PARAMS ((const char *)); int objc_decode_option PARAMS ((int, char **)); +const char *objc_printable_name PARAMS ((tree, int)); /* used by yyparse */ diff --git a/gcc/objc/objc-lang.c b/gcc/objc/objc-lang.c index d779e69d247..2be19df9523 100644 --- a/gcc/objc/objc-lang.c +++ b/gcc/objc/objc-lang.c @@ -52,6 +52,8 @@ static void objc_post_options PARAMS ((void)); #define LANG_HOOKS_DUP_LANG_SPECIFIC_DECL c_dup_lang_specific_decl #undef LANG_HOOKS_PRINT_IDENTIFIER #define LANG_HOOKS_PRINT_IDENTIFIER c_print_identifier +#undef LANG_HOOKS_DECL_PRINTABLE_NAME +#define LANG_HOOKS_DECL_PRINTABLE_NAME objc_printable_name #undef LANG_HOOKS_SET_YYDEBUG #define LANG_HOOKS_SET_YYDEBUG c_set_yydebug /* Inlining hooks same as the C front end. */ diff --git a/gcc/toplev.c b/gcc/toplev.c index a99fdd1af19..134541734cc 100644 --- a/gcc/toplev.c +++ b/gcc/toplev.c @@ -108,7 +108,6 @@ static void init_asm_output PARAMS ((const char *)); static void finalize PARAMS ((void)); static void set_target_switch PARAMS ((const char *)); -static const char *decl_name PARAMS ((tree, int)); static void float_signal PARAMS ((int)) ATTRIBUTE_NORETURN; static void crash_signal PARAMS ((int)) ATTRIBUTE_NORETURN; @@ -353,16 +352,6 @@ tree current_function_decl; if none. */ tree current_function_func_begin_label; -/* Pointer to function to compute the name to use to print a declaration. - DECL is the declaration in question. - VERBOSITY determines what information will be printed: - 0: DECL_NAME, demangled as necessary. - 1: and scope information. - 2: and any other information that might be interesting, such as function - parameter types in C++. */ - -const char *(*decl_printable_name) PARAMS ((tree, int)); - /* Pointer to function to compute rtl for a language-specific tree code. */ typedef rtx (*lang_expand_expr_t) @@ -1559,19 +1548,7 @@ read_integral_parameter (p, pname, defval) return atoi (p); } - -/* This is the default decl_printable_name function. */ - -static const char * -decl_name (decl, verbosity) - tree decl; - int verbosity ATTRIBUTE_UNUSED; -{ - return IDENTIFIER_POINTER (DECL_NAME (decl)); -} - - /* This calls abort and is used to avoid problems when abort if a macro. It is used when we need to pass the address of abort. */ @@ -1829,7 +1806,7 @@ open_dump_file (index, decl) if (decl) fprintf (rtl_dump_file, "\n;; Function %s\n\n", - decl_printable_name (decl, 2)); + (*lang_hooks.decl_printable_name) (decl, 2)); timevar_pop (TV_DUMP); return 1; @@ -5002,7 +4979,6 @@ process_options () static void lang_independent_init () { - decl_printable_name = decl_name; lang_expand_expr = (lang_expand_expr_t) do_abort; /* Initialize the garbage-collector, and string pools. */ diff --git a/gcc/tree.h b/gcc/tree.h index d9ad985f342..6c03df798cc 100644 --- a/gcc/tree.h +++ b/gcc/tree.h @@ -2713,16 +2713,6 @@ extern tree current_function_func_begin_label; extern int all_types_permanent; -/* Pointer to function to compute the name to use to print a declaration. - DECL is the declaration in question. - VERBOSITY determines what information will be printed: - 0: DECL_NAME, demangled as necessary. - 1: and scope information. - 2: and any other information that might be interesting, such as function - parameter types in C++. */ - -extern const char *(*decl_printable_name) PARAMS ((tree, int)); - /* Pointer to function to finish handling an incomplete decl at the end of compilation. */