aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gcc/ChangeLog13
-rw-r--r--gcc/cp/ChangeLog10
-rw-r--r--gcc/cp/Make-lang.in3
-rw-r--r--gcc/cp/cp-lang.c2
-rw-r--r--gcc/cp/cp-tree.h4
-rw-r--r--gcc/cp/error.c11
-rw-r--r--gcc/diagnostic.c10
-rw-r--r--gcc/diagnostic.h8
-rw-r--r--gcc/f/ChangeLog6
-rw-r--r--gcc/f/com.c8
-rw-r--r--gcc/java/ChangeLog9
-rw-r--r--gcc/java/lang.c44
-rw-r--r--gcc/langhooks-def.h6
-rw-r--r--gcc/langhooks.h6
14 files changed, 89 insertions, 51 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index f37442f18d2..7dc14c0894b 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -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.
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 8dd802c9b1d..46bb3569395 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -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):
diff --git a/gcc/cp/Make-lang.in b/gcc/cp/Make-lang.in
index a4e8299382e..6db4e4c70d0 100644
--- a/gcc/cp/Make-lang.in
+++ b/gcc/cp/Make-lang.in
@@ -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) \
diff --git a/gcc/cp/cp-lang.c b/gcc/cp/cp-lang.c
index 5cd481de423..31ee285753e 100644
--- a/gcc/cp/cp-lang.c
+++ b/gcc/cp/cp-lang.c
@@ -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
diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h
index 1339fd6f173..b7aab09d313 100644
--- a/gcc/cp/cp-tree.h
+++ b/gcc/cp/cp-tree.h
@@ -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));
diff --git a/gcc/cp/error.c b/gcc/cp/error.c
index b411d27da7f..499f726b012 100644
--- a/gcc/cp/error.c
+++ b/gcc/cp/error.c
@@ -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);
diff --git a/gcc/diagnostic.c b/gcc/diagnostic.c
index 7cb9c9bbea7..15a614e6215 100644
--- a/gcc/diagnostic.c
+++ b/gcc/diagnostic.c
@@ -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
diff --git a/gcc/diagnostic.h b/gcc/diagnostic.h
index c864405c022..360b64bfa47 100644
--- a/gcc/diagnostic.h
+++ b/gcc/diagnostic.h
@@ -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 */
diff --git a/gcc/f/ChangeLog b/gcc/f/ChangeLog
index 74202a6f819..9719baa2f65 100644
--- a/gcc/f/ChangeLog
+++ b/gcc/f/ChangeLog
@@ -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):
diff --git a/gcc/f/com.c b/gcc/f/com.c
index fcff40150e0..d51fad32995 100644
--- a/gcc/f/com.c
+++ b/gcc/f/com.c
@@ -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
diff --git a/gcc/java/ChangeLog b/gcc/java/ChangeLog
index c66f9a6aaab..a7776f1952a 100644
--- a/gcc/java/ChangeLog
+++ b/gcc/java/ChangeLog
@@ -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.
diff --git a/gcc/java/lang.c b/gcc/java/lang.c
index 583af75eaf1..b56eea4ab16 100644
--- a/gcc/java/lang.c
+++ b/gcc/java/lang.c
@@ -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
diff --git a/gcc/langhooks-def.h b/gcc/langhooks-def.h
index 8679f235c9a..8ffd2a8af37 100644
--- a/gcc/langhooks-def.h
+++ b/gcc/langhooks-def.h
@@ -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, \
diff --git a/gcc/langhooks.h b/gcc/langhooks.h
index df404c53254..e0aad782121 100644
--- a/gcc/langhooks.h
+++ b/gcc/langhooks.h
@@ -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. */