From: Gabriel Dos Reis Date: Thu, 28 Jun 2001 12:26:38 +0000 (+0000) Subject: diagnostic.c (default_print_error_function): Tweak. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=46f018e13847446f543aa9b396de15c9e322f8b3;p=gcc.git diagnostic.c (default_print_error_function): Tweak. * diagnostic.c (default_print_error_function): Tweak. (report_error_function): Likewise. * toplev.h (default_print_error_function): Move to... * diagnostic.h: ...here. Add a `diagnostic_context *' parameter. * tree.h (print_error_function): Move to... * diagnostic.h: ...here. Add a `diagnostic_context *' parameter. ch/ * lang.c: #include diagnostic.h (chill_print_error_function): Add a dummy `diagnostic_context *'. * Makefile.in (lang.o): Depend on diagnostic.h cp/ * error.c (lang_print_error_function): Add a `diagnostic_context *' parameter. Tweak. f/ * Make-lang.in (f/com.o): Depend on diagnostic.h * com.c: #include diagnostic.h (lang_print_error_function): Take a 'diagnostic_context *'. java/ * lang.c: #include diagnostic.h (lang_print_error): Add a `diagnostic_context *' parameter. (java_dummy_print): Likewise. * Make-lang.in (JAVA_LEX_C): Depend on diagnostic.h From-SVN: r43638 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 1d811e23fb2..e7ed3de7d7a 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,12 @@ +2001-06-28 Gabriel Dos Reis + + * diagnostic.c (default_print_error_function): Tweak. + (report_error_function): Likewise. + * toplev.h (default_print_error_function): Move to... + * diagnostic.h: ...here. Add a `diagnostic_context *' parameter. + * tree.h (print_error_function): Move to... + * diagnostic.h: ...here. Add a `diagnostic_context *' parameter. + Thu Jun 28 06:16:45 2001 Richard Kenner * expr.c (expand_assignment): When have varying-length object, diff --git a/gcc/ch/ChangeLog b/gcc/ch/ChangeLog index be600bd3da5..88fbd141297 100644 --- a/gcc/ch/ChangeLog +++ b/gcc/ch/ChangeLog @@ -1,3 +1,9 @@ +2001-06-28 Gabriel Dos Reis + + * lang.c: #include diagnostic.h + (chill_print_error_function): Add a dummy `diagnostic_context *'. + * Makefile.in (lang.o): Depend on diagnostic.h + 2001-06-10 Gabriel Dos Reis * decl.c: #include diagnostic.h diff --git a/gcc/ch/Makefile.in b/gcc/ch/Makefile.in index deb26f3a9bd..cfaf634141b 100644 --- a/gcc/ch/Makefile.in +++ b/gcc/ch/Makefile.in @@ -286,7 +286,8 @@ grant.o: grant.c $(CONFIG_H) $(CHILL_TREE_H) $(RTL_H) $(srcdir)/../flags.h \ inout.o : inout.c $(CONFIG_H) $(CHILL_TREE_H) $(srcdir)/../flags.h \ $(srcdir)/../input.h $(srcdir)/../system.h $(srcdir)/../toplev.h lang.o : lang.c $(CONFIG_H) $(CHILL_TREE_H) $(srcdir)/../input.h lex.h \ - $(srcdir)/../system.h $(srcdir)/../toplev.h $(EXPR_H) $(RTL_H) + $(srcdir)/../system.h $(srcdir)/../toplev.h $(EXPR_H) $(RTL_H) \ + $(srcdir)/../diagnostic.h lex.o : lex.c $(CONFIG_H) $(CHILL_TREE_H) $(RTL_H) $(srcdir)/../flags.h \ $(srcdir)/../input.h $(srcdir)/parse.h $(srcdir)/../system.h \ $(srcdir)/../toplev.h lex.h $(srcdir)/../dwarfout.h hash.h diff --git a/gcc/ch/lang.c b/gcc/ch/lang.c index 0c493b70bfe..b698b29aa1b 100644 --- a/gcc/ch/lang.c +++ b/gcc/ch/lang.c @@ -29,6 +29,7 @@ Boston, MA 02111-1307, USA. */ #include "toplev.h" #include "rtl.h" #include "expr.h" +#include "diagnostic.h" /* Type node for boolean types. */ @@ -54,7 +55,8 @@ const char* chill_real_input_filename; extern FILE* finput; static int deep_const_expr PARAMS ((tree)); -static void chill_print_error_function PARAMS ((const char *)); +static void chill_print_error_function PARAMS ((diagnostic_context *, + const char *)); /* Return 1 if the expression tree given has all constant nodes as its leaves,otherwise. */ @@ -229,7 +231,8 @@ lang_decode_option (argc, argv) } static void -chill_print_error_function (file) +chill_print_error_function (context, file) + diagnostic_context *buffer __attribute__((__unused__)); const char *file; { static tree last_error_function = NULL_TREE; diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 4e1abdaccf2..b0a186fa8d0 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2001-06-28 Gabriel Dos Reis + + * error.c (lang_print_error_function): Add a `diagnostic_context *' + parameter. Tweak. + 2001-06-27 Neil Booth * decl2.c (import_export_class): Update. diff --git a/gcc/cp/error.c b/gcc/cp/error.c index 5a8522a9f52..3bb043dd02e 100644 --- a/gcc/cp/error.c +++ b/gcc/cp/error.c @@ -116,7 +116,8 @@ 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 ((const char *)); +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, @@ -2470,16 +2471,17 @@ cv_to_string (p, v) } static void -lang_print_error_function (file) +lang_print_error_function (context, file) + diagnostic_context *context; const char *file; { output_state os; - default_print_error_function (file); - os = output_buffer_state (diagnostic_buffer); - output_set_prefix (diagnostic_buffer, file); - maybe_print_instantiation_context (diagnostic_buffer); - output_buffer_state (diagnostic_buffer) = os; + default_print_error_function (context, file); + os = output_buffer_state (context); + output_set_prefix ((output_buffer *)context, file); + maybe_print_instantiation_context ((output_buffer *)context); + output_buffer_state (context) = os; } static void diff --git a/gcc/diagnostic.c b/gcc/diagnostic.c index c306355ff25..8f400908ac6 100644 --- a/gcc/diagnostic.c +++ b/gcc/diagnostic.c @@ -121,8 +121,8 @@ 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 ((const char *)) = - default_print_error_function; +void (*print_error_function) PARAMS ((diagnostic_context *, const char *)) + = default_print_error_function; /* Prevent recursion into the error handler. */ static int diagnostic_lock; @@ -1204,35 +1204,36 @@ announce_function (decl) an error. */ void -default_print_error_function (file) - const char *file; +default_print_error_function (context, file) + diagnostic_context *context; + const char *file; { if (error_function_changed ()) { char *prefix = file ? build_message_string ("%s: ", file) : NULL; output_state os; - os = output_buffer_state (diagnostic_buffer); - output_set_prefix (diagnostic_buffer, prefix); + os = output_buffer_state (context); + output_set_prefix ((output_buffer *)context, prefix); if (current_function_decl == NULL) - output_add_string (diagnostic_buffer, _("At top level:")); + output_add_string ((output_buffer *)context, _("At top level:")); else { if (TREE_CODE (TREE_TYPE (current_function_decl)) == METHOD_TYPE) output_printf - (diagnostic_buffer, "In method `%s':", + ((output_buffer *)context, "In member function `%s':", (*decl_printable_name) (current_function_decl, 2)); else output_printf - (diagnostic_buffer, "In function `%s':", + ((output_buffer *)context, "In function `%s':", (*decl_printable_name) (current_function_decl, 2)); } - output_add_newline (diagnostic_buffer); + output_add_newline ((output_buffer *)context); record_last_error_function (); - output_buffer_to_stream (diagnostic_buffer); - output_buffer_state (diagnostic_buffer) = os; + output_buffer_to_stream ((output_buffer *)context); + output_buffer_state (context) = os; free ((char*) prefix); } } @@ -1245,8 +1246,8 @@ void report_error_function (file) const char *file ATTRIBUTE_UNUSED; { - report_problematic_module (diagnostic_buffer); - (*print_error_function) (input_filename); + report_problematic_module ((output_buffer *)global_dc); + (*print_error_function) (global_dc, input_filename); } void diff --git a/gcc/diagnostic.h b/gcc/diagnostic.h index 0e229bb9523..8722ab7da9b 100644 --- a/gcc/diagnostic.h +++ b/gcc/diagnostic.h @@ -310,4 +310,12 @@ 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 a458b28ff49..c2464d9f256 100644 --- a/gcc/f/ChangeLog +++ b/gcc/f/ChangeLog @@ -1,3 +1,9 @@ +2001-06-28 Gabriel Dos Reis + + * Make-lang.in (f/com.o): Depend on diagnostic.h + * com.c: #include diagnostic.h + (lang_print_error_function): Take a 'diagnostic_context *'. + Wed Jun 13 11:22:39 2001 Mark Mitchell * BUGS: Remove. diff --git a/gcc/f/Make-lang.in b/gcc/f/Make-lang.in index 14c1b8366ac..a35bd18f336 100644 --- a/gcc/f/Make-lang.in +++ b/gcc/f/Make-lang.in @@ -417,7 +417,7 @@ f/com.o: f/com.c f/proj.h $(CONFIG_H) $(SYSTEM_H) flags.h $(RTL_H) $(TREE_H) \ f/malloc.h f/info.h f/info-b.def f/info-k.def f/info-w.def f/target.h f/bad.h \ f/bad.def f/where.h glimits.h f/top.h f/lex.h f/type.h f/intrin.h \ f/intrin.def f/lab.h f/symbol.h f/symbol.def f/equiv.h f/storag.h f/global.h \ - f/name.h f/expr.h f/implic.h f/src.h f/st.h $(GGC_H) toplev.h + f/name.h f/expr.h f/implic.h f/src.h f/st.h $(GGC_H) toplev.h diagnostic.h f/data.o: f/data.c f/proj.h $(CONFIG_H) $(SYSTEM_H) f/data.h f/bld.h f/bld-op.def \ f/bit.h f/malloc.h f/com.h f/com-rt.def $(TREE_H) f/info.h f/info-b.def \ f/info-k.def f/info-w.def f/target.h f/bad.h f/bad.def f/where.h glimits.h \ diff --git a/gcc/f/com.c b/gcc/f/com.c index 871c4faa4f7..c5a50193e99 100644 --- a/gcc/f/com.c +++ b/gcc/f/com.c @@ -89,6 +89,7 @@ the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA #include "output.h" /* Must follow tree.h so TREE_CODE is defined! */ #include "convert.h" #include "ggc.h" +#include "diagnostic.h" #endif /* FFECOM_targetCURRENT == FFECOM_targetGCC */ #define FFECOM_GCC_INCLUDE 1 /* Enable -I. */ @@ -13989,7 +13990,7 @@ lang_printable_name (tree decl, int v) #if BUILT_FOR_270 static void -lang_print_error_function (const char *file) +lang_print_error_function (diagnostic_context *context, const char *file) { static ffeglobal last_g = NULL; static ffesymbol last_s = NULL; diff --git a/gcc/java/ChangeLog b/gcc/java/ChangeLog index 676f7be1d7b..2c5cdd27a1e 100644 --- a/gcc/java/ChangeLog +++ b/gcc/java/ChangeLog @@ -1,3 +1,10 @@ +2001-06-28 Gabriel Dos Reis + + * lang.c: #include diagnostic.h + (lang_print_error): Add a `diagnostic_context *' parameter. + (java_dummy_print): Likewise. + * Make-lang.in (JAVA_LEX_C): Depend on diagnostic.h + 2001-06-27 Alexandre Petit-Bianco * class.c (set_super_info): Call `set_class_decl_access_flags.' diff --git a/gcc/java/Make-lang.in b/gcc/java/Make-lang.in index 0cae9b2312b..87a66387361 100644 --- a/gcc/java/Make-lang.in +++ b/gcc/java/Make-lang.in @@ -266,7 +266,7 @@ java/jcf-write.o: java/jcf-write.c $(CONFIG_H) $(JAVA_TREE_H) java/jcf.h \ java/jv-scan.o: java/jv-scan.c $(CONFIG_H) $(SYSTEM_H) version.h java/jvgenmain.o: java/jvgenmain.c $(CONFIG_H) $(JAVA_TREE_H) $(SYSTEM_H) java/lang.o: java/lang.c $(CONFIG_H) $(JAVA_TREE_H) java/jcf.h input.h \ - toplev.h $(SYSTEM_H) $(RTL_H) $(EXPR_H) + toplev.h $(SYSTEM_H) $(RTL_H) $(EXPR_H) diagnostic.h java/mangle.o: java/mangle.c $(CONFIG_H) java/jcf.h $(JAVA_TREE_H) $(SYSTEM_H) \ toplev.h $(GGC_H) java/mangle_name.o: java/mangle_name.c $(CONFIG_H) java/jcf.h $(JAVA_TREE_H) \ diff --git a/gcc/java/lang.c b/gcc/java/lang.c index 0c0b4d6fdf0..e3567f50e01 100644 --- a/gcc/java/lang.c +++ b/gcc/java/lang.c @@ -37,6 +37,7 @@ The Free Software Foundation is independent of Sun Microsystems, Inc. */ #include "flags.h" #include "xref.h" #include "ggc.h" +#include "diagnostic.h" struct string_option { @@ -50,8 +51,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 ((const char *)); -static void lang_print_error PARAMS ((const char *)); +static void java_dummy_print PARAMS ((diagnostic_context *, const char *)); +static void lang_print_error PARAMS ((diagnostic_context *, const char *)); static int process_option_with_no PARAMS ((char *, struct string_option *, int)); @@ -592,7 +593,8 @@ lang_printable_name_wls (decl, v) is the value of the hook print_error_function, called from toplev.c. */ static void -lang_print_error (file) +lang_print_error (context, file) + diagnostic_context *context __attribute__((__unused__)); const char *file; { static tree last_error_function_context = NULL_TREE; @@ -673,7 +675,8 @@ java_init () function prototypes. */ static void -java_dummy_print (s) +java_dummy_print (c, s) + diagnostic_context *c __attribute__ ((__unused__)); const char *s __attribute__ ((__unused__)); { } diff --git a/gcc/toplev.h b/gcc/toplev.h index ca09e0ef2e8..2a6dad13dd7 100644 --- a/gcc/toplev.h +++ b/gcc/toplev.h @@ -84,7 +84,6 @@ extern void error_with_file_and_line PARAMS ((const char *, int, ATTRIBUTE_PRINTF_3; extern void sorry PARAMS ((const char *, ...)) ATTRIBUTE_PRINTF_1; -extern void default_print_error_function PARAMS ((const char *)); extern void report_error_function PARAMS ((const char *)); extern void rest_of_decl_compilation PARAMS ((union tree_node *, diff --git a/gcc/tree.h b/gcc/tree.h index 0d69d6bd199..4f8dbef44eb 100644 --- a/gcc/tree.h +++ b/gcc/tree.h @@ -2651,10 +2651,6 @@ extern void init_decl_processing PARAMS ((void)); /* Function to identify which front-end produced the output file. */ extern const char *lang_identify PARAMS ((void)); -/* Called by report_error_function to print out function name. - * Default may be overridden by language front-ends. */ -extern void (*print_error_function) PARAMS ((const char *)); - /* Function to replace the DECL_LANG_SPECIFIC field of a DECL with a copy. */ extern void copy_lang_decl PARAMS ((tree));