* 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
+2002-03-20 Neil Booth <neil@daikokuya.demon.co.uk>
+
+ * 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 <jimb@redhat.com>
* c-lex.c (cb_file_change): Pass the #inclusion's line number to
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
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 \
$(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)
+2002-03-20 Neil Booth <neil@daikokuya.demon.co.uk>
+
+ * misc.c (LANG_HOOKS_DECL_PRINTABLE_NAME): Redefine.
+ (gnat_init): Remove old hook.
+
2002-03-17 Neil Booth <neil@daikokuya.demon.co.uk>
* misc.c (LANG_HOOKS_PARSE_FILE): Redefine.
#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;
it, but it's where g++ does it. */
lang_expand_expr = gnat_expand_expr;
- decl_printable_name = gnat_printable_name;
gnat_init_decl_processing ();
#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
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));
#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 *));
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);
}
+2002-03-20 Neil Booth <neil@daikokuya.demon.co.uk>
+
+ * 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 <ebotcazou@multimania.com>
PR c++/3882
#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
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));
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)
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 ();
cxx_init (filename)
const char *filename;
{
- decl_printable_name = lang_printable_name;
input_filename = "<internal>";
init_reswords ();
/* 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);
}
#define PRINT_RING_SIZE 4
const char *
-lang_printable_name (decl, v)
+cxx_printable_name (decl, v)
tree decl;
int v;
{
#include "toplev.h"
#include "intl.h"
#include "diagnostic.h"
+#include "langhooks.h"
#define obstack_chunk_alloc xmalloc
#define obstack_chunk_free free
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)
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 ();
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);
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. */
+Wed Mar 20 08:03:42 2002 Neil Booth <neil@daikokuya.demon.co.uk>
+
+ * 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 <ghazi@caip.rutgers.edu>
* com.h (ffe_parse_file): Prototype.
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);
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
#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
#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
#include "ggc.h"
#include "tm_p.h"
#include "integrate.h"
+#include "langhooks.h"
#ifndef TRAMPOLINE_ALIGNMENT
#define TRAMPOLINE_ALIGNMENT FUNCTION_BOUNDARY
{
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. */
+2002-03-20 Neil Booth <neil@daikokuya.demon.co.uk>
+
+ * 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 <apbianco@redhat.com>
* builtins.c (define_builtin): Do nothing if `type' is null.
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. */
#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;
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;
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. */
#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. */
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 \
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
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. */
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. */
{
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. */
return mangled; /* not an objc mangled name */
}
-static const char *
+const char *
objc_printable_name (decl, kind)
tree decl;
int kind ATTRIBUTE_UNUSED;
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 */
#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. */
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;
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)
return atoi (p);
}
-
\f
-/* 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));
-}
-\f
-
/* 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. */
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;
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. */
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. */