Commit 46f018e1 by Gabriel Dos Reis

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
parent eeb35b45
2001-06-28 Gabriel Dos Reis <gdr@codesourcery.com>
* 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 <kenner@vlsi1.ultra.nyu.edu> Thu Jun 28 06:16:45 2001 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
* expr.c (expand_assignment): When have varying-length object, * expr.c (expand_assignment): When have varying-length object,
......
2001-06-28 Gabriel Dos Reis <gdr@merlin.codesourcery.com>
* 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 <gdr@codesourcery.com> 2001-06-10 Gabriel Dos Reis <gdr@codesourcery.com>
* decl.c: #include diagnostic.h * decl.c: #include diagnostic.h
......
...@@ -286,7 +286,8 @@ grant.o: grant.c $(CONFIG_H) $(CHILL_TREE_H) $(RTL_H) $(srcdir)/../flags.h \ ...@@ -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 \ inout.o : inout.c $(CONFIG_H) $(CHILL_TREE_H) $(srcdir)/../flags.h \
$(srcdir)/../input.h $(srcdir)/../system.h $(srcdir)/../toplev.h $(srcdir)/../input.h $(srcdir)/../system.h $(srcdir)/../toplev.h
lang.o : lang.c $(CONFIG_H) $(CHILL_TREE_H) $(srcdir)/../input.h lex.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 \ lex.o : lex.c $(CONFIG_H) $(CHILL_TREE_H) $(RTL_H) $(srcdir)/../flags.h \
$(srcdir)/../input.h $(srcdir)/parse.h $(srcdir)/../system.h \ $(srcdir)/../input.h $(srcdir)/parse.h $(srcdir)/../system.h \
$(srcdir)/../toplev.h lex.h $(srcdir)/../dwarfout.h hash.h $(srcdir)/../toplev.h lex.h $(srcdir)/../dwarfout.h hash.h
......
...@@ -29,6 +29,7 @@ Boston, MA 02111-1307, USA. */ ...@@ -29,6 +29,7 @@ Boston, MA 02111-1307, USA. */
#include "toplev.h" #include "toplev.h"
#include "rtl.h" #include "rtl.h"
#include "expr.h" #include "expr.h"
#include "diagnostic.h"
/* Type node for boolean types. */ /* Type node for boolean types. */
...@@ -54,7 +55,8 @@ const char* chill_real_input_filename; ...@@ -54,7 +55,8 @@ const char* chill_real_input_filename;
extern FILE* finput; extern FILE* finput;
static int deep_const_expr PARAMS ((tree)); 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 /* Return 1 if the expression tree given has all
constant nodes as its leaves,otherwise. */ constant nodes as its leaves,otherwise. */
...@@ -229,7 +231,8 @@ lang_decode_option (argc, argv) ...@@ -229,7 +231,8 @@ lang_decode_option (argc, argv)
} }
static void static void
chill_print_error_function (file) chill_print_error_function (context, file)
diagnostic_context *buffer __attribute__((__unused__));
const char *file; const char *file;
{ {
static tree last_error_function = NULL_TREE; static tree last_error_function = NULL_TREE;
......
2001-06-28 Gabriel Dos Reis <gdr@merlin.codesourcery.com>
* error.c (lang_print_error_function): Add a `diagnostic_context *'
parameter. Tweak.
2001-06-27 Neil Booth <neil@cat.daikokuya.demon.co.uk> 2001-06-27 Neil Booth <neil@cat.daikokuya.demon.co.uk>
* decl2.c (import_export_class): Update. * decl2.c (import_export_class): Update.
......
...@@ -116,7 +116,8 @@ static void dump_scope PARAMS ((tree, int)); ...@@ -116,7 +116,8 @@ static void dump_scope PARAMS ((tree, int));
static void dump_template_parms PARAMS ((tree, int, int)); static void dump_template_parms PARAMS ((tree, int, int));
static const char *function_category PARAMS ((tree)); 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 maybe_print_instantiation_context PARAMS ((output_buffer *));
static void print_instantiation_full_context PARAMS ((output_buffer *)); static void print_instantiation_full_context PARAMS ((output_buffer *));
static void print_instantiation_partial_context PARAMS ((output_buffer *, tree, static void print_instantiation_partial_context PARAMS ((output_buffer *, tree,
...@@ -2470,16 +2471,17 @@ cv_to_string (p, v) ...@@ -2470,16 +2471,17 @@ cv_to_string (p, v)
} }
static void static void
lang_print_error_function (file) lang_print_error_function (context, file)
diagnostic_context *context;
const char *file; const char *file;
{ {
output_state os; output_state os;
default_print_error_function (file); default_print_error_function (context, file);
os = output_buffer_state (diagnostic_buffer); os = output_buffer_state (context);
output_set_prefix (diagnostic_buffer, file); output_set_prefix ((output_buffer *)context, file);
maybe_print_instantiation_context (diagnostic_buffer); maybe_print_instantiation_context ((output_buffer *)context);
output_buffer_state (diagnostic_buffer) = os; output_buffer_state (context) = os;
} }
static void static void
......
...@@ -121,8 +121,8 @@ static int last_error_tick; ...@@ -121,8 +121,8 @@ static int last_error_tick;
/* Called by report_error_function to print out function name. /* Called by report_error_function to print out function name.
Default may be overridden by language front-ends. */ Default may be overridden by language front-ends. */
void (*print_error_function) PARAMS ((const char *)) = void (*print_error_function) PARAMS ((diagnostic_context *, const char *))
default_print_error_function; = default_print_error_function;
/* Prevent recursion into the error handler. */ /* Prevent recursion into the error handler. */
static int diagnostic_lock; static int diagnostic_lock;
...@@ -1204,35 +1204,36 @@ announce_function (decl) ...@@ -1204,35 +1204,36 @@ announce_function (decl)
an error. */ an error. */
void void
default_print_error_function (file) default_print_error_function (context, file)
const char *file; diagnostic_context *context;
const char *file;
{ {
if (error_function_changed ()) if (error_function_changed ())
{ {
char *prefix = file ? build_message_string ("%s: ", file) : NULL; char *prefix = file ? build_message_string ("%s: ", file) : NULL;
output_state os; output_state os;
os = output_buffer_state (diagnostic_buffer); os = output_buffer_state (context);
output_set_prefix (diagnostic_buffer, prefix); output_set_prefix ((output_buffer *)context, prefix);
if (current_function_decl == NULL) if (current_function_decl == NULL)
output_add_string (diagnostic_buffer, _("At top level:")); output_add_string ((output_buffer *)context, _("At top level:"));
else else
{ {
if (TREE_CODE (TREE_TYPE (current_function_decl)) == METHOD_TYPE) if (TREE_CODE (TREE_TYPE (current_function_decl)) == METHOD_TYPE)
output_printf output_printf
(diagnostic_buffer, "In method `%s':", ((output_buffer *)context, "In member function `%s':",
(*decl_printable_name) (current_function_decl, 2)); (*decl_printable_name) (current_function_decl, 2));
else else
output_printf output_printf
(diagnostic_buffer, "In function `%s':", ((output_buffer *)context, "In function `%s':",
(*decl_printable_name) (current_function_decl, 2)); (*decl_printable_name) (current_function_decl, 2));
} }
output_add_newline (diagnostic_buffer); output_add_newline ((output_buffer *)context);
record_last_error_function (); record_last_error_function ();
output_buffer_to_stream (diagnostic_buffer); output_buffer_to_stream ((output_buffer *)context);
output_buffer_state (diagnostic_buffer) = os; output_buffer_state (context) = os;
free ((char*) prefix); free ((char*) prefix);
} }
} }
...@@ -1245,8 +1246,8 @@ void ...@@ -1245,8 +1246,8 @@ void
report_error_function (file) report_error_function (file)
const char *file ATTRIBUTE_UNUSED; const char *file ATTRIBUTE_UNUSED;
{ {
report_problematic_module (diagnostic_buffer); report_problematic_module ((output_buffer *)global_dc);
(*print_error_function) (input_filename); (*print_error_function) (global_dc, input_filename);
} }
void void
......
...@@ -310,4 +310,12 @@ extern int error_function_changed PARAMS ((void)); ...@@ -310,4 +310,12 @@ extern int error_function_changed PARAMS ((void));
extern void record_last_error_function PARAMS ((void)); extern void record_last_error_function PARAMS ((void));
extern void report_problematic_module PARAMS ((output_buffer *)); 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 */ #endif /* ! GCC_DIAGNOSTIC_H */
2001-06-28 Gabriel Dos Reis <gdr@codesourcery.com>
* 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 <mark@codesourcery.com> Wed Jun 13 11:22:39 2001 Mark Mitchell <mark@codesourcery.com>
* BUGS: Remove. * BUGS: Remove.
......
...@@ -417,7 +417,7 @@ f/com.o: f/com.c f/proj.h $(CONFIG_H) $(SYSTEM_H) flags.h $(RTL_H) $(TREE_H) \ ...@@ -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/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/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/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/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/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 \ f/info-k.def f/info-w.def f/target.h f/bad.h f/bad.def f/where.h glimits.h \
......
...@@ -89,6 +89,7 @@ the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA ...@@ -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 "output.h" /* Must follow tree.h so TREE_CODE is defined! */
#include "convert.h" #include "convert.h"
#include "ggc.h" #include "ggc.h"
#include "diagnostic.h"
#endif /* FFECOM_targetCURRENT == FFECOM_targetGCC */ #endif /* FFECOM_targetCURRENT == FFECOM_targetGCC */
#define FFECOM_GCC_INCLUDE 1 /* Enable -I. */ #define FFECOM_GCC_INCLUDE 1 /* Enable -I. */
...@@ -13989,7 +13990,7 @@ lang_printable_name (tree decl, int v) ...@@ -13989,7 +13990,7 @@ lang_printable_name (tree decl, int v)
#if BUILT_FOR_270 #if BUILT_FOR_270
static void 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 ffeglobal last_g = NULL;
static ffesymbol last_s = NULL; static ffesymbol last_s = NULL;
......
2001-06-28 Gabriel Dos Reis <gdr@codesourcery.com>
* 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 <apbianco@redhat.com> 2001-06-27 Alexandre Petit-Bianco <apbianco@redhat.com>
* class.c (set_super_info): Call `set_class_decl_access_flags.' * class.c (set_super_info): Call `set_class_decl_access_flags.'
......
...@@ -266,7 +266,7 @@ java/jcf-write.o: java/jcf-write.c $(CONFIG_H) $(JAVA_TREE_H) java/jcf.h \ ...@@ -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/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/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 \ 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) \ java/mangle.o: java/mangle.c $(CONFIG_H) java/jcf.h $(JAVA_TREE_H) $(SYSTEM_H) \
toplev.h $(GGC_H) toplev.h $(GGC_H)
java/mangle_name.o: java/mangle_name.c $(CONFIG_H) java/jcf.h $(JAVA_TREE_H) \ java/mangle_name.o: java/mangle_name.c $(CONFIG_H) java/jcf.h $(JAVA_TREE_H) \
......
...@@ -37,6 +37,7 @@ The Free Software Foundation is independent of Sun Microsystems, Inc. */ ...@@ -37,6 +37,7 @@ The Free Software Foundation is independent of Sun Microsystems, Inc. */
#include "flags.h" #include "flags.h"
#include "xref.h" #include "xref.h"
#include "ggc.h" #include "ggc.h"
#include "diagnostic.h"
struct string_option struct string_option
{ {
...@@ -50,8 +51,8 @@ static void java_init_options PARAMS ((void)); ...@@ -50,8 +51,8 @@ static void java_init_options PARAMS ((void));
static int java_decode_option PARAMS ((int, char **)); static int java_decode_option PARAMS ((int, char **));
static void put_decl_string PARAMS ((const char *, int)); static void put_decl_string PARAMS ((const char *, int));
static void put_decl_node PARAMS ((tree)); static void put_decl_node PARAMS ((tree));
static void java_dummy_print PARAMS ((const char *)); static void java_dummy_print PARAMS ((diagnostic_context *, const char *));
static void lang_print_error PARAMS ((const char *)); static void lang_print_error PARAMS ((diagnostic_context *, const char *));
static int process_option_with_no PARAMS ((char *, static int process_option_with_no PARAMS ((char *,
struct string_option *, struct string_option *,
int)); int));
...@@ -592,7 +593,8 @@ lang_printable_name_wls (decl, v) ...@@ -592,7 +593,8 @@ lang_printable_name_wls (decl, v)
is the value of the hook print_error_function, called from toplev.c. */ is the value of the hook print_error_function, called from toplev.c. */
static void static void
lang_print_error (file) lang_print_error (context, file)
diagnostic_context *context __attribute__((__unused__));
const char *file; const char *file;
{ {
static tree last_error_function_context = NULL_TREE; static tree last_error_function_context = NULL_TREE;
...@@ -673,7 +675,8 @@ java_init () ...@@ -673,7 +675,8 @@ java_init ()
function prototypes. */ function prototypes. */
static void static void
java_dummy_print (s) java_dummy_print (c, s)
diagnostic_context *c __attribute__ ((__unused__));
const char *s __attribute__ ((__unused__)); const char *s __attribute__ ((__unused__));
{ {
} }
......
...@@ -84,7 +84,6 @@ extern void error_with_file_and_line PARAMS ((const char *, int, ...@@ -84,7 +84,6 @@ extern void error_with_file_and_line PARAMS ((const char *, int,
ATTRIBUTE_PRINTF_3; ATTRIBUTE_PRINTF_3;
extern void sorry PARAMS ((const char *, ...)) extern void sorry PARAMS ((const char *, ...))
ATTRIBUTE_PRINTF_1; ATTRIBUTE_PRINTF_1;
extern void default_print_error_function PARAMS ((const char *));
extern void report_error_function PARAMS ((const char *)); extern void report_error_function PARAMS ((const char *));
extern void rest_of_decl_compilation PARAMS ((union tree_node *, extern void rest_of_decl_compilation PARAMS ((union tree_node *,
......
...@@ -2651,10 +2651,6 @@ extern void init_decl_processing PARAMS ((void)); ...@@ -2651,10 +2651,6 @@ extern void init_decl_processing PARAMS ((void));
/* Function to identify which front-end produced the output file. */ /* Function to identify which front-end produced the output file. */
extern const char *lang_identify PARAMS ((void)); 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. */ /* Function to replace the DECL_LANG_SPECIFIC field of a DECL with a copy. */
extern void copy_lang_decl PARAMS ((tree)); extern void copy_lang_decl PARAMS ((tree));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment