diagnostic.c (print_error_function): Remove.

* diagnostic.c (print_error_function): Remove.
	(default_print_error_function): Rename.
	(report_error_function): Update.
	* diagnostic.h (print_error_function): Remove.
	(default_print_error_function): Remove.
	* langhooks-def.h (struct diagnostic_context): Predeclare.
	(lhd_print_error_function, LANG_HOOKS_PRINT_ERROR_FUNCTION): New.
	(LANG_HOOKS_INITIALIZER): Update.
	* langhooks.h (struct diagnostic context): Predeclare.
	(struct lang_hooks): New hook.
cp:
	* Make-lang.in (error.o): Update.
	* cp-lang.c (LANG_HOOKS_PRINT_ERROR_FUNCTION): Redefine.
	* cp-tree.h (struct diagnostic_context): Predeclare.
	(cxx_print_error_function): New.
	* error.c: Include langhooks-def.h.
	(lang_print_error_function): Rename.  Update.
	(init_error): Don't set hook.
f:
	* com.c (lang_print_error_function): Rename.
	(LANG_HOOKS_PRINT_ERROR_FUNCTION): Redefine.
	(ffe_init): Don't set hook.
java:
	* lang.c (LANG_HOOKS_PRINT_ERROR_FUNCTION): Redefine.
	(java_dummy_print): Remove.
	(lang_print_error): Rename.  Exit early if inhibiting output.
	(inhibit_error_printing_function): New.
	(java_init): Don't set hook.
	(lang_init_source): Use new boolean.

From-SVN: r51672
This commit is contained in:
Neil Booth 2002-03-31 22:32:05 +00:00 committed by Neil Booth
parent 1db0243780
commit 7cb3282270
14 changed files with 89 additions and 51 deletions

View file

@ -1,3 +1,16 @@
2002-03-31 Neil Booth <neil@daikokuya.demon.co.uk>
* diagnostic.c (print_error_function): Remove.
(default_print_error_function): Rename.
(report_error_function): Update.
* diagnostic.h (print_error_function): Remove.
(default_print_error_function): Remove.
* langhooks-def.h (struct diagnostic_context): Predeclare.
(lhd_print_error_function, LANG_HOOKS_PRINT_ERROR_FUNCTION): New.
(LANG_HOOKS_INITIALIZER): Update.
* langhooks.h (struct diagnostic context): Predeclare.
(struct lang_hooks): New hook.
2002-03-31 Franz Sirl <Franz.Sirl-kernel@lauterbach.com>
* config/rs6000/rs6000.h (RS6000_PIC_OFFSET_TABLE_REGNUM): New.

View file

@ -1,3 +1,13 @@
2002-03-31 Neil Booth <neil@daikokuya.demon.co.uk>
* Make-lang.in (error.o): Update.
* cp-lang.c (LANG_HOOKS_PRINT_ERROR_FUNCTION): Redefine.
* cp-tree.h (struct diagnostic_context): Predeclare.
(cxx_print_error_function): New.
* error.c: Include langhooks-def.h.
(lang_print_error_function): Rename. Update.
(init_error): Don't set hook.
2002-03-29 Neil Booth <neil@daikokuya.demon.co.uk>
* cp-lang.c (LANG_HOOKS_TYPE_FOR_MODE, LANG_HOOKS_TYPE_FOR_SIZE):

View file

@ -282,7 +282,8 @@ cp/expr.o: cp/expr.c $(CXX_TREE_H) $(RTL_H) flags.h $(EXPR_H) toplev.h \
except.h $(TM_P_H)
cp/pt.o: cp/pt.c $(CXX_TREE_H) cp/decl.h cp/parse.h cp/lex.h toplev.h \
$(GGC_H) $(RTL_H) except.h tree-inline.h
cp/error.o: cp/error.c $(CXX_TREE_H) toplev.h diagnostic.h flags.h real.h
cp/error.o: cp/error.c $(CXX_TREE_H) toplev.h diagnostic.h flags.h real.h \
langhooks-def.h
cp/repo.o: cp/repo.c $(CXX_TREE_H) toplev.h $(GGC_H) diagnostic.h
cp/semantics.o: cp/semantics.c $(CXX_TREE_H) cp/lex.h except.h toplev.h \
flags.h $(GGC_H) debug.h output.h $(RTL_H) $(TIMEVAR_H) $(EXPR_H) \

View file

@ -77,6 +77,8 @@ static bool ok_to_generate_alias_set_for_type PARAMS ((tree));
#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_PRINT_ERROR_FUNCTION
#define LANG_HOOKS_PRINT_ERROR_FUNCTION cxx_print_error_function
#undef LANG_HOOKS_SET_YYDEBUG
#define LANG_HOOKS_SET_YYDEBUG cxx_set_yydebug

View file

@ -34,6 +34,8 @@ Boston, MA 02111-1307, USA. */
#include "c-common.h"
struct diagnostic_context;
/* Usage of TREE_LANG_FLAG_?:
0: BINFO_MARKED (BINFO nodes).
IDENTIFIER_MARKED (IDENTIFIER_NODEs)
@ -3626,6 +3628,8 @@ extern void cxx_print_xnode PARAMS ((FILE *, tree, int));
extern void cxx_print_decl PARAMS ((FILE *, tree, int));
extern void cxx_print_type PARAMS ((FILE *, tree, int));
extern void cxx_print_identifier PARAMS ((FILE *, tree, int));
extern void cxx_print_error_function PARAMS ((struct diagnostic_context *,
const char *));
extern void cxx_set_yydebug PARAMS ((int));
extern void build_self_reference PARAMS ((void));
extern int same_signature_p PARAMS ((tree, tree));

View file

@ -28,6 +28,7 @@ Boston, MA 02111-1307, USA. */
#include "toplev.h"
#include "flags.h"
#include "diagnostic.h"
#include "langhooks-def.h"
enum pad { none, before, after };
@ -104,8 +105,6 @@ static void dump_scope PARAMS ((tree, int));
static void dump_template_parms PARAMS ((tree, int, int));
static const char *function_category PARAMS ((tree));
static void lang_print_error_function PARAMS ((diagnostic_context *,
const char *));
static void maybe_print_instantiation_context PARAMS ((output_buffer *));
static void print_instantiation_full_context PARAMS ((output_buffer *));
static void print_instantiation_partial_context PARAMS ((output_buffer *, tree,
@ -125,7 +124,6 @@ static tree locate_error PARAMS ((const char *, va_list));
void
init_error ()
{
print_error_function = lang_print_error_function;
diagnostic_starter (global_dc) = cp_diagnostic_starter;
diagnostic_finalizer (global_dc) = cp_diagnostic_finalizer;
diagnostic_format_decoder (global_dc) = cp_printer;
@ -2375,14 +2373,15 @@ cv_to_string (p, v)
return output_finalize_message (scratch_buffer);
}
static void
lang_print_error_function (context, file)
/* Langhook for print_error_function. */
void
cxx_print_error_function (context, file)
diagnostic_context *context;
const char *file;
{
output_state os;
default_print_error_function (context, file);
lhd_print_error_function (context, file);
os = output_buffer_state (context);
output_set_prefix ((output_buffer *)context, file);
maybe_print_instantiation_context ((output_buffer *)context);

View file

@ -113,12 +113,6 @@ static tree last_error_function = NULL;
/* Used to detect when input_file_stack has changed since last described. */
static int last_error_tick;
/* Called by report_error_function to print out function name.
Default may be overridden by language front-ends. */
void (*print_error_function) PARAMS ((diagnostic_context *, const char *))
= default_print_error_function;
/* Prevent recursion into the error handler. */
static int diagnostic_lock;
@ -1087,7 +1081,7 @@ announce_function (decl)
an error. */
void
default_print_error_function (context, file)
lhd_print_error_function (context, file)
diagnostic_context *context;
const char *file;
{
@ -1130,7 +1124,7 @@ report_error_function (file)
const char *file ATTRIBUTE_UNUSED;
{
report_problematic_module ((output_buffer *) global_dc);
(*print_error_function) (global_dc, input_filename);
(*lang_hooks.print_error_function) (global_dc, input_filename);
}
void

View file

@ -310,12 +310,4 @@ extern int error_function_changed PARAMS ((void));
extern void record_last_error_function PARAMS ((void));
extern void report_problematic_module PARAMS ((output_buffer *));
/* Called by report_error_function to print out function name.
* Default may be overridden by language front-ends. */
extern void (*print_error_function) PARAMS ((diagnostic_context *,
const char *));
extern void default_print_error_function PARAMS ((diagnostic_context *,
const char *));
#endif /* ! GCC_DIAGNOSTIC_H */

View file

@ -1,3 +1,9 @@
Sun Mar 31 23:50:22 2002 Neil Booth <neil@daikokuya.demon.co.uk>
* com.c (lang_print_error_function): Rename.
(LANG_HOOKS_PRINT_ERROR_FUNCTION): Redefine.
(ffe_init): Don't set hook.
Fri Mar 29 21:59:15 2002 Neil Booth <neil@daikokuya.demon.co.uk>
* com.c (LANG_HOOKS_TYPE_FOR_MODE, LANG_HOOKS_TYPE_FOR_SIZE):

View file

@ -367,6 +367,7 @@ 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 *ffe_printable_name (tree decl, int v);
static void ffe_print_error_function (diagnostic_context *, const char *);
static tree lookup_name_current_level (tree name);
static struct binding_level *make_binding_level (void);
static void pop_f_function_context (void);
@ -13655,8 +13656,8 @@ ffe_printable_name (tree decl, int v)
an error. */
static void
lang_print_error_function (diagnostic_context *context __attribute__((unused)),
const char *file)
ffe_print_error_function (diagnostic_context *context __attribute__((unused)),
const char *file)
{
static ffeglobal last_g = NULL;
static ffesymbol last_s = NULL;
@ -14227,6 +14228,8 @@ static void ffe_mark_tree (tree);
#define LANG_HOOKS_PRINT_IDENTIFIER ffe_print_identifier
#undef LANG_HOOKS_DECL_PRINTABLE_NAME
#define LANG_HOOKS_DECL_PRINTABLE_NAME ffe_printable_name
#undef LANG_HOOKS_PRINT_ERROR_FUNCTION
#define LANG_HOOKS_PRINT_ERROR_FUNCTION ffe_print_error_function
#undef LANG_HOOKS_TYPE_FOR_MODE
#define LANG_HOOKS_TYPE_FOR_MODE ffe_type_for_mode
#undef LANG_HOOKS_TYPE_FOR_SIZE
@ -14293,7 +14296,6 @@ ffe_init (filename)
#endif
ffecom_init_decl_processing ();
print_error_function = lang_print_error_function;
/* If the file is output from cpp, it should contain a first line
`# 1 "real-filename"', and the current design of gcc (toplev.c

View file

@ -1,3 +1,12 @@
2002-03-31 Neil Booth <neil@daikokuya.demon.co.uk>
* lang.c (LANG_HOOKS_PRINT_ERROR_FUNCTION): Redefine.
(java_dummy_print): Remove.
(lang_print_error): Rename. Exit early if inhibiting output.
(inhibit_error_printing_function): New.
(java_init): Don't set hook.
(lang_init_source): Use new boolean.
2002-03-29 Martin Kahlert <martin.kahlert@infineon.com>
* parse.y (do_resolve_class): Fix infinite recursion.

View file

@ -54,8 +54,8 @@ static void java_init_options PARAMS ((void));
static int java_decode_option PARAMS ((int, char **));
static void put_decl_string PARAMS ((const char *, int));
static void put_decl_node PARAMS ((tree));
static void java_dummy_print PARAMS ((diagnostic_context *, const char *));
static void lang_print_error PARAMS ((diagnostic_context *, const char *));
static void java_print_error_function PARAMS ((diagnostic_context *,
const char *));
static int process_option_with_no PARAMS ((const char *,
const struct string_option *,
int));
@ -101,6 +101,10 @@ const char *const tree_code_name[] = {
};
#undef DEFTREECODE
/* Used to avoid printing error messages with bogus function
prototypes. Starts out false. */
static bool inhibit_error_function_printing;
int compiling_from_source;
char * resource_name;
@ -231,6 +235,8 @@ static int dependency_tracking = 0;
#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
#undef LANG_HOOKS_PRINT_ERROR_FUNCTION
#define LANG_HOOKS_PRINT_ERROR_FUNCTION java_print_error_function
#undef LANG_HOOKS_TYPE_FOR_MODE
#define LANG_HOOKS_TYPE_FOR_MODE java_type_for_mode
#undef LANG_HOOKS_TYPE_FOR_SIZE
@ -516,8 +522,6 @@ java_init (filename)
jcf_path_init ();
jcf_path_seal (version_flag);
print_error_function = lang_print_error;
java_init_decl_processing ();
using_eh_for_cleanups ();
@ -643,7 +647,7 @@ put_decl_node (node)
/* Return a user-friendly name for DECL.
The resulting string is only valid until the next call.
The value of the hook decl_printable_name is this function,
which is also called directly by lang_print_error. */
which is also called directly by java_print_error_function. */
const char *
lang_printable_name (decl, v)
@ -672,10 +676,10 @@ lang_printable_name_wls (decl, v)
}
/* Print on stderr the current class and method context. This function
is the value of the hook print_error_function, called from toplev.c. */
is the value of the hook print_error_function. */
static void
lang_print_error (context, file)
java_print_error_function (context, file)
diagnostic_context *context __attribute__((__unused__));
const char *file;
{
@ -692,6 +696,10 @@ lang_print_error (context, file)
initialized_p = 1;
}
/* Don't print error messages with bogus function prototypes. */
if (inhibit_error_function_printing)
return;
if (current_function_decl != NULL
&& DECL_CONTEXT (current_function_decl) != last_error_function_context)
{
@ -723,31 +731,17 @@ lang_print_error (context, file)
}
/* This doesn't do anything on purpose. It's used to satisfy the
print_error_function hook we don't print error messages with bogus
function prototypes. */
static void
java_dummy_print (c, s)
diagnostic_context *c __attribute__ ((__unused__));
const char *s __attribute__ ((__unused__));
{
}
/* Called to install the PRINT_ERROR_FUNCTION hook differently
according to LEVEL. LEVEL is 1 during early parsing, when function
prototypes aren't fully resolved. print_error_function is set so it
doesn't print incomplete function prototypes. When LEVEL is 2,
function prototypes are fully resolved and can be printed when
prototypes aren't fully resolved. java_print_error_function is set
so it doesn't print incomplete function prototypes. When LEVEL is
2, function prototypes are fully resolved and can be printed when
reporting errors. */
void lang_init_source (level)
int level;
{
if (level == 1)
print_error_function = java_dummy_print;
else
print_error_function = lang_print_error;
inhibit_error_function_printing = (level == 1);
}
static void

View file

@ -22,6 +22,8 @@ Boston, MA 02111-1307, USA. */
#ifndef GCC_LANG_HOOKS_DEF_H
#define GCC_LANG_HOOKS_DEF_H
struct diagnostic_context;
/* Provide a hook routine for alias sets that always returns 1. This is
used by languages that haven't deal with alias sets yet. */
extern HOST_WIDE_INT hook_get_alias_set_0 PARAMS ((tree));
@ -50,6 +52,8 @@ 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));
extern rtx lhd_expand_expr PARAMS ((tree, rtx, enum machine_mode, int));
extern void lhd_print_error_function PARAMS ((struct diagnostic_context *,
const char *));
/* Declarations of default tree inlining hooks. */
tree lhd_tree_inlining_walk_subtrees PARAMS ((tree *, int *,
@ -93,6 +97,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_PRINT_ERROR_FUNCTION lhd_print_error_function
#define LANG_HOOKS_DECL_PRINTABLE_NAME lhd_decl_printable_name
#define LANG_HOOKS_SET_YYDEBUG lhd_set_yydebug
@ -202,6 +207,7 @@ int lhd_tree_dump_type_quals PARAMS ((tree));
LANG_HOOKS_PRINT_TYPE, \
LANG_HOOKS_PRINT_IDENTIFIER, \
LANG_HOOKS_DECL_PRINTABLE_NAME, \
LANG_HOOKS_PRINT_ERROR_FUNCTION, \
LANG_HOOKS_SET_YYDEBUG, \
LANG_HOOKS_TREE_INLINING_INITIALIZER, \
LANG_HOOKS_TREE_DUMP_INITIALIZER, \

View file

@ -23,6 +23,8 @@ Boston, MA 02111-1307, USA. */
/* This file should be #include-d after tree.h. */
struct diagnostic_context;
/* A print hook for print_tree (). */
typedef void (*lang_print_tree_hook) PARAMS ((FILE *, tree, int indent));
@ -239,6 +241,10 @@ struct lang_hooks
types in C++. */
const char *(*decl_printable_name) PARAMS ((tree decl, int verbosity));
/* Called by report_error_function to print out function name. */
void (*print_error_function) PARAMS ((struct diagnostic_context *,
const char *));
/* 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. */