gcc/gcc/diagnostic.c

1442 lines
40 KiB
C
Raw Normal View History

toplev.h (report_error_function): Remove. * toplev.h (report_error_function): Remove. * diagnostic.h (location_t): New datatype. (text_info): Likewise. (diagnostic_info): Likewise. (output_prefix): New macro. (diagnostic_last_function_changed): Likewise. (diagnostic_set_last_function): Likewise. (diagnostic_last_module_changed): Likewise. (diagnostic_set_last_module): Likewise. (report_diagnostic): Now macro. (diagnostic_set_info): Declare. * diagnostic.c (report_problematic_module): Rename to diagnostic_repor_current_module. (set_diagnostic_context): Remove. (count_error): Rename to diagnostic_error_count. (error_function_changed): Remove. (record_last_error_function): Likewise. (error_module_changed): Likewise. (record_last_error_module): Likewise. (context_as_prefix): Rename to diagnostic_build_prefix. (flush_diagnostic_buffer): Rename to diagnostic_flush_buffer. (diagnostic_set_info): New function. * objc/objc-act.c: #include diagnostic.h (error_with_ivar): Adjust call to count_error. (warn_with_method): Likewise. * objc/Make-lang.in (objc-act.o): Depend on diagnostic.h cp/ 2002-06-04 Gabriel Dos Reis <gdr@codesourcery.com> * error.c (cp_diagnostic_starter): Adjust call. (maybe_print_instantiation_context): Change prototype to take a 'diagnostic_info *'. (print_instantiation_full_context): Likewise. (print_instantiation_partial_context): Likewise. (cp_diagnostic_starter): Likewise. (cp_diagnostic_finalizer): Likewise. (cp_print_error_function): Likewise. (cp_printer): Take a secondary parameter as a 'text_info *'. Remove output_state savings. Adjust calls. f/ 2002-06-04 Gabriel Dos Reis <gdr@codesourcery.com> * bad.c (ffebad_start_): Adjust call to count_error. * Make-lang.in (f/bad.o): Depend on diagnostic.h * bad.c: #include diagnostic.h From-SVN: r54291
2002-06-05 21:35:45 +02:00
/* Language-independent diagnostic subroutines for the GNU Compiler Collection
input.h (lineno): Rename to ... * input.h (lineno): Rename to ... (input_line): ... here. * tree.h (lineno): Rename to ... (input_line): ... here. * scan.h (lineno): Rename to ... (input_line): ... here. * toplev.c (lineno): Rename to ... (input_line): ... here. (push_srcloc, pop_srcloc): Rename lineno to input_line. * c-common.c (c_expand_start_cond, fname_decl): Likewise. * c-decl.c (poplevel, pop_label_level, lookup_label, lookup_tag, store_parm_decls, c_expand_body_1): Likewise. * c-errors.c (pedwarn_c99): Likewise. * c-format.c (status_warning): Likewise. * c-lex.c (fe_file_change, cb_def_pragma, c_lex): Likewise. * c-opts.c (c_common_post_options, c_common_parse_file): Likewise. * c-parse.in (save_filename, maybe_type_qual, ifc): Likwise. * c-semantics.c (finish_stmt_tree, build_stmt, emit_local_var, gentrtl_goto_stmt, genrtl_expr_stmt_value, genrtl_decl_stmt, genrtl_if_stmt, genrtl_while_stmt, genrtl_do_stmt, genrtl_return_stmt, genrtl_for_stmt, build_break_stmt, build_continue_stmt, genrtl_switch_stmt, genrtl_asm_stmt, prep_stmt, find_reachable_label, expand_unreachable_stmt): Likewise. * coverage.c (create_coverage): Likewise. * diagnostic.c (pedwarn, sorry, error, fatal_error, internal_error, warning, diagnostic_report_current_module, inform): Likewise. * expr.c (expand_expr): Likewise. * integrate.c (expand_inline_function, output_inline_function): Likewise. * rtl-error.c (file_and_line_for_asm): Likewise. * tree-inline.c (find_alloca_call, find_builtin_longjmp_call, walk_tree): Likewise. * tree.c (make_node): Likewise. * ada, cp, f, java, objc, treelang: Likewise. ada * trans.c (build_unit_elab, set_lineno): Rename lineno to input_line. * utils.c (pushdecl, create_label_decl, begin_subprog_body, end_subprog_body): Likewise. * utils2.c (build_call_raise): Likewise. cp * class.c (finish_struct): Rename lineno to input_line. * decl.c (push_binding_level, pop_binding_level, suspend_binding_level, resume_binding_level, make_label_decl, use_label, start_function): Likewise. * decl2.c (warn_if_unknown_interface, start_static_initialization_or_destruction, generate_ctor_or_dtor_function, finish_file): Likewise. * error.c (cp_line_of, print_instantiation_full_context, print_instantiation_context): Likewise. * except.c (check_handlers_1, check_handlers): Likewise. * init.c (create_temporary_var): Likewise. * method.c (use_thunk, synthesize_method): Likewise. * parser.c (cp_lexer_set_source_position_from_token, cp_lexer_get_preprocessor_token): Likewise. * pt.c (push_tinst_level, pop_tinst_level, tsubst_friend_function, instantiate_class_template, tsubst_decl, tsubst, tsubst_expr, instantiate_decl): Likewise. * semantics.c (genrtl_try_block, finish_label_stmt, begin_class_definition, expand_body, genrtl_finish_function): Likewise. * tree.c (build_min_nt, build_min): Likewise. f * ansify.c (die_unless): Rename lineno to input_line. * com.c (ffecom_subscript_check_, ffecom_do_entry_, ffecom_gen_sfuncdef_, ffecom_start_progunit_, ffecom_sym_transform_, ffecom_sym_transform_assign_, bison_rule_pushlevel_, bison_rule_compstmt_, finish_function, store_parm_decls): Likewise. * intrin.c (ffeintrin_fulfill_generic): Likewise. * lex.c (ffelex_hash_, ffelex_include_, ffelex_next_line_, ffelex_file_fixed, ffelex_file_free): Likewise. * std.c (ffestd_exec_end): Likewise. * ste.c (ffeste_emit_line_note_, ffeste_start_block_, ffeste_start_stmt_): Likewise. * ste.h (ffeste_filelinenum, ffeste_set_line): Likewise. java * lex.h (lineno): Rename to ... (input_line): ... here * parse-scan.y (lineno): Rename to ... (input_line): ... here. (reset_report): Rename lineno to input_line. * check-init.c (check_init): Likewise. * class.c (push_class): Likewise. * decl.c (complete_start_java_method, end_java_method): Likewise. * expr.c (expand_byte_code): Likewise. * jcf-parse.c (give_name_to_class, parse_class_file): Likewise. * jcf-write.c (generate_bytecode_insns): Likewise. * lex.c (java_init_lex, java_allocate_new_line, do_java_lex): Likewise. * parse.h (YYNOT_TWICE): Likewise. * parse.y (empty_statement, expression_statement, java_pop_parser_context, java_parser_context_save_global, yyerror, register_fields, method_header, safe_layout_class, find_in_imports_on_demand, create_artificial_method, source_end_java_method, start_complete_expand_method, build_thisn_assign, java_complete_lhs, maybe_absorb_scoping_block): Likewise. objc * objc-act.c (objc_init): Rename lineno to input_line. (build_module_descriptor, build_selector_translation_table, build_protocol_template, build_method_prototype_list_template, build_category_template, build_selector_table, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template, add_instance_variable): Likewise. treelang * tree1.c (treelang_init): Rename lineno to input_line. From-SVN: r66333
2003-05-01 18:13:36 +02:00
Copyright (C) 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
Contributed by Gabriel Dos Reis <gdr@codesourcery.com>
Makefile.in, [...]: replace "GNU CC" with "GCC". * Makefile.in, alias.c, basic-block.h, bb-reorder.c, bitmap.c, bitmap.h, builtin-types.def, builtins.c, builtins.def, c-aux-info.c, c-common.c, c-common.def, c-common.h, c-convert.c, c-decl.c, c-dump.c, c-dump.h, c-errors.c, c-format.c, c-lang.c, c-lex.c, c-lex.h, c-parse.in, c-pragma.c, c-pragma.h, c-semantics.c, c-tree.h, c-typeck.c, caller-save.c, calls.c, collect2.c, collect2.h, combine.c, conditions.h, config.gcc, configure.frag, configure.in, conflict.c, convert.c, convert.h, cppspec.c, crtstuff.c, cse.c, cselib.c, cselib.h, dbxout.c, dbxout.h, defaults.h, dependence.c, df.c, df.h, diagnostic.c, diagnostic.h, doloop.c, dominance.c, dwarf.h, dwarf2.h, dwarf2asm.c, dwarf2asm.h, dwarf2out.c, dwarf2out.h, dwarfout.c, emit-rtl.c, errors.c, errors.h, except.c, except.h, exgettext, explow.c, expmed.c, expr.c, expr.h, final.c, fixproto, flags.h, flow.c, fold-const.c, fp-test.c, function.c, function.h, gbl-ctors.h, gcc.c, gcc.h, gcc.hlp, gccspec.c, gcov-io.h, gcse.c, genattr.c, genattrtab.c, gencheck.c, gencodes.c, genconfig.c, genemit.c, genextract.c, genflags.c, gengenrtl.c, genmultilib, genopinit.c, genoutput.c, genpeep.c, genrecog.c, gensupport.c, gensupport.h, ggc-callbacks.c, ggc-common.c, ggc-none.c, ggc-page.c, ggc-simple.c, ggc.h, global.c, graph.c, graph.h, gthr-aix.h, gthr-dce.h, gthr-posix.h, gthr-rtems.h, gthr-single.h, gthr-solaris.h, gthr-vxworks.h, gthr-win32.h, gthr.h, haifa-sched.c, halfpic.c, halfpic.h, hard-reg-set.h, hwint.h, ifcvt.c, input.h, insn-addr.h, integrate.c, integrate.h, jump.c, lcm.c, libgcc2.c, libgcc2.h, lists.c, local-alloc.c, loop.c, loop.h, machmode.def, machmode.h, main.c, mbchar.c, mbchar.h, mips-tdump.c, mips-tfile.c, mklibgcc.in, mkmap-flat.awk, mkmap-symver.awk, optabs.c, output.h, params.c, params.def, params.h, predict.c, predict.def, predict.h, prefix.c, prefix.h, print-rtl.c, print-tree.c, profile.c, protoize.c, read-rtl.c, real.c, real.h, recog.c, recog.h, reg-stack.c, regclass.c, regmove.c, regrename.c, regs.h, reload.c, reload.h, reload1.c, reorg.c, resource.c, resource.h, rtl.c, rtl.def, rtl.h, rtlanal.c, sbitmap.c, sbitmap.h, sched-deps.c, sched-ebb.c, sched-int.h, sched-rgn.c, sched-vis.c, sdbout.c, sdbout.h, sibcall.c, simplify-rtx.c, ssa-ccp.c, ssa-dce.c, ssa.c, ssa.h, stmt.c, stor-layout.c, stringpool.c, system.h, timevar.c, timevar.def, timevar.h, tlink.c, toplev.c, toplev.h, tree.c, tree.def, tree.h, tsystem.h, unroll.c, unwind-dw2-fde.c, unwind-dw2-fde.h, unwind-dw2.c, unwind-pe.h, unwind-sjlj.c, unwind.h, unwind.inc, varasm.c, varray.c, varray.h, xcoffout.c, xcoffout.h: replace "GNU CC" with "GCC". From-SVN: r45105
2001-08-22 16:35:51 +02:00
This file is part of GCC.
Makefile.in, [...]: replace "GNU CC" with "GCC". * Makefile.in, alias.c, basic-block.h, bb-reorder.c, bitmap.c, bitmap.h, builtin-types.def, builtins.c, builtins.def, c-aux-info.c, c-common.c, c-common.def, c-common.h, c-convert.c, c-decl.c, c-dump.c, c-dump.h, c-errors.c, c-format.c, c-lang.c, c-lex.c, c-lex.h, c-parse.in, c-pragma.c, c-pragma.h, c-semantics.c, c-tree.h, c-typeck.c, caller-save.c, calls.c, collect2.c, collect2.h, combine.c, conditions.h, config.gcc, configure.frag, configure.in, conflict.c, convert.c, convert.h, cppspec.c, crtstuff.c, cse.c, cselib.c, cselib.h, dbxout.c, dbxout.h, defaults.h, dependence.c, df.c, df.h, diagnostic.c, diagnostic.h, doloop.c, dominance.c, dwarf.h, dwarf2.h, dwarf2asm.c, dwarf2asm.h, dwarf2out.c, dwarf2out.h, dwarfout.c, emit-rtl.c, errors.c, errors.h, except.c, except.h, exgettext, explow.c, expmed.c, expr.c, expr.h, final.c, fixproto, flags.h, flow.c, fold-const.c, fp-test.c, function.c, function.h, gbl-ctors.h, gcc.c, gcc.h, gcc.hlp, gccspec.c, gcov-io.h, gcse.c, genattr.c, genattrtab.c, gencheck.c, gencodes.c, genconfig.c, genemit.c, genextract.c, genflags.c, gengenrtl.c, genmultilib, genopinit.c, genoutput.c, genpeep.c, genrecog.c, gensupport.c, gensupport.h, ggc-callbacks.c, ggc-common.c, ggc-none.c, ggc-page.c, ggc-simple.c, ggc.h, global.c, graph.c, graph.h, gthr-aix.h, gthr-dce.h, gthr-posix.h, gthr-rtems.h, gthr-single.h, gthr-solaris.h, gthr-vxworks.h, gthr-win32.h, gthr.h, haifa-sched.c, halfpic.c, halfpic.h, hard-reg-set.h, hwint.h, ifcvt.c, input.h, insn-addr.h, integrate.c, integrate.h, jump.c, lcm.c, libgcc2.c, libgcc2.h, lists.c, local-alloc.c, loop.c, loop.h, machmode.def, machmode.h, main.c, mbchar.c, mbchar.h, mips-tdump.c, mips-tfile.c, mklibgcc.in, mkmap-flat.awk, mkmap-symver.awk, optabs.c, output.h, params.c, params.def, params.h, predict.c, predict.def, predict.h, prefix.c, prefix.h, print-rtl.c, print-tree.c, profile.c, protoize.c, read-rtl.c, real.c, real.h, recog.c, recog.h, reg-stack.c, regclass.c, regmove.c, regrename.c, regs.h, reload.c, reload.h, reload1.c, reorg.c, resource.c, resource.h, rtl.c, rtl.def, rtl.h, rtlanal.c, sbitmap.c, sbitmap.h, sched-deps.c, sched-ebb.c, sched-int.h, sched-rgn.c, sched-vis.c, sdbout.c, sdbout.h, sibcall.c, simplify-rtx.c, ssa-ccp.c, ssa-dce.c, ssa.c, ssa.h, stmt.c, stor-layout.c, stringpool.c, system.h, timevar.c, timevar.def, timevar.h, tlink.c, toplev.c, toplev.h, tree.c, tree.def, tree.h, tsystem.h, unroll.c, unwind-dw2-fde.c, unwind-dw2-fde.h, unwind-dw2.c, unwind-pe.h, unwind-sjlj.c, unwind.h, unwind.inc, varasm.c, varray.c, varray.h, xcoffout.c, xcoffout.h: replace "GNU CC" with "GCC". From-SVN: r45105
2001-08-22 16:35:51 +02:00
GCC is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation; either version 2, or (at your option) any later
version.
Makefile.in, [...]: replace "GNU CC" with "GCC". * Makefile.in, alias.c, basic-block.h, bb-reorder.c, bitmap.c, bitmap.h, builtin-types.def, builtins.c, builtins.def, c-aux-info.c, c-common.c, c-common.def, c-common.h, c-convert.c, c-decl.c, c-dump.c, c-dump.h, c-errors.c, c-format.c, c-lang.c, c-lex.c, c-lex.h, c-parse.in, c-pragma.c, c-pragma.h, c-semantics.c, c-tree.h, c-typeck.c, caller-save.c, calls.c, collect2.c, collect2.h, combine.c, conditions.h, config.gcc, configure.frag, configure.in, conflict.c, convert.c, convert.h, cppspec.c, crtstuff.c, cse.c, cselib.c, cselib.h, dbxout.c, dbxout.h, defaults.h, dependence.c, df.c, df.h, diagnostic.c, diagnostic.h, doloop.c, dominance.c, dwarf.h, dwarf2.h, dwarf2asm.c, dwarf2asm.h, dwarf2out.c, dwarf2out.h, dwarfout.c, emit-rtl.c, errors.c, errors.h, except.c, except.h, exgettext, explow.c, expmed.c, expr.c, expr.h, final.c, fixproto, flags.h, flow.c, fold-const.c, fp-test.c, function.c, function.h, gbl-ctors.h, gcc.c, gcc.h, gcc.hlp, gccspec.c, gcov-io.h, gcse.c, genattr.c, genattrtab.c, gencheck.c, gencodes.c, genconfig.c, genemit.c, genextract.c, genflags.c, gengenrtl.c, genmultilib, genopinit.c, genoutput.c, genpeep.c, genrecog.c, gensupport.c, gensupport.h, ggc-callbacks.c, ggc-common.c, ggc-none.c, ggc-page.c, ggc-simple.c, ggc.h, global.c, graph.c, graph.h, gthr-aix.h, gthr-dce.h, gthr-posix.h, gthr-rtems.h, gthr-single.h, gthr-solaris.h, gthr-vxworks.h, gthr-win32.h, gthr.h, haifa-sched.c, halfpic.c, halfpic.h, hard-reg-set.h, hwint.h, ifcvt.c, input.h, insn-addr.h, integrate.c, integrate.h, jump.c, lcm.c, libgcc2.c, libgcc2.h, lists.c, local-alloc.c, loop.c, loop.h, machmode.def, machmode.h, main.c, mbchar.c, mbchar.h, mips-tdump.c, mips-tfile.c, mklibgcc.in, mkmap-flat.awk, mkmap-symver.awk, optabs.c, output.h, params.c, params.def, params.h, predict.c, predict.def, predict.h, prefix.c, prefix.h, print-rtl.c, print-tree.c, profile.c, protoize.c, read-rtl.c, real.c, real.h, recog.c, recog.h, reg-stack.c, regclass.c, regmove.c, regrename.c, regs.h, reload.c, reload.h, reload1.c, reorg.c, resource.c, resource.h, rtl.c, rtl.def, rtl.h, rtlanal.c, sbitmap.c, sbitmap.h, sched-deps.c, sched-ebb.c, sched-int.h, sched-rgn.c, sched-vis.c, sdbout.c, sdbout.h, sibcall.c, simplify-rtx.c, ssa-ccp.c, ssa-dce.c, ssa.c, ssa.h, stmt.c, stor-layout.c, stringpool.c, system.h, timevar.c, timevar.def, timevar.h, tlink.c, toplev.c, toplev.h, tree.c, tree.def, tree.h, tsystem.h, unroll.c, unwind-dw2-fde.c, unwind-dw2-fde.h, unwind-dw2.c, unwind-pe.h, unwind-sjlj.c, unwind.h, unwind.inc, varasm.c, varray.c, varray.h, xcoffout.c, xcoffout.h: replace "GNU CC" with "GCC". From-SVN: r45105
2001-08-22 16:35:51 +02:00
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
Makefile.in, [...]: replace "GNU CC" with "GCC". * Makefile.in, alias.c, basic-block.h, bb-reorder.c, bitmap.c, bitmap.h, builtin-types.def, builtins.c, builtins.def, c-aux-info.c, c-common.c, c-common.def, c-common.h, c-convert.c, c-decl.c, c-dump.c, c-dump.h, c-errors.c, c-format.c, c-lang.c, c-lex.c, c-lex.h, c-parse.in, c-pragma.c, c-pragma.h, c-semantics.c, c-tree.h, c-typeck.c, caller-save.c, calls.c, collect2.c, collect2.h, combine.c, conditions.h, config.gcc, configure.frag, configure.in, conflict.c, convert.c, convert.h, cppspec.c, crtstuff.c, cse.c, cselib.c, cselib.h, dbxout.c, dbxout.h, defaults.h, dependence.c, df.c, df.h, diagnostic.c, diagnostic.h, doloop.c, dominance.c, dwarf.h, dwarf2.h, dwarf2asm.c, dwarf2asm.h, dwarf2out.c, dwarf2out.h, dwarfout.c, emit-rtl.c, errors.c, errors.h, except.c, except.h, exgettext, explow.c, expmed.c, expr.c, expr.h, final.c, fixproto, flags.h, flow.c, fold-const.c, fp-test.c, function.c, function.h, gbl-ctors.h, gcc.c, gcc.h, gcc.hlp, gccspec.c, gcov-io.h, gcse.c, genattr.c, genattrtab.c, gencheck.c, gencodes.c, genconfig.c, genemit.c, genextract.c, genflags.c, gengenrtl.c, genmultilib, genopinit.c, genoutput.c, genpeep.c, genrecog.c, gensupport.c, gensupport.h, ggc-callbacks.c, ggc-common.c, ggc-none.c, ggc-page.c, ggc-simple.c, ggc.h, global.c, graph.c, graph.h, gthr-aix.h, gthr-dce.h, gthr-posix.h, gthr-rtems.h, gthr-single.h, gthr-solaris.h, gthr-vxworks.h, gthr-win32.h, gthr.h, haifa-sched.c, halfpic.c, halfpic.h, hard-reg-set.h, hwint.h, ifcvt.c, input.h, insn-addr.h, integrate.c, integrate.h, jump.c, lcm.c, libgcc2.c, libgcc2.h, lists.c, local-alloc.c, loop.c, loop.h, machmode.def, machmode.h, main.c, mbchar.c, mbchar.h, mips-tdump.c, mips-tfile.c, mklibgcc.in, mkmap-flat.awk, mkmap-symver.awk, optabs.c, output.h, params.c, params.def, params.h, predict.c, predict.def, predict.h, prefix.c, prefix.h, print-rtl.c, print-tree.c, profile.c, protoize.c, read-rtl.c, real.c, real.h, recog.c, recog.h, reg-stack.c, regclass.c, regmove.c, regrename.c, regs.h, reload.c, reload.h, reload1.c, reorg.c, resource.c, resource.h, rtl.c, rtl.def, rtl.h, rtlanal.c, sbitmap.c, sbitmap.h, sched-deps.c, sched-ebb.c, sched-int.h, sched-rgn.c, sched-vis.c, sdbout.c, sdbout.h, sibcall.c, simplify-rtx.c, ssa-ccp.c, ssa-dce.c, ssa.c, ssa.h, stmt.c, stor-layout.c, stringpool.c, system.h, timevar.c, timevar.def, timevar.h, tlink.c, toplev.c, toplev.h, tree.c, tree.def, tree.h, tsystem.h, unroll.c, unwind-dw2-fde.c, unwind-dw2-fde.h, unwind-dw2.c, unwind-pe.h, unwind-sjlj.c, unwind.h, unwind.inc, varasm.c, varray.c, varray.h, xcoffout.c, xcoffout.h: replace "GNU CC" with "GCC". From-SVN: r45105
2001-08-22 16:35:51 +02:00
along with GCC; see the file COPYING. If not, write to the Free
Software Foundation, 59 Temple Place - Suite 330, Boston, MA
02111-1307, USA. */
/* This file implements the language independent aspect of diagnostic
message module. */
#include "config.h"
#undef FLOAT /* This is for hpux. They should change hpux. */
#undef FFS /* Some systems define this in param.h. */
#include "system.h"
#include "coretypes.h"
#include "tm.h"
#include "tree.h"
#include "tm_p.h"
#include "flags.h"
#include "input.h"
#include "toplev.h"
#include "intl.h"
#include "diagnostic.h"
Makefile.in: Update. * 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 08:58:41 +01:00
#include "langhooks.h"
#include "langhooks-def.h"
#define output_text_length(BUFFER) (BUFFER)->line_length
#define is_starting_newline(BUFFER) (output_text_length (BUFFER) == 0)
#define line_wrap_cutoff(BUFFER) (BUFFER)->state.maximum_length
#define prefix_was_emitted_for(BUFFER) (BUFFER)->state.emitted_prefix_p
/* Prototypes. */
static void output_flush PARAMS ((output_buffer *));
toplev.h (report_error_function): Remove. * toplev.h (report_error_function): Remove. * diagnostic.h (location_t): New datatype. (text_info): Likewise. (diagnostic_info): Likewise. (output_prefix): New macro. (diagnostic_last_function_changed): Likewise. (diagnostic_set_last_function): Likewise. (diagnostic_last_module_changed): Likewise. (diagnostic_set_last_module): Likewise. (report_diagnostic): Now macro. (diagnostic_set_info): Declare. * diagnostic.c (report_problematic_module): Rename to diagnostic_repor_current_module. (set_diagnostic_context): Remove. (count_error): Rename to diagnostic_error_count. (error_function_changed): Remove. (record_last_error_function): Likewise. (error_module_changed): Likewise. (record_last_error_module): Likewise. (context_as_prefix): Rename to diagnostic_build_prefix. (flush_diagnostic_buffer): Rename to diagnostic_flush_buffer. (diagnostic_set_info): New function. * objc/objc-act.c: #include diagnostic.h (error_with_ivar): Adjust call to count_error. (warn_with_method): Likewise. * objc/Make-lang.in (objc-act.o): Depend on diagnostic.h cp/ 2002-06-04 Gabriel Dos Reis <gdr@codesourcery.com> * error.c (cp_diagnostic_starter): Adjust call. (maybe_print_instantiation_context): Change prototype to take a 'diagnostic_info *'. (print_instantiation_full_context): Likewise. (print_instantiation_partial_context): Likewise. (cp_diagnostic_starter): Likewise. (cp_diagnostic_finalizer): Likewise. (cp_print_error_function): Likewise. (cp_printer): Take a secondary parameter as a 'text_info *'. Remove output_state savings. Adjust calls. f/ 2002-06-04 Gabriel Dos Reis <gdr@codesourcery.com> * bad.c (ffebad_start_): Adjust call to count_error. * Make-lang.in (f/bad.o): Depend on diagnostic.h * bad.c: #include diagnostic.h From-SVN: r54291
2002-06-05 21:35:45 +02:00
static void output_do_verbatim PARAMS ((output_buffer *, text_info *));
static void output_buffer_to_stream PARAMS ((output_buffer *));
toplev.h (report_error_function): Remove. * toplev.h (report_error_function): Remove. * diagnostic.h (location_t): New datatype. (text_info): Likewise. (diagnostic_info): Likewise. (output_prefix): New macro. (diagnostic_last_function_changed): Likewise. (diagnostic_set_last_function): Likewise. (diagnostic_last_module_changed): Likewise. (diagnostic_set_last_module): Likewise. (report_diagnostic): Now macro. (diagnostic_set_info): Declare. * diagnostic.c (report_problematic_module): Rename to diagnostic_repor_current_module. (set_diagnostic_context): Remove. (count_error): Rename to diagnostic_error_count. (error_function_changed): Remove. (record_last_error_function): Likewise. (error_module_changed): Likewise. (record_last_error_module): Likewise. (context_as_prefix): Rename to diagnostic_build_prefix. (flush_diagnostic_buffer): Rename to diagnostic_flush_buffer. (diagnostic_set_info): New function. * objc/objc-act.c: #include diagnostic.h (error_with_ivar): Adjust call to count_error. (warn_with_method): Likewise. * objc/Make-lang.in (objc-act.o): Depend on diagnostic.h cp/ 2002-06-04 Gabriel Dos Reis <gdr@codesourcery.com> * error.c (cp_diagnostic_starter): Adjust call. (maybe_print_instantiation_context): Change prototype to take a 'diagnostic_info *'. (print_instantiation_full_context): Likewise. (print_instantiation_partial_context): Likewise. (cp_diagnostic_starter): Likewise. (cp_diagnostic_finalizer): Likewise. (cp_print_error_function): Likewise. (cp_printer): Take a secondary parameter as a 'text_info *'. Remove output_state savings. Adjust calls. f/ 2002-06-04 Gabriel Dos Reis <gdr@codesourcery.com> * bad.c (ffebad_start_): Adjust call to count_error. * Make-lang.in (f/bad.o): Depend on diagnostic.h * bad.c: #include diagnostic.h From-SVN: r54291
2002-06-05 21:35:45 +02:00
static void output_format PARAMS ((output_buffer *, text_info *));
static void output_indent PARAMS ((output_buffer *));
static char *build_message_string PARAMS ((const char *, ...))
ATTRIBUTE_PRINTF_1;
toplev.h (report_error_function): Remove. * toplev.h (report_error_function): Remove. * diagnostic.h (location_t): New datatype. (text_info): Likewise. (diagnostic_info): Likewise. (output_prefix): New macro. (diagnostic_last_function_changed): Likewise. (diagnostic_set_last_function): Likewise. (diagnostic_last_module_changed): Likewise. (diagnostic_set_last_module): Likewise. (report_diagnostic): Now macro. (diagnostic_set_info): Declare. * diagnostic.c (report_problematic_module): Rename to diagnostic_repor_current_module. (set_diagnostic_context): Remove. (count_error): Rename to diagnostic_error_count. (error_function_changed): Remove. (record_last_error_function): Likewise. (error_module_changed): Likewise. (record_last_error_module): Likewise. (context_as_prefix): Rename to diagnostic_build_prefix. (flush_diagnostic_buffer): Rename to diagnostic_flush_buffer. (diagnostic_set_info): New function. * objc/objc-act.c: #include diagnostic.h (error_with_ivar): Adjust call to count_error. (warn_with_method): Likewise. * objc/Make-lang.in (objc-act.o): Depend on diagnostic.h cp/ 2002-06-04 Gabriel Dos Reis <gdr@codesourcery.com> * error.c (cp_diagnostic_starter): Adjust call. (maybe_print_instantiation_context): Change prototype to take a 'diagnostic_info *'. (print_instantiation_full_context): Likewise. (print_instantiation_partial_context): Likewise. (cp_diagnostic_starter): Likewise. (cp_diagnostic_finalizer): Likewise. (cp_print_error_function): Likewise. (cp_printer): Take a secondary parameter as a 'text_info *'. Remove output_state savings. Adjust calls. f/ 2002-06-04 Gabriel Dos Reis <gdr@codesourcery.com> * bad.c (ffebad_start_): Adjust call to count_error. * Make-lang.in (f/bad.o): Depend on diagnostic.h * bad.c: #include diagnostic.h From-SVN: r54291
2002-06-05 21:35:45 +02:00
static void format_with_decl PARAMS ((output_buffer *, text_info *, tree));
static void diagnostic_for_decl PARAMS ((diagnostic_info *, tree));
static void set_real_maximum_length PARAMS ((output_buffer *));
static void output_unsigned_decimal PARAMS ((output_buffer *, unsigned int));
static void output_long_decimal PARAMS ((output_buffer *, long int));
static void output_long_unsigned_decimal PARAMS ((output_buffer *,
long unsigned int));
static void output_octal PARAMS ((output_buffer *, unsigned int));
static void output_long_octal PARAMS ((output_buffer *, unsigned long int));
static void output_hexadecimal PARAMS ((output_buffer *, unsigned int));
static void output_long_hexadecimal PARAMS ((output_buffer *,
unsigned long int));
static void output_append_r PARAMS ((output_buffer *, const char *, int));
static void wrap_text PARAMS ((output_buffer *, const char *, const char *));
static void maybe_wrap_text PARAMS ((output_buffer *, const char *,
const char *));
static void output_clear_data PARAMS ((output_buffer *));
toplev.h (report_error_function): Remove. * toplev.h (report_error_function): Remove. * diagnostic.h (location_t): New datatype. (text_info): Likewise. (diagnostic_info): Likewise. (output_prefix): New macro. (diagnostic_last_function_changed): Likewise. (diagnostic_set_last_function): Likewise. (diagnostic_last_module_changed): Likewise. (diagnostic_set_last_module): Likewise. (report_diagnostic): Now macro. (diagnostic_set_info): Declare. * diagnostic.c (report_problematic_module): Rename to diagnostic_repor_current_module. (set_diagnostic_context): Remove. (count_error): Rename to diagnostic_error_count. (error_function_changed): Remove. (record_last_error_function): Likewise. (error_module_changed): Likewise. (record_last_error_module): Likewise. (context_as_prefix): Rename to diagnostic_build_prefix. (flush_diagnostic_buffer): Rename to diagnostic_flush_buffer. (diagnostic_set_info): New function. * objc/objc-act.c: #include diagnostic.h (error_with_ivar): Adjust call to count_error. (warn_with_method): Likewise. * objc/Make-lang.in (objc-act.o): Depend on diagnostic.h cp/ 2002-06-04 Gabriel Dos Reis <gdr@codesourcery.com> * error.c (cp_diagnostic_starter): Adjust call. (maybe_print_instantiation_context): Change prototype to take a 'diagnostic_info *'. (print_instantiation_full_context): Likewise. (print_instantiation_partial_context): Likewise. (cp_diagnostic_starter): Likewise. (cp_diagnostic_finalizer): Likewise. (cp_print_error_function): Likewise. (cp_printer): Take a secondary parameter as a 'text_info *'. Remove output_state savings. Adjust calls. f/ 2002-06-04 Gabriel Dos Reis <gdr@codesourcery.com> * bad.c (ffebad_start_): Adjust call to count_error. * Make-lang.in (f/bad.o): Depend on diagnostic.h * bad.c: #include diagnostic.h From-SVN: r54291
2002-06-05 21:35:45 +02:00
static void default_diagnostic_starter PARAMS ((diagnostic_context *,
diagnostic_info *));
static void default_diagnostic_finalizer PARAMS ((diagnostic_context *,
diagnostic_info *));
toplev.h (report_error_function): Remove. * toplev.h (report_error_function): Remove. * diagnostic.h (location_t): New datatype. (text_info): Likewise. (diagnostic_info): Likewise. (output_prefix): New macro. (diagnostic_last_function_changed): Likewise. (diagnostic_set_last_function): Likewise. (diagnostic_last_module_changed): Likewise. (diagnostic_set_last_module): Likewise. (report_diagnostic): Now macro. (diagnostic_set_info): Declare. * diagnostic.c (report_problematic_module): Rename to diagnostic_repor_current_module. (set_diagnostic_context): Remove. (count_error): Rename to diagnostic_error_count. (error_function_changed): Remove. (record_last_error_function): Likewise. (error_module_changed): Likewise. (record_last_error_module): Likewise. (context_as_prefix): Rename to diagnostic_build_prefix. (flush_diagnostic_buffer): Rename to diagnostic_flush_buffer. (diagnostic_set_info): New function. * objc/objc-act.c: #include diagnostic.h (error_with_ivar): Adjust call to count_error. (warn_with_method): Likewise. * objc/Make-lang.in (objc-act.o): Depend on diagnostic.h cp/ 2002-06-04 Gabriel Dos Reis <gdr@codesourcery.com> * error.c (cp_diagnostic_starter): Adjust call. (maybe_print_instantiation_context): Change prototype to take a 'diagnostic_info *'. (print_instantiation_full_context): Likewise. (print_instantiation_partial_context): Likewise. (cp_diagnostic_starter): Likewise. (cp_diagnostic_finalizer): Likewise. (cp_print_error_function): Likewise. (cp_printer): Take a secondary parameter as a 'text_info *'. Remove output_state savings. Adjust calls. f/ 2002-06-04 Gabriel Dos Reis <gdr@codesourcery.com> * bad.c (ffebad_start_): Adjust call to count_error. * Make-lang.in (f/bad.o): Depend on diagnostic.h * bad.c: #include diagnostic.h From-SVN: r54291
2002-06-05 21:35:45 +02:00
static void error_recursion PARAMS ((diagnostic_context *)) ATTRIBUTE_NORETURN;
static bool text_specifies_location PARAMS ((text_info *, location_t *));
static void real_abort PARAMS ((void)) ATTRIBUTE_NORETURN;
extern int rtl_dump_and_exit;
extern int warnings_are_errors;
/* A diagnostic_context surrogate for stderr. */
static diagnostic_context global_diagnostic_context;
diagnostic_context *global_dc = &global_diagnostic_context;
/* Subroutine of output_set_maximum_length. Set up BUFFER's
internal maximum characters per line. */
static void
set_real_maximum_length (buffer)
output_buffer *buffer;
{
/* If we're told not to wrap lines then do the obvious thing. In case
we'll emit prefix only once per diagnostic message, it is appropriate
not to increase unnecessarily the line-length cut-off. */
toplev.h (report_error_function): Remove. * toplev.h (report_error_function): Remove. * diagnostic.h (location_t): New datatype. (text_info): Likewise. (diagnostic_info): Likewise. (output_prefix): New macro. (diagnostic_last_function_changed): Likewise. (diagnostic_set_last_function): Likewise. (diagnostic_last_module_changed): Likewise. (diagnostic_set_last_module): Likewise. (report_diagnostic): Now macro. (diagnostic_set_info): Declare. * diagnostic.c (report_problematic_module): Rename to diagnostic_repor_current_module. (set_diagnostic_context): Remove. (count_error): Rename to diagnostic_error_count. (error_function_changed): Remove. (record_last_error_function): Likewise. (error_module_changed): Likewise. (record_last_error_module): Likewise. (context_as_prefix): Rename to diagnostic_build_prefix. (flush_diagnostic_buffer): Rename to diagnostic_flush_buffer. (diagnostic_set_info): New function. * objc/objc-act.c: #include diagnostic.h (error_with_ivar): Adjust call to count_error. (warn_with_method): Likewise. * objc/Make-lang.in (objc-act.o): Depend on diagnostic.h cp/ 2002-06-04 Gabriel Dos Reis <gdr@codesourcery.com> * error.c (cp_diagnostic_starter): Adjust call. (maybe_print_instantiation_context): Change prototype to take a 'diagnostic_info *'. (print_instantiation_full_context): Likewise. (print_instantiation_partial_context): Likewise. (cp_diagnostic_starter): Likewise. (cp_diagnostic_finalizer): Likewise. (cp_print_error_function): Likewise. (cp_printer): Take a secondary parameter as a 'text_info *'. Remove output_state savings. Adjust calls. f/ 2002-06-04 Gabriel Dos Reis <gdr@codesourcery.com> * bad.c (ffebad_start_): Adjust call to count_error. * Make-lang.in (f/bad.o): Depend on diagnostic.h * bad.c: #include diagnostic.h From-SVN: r54291
2002-06-05 21:35:45 +02:00
if (!output_is_line_wrapping (buffer)
|| output_prefixing_rule (buffer) == DIAGNOSTICS_SHOW_PREFIX_ONCE
|| output_prefixing_rule (buffer) == DIAGNOSTICS_SHOW_PREFIX_NEVER)
line_wrap_cutoff (buffer) = output_line_cutoff (buffer);
else
{
toplev.h (report_error_function): Remove. * toplev.h (report_error_function): Remove. * diagnostic.h (location_t): New datatype. (text_info): Likewise. (diagnostic_info): Likewise. (output_prefix): New macro. (diagnostic_last_function_changed): Likewise. (diagnostic_set_last_function): Likewise. (diagnostic_last_module_changed): Likewise. (diagnostic_set_last_module): Likewise. (report_diagnostic): Now macro. (diagnostic_set_info): Declare. * diagnostic.c (report_problematic_module): Rename to diagnostic_repor_current_module. (set_diagnostic_context): Remove. (count_error): Rename to diagnostic_error_count. (error_function_changed): Remove. (record_last_error_function): Likewise. (error_module_changed): Likewise. (record_last_error_module): Likewise. (context_as_prefix): Rename to diagnostic_build_prefix. (flush_diagnostic_buffer): Rename to diagnostic_flush_buffer. (diagnostic_set_info): New function. * objc/objc-act.c: #include diagnostic.h (error_with_ivar): Adjust call to count_error. (warn_with_method): Likewise. * objc/Make-lang.in (objc-act.o): Depend on diagnostic.h cp/ 2002-06-04 Gabriel Dos Reis <gdr@codesourcery.com> * error.c (cp_diagnostic_starter): Adjust call. (maybe_print_instantiation_context): Change prototype to take a 'diagnostic_info *'. (print_instantiation_full_context): Likewise. (print_instantiation_partial_context): Likewise. (cp_diagnostic_starter): Likewise. (cp_diagnostic_finalizer): Likewise. (cp_print_error_function): Likewise. (cp_printer): Take a secondary parameter as a 'text_info *'. Remove output_state savings. Adjust calls. f/ 2002-06-04 Gabriel Dos Reis <gdr@codesourcery.com> * bad.c (ffebad_start_): Adjust call to count_error. * Make-lang.in (f/bad.o): Depend on diagnostic.h * bad.c: #include diagnostic.h From-SVN: r54291
2002-06-05 21:35:45 +02:00
int prefix_length = buffer->state.prefix ?
strlen (buffer->state.prefix) : 0;
/* If the prefix is ridiculously too long, output at least
32 characters. */
if (output_line_cutoff (buffer) - prefix_length < 32)
line_wrap_cutoff (buffer) = output_line_cutoff (buffer) + 32;
else
line_wrap_cutoff (buffer) = output_line_cutoff (buffer);
}
}
/* Sets the number of maximum characters per line BUFFER can output
in line-wrapping mode. A LENGTH value 0 suppresses line-wrapping. */
void
output_set_maximum_length (buffer, length)
output_buffer *buffer;
int length;
{
output_line_cutoff (buffer) = length;
set_real_maximum_length (buffer);
}
/* Sets BUFFER's PREFIX. */
void
output_set_prefix (buffer, prefix)
output_buffer *buffer;
diagnostic.c (output_maximum_width): Remove. 2000-06-06 Gabriel Dos Reis <gdr@codesourcery.com> * diagnostic.c (output_maximum_width): Remove. (doing_line_wrapping): Tweak. (diagnostic_buffer): New object. (global_output_buffer): New object. (output_destroy_prefix): New function. (default_initialize_buffer): Likewise. (reshape_diagnostic_buffer): Likewise. (initialize_diagnostics): Likewise. (output_clear): Tweak. (line_wrapper_printf): Adjust call to init_output_buffer. (vline_wrapper_message_with_location): Likewise. Use output_destroy_prefix. (v_message_with_decl): Likewise. * diagnostic.h (struct output_buffer): Constify prefix. (init_output_buffer, output_get_prefix): Constify. (diagnostic_message_length_per_line): Likewise. (reshape_diagnostic_buffer): Declare. (default_initialize_buffer): Declare. (initialize_diagnostics): Declare. (diagnostic_buffer): Declare new obbject. * toplev.c: #include diagnostic.h (display_help): Document diagnostic formatting options. (decode_f_option): Handle diagnostic formatting options. (main): Setup initialization for diagnostic messages outputter. * toplev.h (set_message_length): Remove. * Makefile.in (toplev.o): Depends upon diagnostic.h * invoke.texi : Document diagnostics formatting options. cp/ 2000-06-06 Gabriel Dos Reis <gdr@codesourcery.com> * lex.c (lang_init_options): Tweak. * decl2.c: Remove #inclusion of diagnostic.h (lang_decode_option): Move diagnostic formatting options to toplevel. * lang-options.h: Remove documentation for diagnostic options. * Makefile.in (lex.o): Depends upon diagnostic.h From-SVN: r34435
2000-06-06 22:11:40 +02:00
const char *prefix;
{
toplev.h (report_error_function): Remove. * toplev.h (report_error_function): Remove. * diagnostic.h (location_t): New datatype. (text_info): Likewise. (diagnostic_info): Likewise. (output_prefix): New macro. (diagnostic_last_function_changed): Likewise. (diagnostic_set_last_function): Likewise. (diagnostic_last_module_changed): Likewise. (diagnostic_set_last_module): Likewise. (report_diagnostic): Now macro. (diagnostic_set_info): Declare. * diagnostic.c (report_problematic_module): Rename to diagnostic_repor_current_module. (set_diagnostic_context): Remove. (count_error): Rename to diagnostic_error_count. (error_function_changed): Remove. (record_last_error_function): Likewise. (error_module_changed): Likewise. (record_last_error_module): Likewise. (context_as_prefix): Rename to diagnostic_build_prefix. (flush_diagnostic_buffer): Rename to diagnostic_flush_buffer. (diagnostic_set_info): New function. * objc/objc-act.c: #include diagnostic.h (error_with_ivar): Adjust call to count_error. (warn_with_method): Likewise. * objc/Make-lang.in (objc-act.o): Depend on diagnostic.h cp/ 2002-06-04 Gabriel Dos Reis <gdr@codesourcery.com> * error.c (cp_diagnostic_starter): Adjust call. (maybe_print_instantiation_context): Change prototype to take a 'diagnostic_info *'. (print_instantiation_full_context): Likewise. (print_instantiation_partial_context): Likewise. (cp_diagnostic_starter): Likewise. (cp_diagnostic_finalizer): Likewise. (cp_print_error_function): Likewise. (cp_printer): Take a secondary parameter as a 'text_info *'. Remove output_state savings. Adjust calls. f/ 2002-06-04 Gabriel Dos Reis <gdr@codesourcery.com> * bad.c (ffebad_start_): Adjust call to count_error. * Make-lang.in (f/bad.o): Depend on diagnostic.h * bad.c: #include diagnostic.h From-SVN: r54291
2002-06-05 21:35:45 +02:00
buffer->state.prefix = prefix;
set_real_maximum_length (buffer);
toplev.h (report_error_function): Remove. * toplev.h (report_error_function): Remove. * diagnostic.h (location_t): New datatype. (text_info): Likewise. (diagnostic_info): Likewise. (output_prefix): New macro. (diagnostic_last_function_changed): Likewise. (diagnostic_set_last_function): Likewise. (diagnostic_last_module_changed): Likewise. (diagnostic_set_last_module): Likewise. (report_diagnostic): Now macro. (diagnostic_set_info): Declare. * diagnostic.c (report_problematic_module): Rename to diagnostic_repor_current_module. (set_diagnostic_context): Remove. (count_error): Rename to diagnostic_error_count. (error_function_changed): Remove. (record_last_error_function): Likewise. (error_module_changed): Likewise. (record_last_error_module): Likewise. (context_as_prefix): Rename to diagnostic_build_prefix. (flush_diagnostic_buffer): Rename to diagnostic_flush_buffer. (diagnostic_set_info): New function. * objc/objc-act.c: #include diagnostic.h (error_with_ivar): Adjust call to count_error. (warn_with_method): Likewise. * objc/Make-lang.in (objc-act.o): Depend on diagnostic.h cp/ 2002-06-04 Gabriel Dos Reis <gdr@codesourcery.com> * error.c (cp_diagnostic_starter): Adjust call. (maybe_print_instantiation_context): Change prototype to take a 'diagnostic_info *'. (print_instantiation_full_context): Likewise. (print_instantiation_partial_context): Likewise. (cp_diagnostic_starter): Likewise. (cp_diagnostic_finalizer): Likewise. (cp_print_error_function): Likewise. (cp_printer): Take a secondary parameter as a 'text_info *'. Remove output_state savings. Adjust calls. f/ 2002-06-04 Gabriel Dos Reis <gdr@codesourcery.com> * bad.c (ffebad_start_): Adjust call to count_error. * Make-lang.in (f/bad.o): Depend on diagnostic.h * bad.c: #include diagnostic.h From-SVN: r54291
2002-06-05 21:35:45 +02:00
prefix_was_emitted_for (buffer) = false;
output_indentation (buffer) = 0;
}
/* Return a pointer to the last character emitted in the output
BUFFER area. A NULL pointer means no character available. */
const char *
output_last_position (buffer)
const output_buffer *buffer;
{
const char *p = NULL;
if (obstack_base (&buffer->obstack) != obstack_next_free (&buffer->obstack))
p = ((const char *) obstack_next_free (&buffer->obstack)) - 1;
return p;
}
/* Free BUFFER's prefix, a previously malloc'd string. */
diagnostic.c (output_maximum_width): Remove. 2000-06-06 Gabriel Dos Reis <gdr@codesourcery.com> * diagnostic.c (output_maximum_width): Remove. (doing_line_wrapping): Tweak. (diagnostic_buffer): New object. (global_output_buffer): New object. (output_destroy_prefix): New function. (default_initialize_buffer): Likewise. (reshape_diagnostic_buffer): Likewise. (initialize_diagnostics): Likewise. (output_clear): Tweak. (line_wrapper_printf): Adjust call to init_output_buffer. (vline_wrapper_message_with_location): Likewise. Use output_destroy_prefix. (v_message_with_decl): Likewise. * diagnostic.h (struct output_buffer): Constify prefix. (init_output_buffer, output_get_prefix): Constify. (diagnostic_message_length_per_line): Likewise. (reshape_diagnostic_buffer): Declare. (default_initialize_buffer): Declare. (initialize_diagnostics): Declare. (diagnostic_buffer): Declare new obbject. * toplev.c: #include diagnostic.h (display_help): Document diagnostic formatting options. (decode_f_option): Handle diagnostic formatting options. (main): Setup initialization for diagnostic messages outputter. * toplev.h (set_message_length): Remove. * Makefile.in (toplev.o): Depends upon diagnostic.h * invoke.texi : Document diagnostics formatting options. cp/ 2000-06-06 Gabriel Dos Reis <gdr@codesourcery.com> * lex.c (lang_init_options): Tweak. * decl2.c: Remove #inclusion of diagnostic.h (lang_decode_option): Move diagnostic formatting options to toplevel. * lang-options.h: Remove documentation for diagnostic options. * Makefile.in (lex.o): Depends upon diagnostic.h From-SVN: r34435
2000-06-06 22:11:40 +02:00
void
output_destroy_prefix (buffer)
output_buffer *buffer;
{
toplev.h (report_error_function): Remove. * toplev.h (report_error_function): Remove. * diagnostic.h (location_t): New datatype. (text_info): Likewise. (diagnostic_info): Likewise. (output_prefix): New macro. (diagnostic_last_function_changed): Likewise. (diagnostic_set_last_function): Likewise. (diagnostic_last_module_changed): Likewise. (diagnostic_set_last_module): Likewise. (report_diagnostic): Now macro. (diagnostic_set_info): Declare. * diagnostic.c (report_problematic_module): Rename to diagnostic_repor_current_module. (set_diagnostic_context): Remove. (count_error): Rename to diagnostic_error_count. (error_function_changed): Remove. (record_last_error_function): Likewise. (error_module_changed): Likewise. (record_last_error_module): Likewise. (context_as_prefix): Rename to diagnostic_build_prefix. (flush_diagnostic_buffer): Rename to diagnostic_flush_buffer. (diagnostic_set_info): New function. * objc/objc-act.c: #include diagnostic.h (error_with_ivar): Adjust call to count_error. (warn_with_method): Likewise. * objc/Make-lang.in (objc-act.o): Depend on diagnostic.h cp/ 2002-06-04 Gabriel Dos Reis <gdr@codesourcery.com> * error.c (cp_diagnostic_starter): Adjust call. (maybe_print_instantiation_context): Change prototype to take a 'diagnostic_info *'. (print_instantiation_full_context): Likewise. (print_instantiation_partial_context): Likewise. (cp_diagnostic_starter): Likewise. (cp_diagnostic_finalizer): Likewise. (cp_print_error_function): Likewise. (cp_printer): Take a secondary parameter as a 'text_info *'. Remove output_state savings. Adjust calls. f/ 2002-06-04 Gabriel Dos Reis <gdr@codesourcery.com> * bad.c (ffebad_start_): Adjust call to count_error. * Make-lang.in (f/bad.o): Depend on diagnostic.h * bad.c: #include diagnostic.h From-SVN: r54291
2002-06-05 21:35:45 +02:00
if (buffer->state.prefix != NULL)
diagnostic.c (output_maximum_width): Remove. 2000-06-06 Gabriel Dos Reis <gdr@codesourcery.com> * diagnostic.c (output_maximum_width): Remove. (doing_line_wrapping): Tweak. (diagnostic_buffer): New object. (global_output_buffer): New object. (output_destroy_prefix): New function. (default_initialize_buffer): Likewise. (reshape_diagnostic_buffer): Likewise. (initialize_diagnostics): Likewise. (output_clear): Tweak. (line_wrapper_printf): Adjust call to init_output_buffer. (vline_wrapper_message_with_location): Likewise. Use output_destroy_prefix. (v_message_with_decl): Likewise. * diagnostic.h (struct output_buffer): Constify prefix. (init_output_buffer, output_get_prefix): Constify. (diagnostic_message_length_per_line): Likewise. (reshape_diagnostic_buffer): Declare. (default_initialize_buffer): Declare. (initialize_diagnostics): Declare. (diagnostic_buffer): Declare new obbject. * toplev.c: #include diagnostic.h (display_help): Document diagnostic formatting options. (decode_f_option): Handle diagnostic formatting options. (main): Setup initialization for diagnostic messages outputter. * toplev.h (set_message_length): Remove. * Makefile.in (toplev.o): Depends upon diagnostic.h * invoke.texi : Document diagnostics formatting options. cp/ 2000-06-06 Gabriel Dos Reis <gdr@codesourcery.com> * lex.c (lang_init_options): Tweak. * decl2.c: Remove #inclusion of diagnostic.h (lang_decode_option): Move diagnostic formatting options to toplevel. * lang-options.h: Remove documentation for diagnostic options. * Makefile.in (lex.o): Depends upon diagnostic.h From-SVN: r34435
2000-06-06 22:11:40 +02:00
{
toplev.h (report_error_function): Remove. * toplev.h (report_error_function): Remove. * diagnostic.h (location_t): New datatype. (text_info): Likewise. (diagnostic_info): Likewise. (output_prefix): New macro. (diagnostic_last_function_changed): Likewise. (diagnostic_set_last_function): Likewise. (diagnostic_last_module_changed): Likewise. (diagnostic_set_last_module): Likewise. (report_diagnostic): Now macro. (diagnostic_set_info): Declare. * diagnostic.c (report_problematic_module): Rename to diagnostic_repor_current_module. (set_diagnostic_context): Remove. (count_error): Rename to diagnostic_error_count. (error_function_changed): Remove. (record_last_error_function): Likewise. (error_module_changed): Likewise. (record_last_error_module): Likewise. (context_as_prefix): Rename to diagnostic_build_prefix. (flush_diagnostic_buffer): Rename to diagnostic_flush_buffer. (diagnostic_set_info): New function. * objc/objc-act.c: #include diagnostic.h (error_with_ivar): Adjust call to count_error. (warn_with_method): Likewise. * objc/Make-lang.in (objc-act.o): Depend on diagnostic.h cp/ 2002-06-04 Gabriel Dos Reis <gdr@codesourcery.com> * error.c (cp_diagnostic_starter): Adjust call. (maybe_print_instantiation_context): Change prototype to take a 'diagnostic_info *'. (print_instantiation_full_context): Likewise. (print_instantiation_partial_context): Likewise. (cp_diagnostic_starter): Likewise. (cp_diagnostic_finalizer): Likewise. (cp_print_error_function): Likewise. (cp_printer): Take a secondary parameter as a 'text_info *'. Remove output_state savings. Adjust calls. f/ 2002-06-04 Gabriel Dos Reis <gdr@codesourcery.com> * bad.c (ffebad_start_): Adjust call to count_error. * Make-lang.in (f/bad.o): Depend on diagnostic.h * bad.c: #include diagnostic.h From-SVN: r54291
2002-06-05 21:35:45 +02:00
free ((char *) buffer->state.prefix);
buffer->state.prefix = NULL;
diagnostic.c (output_maximum_width): Remove. 2000-06-06 Gabriel Dos Reis <gdr@codesourcery.com> * diagnostic.c (output_maximum_width): Remove. (doing_line_wrapping): Tweak. (diagnostic_buffer): New object. (global_output_buffer): New object. (output_destroy_prefix): New function. (default_initialize_buffer): Likewise. (reshape_diagnostic_buffer): Likewise. (initialize_diagnostics): Likewise. (output_clear): Tweak. (line_wrapper_printf): Adjust call to init_output_buffer. (vline_wrapper_message_with_location): Likewise. Use output_destroy_prefix. (v_message_with_decl): Likewise. * diagnostic.h (struct output_buffer): Constify prefix. (init_output_buffer, output_get_prefix): Constify. (diagnostic_message_length_per_line): Likewise. (reshape_diagnostic_buffer): Declare. (default_initialize_buffer): Declare. (initialize_diagnostics): Declare. (diagnostic_buffer): Declare new obbject. * toplev.c: #include diagnostic.h (display_help): Document diagnostic formatting options. (decode_f_option): Handle diagnostic formatting options. (main): Setup initialization for diagnostic messages outputter. * toplev.h (set_message_length): Remove. * Makefile.in (toplev.o): Depends upon diagnostic.h * invoke.texi : Document diagnostics formatting options. cp/ 2000-06-06 Gabriel Dos Reis <gdr@codesourcery.com> * lex.c (lang_init_options): Tweak. * decl2.c: Remove #inclusion of diagnostic.h (lang_decode_option): Move diagnostic formatting options to toplevel. * lang-options.h: Remove documentation for diagnostic options. * Makefile.in (lex.o): Depends upon diagnostic.h From-SVN: r34435
2000-06-06 22:11:40 +02:00
}
}
/* Zero out any text output so far in BUFFER. */
void
output_clear_message_text (buffer)
output_buffer *buffer;
{
obstack_free (&buffer->obstack, obstack_base (&buffer->obstack));
output_text_length (buffer) = 0;
}
/* Zero out any formatting data used so far by BUFFER. */
static void
output_clear_data (buffer)
output_buffer *buffer;
{
prefix_was_emitted_for (buffer) = false;
output_indentation (buffer) = 0;
}
/* Construct an output BUFFER with PREFIX and of MAXIMUM_LENGTH
characters per line. */
void
init_output_buffer (buffer, prefix, maximum_length)
output_buffer *buffer;
diagnostic.c (output_maximum_width): Remove. 2000-06-06 Gabriel Dos Reis <gdr@codesourcery.com> * diagnostic.c (output_maximum_width): Remove. (doing_line_wrapping): Tweak. (diagnostic_buffer): New object. (global_output_buffer): New object. (output_destroy_prefix): New function. (default_initialize_buffer): Likewise. (reshape_diagnostic_buffer): Likewise. (initialize_diagnostics): Likewise. (output_clear): Tweak. (line_wrapper_printf): Adjust call to init_output_buffer. (vline_wrapper_message_with_location): Likewise. Use output_destroy_prefix. (v_message_with_decl): Likewise. * diagnostic.h (struct output_buffer): Constify prefix. (init_output_buffer, output_get_prefix): Constify. (diagnostic_message_length_per_line): Likewise. (reshape_diagnostic_buffer): Declare. (default_initialize_buffer): Declare. (initialize_diagnostics): Declare. (diagnostic_buffer): Declare new obbject. * toplev.c: #include diagnostic.h (display_help): Document diagnostic formatting options. (decode_f_option): Handle diagnostic formatting options. (main): Setup initialization for diagnostic messages outputter. * toplev.h (set_message_length): Remove. * Makefile.in (toplev.o): Depends upon diagnostic.h * invoke.texi : Document diagnostics formatting options. cp/ 2000-06-06 Gabriel Dos Reis <gdr@codesourcery.com> * lex.c (lang_init_options): Tweak. * decl2.c: Remove #inclusion of diagnostic.h (lang_decode_option): Move diagnostic formatting options to toplevel. * lang-options.h: Remove documentation for diagnostic options. * Makefile.in (lex.o): Depends upon diagnostic.h From-SVN: r34435
2000-06-06 22:11:40 +02:00
const char *prefix;
int maximum_length;
{
alias.c [...] (init_alias_analysis, [...]): Use memset () instead of bzero (). * alias.c (init_alias_analysis), calls.c (expand_call, emit_library_call_value_1), combine.c (init_reg_last_arrays), cse.c (new_basic_block), dbxout.c (dbxout_type), diagnostic.c (init_output_buffer, set_diagnostic_context), dwarf2out.c (equate_decl_number_to_die, build_abbrev_table), emit-rtl.c (init_emit_once), fold-const.c (mul_double, div_and_round_double), function.c (assign_parms), gcse.c (compute_can_copy, alloc_gcse_mem, alloc_reg_set_mem, record_one_set, compute_hash_table, compute_set_hash_table, compute_expr_hash_table), genattrtab.c (optimize_attrs), global.c (global_alloc, global_conflicts), haifa-sched.c (compute_trg_info, clear_units, schedule_block), integrate.c (initialize_for_inline, expand_inline_function), jump.c (thread_jumps), local-alloc.c (local_alloc), loop.c (combine_movables, count_loop_regs_set, load_mems_and_recount_loop_regs_set), print-tree.c (debug_tree), regclass.c (init_reg_sets, init_reg_sets_1, regclass, record_reg_classes, allocate_reg_info), reload.c (get_secondary_mem, remove_address_replacements, find_reloads), reload1.c (reload, set_initial_label_offsets, finish_spills, reload_as_needed, choose_reload_regs_init, reload_cse_simplify_operands), reorg.c (dbr_schedule), sbitmap.c (sbitmap_zero), simplify-rtx.c (simplify_plus_minus), ssa.c (rename_registers), stmt.c (expand_end_case), unroll.c (unroll_loop), varray.c (varray_grow), objc/objc-act.c: Use memset () instead of bzero (). ch: * actions.c (check_missing_cases), typeck.c (build_chill_slice, build_chill_cast): Use memset () instead of bzero (). cp: * class.c (duplicate_tag_error, build_vtbl_initializer), decl.c (push_binding_level), error.c (cp_tree_printer), pt.c (process_partial_specialization, tsubst_template_arg_vector), search.c (lookup_member): Use memset () instead of bzero (). java: * expr.c (note_instructions), jcf-io.c (find_class), jcf-parse.c (init_outgoing_cpool), lex.c (java_init_lex): Use memset () instead of bzero (). From-SVN: r37303
2000-11-07 23:50:06 +01:00
memset (buffer, 0, sizeof (output_buffer));
obstack_init (&buffer->obstack);
output_buffer_attached_stream (buffer) = stderr;
output_line_cutoff (buffer) = maximum_length;
output_prefixing_rule (buffer) = diagnostic_prefixing_rule (global_dc);
output_set_prefix (buffer, prefix);
output_text_length (buffer) = 0;
output_clear_data (buffer);
}
/* Reinitialize BUFFER. */
void
output_clear (buffer)
output_buffer *buffer;
{
output_clear_message_text (buffer);
output_clear_data (buffer);
}
/* Finishes constructing a NULL-terminated character string representing
the BUFFERed message. */
const char *
output_finalize_message (buffer)
output_buffer *buffer;
{
obstack_1grow (&buffer->obstack, '\0');
return output_message_text (buffer);
}
/* Return the amount of characters BUFFER can accept to
make a full line. */
int
output_space_left (buffer)
const output_buffer *buffer;
{
return line_wrap_cutoff (buffer) - output_text_length (buffer);
}
/* Write out BUFFER's prefix. */
void
output_emit_prefix (buffer)
output_buffer *buffer;
{
toplev.h (report_error_function): Remove. * toplev.h (report_error_function): Remove. * diagnostic.h (location_t): New datatype. (text_info): Likewise. (diagnostic_info): Likewise. (output_prefix): New macro. (diagnostic_last_function_changed): Likewise. (diagnostic_set_last_function): Likewise. (diagnostic_last_module_changed): Likewise. (diagnostic_set_last_module): Likewise. (report_diagnostic): Now macro. (diagnostic_set_info): Declare. * diagnostic.c (report_problematic_module): Rename to diagnostic_repor_current_module. (set_diagnostic_context): Remove. (count_error): Rename to diagnostic_error_count. (error_function_changed): Remove. (record_last_error_function): Likewise. (error_module_changed): Likewise. (record_last_error_module): Likewise. (context_as_prefix): Rename to diagnostic_build_prefix. (flush_diagnostic_buffer): Rename to diagnostic_flush_buffer. (diagnostic_set_info): New function. * objc/objc-act.c: #include diagnostic.h (error_with_ivar): Adjust call to count_error. (warn_with_method): Likewise. * objc/Make-lang.in (objc-act.o): Depend on diagnostic.h cp/ 2002-06-04 Gabriel Dos Reis <gdr@codesourcery.com> * error.c (cp_diagnostic_starter): Adjust call. (maybe_print_instantiation_context): Change prototype to take a 'diagnostic_info *'. (print_instantiation_full_context): Likewise. (print_instantiation_partial_context): Likewise. (cp_diagnostic_starter): Likewise. (cp_diagnostic_finalizer): Likewise. (cp_print_error_function): Likewise. (cp_printer): Take a secondary parameter as a 'text_info *'. Remove output_state savings. Adjust calls. f/ 2002-06-04 Gabriel Dos Reis <gdr@codesourcery.com> * bad.c (ffebad_start_): Adjust call to count_error. * Make-lang.in (f/bad.o): Depend on diagnostic.h * bad.c: #include diagnostic.h From-SVN: r54291
2002-06-05 21:35:45 +02:00
if (buffer->state.prefix != NULL)
{
switch (output_prefixing_rule (buffer))
{
default:
case DIAGNOSTICS_SHOW_PREFIX_NEVER:
break;
case DIAGNOSTICS_SHOW_PREFIX_ONCE:
if (prefix_was_emitted_for (buffer))
{
output_indent (buffer);
break;
}
output_indentation (buffer) += 3;
/* Fall through. */
case DIAGNOSTICS_SHOW_PREFIX_EVERY_LINE:
{
toplev.h (report_error_function): Remove. * toplev.h (report_error_function): Remove. * diagnostic.h (location_t): New datatype. (text_info): Likewise. (diagnostic_info): Likewise. (output_prefix): New macro. (diagnostic_last_function_changed): Likewise. (diagnostic_set_last_function): Likewise. (diagnostic_last_module_changed): Likewise. (diagnostic_set_last_module): Likewise. (report_diagnostic): Now macro. (diagnostic_set_info): Declare. * diagnostic.c (report_problematic_module): Rename to diagnostic_repor_current_module. (set_diagnostic_context): Remove. (count_error): Rename to diagnostic_error_count. (error_function_changed): Remove. (record_last_error_function): Likewise. (error_module_changed): Likewise. (record_last_error_module): Likewise. (context_as_prefix): Rename to diagnostic_build_prefix. (flush_diagnostic_buffer): Rename to diagnostic_flush_buffer. (diagnostic_set_info): New function. * objc/objc-act.c: #include diagnostic.h (error_with_ivar): Adjust call to count_error. (warn_with_method): Likewise. * objc/Make-lang.in (objc-act.o): Depend on diagnostic.h cp/ 2002-06-04 Gabriel Dos Reis <gdr@codesourcery.com> * error.c (cp_diagnostic_starter): Adjust call. (maybe_print_instantiation_context): Change prototype to take a 'diagnostic_info *'. (print_instantiation_full_context): Likewise. (print_instantiation_partial_context): Likewise. (cp_diagnostic_starter): Likewise. (cp_diagnostic_finalizer): Likewise. (cp_print_error_function): Likewise. (cp_printer): Take a secondary parameter as a 'text_info *'. Remove output_state savings. Adjust calls. f/ 2002-06-04 Gabriel Dos Reis <gdr@codesourcery.com> * bad.c (ffebad_start_): Adjust call to count_error. * Make-lang.in (f/bad.o): Depend on diagnostic.h * bad.c: #include diagnostic.h From-SVN: r54291
2002-06-05 21:35:45 +02:00
int prefix_length = strlen (buffer->state.prefix);
output_append_r (buffer, buffer->state.prefix, prefix_length);
prefix_was_emitted_for (buffer) = true;
}
break;
}
}
}
/* Have BUFFER start a new line. */
void
output_add_newline (buffer)
output_buffer *buffer;
{
obstack_1grow (&buffer->obstack, '\n');
output_text_length (buffer) = 0;
}
/* Appends a character to BUFFER. */
void
output_add_character (buffer, c)
output_buffer *buffer;
int c;
{
if (output_is_line_wrapping (buffer) && output_space_left (buffer) <= 0)
output_add_newline (buffer);
obstack_1grow (&buffer->obstack, c);
++output_text_length (buffer);
}
/* Adds a space to BUFFER. */
void
output_add_space (buffer)
output_buffer *buffer;
{
if (output_is_line_wrapping (buffer) && output_space_left (buffer) <= 0)
{
output_add_newline (buffer);
return;
}
obstack_1grow (&buffer->obstack, ' ');
++output_text_length (buffer);
}
/* These functions format an INTEGER into BUFFER as suggested by their
names. */
void
output_decimal (buffer, i)
output_buffer *buffer;
int i;
{
output_formatted_scalar (buffer, "%d", i);
}
static inline void
output_long_decimal (output_buffer *buffer, long int i)
{
output_formatted_scalar (buffer, "%ld", i);
}
static inline void
output_unsigned_decimal (output_buffer *buffer, unsigned int i)
{
output_formatted_scalar (buffer, "%u", i);
}
static inline void
output_long_unsigned_decimal (output_buffer *buffer, long unsigned int i)
{
output_formatted_scalar (buffer, "%lu", i);
}
static inline void
output_octal (output_buffer *buffer, unsigned int i)
{
output_formatted_scalar (buffer, "%o", i);
}
static inline void
output_long_octal (output_buffer *buffer, long unsigned int i)
{
output_formatted_scalar (buffer, "%lo", i);
}
static inline void
output_hexadecimal (output_buffer *buffer, unsigned int i)
{
output_formatted_scalar (buffer, "%x", i);
}
static inline void
output_long_hexadecimal (output_buffer *buffer, long unsigned int i)
{
output_formatted_scalar (buffer, "%lx", i);
}
static inline void
output_pointer (output_buffer *buffer, void *p)
{
output_formatted_scalar (buffer, HOST_PTR_PRINTF, p);
}
/* Append to BUFFER a string specified by its STARTING character
and LENGTH. */
static void
output_append_r (buffer, start, length)
output_buffer *buffer;
const char *start;
int length;
{
obstack_grow (&buffer->obstack, start, length);
output_text_length (buffer) += length;
}
/* Append a string deliminated by START and END to BUFFER. No wrapping is
toplev.h (report_error_function): Remove. * toplev.h (report_error_function): Remove. * diagnostic.h (location_t): New datatype. (text_info): Likewise. (diagnostic_info): Likewise. (output_prefix): New macro. (diagnostic_last_function_changed): Likewise. (diagnostic_set_last_function): Likewise. (diagnostic_last_module_changed): Likewise. (diagnostic_set_last_module): Likewise. (report_diagnostic): Now macro. (diagnostic_set_info): Declare. * diagnostic.c (report_problematic_module): Rename to diagnostic_repor_current_module. (set_diagnostic_context): Remove. (count_error): Rename to diagnostic_error_count. (error_function_changed): Remove. (record_last_error_function): Likewise. (error_module_changed): Likewise. (record_last_error_module): Likewise. (context_as_prefix): Rename to diagnostic_build_prefix. (flush_diagnostic_buffer): Rename to diagnostic_flush_buffer. (diagnostic_set_info): New function. * objc/objc-act.c: #include diagnostic.h (error_with_ivar): Adjust call to count_error. (warn_with_method): Likewise. * objc/Make-lang.in (objc-act.o): Depend on diagnostic.h cp/ 2002-06-04 Gabriel Dos Reis <gdr@codesourcery.com> * error.c (cp_diagnostic_starter): Adjust call. (maybe_print_instantiation_context): Change prototype to take a 'diagnostic_info *'. (print_instantiation_full_context): Likewise. (print_instantiation_partial_context): Likewise. (cp_diagnostic_starter): Likewise. (cp_diagnostic_finalizer): Likewise. (cp_print_error_function): Likewise. (cp_printer): Take a secondary parameter as a 'text_info *'. Remove output_state savings. Adjust calls. f/ 2002-06-04 Gabriel Dos Reis <gdr@codesourcery.com> * bad.c (ffebad_start_): Adjust call to count_error. * Make-lang.in (f/bad.o): Depend on diagnostic.h * bad.c: #include diagnostic.h From-SVN: r54291
2002-06-05 21:35:45 +02:00
done. However, if beginning a new line then emit BUFFER->state.prefix
and skip any leading whitespace if appropriate. The caller must ensure
that it is safe to do so. */
void
output_append (buffer, start, end)
output_buffer *buffer;
const char *start;
const char *end;
{
/* Emit prefix and skip whitespace if we're starting a new line. */
if (is_starting_newline (buffer))
{
output_emit_prefix (buffer);
if (output_is_line_wrapping (buffer))
while (start != end && *start == ' ')
++start;
}
output_append_r (buffer, start, end - start);
}
/* Insert enough spaces into BUFFER to bring the column position to
the current indentation level, assuming that a newline has just
been written to the buffer. */
static void
output_indent (buffer)
output_buffer *buffer;
{
int n = output_indentation (buffer);
int i;
for (i = 0; i < n; ++i)
output_add_character (buffer, ' ');
}
/* Wrap a text delimited by START and END into BUFFER. */
static void
wrap_text (buffer, start, end)
output_buffer *buffer;
const char *start;
const char *end;
{
toplev.h (report_error_function): Remove. * toplev.h (report_error_function): Remove. * diagnostic.h (location_t): New datatype. (text_info): Likewise. (diagnostic_info): Likewise. (output_prefix): New macro. (diagnostic_last_function_changed): Likewise. (diagnostic_set_last_function): Likewise. (diagnostic_last_module_changed): Likewise. (diagnostic_set_last_module): Likewise. (report_diagnostic): Now macro. (diagnostic_set_info): Declare. * diagnostic.c (report_problematic_module): Rename to diagnostic_repor_current_module. (set_diagnostic_context): Remove. (count_error): Rename to diagnostic_error_count. (error_function_changed): Remove. (record_last_error_function): Likewise. (error_module_changed): Likewise. (record_last_error_module): Likewise. (context_as_prefix): Rename to diagnostic_build_prefix. (flush_diagnostic_buffer): Rename to diagnostic_flush_buffer. (diagnostic_set_info): New function. * objc/objc-act.c: #include diagnostic.h (error_with_ivar): Adjust call to count_error. (warn_with_method): Likewise. * objc/Make-lang.in (objc-act.o): Depend on diagnostic.h cp/ 2002-06-04 Gabriel Dos Reis <gdr@codesourcery.com> * error.c (cp_diagnostic_starter): Adjust call. (maybe_print_instantiation_context): Change prototype to take a 'diagnostic_info *'. (print_instantiation_full_context): Likewise. (print_instantiation_partial_context): Likewise. (cp_diagnostic_starter): Likewise. (cp_diagnostic_finalizer): Likewise. (cp_print_error_function): Likewise. (cp_printer): Take a secondary parameter as a 'text_info *'. Remove output_state savings. Adjust calls. f/ 2002-06-04 Gabriel Dos Reis <gdr@codesourcery.com> * bad.c (ffebad_start_): Adjust call to count_error. * Make-lang.in (f/bad.o): Depend on diagnostic.h * bad.c: #include diagnostic.h From-SVN: r54291
2002-06-05 21:35:45 +02:00
bool is_wrapping = output_is_line_wrapping (buffer);
while (start != end)
{
/* Dump anything bordered by whitespaces. */
{
const char *p = start;
while (p != end && *p != ' ' && *p != '\n')
++p;
if (is_wrapping && p - start >= output_space_left (buffer))
output_add_newline (buffer);
output_append (buffer, start, p);
start = p;
}
if (start != end && *start == ' ')
{
output_add_space (buffer);
++start;
}
if (start != end && *start == '\n')
{
output_add_newline (buffer);
++start;
}
}
}
/* Same as wrap_text but wrap text only when in line-wrapping mode. */
static void
maybe_wrap_text (buffer, start, end)
output_buffer *buffer;
const char *start;
const char *end;
{
if (output_is_line_wrapping (buffer))
wrap_text (buffer, start, end);
else
output_append (buffer, start, end);
}
/* Append a STRING to BUFFER; the STRING might be line-wrapped if in
appropriate mode. */
void
output_add_string (buffer, str)
output_buffer *buffer;
const char *str;
{
maybe_wrap_text (buffer, str, str + (str ? strlen (str) : 0));
}
/* Append an identifier ID to BUFFER. */
void
output_add_identifier (buffer, id)
output_buffer *buffer;
tree id;
{
output_append (buffer, IDENTIFIER_POINTER (id),
IDENTIFIER_POINTER (id) + IDENTIFIER_LENGTH (id));
}
/* Flush the content of BUFFER onto the attached stream,
and reinitialize. */
static void
output_buffer_to_stream (buffer)
output_buffer *buffer;
{
const char *text = output_finalize_message (buffer);
fputs (text, output_buffer_attached_stream (buffer));
output_clear_message_text (buffer);
}
toplev.h (report_error_function): Remove. * toplev.h (report_error_function): Remove. * diagnostic.h (location_t): New datatype. (text_info): Likewise. (diagnostic_info): Likewise. (output_prefix): New macro. (diagnostic_last_function_changed): Likewise. (diagnostic_set_last_function): Likewise. (diagnostic_last_module_changed): Likewise. (diagnostic_set_last_module): Likewise. (report_diagnostic): Now macro. (diagnostic_set_info): Declare. * diagnostic.c (report_problematic_module): Rename to diagnostic_repor_current_module. (set_diagnostic_context): Remove. (count_error): Rename to diagnostic_error_count. (error_function_changed): Remove. (record_last_error_function): Likewise. (error_module_changed): Likewise. (record_last_error_module): Likewise. (context_as_prefix): Rename to diagnostic_build_prefix. (flush_diagnostic_buffer): Rename to diagnostic_flush_buffer. (diagnostic_set_info): New function. * objc/objc-act.c: #include diagnostic.h (error_with_ivar): Adjust call to count_error. (warn_with_method): Likewise. * objc/Make-lang.in (objc-act.o): Depend on diagnostic.h cp/ 2002-06-04 Gabriel Dos Reis <gdr@codesourcery.com> * error.c (cp_diagnostic_starter): Adjust call. (maybe_print_instantiation_context): Change prototype to take a 'diagnostic_info *'. (print_instantiation_full_context): Likewise. (print_instantiation_partial_context): Likewise. (cp_diagnostic_starter): Likewise. (cp_diagnostic_finalizer): Likewise. (cp_print_error_function): Likewise. (cp_printer): Take a secondary parameter as a 'text_info *'. Remove output_state savings. Adjust calls. f/ 2002-06-04 Gabriel Dos Reis <gdr@codesourcery.com> * bad.c (ffebad_start_): Adjust call to count_error. * Make-lang.in (f/bad.o): Depend on diagnostic.h * bad.c: #include diagnostic.h From-SVN: r54291
2002-06-05 21:35:45 +02:00
/* Format a message pointed to by TEXT. The following format specifiers are
recognized as being language independent:
%d, %i: (signed) integer in base ten.
%u: unsigned integer in base ten.
%o: unsigned integer in base eight.
%x: unsigned integer in base sixteen.
%ld, %li, %lo, %lu, %lx: long versions of the above.
%c: character.
%s: string.
%p: pointer.
%%: `%'.
%*.s: a substring the length of which is specified by an integer.
%H: location_t. */
static void
toplev.h (report_error_function): Remove. * toplev.h (report_error_function): Remove. * diagnostic.h (location_t): New datatype. (text_info): Likewise. (diagnostic_info): Likewise. (output_prefix): New macro. (diagnostic_last_function_changed): Likewise. (diagnostic_set_last_function): Likewise. (diagnostic_last_module_changed): Likewise. (diagnostic_set_last_module): Likewise. (report_diagnostic): Now macro. (diagnostic_set_info): Declare. * diagnostic.c (report_problematic_module): Rename to diagnostic_repor_current_module. (set_diagnostic_context): Remove. (count_error): Rename to diagnostic_error_count. (error_function_changed): Remove. (record_last_error_function): Likewise. (error_module_changed): Likewise. (record_last_error_module): Likewise. (context_as_prefix): Rename to diagnostic_build_prefix. (flush_diagnostic_buffer): Rename to diagnostic_flush_buffer. (diagnostic_set_info): New function. * objc/objc-act.c: #include diagnostic.h (error_with_ivar): Adjust call to count_error. (warn_with_method): Likewise. * objc/Make-lang.in (objc-act.o): Depend on diagnostic.h cp/ 2002-06-04 Gabriel Dos Reis <gdr@codesourcery.com> * error.c (cp_diagnostic_starter): Adjust call. (maybe_print_instantiation_context): Change prototype to take a 'diagnostic_info *'. (print_instantiation_full_context): Likewise. (print_instantiation_partial_context): Likewise. (cp_diagnostic_starter): Likewise. (cp_diagnostic_finalizer): Likewise. (cp_print_error_function): Likewise. (cp_printer): Take a secondary parameter as a 'text_info *'. Remove output_state savings. Adjust calls. f/ 2002-06-04 Gabriel Dos Reis <gdr@codesourcery.com> * bad.c (ffebad_start_): Adjust call to count_error. * Make-lang.in (f/bad.o): Depend on diagnostic.h * bad.c: #include diagnostic.h From-SVN: r54291
2002-06-05 21:35:45 +02:00
output_format (buffer, text)
output_buffer *buffer;
toplev.h (report_error_function): Remove. * toplev.h (report_error_function): Remove. * diagnostic.h (location_t): New datatype. (text_info): Likewise. (diagnostic_info): Likewise. (output_prefix): New macro. (diagnostic_last_function_changed): Likewise. (diagnostic_set_last_function): Likewise. (diagnostic_last_module_changed): Likewise. (diagnostic_set_last_module): Likewise. (report_diagnostic): Now macro. (diagnostic_set_info): Declare. * diagnostic.c (report_problematic_module): Rename to diagnostic_repor_current_module. (set_diagnostic_context): Remove. (count_error): Rename to diagnostic_error_count. (error_function_changed): Remove. (record_last_error_function): Likewise. (error_module_changed): Likewise. (record_last_error_module): Likewise. (context_as_prefix): Rename to diagnostic_build_prefix. (flush_diagnostic_buffer): Rename to diagnostic_flush_buffer. (diagnostic_set_info): New function. * objc/objc-act.c: #include diagnostic.h (error_with_ivar): Adjust call to count_error. (warn_with_method): Likewise. * objc/Make-lang.in (objc-act.o): Depend on diagnostic.h cp/ 2002-06-04 Gabriel Dos Reis <gdr@codesourcery.com> * error.c (cp_diagnostic_starter): Adjust call. (maybe_print_instantiation_context): Change prototype to take a 'diagnostic_info *'. (print_instantiation_full_context): Likewise. (print_instantiation_partial_context): Likewise. (cp_diagnostic_starter): Likewise. (cp_diagnostic_finalizer): Likewise. (cp_print_error_function): Likewise. (cp_printer): Take a secondary parameter as a 'text_info *'. Remove output_state savings. Adjust calls. f/ 2002-06-04 Gabriel Dos Reis <gdr@codesourcery.com> * bad.c (ffebad_start_): Adjust call to count_error. * Make-lang.in (f/bad.o): Depend on diagnostic.h * bad.c: #include diagnostic.h From-SVN: r54291
2002-06-05 21:35:45 +02:00
text_info *text;
{
toplev.h (report_error_function): Remove. * toplev.h (report_error_function): Remove. * diagnostic.h (location_t): New datatype. (text_info): Likewise. (diagnostic_info): Likewise. (output_prefix): New macro. (diagnostic_last_function_changed): Likewise. (diagnostic_set_last_function): Likewise. (diagnostic_last_module_changed): Likewise. (diagnostic_set_last_module): Likewise. (report_diagnostic): Now macro. (diagnostic_set_info): Declare. * diagnostic.c (report_problematic_module): Rename to diagnostic_repor_current_module. (set_diagnostic_context): Remove. (count_error): Rename to diagnostic_error_count. (error_function_changed): Remove. (record_last_error_function): Likewise. (error_module_changed): Likewise. (record_last_error_module): Likewise. (context_as_prefix): Rename to diagnostic_build_prefix. (flush_diagnostic_buffer): Rename to diagnostic_flush_buffer. (diagnostic_set_info): New function. * objc/objc-act.c: #include diagnostic.h (error_with_ivar): Adjust call to count_error. (warn_with_method): Likewise. * objc/Make-lang.in (objc-act.o): Depend on diagnostic.h cp/ 2002-06-04 Gabriel Dos Reis <gdr@codesourcery.com> * error.c (cp_diagnostic_starter): Adjust call. (maybe_print_instantiation_context): Change prototype to take a 'diagnostic_info *'. (print_instantiation_full_context): Likewise. (print_instantiation_partial_context): Likewise. (cp_diagnostic_starter): Likewise. (cp_diagnostic_finalizer): Likewise. (cp_print_error_function): Likewise. (cp_printer): Take a secondary parameter as a 'text_info *'. Remove output_state savings. Adjust calls. f/ 2002-06-04 Gabriel Dos Reis <gdr@codesourcery.com> * bad.c (ffebad_start_): Adjust call to count_error. * Make-lang.in (f/bad.o): Depend on diagnostic.h * bad.c: #include diagnostic.h From-SVN: r54291
2002-06-05 21:35:45 +02:00
for (; *text->format_spec; ++text->format_spec)
{
toplev.h (report_error_function): Remove. * toplev.h (report_error_function): Remove. * diagnostic.h (location_t): New datatype. (text_info): Likewise. (diagnostic_info): Likewise. (output_prefix): New macro. (diagnostic_last_function_changed): Likewise. (diagnostic_set_last_function): Likewise. (diagnostic_last_module_changed): Likewise. (diagnostic_set_last_module): Likewise. (report_diagnostic): Now macro. (diagnostic_set_info): Declare. * diagnostic.c (report_problematic_module): Rename to diagnostic_repor_current_module. (set_diagnostic_context): Remove. (count_error): Rename to diagnostic_error_count. (error_function_changed): Remove. (record_last_error_function): Likewise. (error_module_changed): Likewise. (record_last_error_module): Likewise. (context_as_prefix): Rename to diagnostic_build_prefix. (flush_diagnostic_buffer): Rename to diagnostic_flush_buffer. (diagnostic_set_info): New function. * objc/objc-act.c: #include diagnostic.h (error_with_ivar): Adjust call to count_error. (warn_with_method): Likewise. * objc/Make-lang.in (objc-act.o): Depend on diagnostic.h cp/ 2002-06-04 Gabriel Dos Reis <gdr@codesourcery.com> * error.c (cp_diagnostic_starter): Adjust call. (maybe_print_instantiation_context): Change prototype to take a 'diagnostic_info *'. (print_instantiation_full_context): Likewise. (print_instantiation_partial_context): Likewise. (cp_diagnostic_starter): Likewise. (cp_diagnostic_finalizer): Likewise. (cp_print_error_function): Likewise. (cp_printer): Take a secondary parameter as a 'text_info *'. Remove output_state savings. Adjust calls. f/ 2002-06-04 Gabriel Dos Reis <gdr@codesourcery.com> * bad.c (ffebad_start_): Adjust call to count_error. * Make-lang.in (f/bad.o): Depend on diagnostic.h * bad.c: #include diagnostic.h From-SVN: r54291
2002-06-05 21:35:45 +02:00
bool long_integer = 0;
/* Ignore text. */
{
toplev.h (report_error_function): Remove. * toplev.h (report_error_function): Remove. * diagnostic.h (location_t): New datatype. (text_info): Likewise. (diagnostic_info): Likewise. (output_prefix): New macro. (diagnostic_last_function_changed): Likewise. (diagnostic_set_last_function): Likewise. (diagnostic_last_module_changed): Likewise. (diagnostic_set_last_module): Likewise. (report_diagnostic): Now macro. (diagnostic_set_info): Declare. * diagnostic.c (report_problematic_module): Rename to diagnostic_repor_current_module. (set_diagnostic_context): Remove. (count_error): Rename to diagnostic_error_count. (error_function_changed): Remove. (record_last_error_function): Likewise. (error_module_changed): Likewise. (record_last_error_module): Likewise. (context_as_prefix): Rename to diagnostic_build_prefix. (flush_diagnostic_buffer): Rename to diagnostic_flush_buffer. (diagnostic_set_info): New function. * objc/objc-act.c: #include diagnostic.h (error_with_ivar): Adjust call to count_error. (warn_with_method): Likewise. * objc/Make-lang.in (objc-act.o): Depend on diagnostic.h cp/ 2002-06-04 Gabriel Dos Reis <gdr@codesourcery.com> * error.c (cp_diagnostic_starter): Adjust call. (maybe_print_instantiation_context): Change prototype to take a 'diagnostic_info *'. (print_instantiation_full_context): Likewise. (print_instantiation_partial_context): Likewise. (cp_diagnostic_starter): Likewise. (cp_diagnostic_finalizer): Likewise. (cp_print_error_function): Likewise. (cp_printer): Take a secondary parameter as a 'text_info *'. Remove output_state savings. Adjust calls. f/ 2002-06-04 Gabriel Dos Reis <gdr@codesourcery.com> * bad.c (ffebad_start_): Adjust call to count_error. * Make-lang.in (f/bad.o): Depend on diagnostic.h * bad.c: #include diagnostic.h From-SVN: r54291
2002-06-05 21:35:45 +02:00
const char *p = text->format_spec;
while (*p && *p != '%')
++p;
toplev.h (report_error_function): Remove. * toplev.h (report_error_function): Remove. * diagnostic.h (location_t): New datatype. (text_info): Likewise. (diagnostic_info): Likewise. (output_prefix): New macro. (diagnostic_last_function_changed): Likewise. (diagnostic_set_last_function): Likewise. (diagnostic_last_module_changed): Likewise. (diagnostic_set_last_module): Likewise. (report_diagnostic): Now macro. (diagnostic_set_info): Declare. * diagnostic.c (report_problematic_module): Rename to diagnostic_repor_current_module. (set_diagnostic_context): Remove. (count_error): Rename to diagnostic_error_count. (error_function_changed): Remove. (record_last_error_function): Likewise. (error_module_changed): Likewise. (record_last_error_module): Likewise. (context_as_prefix): Rename to diagnostic_build_prefix. (flush_diagnostic_buffer): Rename to diagnostic_flush_buffer. (diagnostic_set_info): New function. * objc/objc-act.c: #include diagnostic.h (error_with_ivar): Adjust call to count_error. (warn_with_method): Likewise. * objc/Make-lang.in (objc-act.o): Depend on diagnostic.h cp/ 2002-06-04 Gabriel Dos Reis <gdr@codesourcery.com> * error.c (cp_diagnostic_starter): Adjust call. (maybe_print_instantiation_context): Change prototype to take a 'diagnostic_info *'. (print_instantiation_full_context): Likewise. (print_instantiation_partial_context): Likewise. (cp_diagnostic_starter): Likewise. (cp_diagnostic_finalizer): Likewise. (cp_print_error_function): Likewise. (cp_printer): Take a secondary parameter as a 'text_info *'. Remove output_state savings. Adjust calls. f/ 2002-06-04 Gabriel Dos Reis <gdr@codesourcery.com> * bad.c (ffebad_start_): Adjust call to count_error. * Make-lang.in (f/bad.o): Depend on diagnostic.h * bad.c: #include diagnostic.h From-SVN: r54291
2002-06-05 21:35:45 +02:00
wrap_text (buffer, text->format_spec, p);
text->format_spec = p;
}
toplev.h (report_error_function): Remove. * toplev.h (report_error_function): Remove. * diagnostic.h (location_t): New datatype. (text_info): Likewise. (diagnostic_info): Likewise. (output_prefix): New macro. (diagnostic_last_function_changed): Likewise. (diagnostic_set_last_function): Likewise. (diagnostic_last_module_changed): Likewise. (diagnostic_set_last_module): Likewise. (report_diagnostic): Now macro. (diagnostic_set_info): Declare. * diagnostic.c (report_problematic_module): Rename to diagnostic_repor_current_module. (set_diagnostic_context): Remove. (count_error): Rename to diagnostic_error_count. (error_function_changed): Remove. (record_last_error_function): Likewise. (error_module_changed): Likewise. (record_last_error_module): Likewise. (context_as_prefix): Rename to diagnostic_build_prefix. (flush_diagnostic_buffer): Rename to diagnostic_flush_buffer. (diagnostic_set_info): New function. * objc/objc-act.c: #include diagnostic.h (error_with_ivar): Adjust call to count_error. (warn_with_method): Likewise. * objc/Make-lang.in (objc-act.o): Depend on diagnostic.h cp/ 2002-06-04 Gabriel Dos Reis <gdr@codesourcery.com> * error.c (cp_diagnostic_starter): Adjust call. (maybe_print_instantiation_context): Change prototype to take a 'diagnostic_info *'. (print_instantiation_full_context): Likewise. (print_instantiation_partial_context): Likewise. (cp_diagnostic_starter): Likewise. (cp_diagnostic_finalizer): Likewise. (cp_print_error_function): Likewise. (cp_printer): Take a secondary parameter as a 'text_info *'. Remove output_state savings. Adjust calls. f/ 2002-06-04 Gabriel Dos Reis <gdr@codesourcery.com> * bad.c (ffebad_start_): Adjust call to count_error. * Make-lang.in (f/bad.o): Depend on diagnostic.h * bad.c: #include diagnostic.h From-SVN: r54291
2002-06-05 21:35:45 +02:00
if (*text->format_spec == '\0')
break;
/* We got a '%'. Let's see what happens. Record whether we're
parsing a long integer format specifier. */
toplev.h (report_error_function): Remove. * toplev.h (report_error_function): Remove. * diagnostic.h (location_t): New datatype. (text_info): Likewise. (diagnostic_info): Likewise. (output_prefix): New macro. (diagnostic_last_function_changed): Likewise. (diagnostic_set_last_function): Likewise. (diagnostic_last_module_changed): Likewise. (diagnostic_set_last_module): Likewise. (report_diagnostic): Now macro. (diagnostic_set_info): Declare. * diagnostic.c (report_problematic_module): Rename to diagnostic_repor_current_module. (set_diagnostic_context): Remove. (count_error): Rename to diagnostic_error_count. (error_function_changed): Remove. (record_last_error_function): Likewise. (error_module_changed): Likewise. (record_last_error_module): Likewise. (context_as_prefix): Rename to diagnostic_build_prefix. (flush_diagnostic_buffer): Rename to diagnostic_flush_buffer. (diagnostic_set_info): New function. * objc/objc-act.c: #include diagnostic.h (error_with_ivar): Adjust call to count_error. (warn_with_method): Likewise. * objc/Make-lang.in (objc-act.o): Depend on diagnostic.h cp/ 2002-06-04 Gabriel Dos Reis <gdr@codesourcery.com> * error.c (cp_diagnostic_starter): Adjust call. (maybe_print_instantiation_context): Change prototype to take a 'diagnostic_info *'. (print_instantiation_full_context): Likewise. (print_instantiation_partial_context): Likewise. (cp_diagnostic_starter): Likewise. (cp_diagnostic_finalizer): Likewise. (cp_print_error_function): Likewise. (cp_printer): Take a secondary parameter as a 'text_info *'. Remove output_state savings. Adjust calls. f/ 2002-06-04 Gabriel Dos Reis <gdr@codesourcery.com> * bad.c (ffebad_start_): Adjust call to count_error. * Make-lang.in (f/bad.o): Depend on diagnostic.h * bad.c: #include diagnostic.h From-SVN: r54291
2002-06-05 21:35:45 +02:00
if (*++text->format_spec == 'l')
{
toplev.h (report_error_function): Remove. * toplev.h (report_error_function): Remove. * diagnostic.h (location_t): New datatype. (text_info): Likewise. (diagnostic_info): Likewise. (output_prefix): New macro. (diagnostic_last_function_changed): Likewise. (diagnostic_set_last_function): Likewise. (diagnostic_last_module_changed): Likewise. (diagnostic_set_last_module): Likewise. (report_diagnostic): Now macro. (diagnostic_set_info): Declare. * diagnostic.c (report_problematic_module): Rename to diagnostic_repor_current_module. (set_diagnostic_context): Remove. (count_error): Rename to diagnostic_error_count. (error_function_changed): Remove. (record_last_error_function): Likewise. (error_module_changed): Likewise. (record_last_error_module): Likewise. (context_as_prefix): Rename to diagnostic_build_prefix. (flush_diagnostic_buffer): Rename to diagnostic_flush_buffer. (diagnostic_set_info): New function. * objc/objc-act.c: #include diagnostic.h (error_with_ivar): Adjust call to count_error. (warn_with_method): Likewise. * objc/Make-lang.in (objc-act.o): Depend on diagnostic.h cp/ 2002-06-04 Gabriel Dos Reis <gdr@codesourcery.com> * error.c (cp_diagnostic_starter): Adjust call. (maybe_print_instantiation_context): Change prototype to take a 'diagnostic_info *'. (print_instantiation_full_context): Likewise. (print_instantiation_partial_context): Likewise. (cp_diagnostic_starter): Likewise. (cp_diagnostic_finalizer): Likewise. (cp_print_error_function): Likewise. (cp_printer): Take a secondary parameter as a 'text_info *'. Remove output_state savings. Adjust calls. f/ 2002-06-04 Gabriel Dos Reis <gdr@codesourcery.com> * bad.c (ffebad_start_): Adjust call to count_error. * Make-lang.in (f/bad.o): Depend on diagnostic.h * bad.c: #include diagnostic.h From-SVN: r54291
2002-06-05 21:35:45 +02:00
long_integer = true;
++text->format_spec;
}
/* Handle %c, %d, %i, %ld, %li, %lo, %lu, %lx, %o, %s, %u,
%x, %p, %.*s; %%. And nothing else. Front-ends should install
printers to grok language specific format specifiers. */
toplev.h (report_error_function): Remove. * toplev.h (report_error_function): Remove. * diagnostic.h (location_t): New datatype. (text_info): Likewise. (diagnostic_info): Likewise. (output_prefix): New macro. (diagnostic_last_function_changed): Likewise. (diagnostic_set_last_function): Likewise. (diagnostic_last_module_changed): Likewise. (diagnostic_set_last_module): Likewise. (report_diagnostic): Now macro. (diagnostic_set_info): Declare. * diagnostic.c (report_problematic_module): Rename to diagnostic_repor_current_module. (set_diagnostic_context): Remove. (count_error): Rename to diagnostic_error_count. (error_function_changed): Remove. (record_last_error_function): Likewise. (error_module_changed): Likewise. (record_last_error_module): Likewise. (context_as_prefix): Rename to diagnostic_build_prefix. (flush_diagnostic_buffer): Rename to diagnostic_flush_buffer. (diagnostic_set_info): New function. * objc/objc-act.c: #include diagnostic.h (error_with_ivar): Adjust call to count_error. (warn_with_method): Likewise. * objc/Make-lang.in (objc-act.o): Depend on diagnostic.h cp/ 2002-06-04 Gabriel Dos Reis <gdr@codesourcery.com> * error.c (cp_diagnostic_starter): Adjust call. (maybe_print_instantiation_context): Change prototype to take a 'diagnostic_info *'. (print_instantiation_full_context): Likewise. (print_instantiation_partial_context): Likewise. (cp_diagnostic_starter): Likewise. (cp_diagnostic_finalizer): Likewise. (cp_print_error_function): Likewise. (cp_printer): Take a secondary parameter as a 'text_info *'. Remove output_state savings. Adjust calls. f/ 2002-06-04 Gabriel Dos Reis <gdr@codesourcery.com> * bad.c (ffebad_start_): Adjust call to count_error. * Make-lang.in (f/bad.o): Depend on diagnostic.h * bad.c: #include diagnostic.h From-SVN: r54291
2002-06-05 21:35:45 +02:00
switch (*text->format_spec)
{
case 'c':
toplev.h (report_error_function): Remove. * toplev.h (report_error_function): Remove. * diagnostic.h (location_t): New datatype. (text_info): Likewise. (diagnostic_info): Likewise. (output_prefix): New macro. (diagnostic_last_function_changed): Likewise. (diagnostic_set_last_function): Likewise. (diagnostic_last_module_changed): Likewise. (diagnostic_set_last_module): Likewise. (report_diagnostic): Now macro. (diagnostic_set_info): Declare. * diagnostic.c (report_problematic_module): Rename to diagnostic_repor_current_module. (set_diagnostic_context): Remove. (count_error): Rename to diagnostic_error_count. (error_function_changed): Remove. (record_last_error_function): Likewise. (error_module_changed): Likewise. (record_last_error_module): Likewise. (context_as_prefix): Rename to diagnostic_build_prefix. (flush_diagnostic_buffer): Rename to diagnostic_flush_buffer. (diagnostic_set_info): New function. * objc/objc-act.c: #include diagnostic.h (error_with_ivar): Adjust call to count_error. (warn_with_method): Likewise. * objc/Make-lang.in (objc-act.o): Depend on diagnostic.h cp/ 2002-06-04 Gabriel Dos Reis <gdr@codesourcery.com> * error.c (cp_diagnostic_starter): Adjust call. (maybe_print_instantiation_context): Change prototype to take a 'diagnostic_info *'. (print_instantiation_full_context): Likewise. (print_instantiation_partial_context): Likewise. (cp_diagnostic_starter): Likewise. (cp_diagnostic_finalizer): Likewise. (cp_print_error_function): Likewise. (cp_printer): Take a secondary parameter as a 'text_info *'. Remove output_state savings. Adjust calls. f/ 2002-06-04 Gabriel Dos Reis <gdr@codesourcery.com> * bad.c (ffebad_start_): Adjust call to count_error. * Make-lang.in (f/bad.o): Depend on diagnostic.h * bad.c: #include diagnostic.h From-SVN: r54291
2002-06-05 21:35:45 +02:00
output_add_character (buffer, va_arg (*text->args_ptr, int));
break;
case 'd':
case 'i':
if (long_integer)
toplev.h (report_error_function): Remove. * toplev.h (report_error_function): Remove. * diagnostic.h (location_t): New datatype. (text_info): Likewise. (diagnostic_info): Likewise. (output_prefix): New macro. (diagnostic_last_function_changed): Likewise. (diagnostic_set_last_function): Likewise. (diagnostic_last_module_changed): Likewise. (diagnostic_set_last_module): Likewise. (report_diagnostic): Now macro. (diagnostic_set_info): Declare. * diagnostic.c (report_problematic_module): Rename to diagnostic_repor_current_module. (set_diagnostic_context): Remove. (count_error): Rename to diagnostic_error_count. (error_function_changed): Remove. (record_last_error_function): Likewise. (error_module_changed): Likewise. (record_last_error_module): Likewise. (context_as_prefix): Rename to diagnostic_build_prefix. (flush_diagnostic_buffer): Rename to diagnostic_flush_buffer. (diagnostic_set_info): New function. * objc/objc-act.c: #include diagnostic.h (error_with_ivar): Adjust call to count_error. (warn_with_method): Likewise. * objc/Make-lang.in (objc-act.o): Depend on diagnostic.h cp/ 2002-06-04 Gabriel Dos Reis <gdr@codesourcery.com> * error.c (cp_diagnostic_starter): Adjust call. (maybe_print_instantiation_context): Change prototype to take a 'diagnostic_info *'. (print_instantiation_full_context): Likewise. (print_instantiation_partial_context): Likewise. (cp_diagnostic_starter): Likewise. (cp_diagnostic_finalizer): Likewise. (cp_print_error_function): Likewise. (cp_printer): Take a secondary parameter as a 'text_info *'. Remove output_state savings. Adjust calls. f/ 2002-06-04 Gabriel Dos Reis <gdr@codesourcery.com> * bad.c (ffebad_start_): Adjust call to count_error. * Make-lang.in (f/bad.o): Depend on diagnostic.h * bad.c: #include diagnostic.h From-SVN: r54291
2002-06-05 21:35:45 +02:00
output_long_decimal (buffer, va_arg (*text->args_ptr, long int));
else
toplev.h (report_error_function): Remove. * toplev.h (report_error_function): Remove. * diagnostic.h (location_t): New datatype. (text_info): Likewise. (diagnostic_info): Likewise. (output_prefix): New macro. (diagnostic_last_function_changed): Likewise. (diagnostic_set_last_function): Likewise. (diagnostic_last_module_changed): Likewise. (diagnostic_set_last_module): Likewise. (report_diagnostic): Now macro. (diagnostic_set_info): Declare. * diagnostic.c (report_problematic_module): Rename to diagnostic_repor_current_module. (set_diagnostic_context): Remove. (count_error): Rename to diagnostic_error_count. (error_function_changed): Remove. (record_last_error_function): Likewise. (error_module_changed): Likewise. (record_last_error_module): Likewise. (context_as_prefix): Rename to diagnostic_build_prefix. (flush_diagnostic_buffer): Rename to diagnostic_flush_buffer. (diagnostic_set_info): New function. * objc/objc-act.c: #include diagnostic.h (error_with_ivar): Adjust call to count_error. (warn_with_method): Likewise. * objc/Make-lang.in (objc-act.o): Depend on diagnostic.h cp/ 2002-06-04 Gabriel Dos Reis <gdr@codesourcery.com> * error.c (cp_diagnostic_starter): Adjust call. (maybe_print_instantiation_context): Change prototype to take a 'diagnostic_info *'. (print_instantiation_full_context): Likewise. (print_instantiation_partial_context): Likewise. (cp_diagnostic_starter): Likewise. (cp_diagnostic_finalizer): Likewise. (cp_print_error_function): Likewise. (cp_printer): Take a secondary parameter as a 'text_info *'. Remove output_state savings. Adjust calls. f/ 2002-06-04 Gabriel Dos Reis <gdr@codesourcery.com> * bad.c (ffebad_start_): Adjust call to count_error. * Make-lang.in (f/bad.o): Depend on diagnostic.h * bad.c: #include diagnostic.h From-SVN: r54291
2002-06-05 21:35:45 +02:00
output_decimal (buffer, va_arg (*text->args_ptr, int));
break;
case 'o':
if (long_integer)
output_long_octal (buffer,
toplev.h (report_error_function): Remove. * toplev.h (report_error_function): Remove. * diagnostic.h (location_t): New datatype. (text_info): Likewise. (diagnostic_info): Likewise. (output_prefix): New macro. (diagnostic_last_function_changed): Likewise. (diagnostic_set_last_function): Likewise. (diagnostic_last_module_changed): Likewise. (diagnostic_set_last_module): Likewise. (report_diagnostic): Now macro. (diagnostic_set_info): Declare. * diagnostic.c (report_problematic_module): Rename to diagnostic_repor_current_module. (set_diagnostic_context): Remove. (count_error): Rename to diagnostic_error_count. (error_function_changed): Remove. (record_last_error_function): Likewise. (error_module_changed): Likewise. (record_last_error_module): Likewise. (context_as_prefix): Rename to diagnostic_build_prefix. (flush_diagnostic_buffer): Rename to diagnostic_flush_buffer. (diagnostic_set_info): New function. * objc/objc-act.c: #include diagnostic.h (error_with_ivar): Adjust call to count_error. (warn_with_method): Likewise. * objc/Make-lang.in (objc-act.o): Depend on diagnostic.h cp/ 2002-06-04 Gabriel Dos Reis <gdr@codesourcery.com> * error.c (cp_diagnostic_starter): Adjust call. (maybe_print_instantiation_context): Change prototype to take a 'diagnostic_info *'. (print_instantiation_full_context): Likewise. (print_instantiation_partial_context): Likewise. (cp_diagnostic_starter): Likewise. (cp_diagnostic_finalizer): Likewise. (cp_print_error_function): Likewise. (cp_printer): Take a secondary parameter as a 'text_info *'. Remove output_state savings. Adjust calls. f/ 2002-06-04 Gabriel Dos Reis <gdr@codesourcery.com> * bad.c (ffebad_start_): Adjust call to count_error. * Make-lang.in (f/bad.o): Depend on diagnostic.h * bad.c: #include diagnostic.h From-SVN: r54291
2002-06-05 21:35:45 +02:00
va_arg (*text->args_ptr, unsigned long int));
else
toplev.h (report_error_function): Remove. * toplev.h (report_error_function): Remove. * diagnostic.h (location_t): New datatype. (text_info): Likewise. (diagnostic_info): Likewise. (output_prefix): New macro. (diagnostic_last_function_changed): Likewise. (diagnostic_set_last_function): Likewise. (diagnostic_last_module_changed): Likewise. (diagnostic_set_last_module): Likewise. (report_diagnostic): Now macro. (diagnostic_set_info): Declare. * diagnostic.c (report_problematic_module): Rename to diagnostic_repor_current_module. (set_diagnostic_context): Remove. (count_error): Rename to diagnostic_error_count. (error_function_changed): Remove. (record_last_error_function): Likewise. (error_module_changed): Likewise. (record_last_error_module): Likewise. (context_as_prefix): Rename to diagnostic_build_prefix. (flush_diagnostic_buffer): Rename to diagnostic_flush_buffer. (diagnostic_set_info): New function. * objc/objc-act.c: #include diagnostic.h (error_with_ivar): Adjust call to count_error. (warn_with_method): Likewise. * objc/Make-lang.in (objc-act.o): Depend on diagnostic.h cp/ 2002-06-04 Gabriel Dos Reis <gdr@codesourcery.com> * error.c (cp_diagnostic_starter): Adjust call. (maybe_print_instantiation_context): Change prototype to take a 'diagnostic_info *'. (print_instantiation_full_context): Likewise. (print_instantiation_partial_context): Likewise. (cp_diagnostic_starter): Likewise. (cp_diagnostic_finalizer): Likewise. (cp_print_error_function): Likewise. (cp_printer): Take a secondary parameter as a 'text_info *'. Remove output_state savings. Adjust calls. f/ 2002-06-04 Gabriel Dos Reis <gdr@codesourcery.com> * bad.c (ffebad_start_): Adjust call to count_error. * Make-lang.in (f/bad.o): Depend on diagnostic.h * bad.c: #include diagnostic.h From-SVN: r54291
2002-06-05 21:35:45 +02:00
output_octal (buffer, va_arg (*text->args_ptr, unsigned int));
break;
case 's':
toplev.h (report_error_function): Remove. * toplev.h (report_error_function): Remove. * diagnostic.h (location_t): New datatype. (text_info): Likewise. (diagnostic_info): Likewise. (output_prefix): New macro. (diagnostic_last_function_changed): Likewise. (diagnostic_set_last_function): Likewise. (diagnostic_last_module_changed): Likewise. (diagnostic_set_last_module): Likewise. (report_diagnostic): Now macro. (diagnostic_set_info): Declare. * diagnostic.c (report_problematic_module): Rename to diagnostic_repor_current_module. (set_diagnostic_context): Remove. (count_error): Rename to diagnostic_error_count. (error_function_changed): Remove. (record_last_error_function): Likewise. (error_module_changed): Likewise. (record_last_error_module): Likewise. (context_as_prefix): Rename to diagnostic_build_prefix. (flush_diagnostic_buffer): Rename to diagnostic_flush_buffer. (diagnostic_set_info): New function. * objc/objc-act.c: #include diagnostic.h (error_with_ivar): Adjust call to count_error. (warn_with_method): Likewise. * objc/Make-lang.in (objc-act.o): Depend on diagnostic.h cp/ 2002-06-04 Gabriel Dos Reis <gdr@codesourcery.com> * error.c (cp_diagnostic_starter): Adjust call. (maybe_print_instantiation_context): Change prototype to take a 'diagnostic_info *'. (print_instantiation_full_context): Likewise. (print_instantiation_partial_context): Likewise. (cp_diagnostic_starter): Likewise. (cp_diagnostic_finalizer): Likewise. (cp_print_error_function): Likewise. (cp_printer): Take a secondary parameter as a 'text_info *'. Remove output_state savings. Adjust calls. f/ 2002-06-04 Gabriel Dos Reis <gdr@codesourcery.com> * bad.c (ffebad_start_): Adjust call to count_error. * Make-lang.in (f/bad.o): Depend on diagnostic.h * bad.c: #include diagnostic.h From-SVN: r54291
2002-06-05 21:35:45 +02:00
output_add_string (buffer, va_arg (*text->args_ptr, const char *));
break;
case 'p':
output_pointer (buffer, va_arg (*text->args_ptr, void *));
break;
case 'u':
if (long_integer)
output_long_unsigned_decimal
toplev.h (report_error_function): Remove. * toplev.h (report_error_function): Remove. * diagnostic.h (location_t): New datatype. (text_info): Likewise. (diagnostic_info): Likewise. (output_prefix): New macro. (diagnostic_last_function_changed): Likewise. (diagnostic_set_last_function): Likewise. (diagnostic_last_module_changed): Likewise. (diagnostic_set_last_module): Likewise. (report_diagnostic): Now macro. (diagnostic_set_info): Declare. * diagnostic.c (report_problematic_module): Rename to diagnostic_repor_current_module. (set_diagnostic_context): Remove. (count_error): Rename to diagnostic_error_count. (error_function_changed): Remove. (record_last_error_function): Likewise. (error_module_changed): Likewise. (record_last_error_module): Likewise. (context_as_prefix): Rename to diagnostic_build_prefix. (flush_diagnostic_buffer): Rename to diagnostic_flush_buffer. (diagnostic_set_info): New function. * objc/objc-act.c: #include diagnostic.h (error_with_ivar): Adjust call to count_error. (warn_with_method): Likewise. * objc/Make-lang.in (objc-act.o): Depend on diagnostic.h cp/ 2002-06-04 Gabriel Dos Reis <gdr@codesourcery.com> * error.c (cp_diagnostic_starter): Adjust call. (maybe_print_instantiation_context): Change prototype to take a 'diagnostic_info *'. (print_instantiation_full_context): Likewise. (print_instantiation_partial_context): Likewise. (cp_diagnostic_starter): Likewise. (cp_diagnostic_finalizer): Likewise. (cp_print_error_function): Likewise. (cp_printer): Take a secondary parameter as a 'text_info *'. Remove output_state savings. Adjust calls. f/ 2002-06-04 Gabriel Dos Reis <gdr@codesourcery.com> * bad.c (ffebad_start_): Adjust call to count_error. * Make-lang.in (f/bad.o): Depend on diagnostic.h * bad.c: #include diagnostic.h From-SVN: r54291
2002-06-05 21:35:45 +02:00
(buffer, va_arg (*text->args_ptr, long unsigned int));
else
output_unsigned_decimal
toplev.h (report_error_function): Remove. * toplev.h (report_error_function): Remove. * diagnostic.h (location_t): New datatype. (text_info): Likewise. (diagnostic_info): Likewise. (output_prefix): New macro. (diagnostic_last_function_changed): Likewise. (diagnostic_set_last_function): Likewise. (diagnostic_last_module_changed): Likewise. (diagnostic_set_last_module): Likewise. (report_diagnostic): Now macro. (diagnostic_set_info): Declare. * diagnostic.c (report_problematic_module): Rename to diagnostic_repor_current_module. (set_diagnostic_context): Remove. (count_error): Rename to diagnostic_error_count. (error_function_changed): Remove. (record_last_error_function): Likewise. (error_module_changed): Likewise. (record_last_error_module): Likewise. (context_as_prefix): Rename to diagnostic_build_prefix. (flush_diagnostic_buffer): Rename to diagnostic_flush_buffer. (diagnostic_set_info): New function. * objc/objc-act.c: #include diagnostic.h (error_with_ivar): Adjust call to count_error. (warn_with_method): Likewise. * objc/Make-lang.in (objc-act.o): Depend on diagnostic.h cp/ 2002-06-04 Gabriel Dos Reis <gdr@codesourcery.com> * error.c (cp_diagnostic_starter): Adjust call. (maybe_print_instantiation_context): Change prototype to take a 'diagnostic_info *'. (print_instantiation_full_context): Likewise. (print_instantiation_partial_context): Likewise. (cp_diagnostic_starter): Likewise. (cp_diagnostic_finalizer): Likewise. (cp_print_error_function): Likewise. (cp_printer): Take a secondary parameter as a 'text_info *'. Remove output_state savings. Adjust calls. f/ 2002-06-04 Gabriel Dos Reis <gdr@codesourcery.com> * bad.c (ffebad_start_): Adjust call to count_error. * Make-lang.in (f/bad.o): Depend on diagnostic.h * bad.c: #include diagnostic.h From-SVN: r54291
2002-06-05 21:35:45 +02:00
(buffer, va_arg (*text->args_ptr, unsigned int));
break;
case 'x':
if (long_integer)
output_long_hexadecimal
toplev.h (report_error_function): Remove. * toplev.h (report_error_function): Remove. * diagnostic.h (location_t): New datatype. (text_info): Likewise. (diagnostic_info): Likewise. (output_prefix): New macro. (diagnostic_last_function_changed): Likewise. (diagnostic_set_last_function): Likewise. (diagnostic_last_module_changed): Likewise. (diagnostic_set_last_module): Likewise. (report_diagnostic): Now macro. (diagnostic_set_info): Declare. * diagnostic.c (report_problematic_module): Rename to diagnostic_repor_current_module. (set_diagnostic_context): Remove. (count_error): Rename to diagnostic_error_count. (error_function_changed): Remove. (record_last_error_function): Likewise. (error_module_changed): Likewise. (record_last_error_module): Likewise. (context_as_prefix): Rename to diagnostic_build_prefix. (flush_diagnostic_buffer): Rename to diagnostic_flush_buffer. (diagnostic_set_info): New function. * objc/objc-act.c: #include diagnostic.h (error_with_ivar): Adjust call to count_error. (warn_with_method): Likewise. * objc/Make-lang.in (objc-act.o): Depend on diagnostic.h cp/ 2002-06-04 Gabriel Dos Reis <gdr@codesourcery.com> * error.c (cp_diagnostic_starter): Adjust call. (maybe_print_instantiation_context): Change prototype to take a 'diagnostic_info *'. (print_instantiation_full_context): Likewise. (print_instantiation_partial_context): Likewise. (cp_diagnostic_starter): Likewise. (cp_diagnostic_finalizer): Likewise. (cp_print_error_function): Likewise. (cp_printer): Take a secondary parameter as a 'text_info *'. Remove output_state savings. Adjust calls. f/ 2002-06-04 Gabriel Dos Reis <gdr@codesourcery.com> * bad.c (ffebad_start_): Adjust call to count_error. * Make-lang.in (f/bad.o): Depend on diagnostic.h * bad.c: #include diagnostic.h From-SVN: r54291
2002-06-05 21:35:45 +02:00
(buffer, va_arg (*text->args_ptr, unsigned long int));
else
output_hexadecimal
toplev.h (report_error_function): Remove. * toplev.h (report_error_function): Remove. * diagnostic.h (location_t): New datatype. (text_info): Likewise. (diagnostic_info): Likewise. (output_prefix): New macro. (diagnostic_last_function_changed): Likewise. (diagnostic_set_last_function): Likewise. (diagnostic_last_module_changed): Likewise. (diagnostic_set_last_module): Likewise. (report_diagnostic): Now macro. (diagnostic_set_info): Declare. * diagnostic.c (report_problematic_module): Rename to diagnostic_repor_current_module. (set_diagnostic_context): Remove. (count_error): Rename to diagnostic_error_count. (error_function_changed): Remove. (record_last_error_function): Likewise. (error_module_changed): Likewise. (record_last_error_module): Likewise. (context_as_prefix): Rename to diagnostic_build_prefix. (flush_diagnostic_buffer): Rename to diagnostic_flush_buffer. (diagnostic_set_info): New function. * objc/objc-act.c: #include diagnostic.h (error_with_ivar): Adjust call to count_error. (warn_with_method): Likewise. * objc/Make-lang.in (objc-act.o): Depend on diagnostic.h cp/ 2002-06-04 Gabriel Dos Reis <gdr@codesourcery.com> * error.c (cp_diagnostic_starter): Adjust call. (maybe_print_instantiation_context): Change prototype to take a 'diagnostic_info *'. (print_instantiation_full_context): Likewise. (print_instantiation_partial_context): Likewise. (cp_diagnostic_starter): Likewise. (cp_diagnostic_finalizer): Likewise. (cp_print_error_function): Likewise. (cp_printer): Take a secondary parameter as a 'text_info *'. Remove output_state savings. Adjust calls. f/ 2002-06-04 Gabriel Dos Reis <gdr@codesourcery.com> * bad.c (ffebad_start_): Adjust call to count_error. * Make-lang.in (f/bad.o): Depend on diagnostic.h * bad.c: #include diagnostic.h From-SVN: r54291
2002-06-05 21:35:45 +02:00
(buffer, va_arg (*text->args_ptr, unsigned int));
break;
case '%':
output_add_character (buffer, '%');
break;
case 'H':
{
const location_t *locus = va_arg (*text->args_ptr, location_t *);
output_add_string (buffer, "file '");
output_add_string (buffer, locus->file);
output_add_string (buffer, "', line ");
output_decimal (buffer, locus->line);
}
break;
case '.':
{
int n;
const char *s;
/* We handle no precision specifier but `%.*s'. */
toplev.h (report_error_function): Remove. * toplev.h (report_error_function): Remove. * diagnostic.h (location_t): New datatype. (text_info): Likewise. (diagnostic_info): Likewise. (output_prefix): New macro. (diagnostic_last_function_changed): Likewise. (diagnostic_set_last_function): Likewise. (diagnostic_last_module_changed): Likewise. (diagnostic_set_last_module): Likewise. (report_diagnostic): Now macro. (diagnostic_set_info): Declare. * diagnostic.c (report_problematic_module): Rename to diagnostic_repor_current_module. (set_diagnostic_context): Remove. (count_error): Rename to diagnostic_error_count. (error_function_changed): Remove. (record_last_error_function): Likewise. (error_module_changed): Likewise. (record_last_error_module): Likewise. (context_as_prefix): Rename to diagnostic_build_prefix. (flush_diagnostic_buffer): Rename to diagnostic_flush_buffer. (diagnostic_set_info): New function. * objc/objc-act.c: #include diagnostic.h (error_with_ivar): Adjust call to count_error. (warn_with_method): Likewise. * objc/Make-lang.in (objc-act.o): Depend on diagnostic.h cp/ 2002-06-04 Gabriel Dos Reis <gdr@codesourcery.com> * error.c (cp_diagnostic_starter): Adjust call. (maybe_print_instantiation_context): Change prototype to take a 'diagnostic_info *'. (print_instantiation_full_context): Likewise. (print_instantiation_partial_context): Likewise. (cp_diagnostic_starter): Likewise. (cp_diagnostic_finalizer): Likewise. (cp_print_error_function): Likewise. (cp_printer): Take a secondary parameter as a 'text_info *'. Remove output_state savings. Adjust calls. f/ 2002-06-04 Gabriel Dos Reis <gdr@codesourcery.com> * bad.c (ffebad_start_): Adjust call to count_error. * Make-lang.in (f/bad.o): Depend on diagnostic.h * bad.c: #include diagnostic.h From-SVN: r54291
2002-06-05 21:35:45 +02:00
if (*++text->format_spec != '*')
abort ();
toplev.h (report_error_function): Remove. * toplev.h (report_error_function): Remove. * diagnostic.h (location_t): New datatype. (text_info): Likewise. (diagnostic_info): Likewise. (output_prefix): New macro. (diagnostic_last_function_changed): Likewise. (diagnostic_set_last_function): Likewise. (diagnostic_last_module_changed): Likewise. (diagnostic_set_last_module): Likewise. (report_diagnostic): Now macro. (diagnostic_set_info): Declare. * diagnostic.c (report_problematic_module): Rename to diagnostic_repor_current_module. (set_diagnostic_context): Remove. (count_error): Rename to diagnostic_error_count. (error_function_changed): Remove. (record_last_error_function): Likewise. (error_module_changed): Likewise. (record_last_error_module): Likewise. (context_as_prefix): Rename to diagnostic_build_prefix. (flush_diagnostic_buffer): Rename to diagnostic_flush_buffer. (diagnostic_set_info): New function. * objc/objc-act.c: #include diagnostic.h (error_with_ivar): Adjust call to count_error. (warn_with_method): Likewise. * objc/Make-lang.in (objc-act.o): Depend on diagnostic.h cp/ 2002-06-04 Gabriel Dos Reis <gdr@codesourcery.com> * error.c (cp_diagnostic_starter): Adjust call. (maybe_print_instantiation_context): Change prototype to take a 'diagnostic_info *'. (print_instantiation_full_context): Likewise. (print_instantiation_partial_context): Likewise. (cp_diagnostic_starter): Likewise. (cp_diagnostic_finalizer): Likewise. (cp_print_error_function): Likewise. (cp_printer): Take a secondary parameter as a 'text_info *'. Remove output_state savings. Adjust calls. f/ 2002-06-04 Gabriel Dos Reis <gdr@codesourcery.com> * bad.c (ffebad_start_): Adjust call to count_error. * Make-lang.in (f/bad.o): Depend on diagnostic.h * bad.c: #include diagnostic.h From-SVN: r54291
2002-06-05 21:35:45 +02:00
else if (*++text->format_spec != 's')
abort ();
toplev.h (report_error_function): Remove. * toplev.h (report_error_function): Remove. * diagnostic.h (location_t): New datatype. (text_info): Likewise. (diagnostic_info): Likewise. (output_prefix): New macro. (diagnostic_last_function_changed): Likewise. (diagnostic_set_last_function): Likewise. (diagnostic_last_module_changed): Likewise. (diagnostic_set_last_module): Likewise. (report_diagnostic): Now macro. (diagnostic_set_info): Declare. * diagnostic.c (report_problematic_module): Rename to diagnostic_repor_current_module. (set_diagnostic_context): Remove. (count_error): Rename to diagnostic_error_count. (error_function_changed): Remove. (record_last_error_function): Likewise. (error_module_changed): Likewise. (record_last_error_module): Likewise. (context_as_prefix): Rename to diagnostic_build_prefix. (flush_diagnostic_buffer): Rename to diagnostic_flush_buffer. (diagnostic_set_info): New function. * objc/objc-act.c: #include diagnostic.h (error_with_ivar): Adjust call to count_error. (warn_with_method): Likewise. * objc/Make-lang.in (objc-act.o): Depend on diagnostic.h cp/ 2002-06-04 Gabriel Dos Reis <gdr@codesourcery.com> * error.c (cp_diagnostic_starter): Adjust call. (maybe_print_instantiation_context): Change prototype to take a 'diagnostic_info *'. (print_instantiation_full_context): Likewise. (print_instantiation_partial_context): Likewise. (cp_diagnostic_starter): Likewise. (cp_diagnostic_finalizer): Likewise. (cp_print_error_function): Likewise. (cp_printer): Take a secondary parameter as a 'text_info *'. Remove output_state savings. Adjust calls. f/ 2002-06-04 Gabriel Dos Reis <gdr@codesourcery.com> * bad.c (ffebad_start_): Adjust call to count_error. * Make-lang.in (f/bad.o): Depend on diagnostic.h * bad.c: #include diagnostic.h From-SVN: r54291
2002-06-05 21:35:45 +02:00
n = va_arg (*text->args_ptr, int);
s = va_arg (*text->args_ptr, const char *);
output_append (buffer, s, s + n);
}
break;
default:
toplev.h (report_error_function): Remove. * toplev.h (report_error_function): Remove. * diagnostic.h (location_t): New datatype. (text_info): Likewise. (diagnostic_info): Likewise. (output_prefix): New macro. (diagnostic_last_function_changed): Likewise. (diagnostic_set_last_function): Likewise. (diagnostic_last_module_changed): Likewise. (diagnostic_set_last_module): Likewise. (report_diagnostic): Now macro. (diagnostic_set_info): Declare. * diagnostic.c (report_problematic_module): Rename to diagnostic_repor_current_module. (set_diagnostic_context): Remove. (count_error): Rename to diagnostic_error_count. (error_function_changed): Remove. (record_last_error_function): Likewise. (error_module_changed): Likewise. (record_last_error_module): Likewise. (context_as_prefix): Rename to diagnostic_build_prefix. (flush_diagnostic_buffer): Rename to diagnostic_flush_buffer. (diagnostic_set_info): New function. * objc/objc-act.c: #include diagnostic.h (error_with_ivar): Adjust call to count_error. (warn_with_method): Likewise. * objc/Make-lang.in (objc-act.o): Depend on diagnostic.h cp/ 2002-06-04 Gabriel Dos Reis <gdr@codesourcery.com> * error.c (cp_diagnostic_starter): Adjust call. (maybe_print_instantiation_context): Change prototype to take a 'diagnostic_info *'. (print_instantiation_full_context): Likewise. (print_instantiation_partial_context): Likewise. (cp_diagnostic_starter): Likewise. (cp_diagnostic_finalizer): Likewise. (cp_print_error_function): Likewise. (cp_printer): Take a secondary parameter as a 'text_info *'. Remove output_state savings. Adjust calls. f/ 2002-06-04 Gabriel Dos Reis <gdr@codesourcery.com> * bad.c (ffebad_start_): Adjust call to count_error. * Make-lang.in (f/bad.o): Depend on diagnostic.h * bad.c: #include diagnostic.h From-SVN: r54291
2002-06-05 21:35:45 +02:00
if (!buffer->format_decoder
|| !(*buffer->format_decoder) (buffer, text))
{
/* Hmmm. The front-end failed to install a format translator
but called us with an unrecognized format. Or, maybe, the
translated string just contains an invalid format, or
has formats in the wrong order. Sorry. */
abort ();
}
}
}
}
/* Return a malloc'd string containing MSG formatted a la printf. The
caller is responsible for freeing the memory. */
static char *
build_message_string VPARAMS ((const char *msg, ...))
{
char *str;
VA_OPEN (ap, msg);
VA_FIXEDARG (ap, const char *, msg);
vasprintf (&str, msg, ap);
VA_CLOSE (ap);
return str;
}
/* Same as diagnostic_build_prefix, but only the source FILE is given. */
char *
file_name_as_prefix (f)
const char *f;
{
return build_message_string ("%s: ", f);
}
/* Format a message into BUFFER a la printf. */
void
output_printf VPARAMS ((struct output_buffer *buffer, const char *msgid, ...))
{
toplev.h (report_error_function): Remove. * toplev.h (report_error_function): Remove. * diagnostic.h (location_t): New datatype. (text_info): Likewise. (diagnostic_info): Likewise. (output_prefix): New macro. (diagnostic_last_function_changed): Likewise. (diagnostic_set_last_function): Likewise. (diagnostic_last_module_changed): Likewise. (diagnostic_set_last_module): Likewise. (report_diagnostic): Now macro. (diagnostic_set_info): Declare. * diagnostic.c (report_problematic_module): Rename to diagnostic_repor_current_module. (set_diagnostic_context): Remove. (count_error): Rename to diagnostic_error_count. (error_function_changed): Remove. (record_last_error_function): Likewise. (error_module_changed): Likewise. (record_last_error_module): Likewise. (context_as_prefix): Rename to diagnostic_build_prefix. (flush_diagnostic_buffer): Rename to diagnostic_flush_buffer. (diagnostic_set_info): New function. * objc/objc-act.c: #include diagnostic.h (error_with_ivar): Adjust call to count_error. (warn_with_method): Likewise. * objc/Make-lang.in (objc-act.o): Depend on diagnostic.h cp/ 2002-06-04 Gabriel Dos Reis <gdr@codesourcery.com> * error.c (cp_diagnostic_starter): Adjust call. (maybe_print_instantiation_context): Change prototype to take a 'diagnostic_info *'. (print_instantiation_full_context): Likewise. (print_instantiation_partial_context): Likewise. (cp_diagnostic_starter): Likewise. (cp_diagnostic_finalizer): Likewise. (cp_print_error_function): Likewise. (cp_printer): Take a secondary parameter as a 'text_info *'. Remove output_state savings. Adjust calls. f/ 2002-06-04 Gabriel Dos Reis <gdr@codesourcery.com> * bad.c (ffebad_start_): Adjust call to count_error. * Make-lang.in (f/bad.o): Depend on diagnostic.h * bad.c: #include diagnostic.h From-SVN: r54291
2002-06-05 21:35:45 +02:00
text_info text;
VA_OPEN (ap, msgid);
VA_FIXEDARG (ap, output_buffer *, buffer);
VA_FIXEDARG (ap, const char *, msgid);
toplev.h (report_error_function): Remove. * toplev.h (report_error_function): Remove. * diagnostic.h (location_t): New datatype. (text_info): Likewise. (diagnostic_info): Likewise. (output_prefix): New macro. (diagnostic_last_function_changed): Likewise. (diagnostic_set_last_function): Likewise. (diagnostic_last_module_changed): Likewise. (diagnostic_set_last_module): Likewise. (report_diagnostic): Now macro. (diagnostic_set_info): Declare. * diagnostic.c (report_problematic_module): Rename to diagnostic_repor_current_module. (set_diagnostic_context): Remove. (count_error): Rename to diagnostic_error_count. (error_function_changed): Remove. (record_last_error_function): Likewise. (error_module_changed): Likewise. (record_last_error_module): Likewise. (context_as_prefix): Rename to diagnostic_build_prefix. (flush_diagnostic_buffer): Rename to diagnostic_flush_buffer. (diagnostic_set_info): New function. * objc/objc-act.c: #include diagnostic.h (error_with_ivar): Adjust call to count_error. (warn_with_method): Likewise. * objc/Make-lang.in (objc-act.o): Depend on diagnostic.h cp/ 2002-06-04 Gabriel Dos Reis <gdr@codesourcery.com> * error.c (cp_diagnostic_starter): Adjust call. (maybe_print_instantiation_context): Change prototype to take a 'diagnostic_info *'. (print_instantiation_full_context): Likewise. (print_instantiation_partial_context): Likewise. (cp_diagnostic_starter): Likewise. (cp_diagnostic_finalizer): Likewise. (cp_print_error_function): Likewise. (cp_printer): Take a secondary parameter as a 'text_info *'. Remove output_state savings. Adjust calls. f/ 2002-06-04 Gabriel Dos Reis <gdr@codesourcery.com> * bad.c (ffebad_start_): Adjust call to count_error. * Make-lang.in (f/bad.o): Depend on diagnostic.h * bad.c: #include diagnostic.h From-SVN: r54291
2002-06-05 21:35:45 +02:00
text.args_ptr = &ap;
text.format_spec = _(msgid);
output_format (buffer, &text);
VA_CLOSE (ap);
}
/* Print a message relevant to the given DECL. */
static void
toplev.h (report_error_function): Remove. * toplev.h (report_error_function): Remove. * diagnostic.h (location_t): New datatype. (text_info): Likewise. (diagnostic_info): Likewise. (output_prefix): New macro. (diagnostic_last_function_changed): Likewise. (diagnostic_set_last_function): Likewise. (diagnostic_last_module_changed): Likewise. (diagnostic_set_last_module): Likewise. (report_diagnostic): Now macro. (diagnostic_set_info): Declare. * diagnostic.c (report_problematic_module): Rename to diagnostic_repor_current_module. (set_diagnostic_context): Remove. (count_error): Rename to diagnostic_error_count. (error_function_changed): Remove. (record_last_error_function): Likewise. (error_module_changed): Likewise. (record_last_error_module): Likewise. (context_as_prefix): Rename to diagnostic_build_prefix. (flush_diagnostic_buffer): Rename to diagnostic_flush_buffer. (diagnostic_set_info): New function. * objc/objc-act.c: #include diagnostic.h (error_with_ivar): Adjust call to count_error. (warn_with_method): Likewise. * objc/Make-lang.in (objc-act.o): Depend on diagnostic.h cp/ 2002-06-04 Gabriel Dos Reis <gdr@codesourcery.com> * error.c (cp_diagnostic_starter): Adjust call. (maybe_print_instantiation_context): Change prototype to take a 'diagnostic_info *'. (print_instantiation_full_context): Likewise. (print_instantiation_partial_context): Likewise. (cp_diagnostic_starter): Likewise. (cp_diagnostic_finalizer): Likewise. (cp_print_error_function): Likewise. (cp_printer): Take a secondary parameter as a 'text_info *'. Remove output_state savings. Adjust calls. f/ 2002-06-04 Gabriel Dos Reis <gdr@codesourcery.com> * bad.c (ffebad_start_): Adjust call to count_error. * Make-lang.in (f/bad.o): Depend on diagnostic.h * bad.c: #include diagnostic.h From-SVN: r54291
2002-06-05 21:35:45 +02:00
format_with_decl (buffer, text, decl)
output_buffer *buffer;
toplev.h (report_error_function): Remove. * toplev.h (report_error_function): Remove. * diagnostic.h (location_t): New datatype. (text_info): Likewise. (diagnostic_info): Likewise. (output_prefix): New macro. (diagnostic_last_function_changed): Likewise. (diagnostic_set_last_function): Likewise. (diagnostic_last_module_changed): Likewise. (diagnostic_set_last_module): Likewise. (report_diagnostic): Now macro. (diagnostic_set_info): Declare. * diagnostic.c (report_problematic_module): Rename to diagnostic_repor_current_module. (set_diagnostic_context): Remove. (count_error): Rename to diagnostic_error_count. (error_function_changed): Remove. (record_last_error_function): Likewise. (error_module_changed): Likewise. (record_last_error_module): Likewise. (context_as_prefix): Rename to diagnostic_build_prefix. (flush_diagnostic_buffer): Rename to diagnostic_flush_buffer. (diagnostic_set_info): New function. * objc/objc-act.c: #include diagnostic.h (error_with_ivar): Adjust call to count_error. (warn_with_method): Likewise. * objc/Make-lang.in (objc-act.o): Depend on diagnostic.h cp/ 2002-06-04 Gabriel Dos Reis <gdr@codesourcery.com> * error.c (cp_diagnostic_starter): Adjust call. (maybe_print_instantiation_context): Change prototype to take a 'diagnostic_info *'. (print_instantiation_full_context): Likewise. (print_instantiation_partial_context): Likewise. (cp_diagnostic_starter): Likewise. (cp_diagnostic_finalizer): Likewise. (cp_print_error_function): Likewise. (cp_printer): Take a secondary parameter as a 'text_info *'. Remove output_state savings. Adjust calls. f/ 2002-06-04 Gabriel Dos Reis <gdr@codesourcery.com> * bad.c (ffebad_start_): Adjust call to count_error. * Make-lang.in (f/bad.o): Depend on diagnostic.h * bad.c: #include diagnostic.h From-SVN: r54291
2002-06-05 21:35:45 +02:00
text_info *text;
tree decl;
{
const char *p;
/* Do magic to get around lack of varargs support for insertion
of arguments into existing list. We know that the decl is first;
we ass_u_me that it will be printed with "%s". */
toplev.h (report_error_function): Remove. * toplev.h (report_error_function): Remove. * diagnostic.h (location_t): New datatype. (text_info): Likewise. (diagnostic_info): Likewise. (output_prefix): New macro. (diagnostic_last_function_changed): Likewise. (diagnostic_set_last_function): Likewise. (diagnostic_last_module_changed): Likewise. (diagnostic_set_last_module): Likewise. (report_diagnostic): Now macro. (diagnostic_set_info): Declare. * diagnostic.c (report_problematic_module): Rename to diagnostic_repor_current_module. (set_diagnostic_context): Remove. (count_error): Rename to diagnostic_error_count. (error_function_changed): Remove. (record_last_error_function): Likewise. (error_module_changed): Likewise. (record_last_error_module): Likewise. (context_as_prefix): Rename to diagnostic_build_prefix. (flush_diagnostic_buffer): Rename to diagnostic_flush_buffer. (diagnostic_set_info): New function. * objc/objc-act.c: #include diagnostic.h (error_with_ivar): Adjust call to count_error. (warn_with_method): Likewise. * objc/Make-lang.in (objc-act.o): Depend on diagnostic.h cp/ 2002-06-04 Gabriel Dos Reis <gdr@codesourcery.com> * error.c (cp_diagnostic_starter): Adjust call. (maybe_print_instantiation_context): Change prototype to take a 'diagnostic_info *'. (print_instantiation_full_context): Likewise. (print_instantiation_partial_context): Likewise. (cp_diagnostic_starter): Likewise. (cp_diagnostic_finalizer): Likewise. (cp_print_error_function): Likewise. (cp_printer): Take a secondary parameter as a 'text_info *'. Remove output_state savings. Adjust calls. f/ 2002-06-04 Gabriel Dos Reis <gdr@codesourcery.com> * bad.c (ffebad_start_): Adjust call to count_error. * Make-lang.in (f/bad.o): Depend on diagnostic.h * bad.c: #include diagnostic.h From-SVN: r54291
2002-06-05 21:35:45 +02:00
for (p = text->format_spec; *p; ++p)
{
if (*p == '%')
{
if (*(p + 1) == '%')
++p;
else if (*(p + 1) != 's')
abort ();
else
break;
}
}
/* Print the left-hand substring. */
toplev.h (report_error_function): Remove. * toplev.h (report_error_function): Remove. * diagnostic.h (location_t): New datatype. (text_info): Likewise. (diagnostic_info): Likewise. (output_prefix): New macro. (diagnostic_last_function_changed): Likewise. (diagnostic_set_last_function): Likewise. (diagnostic_last_module_changed): Likewise. (diagnostic_set_last_module): Likewise. (report_diagnostic): Now macro. (diagnostic_set_info): Declare. * diagnostic.c (report_problematic_module): Rename to diagnostic_repor_current_module. (set_diagnostic_context): Remove. (count_error): Rename to diagnostic_error_count. (error_function_changed): Remove. (record_last_error_function): Likewise. (error_module_changed): Likewise. (record_last_error_module): Likewise. (context_as_prefix): Rename to diagnostic_build_prefix. (flush_diagnostic_buffer): Rename to diagnostic_flush_buffer. (diagnostic_set_info): New function. * objc/objc-act.c: #include diagnostic.h (error_with_ivar): Adjust call to count_error. (warn_with_method): Likewise. * objc/Make-lang.in (objc-act.o): Depend on diagnostic.h cp/ 2002-06-04 Gabriel Dos Reis <gdr@codesourcery.com> * error.c (cp_diagnostic_starter): Adjust call. (maybe_print_instantiation_context): Change prototype to take a 'diagnostic_info *'. (print_instantiation_full_context): Likewise. (print_instantiation_partial_context): Likewise. (cp_diagnostic_starter): Likewise. (cp_diagnostic_finalizer): Likewise. (cp_print_error_function): Likewise. (cp_printer): Take a secondary parameter as a 'text_info *'. Remove output_state savings. Adjust calls. f/ 2002-06-04 Gabriel Dos Reis <gdr@codesourcery.com> * bad.c (ffebad_start_): Adjust call to count_error. * Make-lang.in (f/bad.o): Depend on diagnostic.h * bad.c: #include diagnostic.h From-SVN: r54291
2002-06-05 21:35:45 +02:00
maybe_wrap_text (buffer, text->format_spec, p);
if (*p == '%') /* Print the name. */
{
c-parse.in (yyerror): Const-ification and/or static-ization. * c-parse.in (yyerror): Const-ification and/or static-ization. * c-typeck.c (push_member_name): Likewise. * collect2.c (main): Likewise. * dbxout.c (dbxout_parms): Likewise. * diagnostic.c (format_with_decl): Likewise. * dwarf2out.c (output_ranges): Likewise. * dwarfout.c (fundamental_type_code): Likewise. * except.c (dw2_output_call_site_table): Likewise. * gcc.c (do_spec_1): Likewise. * genopinit.c (optabs): Likewise. * objc/objc-act.c (synth_id_with_class_suffix, start_class, gen_declaration_1, handle_impent): Likewise. * protoize.c (default_include, in_system_include_dir, abspath): Likewise. * sched-vis.c (visualize_stall_cycles): Likewise. * sdbout.c (plain_type_1, sdbout_end_function, sdbout_end_epilogue): Likewise. * varasm.c (decode_reg_name): Likewise. * 1750a.c (mod_regno_adjust): Likewise. * alpha.c (alpha_write_one_linkage, unicosmk_output_default_externs): Likewise. * arm.c (arm_condition_codes): Likewise. * arm.h (arm_condition_codes): Likewise. * avr.c (output_movsisf, encode_section_info): Likewise. * darwin.h (GEN_BINDER_NAME_FOR_STUB, GEN_SYMBOL_NAME_FOR_SYMBOL): Likewise. * i386.c (hi_reg_name, qi_reg_name, qi_high_reg_name): Likewise. * i386.h (hi_reg_name, qi_reg_name, qi_high_reg_name): Likewise. * m88k.c (output_function_profiler): Likewise. * mips.c (mips_output_conditional_branch): Likewise. * ns32k.c (ns32k_out_reg_names): Likewise. * ns32k.h (ns32k_out_reg_names): Likewise. * pj.c (pj_output_rval): Likewise. * rs6000.c (GEN_LOCAL_LABEL_FOR_SYMBOL): Likewise. * sparc.c (sparc_flat_function_prologue, sparc_flat_function_epilogue): Likewise. cp: * decl.c (warn_extern_redeclared_static, cp_make_fname_decl): Const-ification. * pt.c (tsubst_decl): Likewise. f: * bad.c (ffebad_finish): Const-ification and/or static-ization. * intrin.c (ffeintrin_cmp_name_): Likewise. * stc.c (ffestc_R904): Likewise. java: * expr.c (expand_invoke): Const-ification. * parse.y (patch_method_invocation): Likewise. From-SVN: r45581
2001-09-13 16:37:29 +02:00
const char *const n = (DECL_NAME (decl)
Makefile.in: Update. * 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 08:58:41 +01:00
? (*lang_hooks.decl_printable_name) (decl, 2)
: _("((anonymous))"));
output_add_string (buffer, n);
while (*p)
{
++p;
if (ISALPHA (*(p - 1) & 0xFF))
break;
}
}
if (*p) /* Print the rest of the message. */
{
toplev.h (report_error_function): Remove. * toplev.h (report_error_function): Remove. * diagnostic.h (location_t): New datatype. (text_info): Likewise. (diagnostic_info): Likewise. (output_prefix): New macro. (diagnostic_last_function_changed): Likewise. (diagnostic_set_last_function): Likewise. (diagnostic_last_module_changed): Likewise. (diagnostic_set_last_module): Likewise. (report_diagnostic): Now macro. (diagnostic_set_info): Declare. * diagnostic.c (report_problematic_module): Rename to diagnostic_repor_current_module. (set_diagnostic_context): Remove. (count_error): Rename to diagnostic_error_count. (error_function_changed): Remove. (record_last_error_function): Likewise. (error_module_changed): Likewise. (record_last_error_module): Likewise. (context_as_prefix): Rename to diagnostic_build_prefix. (flush_diagnostic_buffer): Rename to diagnostic_flush_buffer. (diagnostic_set_info): New function. * objc/objc-act.c: #include diagnostic.h (error_with_ivar): Adjust call to count_error. (warn_with_method): Likewise. * objc/Make-lang.in (objc-act.o): Depend on diagnostic.h cp/ 2002-06-04 Gabriel Dos Reis <gdr@codesourcery.com> * error.c (cp_diagnostic_starter): Adjust call. (maybe_print_instantiation_context): Change prototype to take a 'diagnostic_info *'. (print_instantiation_full_context): Likewise. (print_instantiation_partial_context): Likewise. (cp_diagnostic_starter): Likewise. (cp_diagnostic_finalizer): Likewise. (cp_print_error_function): Likewise. (cp_printer): Take a secondary parameter as a 'text_info *'. Remove output_state savings. Adjust calls. f/ 2002-06-04 Gabriel Dos Reis <gdr@codesourcery.com> * bad.c (ffebad_start_): Adjust call to count_error. * Make-lang.in (f/bad.o): Depend on diagnostic.h * bad.c: #include diagnostic.h From-SVN: r54291
2002-06-05 21:35:45 +02:00
text->format_spec = p;
output_format (buffer, text);
}
}
/* Flush the content of BUFFER onto the attached stream. */
static void
output_flush (buffer)
output_buffer *buffer;
{
output_buffer_to_stream (buffer);
output_clear_data (buffer);
fputc ('\n', output_buffer_attached_stream (buffer));
fflush (output_buffer_attached_stream (buffer));
}
/* Helper subroutine of output_verbatim and verbatim. Do the appropriate
settings needed by BUFFER for a verbatim formatting. */
static void
toplev.h (report_error_function): Remove. * toplev.h (report_error_function): Remove. * diagnostic.h (location_t): New datatype. (text_info): Likewise. (diagnostic_info): Likewise. (output_prefix): New macro. (diagnostic_last_function_changed): Likewise. (diagnostic_set_last_function): Likewise. (diagnostic_last_module_changed): Likewise. (diagnostic_set_last_module): Likewise. (report_diagnostic): Now macro. (diagnostic_set_info): Declare. * diagnostic.c (report_problematic_module): Rename to diagnostic_repor_current_module. (set_diagnostic_context): Remove. (count_error): Rename to diagnostic_error_count. (error_function_changed): Remove. (record_last_error_function): Likewise. (error_module_changed): Likewise. (record_last_error_module): Likewise. (context_as_prefix): Rename to diagnostic_build_prefix. (flush_diagnostic_buffer): Rename to diagnostic_flush_buffer. (diagnostic_set_info): New function. * objc/objc-act.c: #include diagnostic.h (error_with_ivar): Adjust call to count_error. (warn_with_method): Likewise. * objc/Make-lang.in (objc-act.o): Depend on diagnostic.h cp/ 2002-06-04 Gabriel Dos Reis <gdr@codesourcery.com> * error.c (cp_diagnostic_starter): Adjust call. (maybe_print_instantiation_context): Change prototype to take a 'diagnostic_info *'. (print_instantiation_full_context): Likewise. (print_instantiation_partial_context): Likewise. (cp_diagnostic_starter): Likewise. (cp_diagnostic_finalizer): Likewise. (cp_print_error_function): Likewise. (cp_printer): Take a secondary parameter as a 'text_info *'. Remove output_state savings. Adjust calls. f/ 2002-06-04 Gabriel Dos Reis <gdr@codesourcery.com> * bad.c (ffebad_start_): Adjust call to count_error. * Make-lang.in (f/bad.o): Depend on diagnostic.h * bad.c: #include diagnostic.h From-SVN: r54291
2002-06-05 21:35:45 +02:00
output_do_verbatim (buffer, text)
output_buffer *buffer;
toplev.h (report_error_function): Remove. * toplev.h (report_error_function): Remove. * diagnostic.h (location_t): New datatype. (text_info): Likewise. (diagnostic_info): Likewise. (output_prefix): New macro. (diagnostic_last_function_changed): Likewise. (diagnostic_set_last_function): Likewise. (diagnostic_last_module_changed): Likewise. (diagnostic_set_last_module): Likewise. (report_diagnostic): Now macro. (diagnostic_set_info): Declare. * diagnostic.c (report_problematic_module): Rename to diagnostic_repor_current_module. (set_diagnostic_context): Remove. (count_error): Rename to diagnostic_error_count. (error_function_changed): Remove. (record_last_error_function): Likewise. (error_module_changed): Likewise. (record_last_error_module): Likewise. (context_as_prefix): Rename to diagnostic_build_prefix. (flush_diagnostic_buffer): Rename to diagnostic_flush_buffer. (diagnostic_set_info): New function. * objc/objc-act.c: #include diagnostic.h (error_with_ivar): Adjust call to count_error. (warn_with_method): Likewise. * objc/Make-lang.in (objc-act.o): Depend on diagnostic.h cp/ 2002-06-04 Gabriel Dos Reis <gdr@codesourcery.com> * error.c (cp_diagnostic_starter): Adjust call. (maybe_print_instantiation_context): Change prototype to take a 'diagnostic_info *'. (print_instantiation_full_context): Likewise. (print_instantiation_partial_context): Likewise. (cp_diagnostic_starter): Likewise. (cp_diagnostic_finalizer): Likewise. (cp_print_error_function): Likewise. (cp_printer): Take a secondary parameter as a 'text_info *'. Remove output_state savings. Adjust calls. f/ 2002-06-04 Gabriel Dos Reis <gdr@codesourcery.com> * bad.c (ffebad_start_): Adjust call to count_error. * Make-lang.in (f/bad.o): Depend on diagnostic.h * bad.c: #include diagnostic.h From-SVN: r54291
2002-06-05 21:35:45 +02:00
text_info *text;
{
toplev.h (report_error_function): Remove. * toplev.h (report_error_function): Remove. * diagnostic.h (location_t): New datatype. (text_info): Likewise. (diagnostic_info): Likewise. (output_prefix): New macro. (diagnostic_last_function_changed): Likewise. (diagnostic_set_last_function): Likewise. (diagnostic_last_module_changed): Likewise. (diagnostic_set_last_module): Likewise. (report_diagnostic): Now macro. (diagnostic_set_info): Declare. * diagnostic.c (report_problematic_module): Rename to diagnostic_repor_current_module. (set_diagnostic_context): Remove. (count_error): Rename to diagnostic_error_count. (error_function_changed): Remove. (record_last_error_function): Likewise. (error_module_changed): Likewise. (record_last_error_module): Likewise. (context_as_prefix): Rename to diagnostic_build_prefix. (flush_diagnostic_buffer): Rename to diagnostic_flush_buffer. (diagnostic_set_info): New function. * objc/objc-act.c: #include diagnostic.h (error_with_ivar): Adjust call to count_error. (warn_with_method): Likewise. * objc/Make-lang.in (objc-act.o): Depend on diagnostic.h cp/ 2002-06-04 Gabriel Dos Reis <gdr@codesourcery.com> * error.c (cp_diagnostic_starter): Adjust call. (maybe_print_instantiation_context): Change prototype to take a 'diagnostic_info *'. (print_instantiation_full_context): Likewise. (print_instantiation_partial_context): Likewise. (cp_diagnostic_starter): Likewise. (cp_diagnostic_finalizer): Likewise. (cp_print_error_function): Likewise. (cp_printer): Take a secondary parameter as a 'text_info *'. Remove output_state savings. Adjust calls. f/ 2002-06-04 Gabriel Dos Reis <gdr@codesourcery.com> * bad.c (ffebad_start_): Adjust call to count_error. * Make-lang.in (f/bad.o): Depend on diagnostic.h * bad.c: #include diagnostic.h From-SVN: r54291
2002-06-05 21:35:45 +02:00
diagnostic_prefixing_rule_t rule = output_prefixing_rule (buffer);
int line_cutoff = output_line_cutoff (buffer);
toplev.h (report_error_function): Remove. * toplev.h (report_error_function): Remove. * diagnostic.h (location_t): New datatype. (text_info): Likewise. (diagnostic_info): Likewise. (output_prefix): New macro. (diagnostic_last_function_changed): Likewise. (diagnostic_set_last_function): Likewise. (diagnostic_last_module_changed): Likewise. (diagnostic_set_last_module): Likewise. (report_diagnostic): Now macro. (diagnostic_set_info): Declare. * diagnostic.c (report_problematic_module): Rename to diagnostic_repor_current_module. (set_diagnostic_context): Remove. (count_error): Rename to diagnostic_error_count. (error_function_changed): Remove. (record_last_error_function): Likewise. (error_module_changed): Likewise. (record_last_error_module): Likewise. (context_as_prefix): Rename to diagnostic_build_prefix. (flush_diagnostic_buffer): Rename to diagnostic_flush_buffer. (diagnostic_set_info): New function. * objc/objc-act.c: #include diagnostic.h (error_with_ivar): Adjust call to count_error. (warn_with_method): Likewise. * objc/Make-lang.in (objc-act.o): Depend on diagnostic.h cp/ 2002-06-04 Gabriel Dos Reis <gdr@codesourcery.com> * error.c (cp_diagnostic_starter): Adjust call. (maybe_print_instantiation_context): Change prototype to take a 'diagnostic_info *'. (print_instantiation_full_context): Likewise. (print_instantiation_partial_context): Likewise. (cp_diagnostic_starter): Likewise. (cp_diagnostic_finalizer): Likewise. (cp_print_error_function): Likewise. (cp_printer): Take a secondary parameter as a 'text_info *'. Remove output_state savings. Adjust calls. f/ 2002-06-04 Gabriel Dos Reis <gdr@codesourcery.com> * bad.c (ffebad_start_): Adjust call to count_error. * Make-lang.in (f/bad.o): Depend on diagnostic.h * bad.c: #include diagnostic.h From-SVN: r54291
2002-06-05 21:35:45 +02:00
/* Set verbatim mode. */
output_prefixing_rule (buffer) = DIAGNOSTICS_SHOW_PREFIX_NEVER;
toplev.h (report_error_function): Remove. * toplev.h (report_error_function): Remove. * diagnostic.h (location_t): New datatype. (text_info): Likewise. (diagnostic_info): Likewise. (output_prefix): New macro. (diagnostic_last_function_changed): Likewise. (diagnostic_set_last_function): Likewise. (diagnostic_last_module_changed): Likewise. (diagnostic_set_last_module): Likewise. (report_diagnostic): Now macro. (diagnostic_set_info): Declare. * diagnostic.c (report_problematic_module): Rename to diagnostic_repor_current_module. (set_diagnostic_context): Remove. (count_error): Rename to diagnostic_error_count. (error_function_changed): Remove. (record_last_error_function): Likewise. (error_module_changed): Likewise. (record_last_error_module): Likewise. (context_as_prefix): Rename to diagnostic_build_prefix. (flush_diagnostic_buffer): Rename to diagnostic_flush_buffer. (diagnostic_set_info): New function. * objc/objc-act.c: #include diagnostic.h (error_with_ivar): Adjust call to count_error. (warn_with_method): Likewise. * objc/Make-lang.in (objc-act.o): Depend on diagnostic.h cp/ 2002-06-04 Gabriel Dos Reis <gdr@codesourcery.com> * error.c (cp_diagnostic_starter): Adjust call. (maybe_print_instantiation_context): Change prototype to take a 'diagnostic_info *'. (print_instantiation_full_context): Likewise. (print_instantiation_partial_context): Likewise. (cp_diagnostic_starter): Likewise. (cp_diagnostic_finalizer): Likewise. (cp_print_error_function): Likewise. (cp_printer): Take a secondary parameter as a 'text_info *'. Remove output_state savings. Adjust calls. f/ 2002-06-04 Gabriel Dos Reis <gdr@codesourcery.com> * bad.c (ffebad_start_): Adjust call to count_error. * Make-lang.in (f/bad.o): Depend on diagnostic.h * bad.c: #include diagnostic.h From-SVN: r54291
2002-06-05 21:35:45 +02:00
output_line_cutoff (buffer) = 0;
/* Do the actual formatting. */
output_format (buffer, text);
/* Restore previous settings. */
output_prefixing_rule (buffer) = rule;
output_line_cutoff (buffer) = line_cutoff;
}
/* Output MESSAGE verbatim into BUFFER. */
void
output_verbatim VPARAMS ((output_buffer *buffer, const char *msgid, ...))
{
toplev.h (report_error_function): Remove. * toplev.h (report_error_function): Remove. * diagnostic.h (location_t): New datatype. (text_info): Likewise. (diagnostic_info): Likewise. (output_prefix): New macro. (diagnostic_last_function_changed): Likewise. (diagnostic_set_last_function): Likewise. (diagnostic_last_module_changed): Likewise. (diagnostic_set_last_module): Likewise. (report_diagnostic): Now macro. (diagnostic_set_info): Declare. * diagnostic.c (report_problematic_module): Rename to diagnostic_repor_current_module. (set_diagnostic_context): Remove. (count_error): Rename to diagnostic_error_count. (error_function_changed): Remove. (record_last_error_function): Likewise. (error_module_changed): Likewise. (record_last_error_module): Likewise. (context_as_prefix): Rename to diagnostic_build_prefix. (flush_diagnostic_buffer): Rename to diagnostic_flush_buffer. (diagnostic_set_info): New function. * objc/objc-act.c: #include diagnostic.h (error_with_ivar): Adjust call to count_error. (warn_with_method): Likewise. * objc/Make-lang.in (objc-act.o): Depend on diagnostic.h cp/ 2002-06-04 Gabriel Dos Reis <gdr@codesourcery.com> * error.c (cp_diagnostic_starter): Adjust call. (maybe_print_instantiation_context): Change prototype to take a 'diagnostic_info *'. (print_instantiation_full_context): Likewise. (print_instantiation_partial_context): Likewise. (cp_diagnostic_starter): Likewise. (cp_diagnostic_finalizer): Likewise. (cp_print_error_function): Likewise. (cp_printer): Take a secondary parameter as a 'text_info *'. Remove output_state savings. Adjust calls. f/ 2002-06-04 Gabriel Dos Reis <gdr@codesourcery.com> * bad.c (ffebad_start_): Adjust call to count_error. * Make-lang.in (f/bad.o): Depend on diagnostic.h * bad.c: #include diagnostic.h From-SVN: r54291
2002-06-05 21:35:45 +02:00
text_info text;
VA_OPEN (ap, msgid);
VA_FIXEDARG (ap, output_buffer *, buffer);
VA_FIXEDARG (ap, const char *, msgid);
toplev.h (report_error_function): Remove. * toplev.h (report_error_function): Remove. * diagnostic.h (location_t): New datatype. (text_info): Likewise. (diagnostic_info): Likewise. (output_prefix): New macro. (diagnostic_last_function_changed): Likewise. (diagnostic_set_last_function): Likewise. (diagnostic_last_module_changed): Likewise. (diagnostic_set_last_module): Likewise. (report_diagnostic): Now macro. (diagnostic_set_info): Declare. * diagnostic.c (report_problematic_module): Rename to diagnostic_repor_current_module. (set_diagnostic_context): Remove. (count_error): Rename to diagnostic_error_count. (error_function_changed): Remove. (record_last_error_function): Likewise. (error_module_changed): Likewise. (record_last_error_module): Likewise. (context_as_prefix): Rename to diagnostic_build_prefix. (flush_diagnostic_buffer): Rename to diagnostic_flush_buffer. (diagnostic_set_info): New function. * objc/objc-act.c: #include diagnostic.h (error_with_ivar): Adjust call to count_error. (warn_with_method): Likewise. * objc/Make-lang.in (objc-act.o): Depend on diagnostic.h cp/ 2002-06-04 Gabriel Dos Reis <gdr@codesourcery.com> * error.c (cp_diagnostic_starter): Adjust call. (maybe_print_instantiation_context): Change prototype to take a 'diagnostic_info *'. (print_instantiation_full_context): Likewise. (print_instantiation_partial_context): Likewise. (cp_diagnostic_starter): Likewise. (cp_diagnostic_finalizer): Likewise. (cp_print_error_function): Likewise. (cp_printer): Take a secondary parameter as a 'text_info *'. Remove output_state savings. Adjust calls. f/ 2002-06-04 Gabriel Dos Reis <gdr@codesourcery.com> * bad.c (ffebad_start_): Adjust call to count_error. * Make-lang.in (f/bad.o): Depend on diagnostic.h * bad.c: #include diagnostic.h From-SVN: r54291
2002-06-05 21:35:45 +02:00
text.format_spec = msgid;
text.args_ptr = &ap;
output_do_verbatim (buffer, &text);
VA_CLOSE (ap);
}
toplev.h (report_error_function): Remove. * toplev.h (report_error_function): Remove. * diagnostic.h (location_t): New datatype. (text_info): Likewise. (diagnostic_info): Likewise. (output_prefix): New macro. (diagnostic_last_function_changed): Likewise. (diagnostic_set_last_function): Likewise. (diagnostic_last_module_changed): Likewise. (diagnostic_set_last_module): Likewise. (report_diagnostic): Now macro. (diagnostic_set_info): Declare. * diagnostic.c (report_problematic_module): Rename to diagnostic_repor_current_module. (set_diagnostic_context): Remove. (count_error): Rename to diagnostic_error_count. (error_function_changed): Remove. (record_last_error_function): Likewise. (error_module_changed): Likewise. (record_last_error_module): Likewise. (context_as_prefix): Rename to diagnostic_build_prefix. (flush_diagnostic_buffer): Rename to diagnostic_flush_buffer. (diagnostic_set_info): New function. * objc/objc-act.c: #include diagnostic.h (error_with_ivar): Adjust call to count_error. (warn_with_method): Likewise. * objc/Make-lang.in (objc-act.o): Depend on diagnostic.h cp/ 2002-06-04 Gabriel Dos Reis <gdr@codesourcery.com> * error.c (cp_diagnostic_starter): Adjust call. (maybe_print_instantiation_context): Change prototype to take a 'diagnostic_info *'. (print_instantiation_full_context): Likewise. (print_instantiation_partial_context): Likewise. (cp_diagnostic_starter): Likewise. (cp_diagnostic_finalizer): Likewise. (cp_print_error_function): Likewise. (cp_printer): Take a secondary parameter as a 'text_info *'. Remove output_state savings. Adjust calls. f/ 2002-06-04 Gabriel Dos Reis <gdr@codesourcery.com> * bad.c (ffebad_start_): Adjust call to count_error. * Make-lang.in (f/bad.o): Depend on diagnostic.h * bad.c: #include diagnostic.h From-SVN: r54291
2002-06-05 21:35:45 +02:00
toplev.h (report_error_function): Remove. * toplev.h (report_error_function): Remove. * diagnostic.h (location_t): New datatype. (text_info): Likewise. (diagnostic_info): Likewise. (output_prefix): New macro. (diagnostic_last_function_changed): Likewise. (diagnostic_set_last_function): Likewise. (diagnostic_last_module_changed): Likewise. (diagnostic_set_last_module): Likewise. (report_diagnostic): Now macro. (diagnostic_set_info): Declare. * diagnostic.c (report_problematic_module): Rename to diagnostic_repor_current_module. (set_diagnostic_context): Remove. (count_error): Rename to diagnostic_error_count. (error_function_changed): Remove. (record_last_error_function): Likewise. (error_module_changed): Likewise. (record_last_error_module): Likewise. (context_as_prefix): Rename to diagnostic_build_prefix. (flush_diagnostic_buffer): Rename to diagnostic_flush_buffer. (diagnostic_set_info): New function. * objc/objc-act.c: #include diagnostic.h (error_with_ivar): Adjust call to count_error. (warn_with_method): Likewise. * objc/Make-lang.in (objc-act.o): Depend on diagnostic.h cp/ 2002-06-04 Gabriel Dos Reis <gdr@codesourcery.com> * error.c (cp_diagnostic_starter): Adjust call. (maybe_print_instantiation_context): Change prototype to take a 'diagnostic_info *'. (print_instantiation_full_context): Likewise. (print_instantiation_partial_context): Likewise. (cp_diagnostic_starter): Likewise. (cp_diagnostic_finalizer): Likewise. (cp_print_error_function): Likewise. (cp_printer): Take a secondary parameter as a 'text_info *'. Remove output_state savings. Adjust calls. f/ 2002-06-04 Gabriel Dos Reis <gdr@codesourcery.com> * bad.c (ffebad_start_): Adjust call to count_error. * Make-lang.in (f/bad.o): Depend on diagnostic.h * bad.c: #include diagnostic.h From-SVN: r54291
2002-06-05 21:35:45 +02:00
/* Initialize the diagnostic message outputting machinery. */
void
diagnostic_initialize (context)
diagnostic_context *context;
{
memset (context, 0, sizeof *context);
obstack_init (&context->buffer.obstack);
toplev.h (report_error_function): Remove. * toplev.h (report_error_function): Remove. * diagnostic.h (location_t): New datatype. (text_info): Likewise. (diagnostic_info): Likewise. (output_prefix): New macro. (diagnostic_last_function_changed): Likewise. (diagnostic_set_last_function): Likewise. (diagnostic_last_module_changed): Likewise. (diagnostic_set_last_module): Likewise. (report_diagnostic): Now macro. (diagnostic_set_info): Declare. * diagnostic.c (report_problematic_module): Rename to diagnostic_repor_current_module. (set_diagnostic_context): Remove. (count_error): Rename to diagnostic_error_count. (error_function_changed): Remove. (record_last_error_function): Likewise. (error_module_changed): Likewise. (record_last_error_module): Likewise. (context_as_prefix): Rename to diagnostic_build_prefix. (flush_diagnostic_buffer): Rename to diagnostic_flush_buffer. (diagnostic_set_info): New function. * objc/objc-act.c: #include diagnostic.h (error_with_ivar): Adjust call to count_error. (warn_with_method): Likewise. * objc/Make-lang.in (objc-act.o): Depend on diagnostic.h cp/ 2002-06-04 Gabriel Dos Reis <gdr@codesourcery.com> * error.c (cp_diagnostic_starter): Adjust call. (maybe_print_instantiation_context): Change prototype to take a 'diagnostic_info *'. (print_instantiation_full_context): Likewise. (print_instantiation_partial_context): Likewise. (cp_diagnostic_starter): Likewise. (cp_diagnostic_finalizer): Likewise. (cp_print_error_function): Likewise. (cp_printer): Take a secondary parameter as a 'text_info *'. Remove output_state savings. Adjust calls. f/ 2002-06-04 Gabriel Dos Reis <gdr@codesourcery.com> * bad.c (ffebad_start_): Adjust call to count_error. * Make-lang.in (f/bad.o): Depend on diagnostic.h * bad.c: #include diagnostic.h From-SVN: r54291
2002-06-05 21:35:45 +02:00
/* By default, diagnostics are sent to stderr. */
output_buffer_attached_stream (&context->buffer) = stderr;
/* By default, we emit prefixes once per message. */
diagnostic_prefixing_rule (context) = DIAGNOSTICS_SHOW_PREFIX_ONCE;
diagnostic_starter (context) = default_diagnostic_starter;
diagnostic_finalizer (context) = default_diagnostic_finalizer;
context->warnings_are_errors_message = warnings_are_errors;
toplev.h (report_error_function): Remove. * toplev.h (report_error_function): Remove. * diagnostic.h (location_t): New datatype. (text_info): Likewise. (diagnostic_info): Likewise. (output_prefix): New macro. (diagnostic_last_function_changed): Likewise. (diagnostic_set_last_function): Likewise. (diagnostic_last_module_changed): Likewise. (diagnostic_set_last_module): Likewise. (report_diagnostic): Now macro. (diagnostic_set_info): Declare. * diagnostic.c (report_problematic_module): Rename to diagnostic_repor_current_module. (set_diagnostic_context): Remove. (count_error): Rename to diagnostic_error_count. (error_function_changed): Remove. (record_last_error_function): Likewise. (error_module_changed): Likewise. (record_last_error_module): Likewise. (context_as_prefix): Rename to diagnostic_build_prefix. (flush_diagnostic_buffer): Rename to diagnostic_flush_buffer. (diagnostic_set_info): New function. * objc/objc-act.c: #include diagnostic.h (error_with_ivar): Adjust call to count_error. (warn_with_method): Likewise. * objc/Make-lang.in (objc-act.o): Depend on diagnostic.h cp/ 2002-06-04 Gabriel Dos Reis <gdr@codesourcery.com> * error.c (cp_diagnostic_starter): Adjust call. (maybe_print_instantiation_context): Change prototype to take a 'diagnostic_info *'. (print_instantiation_full_context): Likewise. (print_instantiation_partial_context): Likewise. (cp_diagnostic_starter): Likewise. (cp_diagnostic_finalizer): Likewise. (cp_print_error_function): Likewise. (cp_printer): Take a secondary parameter as a 'text_info *'. Remove output_state savings. Adjust calls. f/ 2002-06-04 Gabriel Dos Reis <gdr@codesourcery.com> * bad.c (ffebad_start_): Adjust call to count_error. * Make-lang.in (f/bad.o): Depend on diagnostic.h * bad.c: #include diagnostic.h From-SVN: r54291
2002-06-05 21:35:45 +02:00
}
/* Returns true if the next format specifier in TEXT is a format specifier
for a location_t. If so, update the object pointed by LOCUS to reflect
the specified location in *TEXT->args_ptr. */
static bool
text_specifies_location (text, locus)
text_info *text;
location_t *locus;
{
const char *p;
/* Skip any leading text. */
for (p = text->format_spec; *p && *p != '%'; ++p)
;
/* Extract the location information if any. */
if (*p == '%' && *++p == 'H')
{
*locus = *va_arg (*text->args_ptr, location_t *);
text->format_spec = p + 1;
return true;
}
return false;
}
toplev.h (report_error_function): Remove. * toplev.h (report_error_function): Remove. * diagnostic.h (location_t): New datatype. (text_info): Likewise. (diagnostic_info): Likewise. (output_prefix): New macro. (diagnostic_last_function_changed): Likewise. (diagnostic_set_last_function): Likewise. (diagnostic_last_module_changed): Likewise. (diagnostic_set_last_module): Likewise. (report_diagnostic): Now macro. (diagnostic_set_info): Declare. * diagnostic.c (report_problematic_module): Rename to diagnostic_repor_current_module. (set_diagnostic_context): Remove. (count_error): Rename to diagnostic_error_count. (error_function_changed): Remove. (record_last_error_function): Likewise. (error_module_changed): Likewise. (record_last_error_module): Likewise. (context_as_prefix): Rename to diagnostic_build_prefix. (flush_diagnostic_buffer): Rename to diagnostic_flush_buffer. (diagnostic_set_info): New function. * objc/objc-act.c: #include diagnostic.h (error_with_ivar): Adjust call to count_error. (warn_with_method): Likewise. * objc/Make-lang.in (objc-act.o): Depend on diagnostic.h cp/ 2002-06-04 Gabriel Dos Reis <gdr@codesourcery.com> * error.c (cp_diagnostic_starter): Adjust call. (maybe_print_instantiation_context): Change prototype to take a 'diagnostic_info *'. (print_instantiation_full_context): Likewise. (print_instantiation_partial_context): Likewise. (cp_diagnostic_starter): Likewise. (cp_diagnostic_finalizer): Likewise. (cp_print_error_function): Likewise. (cp_printer): Take a secondary parameter as a 'text_info *'. Remove output_state savings. Adjust calls. f/ 2002-06-04 Gabriel Dos Reis <gdr@codesourcery.com> * bad.c (ffebad_start_): Adjust call to count_error. * Make-lang.in (f/bad.o): Depend on diagnostic.h * bad.c: #include diagnostic.h From-SVN: r54291
2002-06-05 21:35:45 +02:00
void
diagnostic_set_info (diagnostic, msgid, args, file, line, kind)
diagnostic_info *diagnostic;
const char *msgid;
va_list *args;
const char *file;
int line;
diagnostic_t kind;
{
diagnostic->message.format_spec = msgid;
diagnostic->message.args_ptr = args;
/* If the diagnostic message doesn't specify a location,
use FILE and LINE. */
if (!text_specifies_location (&diagnostic->message, &diagnostic->location))
{
diagnostic->location.file = file;
diagnostic->location.line = line;
}
toplev.h (report_error_function): Remove. * toplev.h (report_error_function): Remove. * diagnostic.h (location_t): New datatype. (text_info): Likewise. (diagnostic_info): Likewise. (output_prefix): New macro. (diagnostic_last_function_changed): Likewise. (diagnostic_set_last_function): Likewise. (diagnostic_last_module_changed): Likewise. (diagnostic_set_last_module): Likewise. (report_diagnostic): Now macro. (diagnostic_set_info): Declare. * diagnostic.c (report_problematic_module): Rename to diagnostic_repor_current_module. (set_diagnostic_context): Remove. (count_error): Rename to diagnostic_error_count. (error_function_changed): Remove. (record_last_error_function): Likewise. (error_module_changed): Likewise. (record_last_error_module): Likewise. (context_as_prefix): Rename to diagnostic_build_prefix. (flush_diagnostic_buffer): Rename to diagnostic_flush_buffer. (diagnostic_set_info): New function. * objc/objc-act.c: #include diagnostic.h (error_with_ivar): Adjust call to count_error. (warn_with_method): Likewise. * objc/Make-lang.in (objc-act.o): Depend on diagnostic.h cp/ 2002-06-04 Gabriel Dos Reis <gdr@codesourcery.com> * error.c (cp_diagnostic_starter): Adjust call. (maybe_print_instantiation_context): Change prototype to take a 'diagnostic_info *'. (print_instantiation_full_context): Likewise. (print_instantiation_partial_context): Likewise. (cp_diagnostic_starter): Likewise. (cp_diagnostic_finalizer): Likewise. (cp_print_error_function): Likewise. (cp_printer): Take a secondary parameter as a 'text_info *'. Remove output_state savings. Adjust calls. f/ 2002-06-04 Gabriel Dos Reis <gdr@codesourcery.com> * bad.c (ffebad_start_): Adjust call to count_error. * Make-lang.in (f/bad.o): Depend on diagnostic.h * bad.c: #include diagnostic.h From-SVN: r54291
2002-06-05 21:35:45 +02:00
diagnostic->kind = kind;
}
/* Return a malloc'd string describing a location. The caller is
responsible for freeing the memory. */
char *
diagnostic_build_prefix (diagnostic)
diagnostic_info *diagnostic;
{
static const char *const diagnostic_kind_text[] = {
#define DEFINE_DIAGNOSTIC_KIND(K, T) (T),
#include "diagnostic.def"
#undef DEFINE_DIAGNOSTIC_KIND
"must-not-happen"
};
if (diagnostic->kind >= DK_LAST_DIAGNOSTIC_KIND)
abort();
return diagnostic->location.file
? build_message_string ("%s:%d: %s",
diagnostic->location.file,
diagnostic->location.line,
_(diagnostic_kind_text[diagnostic->kind]))
: build_message_string ("%s: %s", progname,
_(diagnostic_kind_text[diagnostic->kind]));
toplev.h (report_error_function): Remove. * toplev.h (report_error_function): Remove. * diagnostic.h (location_t): New datatype. (text_info): Likewise. (diagnostic_info): Likewise. (output_prefix): New macro. (diagnostic_last_function_changed): Likewise. (diagnostic_set_last_function): Likewise. (diagnostic_last_module_changed): Likewise. (diagnostic_set_last_module): Likewise. (report_diagnostic): Now macro. (diagnostic_set_info): Declare. * diagnostic.c (report_problematic_module): Rename to diagnostic_repor_current_module. (set_diagnostic_context): Remove. (count_error): Rename to diagnostic_error_count. (error_function_changed): Remove. (record_last_error_function): Likewise. (error_module_changed): Likewise. (record_last_error_module): Likewise. (context_as_prefix): Rename to diagnostic_build_prefix. (flush_diagnostic_buffer): Rename to diagnostic_flush_buffer. (diagnostic_set_info): New function. * objc/objc-act.c: #include diagnostic.h (error_with_ivar): Adjust call to count_error. (warn_with_method): Likewise. * objc/Make-lang.in (objc-act.o): Depend on diagnostic.h cp/ 2002-06-04 Gabriel Dos Reis <gdr@codesourcery.com> * error.c (cp_diagnostic_starter): Adjust call. (maybe_print_instantiation_context): Change prototype to take a 'diagnostic_info *'. (print_instantiation_full_context): Likewise. (print_instantiation_partial_context): Likewise. (cp_diagnostic_starter): Likewise. (cp_diagnostic_finalizer): Likewise. (cp_print_error_function): Likewise. (cp_printer): Take a secondary parameter as a 'text_info *'. Remove output_state savings. Adjust calls. f/ 2002-06-04 Gabriel Dos Reis <gdr@codesourcery.com> * bad.c (ffebad_start_): Adjust call to count_error. * Make-lang.in (f/bad.o): Depend on diagnostic.h * bad.c: #include diagnostic.h From-SVN: r54291
2002-06-05 21:35:45 +02:00
}
void
diagnostic_flush_buffer (context)
diagnostic_context *context;
{
output_buffer_to_stream (&context->buffer);
fflush (output_buffer_attached_stream (&context->buffer));
}
/* Count a diagnostic. Return true if the message should be printed. */
toplev.h (report_error_function): Remove. * toplev.h (report_error_function): Remove. * diagnostic.h (location_t): New datatype. (text_info): Likewise. (diagnostic_info): Likewise. (output_prefix): New macro. (diagnostic_last_function_changed): Likewise. (diagnostic_set_last_function): Likewise. (diagnostic_last_module_changed): Likewise. (diagnostic_set_last_module): Likewise. (report_diagnostic): Now macro. (diagnostic_set_info): Declare. * diagnostic.c (report_problematic_module): Rename to diagnostic_repor_current_module. (set_diagnostic_context): Remove. (count_error): Rename to diagnostic_error_count. (error_function_changed): Remove. (record_last_error_function): Likewise. (error_module_changed): Likewise. (record_last_error_module): Likewise. (context_as_prefix): Rename to diagnostic_build_prefix. (flush_diagnostic_buffer): Rename to diagnostic_flush_buffer. (diagnostic_set_info): New function. * objc/objc-act.c: #include diagnostic.h (error_with_ivar): Adjust call to count_error. (warn_with_method): Likewise. * objc/Make-lang.in (objc-act.o): Depend on diagnostic.h cp/ 2002-06-04 Gabriel Dos Reis <gdr@codesourcery.com> * error.c (cp_diagnostic_starter): Adjust call. (maybe_print_instantiation_context): Change prototype to take a 'diagnostic_info *'. (print_instantiation_full_context): Likewise. (print_instantiation_partial_context): Likewise. (cp_diagnostic_starter): Likewise. (cp_diagnostic_finalizer): Likewise. (cp_print_error_function): Likewise. (cp_printer): Take a secondary parameter as a 'text_info *'. Remove output_state savings. Adjust calls. f/ 2002-06-04 Gabriel Dos Reis <gdr@codesourcery.com> * bad.c (ffebad_start_): Adjust call to count_error. * Make-lang.in (f/bad.o): Depend on diagnostic.h * bad.c: #include diagnostic.h From-SVN: r54291
2002-06-05 21:35:45 +02:00
bool
diagnostic_count_diagnostic (context, kind)
toplev.h (report_error_function): Remove. * toplev.h (report_error_function): Remove. * diagnostic.h (location_t): New datatype. (text_info): Likewise. (diagnostic_info): Likewise. (output_prefix): New macro. (diagnostic_last_function_changed): Likewise. (diagnostic_set_last_function): Likewise. (diagnostic_last_module_changed): Likewise. (diagnostic_set_last_module): Likewise. (report_diagnostic): Now macro. (diagnostic_set_info): Declare. * diagnostic.c (report_problematic_module): Rename to diagnostic_repor_current_module. (set_diagnostic_context): Remove. (count_error): Rename to diagnostic_error_count. (error_function_changed): Remove. (record_last_error_function): Likewise. (error_module_changed): Likewise. (record_last_error_module): Likewise. (context_as_prefix): Rename to diagnostic_build_prefix. (flush_diagnostic_buffer): Rename to diagnostic_flush_buffer. (diagnostic_set_info): New function. * objc/objc-act.c: #include diagnostic.h (error_with_ivar): Adjust call to count_error. (warn_with_method): Likewise. * objc/Make-lang.in (objc-act.o): Depend on diagnostic.h cp/ 2002-06-04 Gabriel Dos Reis <gdr@codesourcery.com> * error.c (cp_diagnostic_starter): Adjust call. (maybe_print_instantiation_context): Change prototype to take a 'diagnostic_info *'. (print_instantiation_full_context): Likewise. (print_instantiation_partial_context): Likewise. (cp_diagnostic_starter): Likewise. (cp_diagnostic_finalizer): Likewise. (cp_print_error_function): Likewise. (cp_printer): Take a secondary parameter as a 'text_info *'. Remove output_state savings. Adjust calls. f/ 2002-06-04 Gabriel Dos Reis <gdr@codesourcery.com> * bad.c (ffebad_start_): Adjust call to count_error. * Make-lang.in (f/bad.o): Depend on diagnostic.h * bad.c: #include diagnostic.h From-SVN: r54291
2002-06-05 21:35:45 +02:00
diagnostic_context *context;
diagnostic_t kind;
{
switch (kind)
{
default:
abort();
break;
case DK_FATAL: case DK_ICE: case DK_SORRY:
case DK_ANACHRONISM: case DK_NOTE:
++diagnostic_kind_count (context, kind);
break;
case DK_WARNING:
if (!diagnostic_report_warnings_p ())
return false;
else if (!warnings_are_errors)
{
++diagnostic_kind_count (context, DK_WARNING);
break;
}
/* else fall through. */
case DK_ERROR:
if (kind == DK_WARNING && context->warnings_are_errors_message)
{
toplev.h (report_error_function): Remove. * toplev.h (report_error_function): Remove. * diagnostic.h (location_t): New datatype. (text_info): Likewise. (diagnostic_info): Likewise. (output_prefix): New macro. (diagnostic_last_function_changed): Likewise. (diagnostic_set_last_function): Likewise. (diagnostic_last_module_changed): Likewise. (diagnostic_set_last_module): Likewise. (report_diagnostic): Now macro. (diagnostic_set_info): Declare. * diagnostic.c (report_problematic_module): Rename to diagnostic_repor_current_module. (set_diagnostic_context): Remove. (count_error): Rename to diagnostic_error_count. (error_function_changed): Remove. (record_last_error_function): Likewise. (error_module_changed): Likewise. (record_last_error_module): Likewise. (context_as_prefix): Rename to diagnostic_build_prefix. (flush_diagnostic_buffer): Rename to diagnostic_flush_buffer. (diagnostic_set_info): New function. * objc/objc-act.c: #include diagnostic.h (error_with_ivar): Adjust call to count_error. (warn_with_method): Likewise. * objc/Make-lang.in (objc-act.o): Depend on diagnostic.h cp/ 2002-06-04 Gabriel Dos Reis <gdr@codesourcery.com> * error.c (cp_diagnostic_starter): Adjust call. (maybe_print_instantiation_context): Change prototype to take a 'diagnostic_info *'. (print_instantiation_full_context): Likewise. (print_instantiation_partial_context): Likewise. (cp_diagnostic_starter): Likewise. (cp_diagnostic_finalizer): Likewise. (cp_print_error_function): Likewise. (cp_printer): Take a secondary parameter as a 'text_info *'. Remove output_state savings. Adjust calls. f/ 2002-06-04 Gabriel Dos Reis <gdr@codesourcery.com> * bad.c (ffebad_start_): Adjust call to count_error. * Make-lang.in (f/bad.o): Depend on diagnostic.h * bad.c: #include diagnostic.h From-SVN: r54291
2002-06-05 21:35:45 +02:00
output_verbatim (&context->buffer,
"%s: warnings being treated as errors\n", progname);
context->warnings_are_errors_message = false;
}
toplev.h (report_error_function): Remove. * toplev.h (report_error_function): Remove. * diagnostic.h (location_t): New datatype. (text_info): Likewise. (diagnostic_info): Likewise. (output_prefix): New macro. (diagnostic_last_function_changed): Likewise. (diagnostic_set_last_function): Likewise. (diagnostic_last_module_changed): Likewise. (diagnostic_set_last_module): Likewise. (report_diagnostic): Now macro. (diagnostic_set_info): Declare. * diagnostic.c (report_problematic_module): Rename to diagnostic_repor_current_module. (set_diagnostic_context): Remove. (count_error): Rename to diagnostic_error_count. (error_function_changed): Remove. (record_last_error_function): Likewise. (error_module_changed): Likewise. (record_last_error_module): Likewise. (context_as_prefix): Rename to diagnostic_build_prefix. (flush_diagnostic_buffer): Rename to diagnostic_flush_buffer. (diagnostic_set_info): New function. * objc/objc-act.c: #include diagnostic.h (error_with_ivar): Adjust call to count_error. (warn_with_method): Likewise. * objc/Make-lang.in (objc-act.o): Depend on diagnostic.h cp/ 2002-06-04 Gabriel Dos Reis <gdr@codesourcery.com> * error.c (cp_diagnostic_starter): Adjust call. (maybe_print_instantiation_context): Change prototype to take a 'diagnostic_info *'. (print_instantiation_full_context): Likewise. (print_instantiation_partial_context): Likewise. (cp_diagnostic_starter): Likewise. (cp_diagnostic_finalizer): Likewise. (cp_print_error_function): Likewise. (cp_printer): Take a secondary parameter as a 'text_info *'. Remove output_state savings. Adjust calls. f/ 2002-06-04 Gabriel Dos Reis <gdr@codesourcery.com> * bad.c (ffebad_start_): Adjust call to count_error. * Make-lang.in (f/bad.o): Depend on diagnostic.h * bad.c: #include diagnostic.h From-SVN: r54291
2002-06-05 21:35:45 +02:00
++diagnostic_kind_count (context, DK_ERROR);
break;
}
toplev.h (report_error_function): Remove. * toplev.h (report_error_function): Remove. * diagnostic.h (location_t): New datatype. (text_info): Likewise. (diagnostic_info): Likewise. (output_prefix): New macro. (diagnostic_last_function_changed): Likewise. (diagnostic_set_last_function): Likewise. (diagnostic_last_module_changed): Likewise. (diagnostic_set_last_module): Likewise. (report_diagnostic): Now macro. (diagnostic_set_info): Declare. * diagnostic.c (report_problematic_module): Rename to diagnostic_repor_current_module. (set_diagnostic_context): Remove. (count_error): Rename to diagnostic_error_count. (error_function_changed): Remove. (record_last_error_function): Likewise. (error_module_changed): Likewise. (record_last_error_module): Likewise. (context_as_prefix): Rename to diagnostic_build_prefix. (flush_diagnostic_buffer): Rename to diagnostic_flush_buffer. (diagnostic_set_info): New function. * objc/objc-act.c: #include diagnostic.h (error_with_ivar): Adjust call to count_error. (warn_with_method): Likewise. * objc/Make-lang.in (objc-act.o): Depend on diagnostic.h cp/ 2002-06-04 Gabriel Dos Reis <gdr@codesourcery.com> * error.c (cp_diagnostic_starter): Adjust call. (maybe_print_instantiation_context): Change prototype to take a 'diagnostic_info *'. (print_instantiation_full_context): Likewise. (print_instantiation_partial_context): Likewise. (cp_diagnostic_starter): Likewise. (cp_diagnostic_finalizer): Likewise. (cp_print_error_function): Likewise. (cp_printer): Take a secondary parameter as a 'text_info *'. Remove output_state savings. Adjust calls. f/ 2002-06-04 Gabriel Dos Reis <gdr@codesourcery.com> * bad.c (ffebad_start_): Adjust call to count_error. * Make-lang.in (f/bad.o): Depend on diagnostic.h * bad.c: #include diagnostic.h From-SVN: r54291
2002-06-05 21:35:45 +02:00
return true;
}
/* Called when the start of a function definition is parsed,
this function prints on stderr the name of the function. */
void
announce_function (decl)
tree decl;
{
toplev.h (report_error_function): Remove. * toplev.h (report_error_function): Remove. * diagnostic.h (location_t): New datatype. (text_info): Likewise. (diagnostic_info): Likewise. (output_prefix): New macro. (diagnostic_last_function_changed): Likewise. (diagnostic_set_last_function): Likewise. (diagnostic_last_module_changed): Likewise. (diagnostic_set_last_module): Likewise. (report_diagnostic): Now macro. (diagnostic_set_info): Declare. * diagnostic.c (report_problematic_module): Rename to diagnostic_repor_current_module. (set_diagnostic_context): Remove. (count_error): Rename to diagnostic_error_count. (error_function_changed): Remove. (record_last_error_function): Likewise. (error_module_changed): Likewise. (record_last_error_module): Likewise. (context_as_prefix): Rename to diagnostic_build_prefix. (flush_diagnostic_buffer): Rename to diagnostic_flush_buffer. (diagnostic_set_info): New function. * objc/objc-act.c: #include diagnostic.h (error_with_ivar): Adjust call to count_error. (warn_with_method): Likewise. * objc/Make-lang.in (objc-act.o): Depend on diagnostic.h cp/ 2002-06-04 Gabriel Dos Reis <gdr@codesourcery.com> * error.c (cp_diagnostic_starter): Adjust call. (maybe_print_instantiation_context): Change prototype to take a 'diagnostic_info *'. (print_instantiation_full_context): Likewise. (print_instantiation_partial_context): Likewise. (cp_diagnostic_starter): Likewise. (cp_diagnostic_finalizer): Likewise. (cp_print_error_function): Likewise. (cp_printer): Take a secondary parameter as a 'text_info *'. Remove output_state savings. Adjust calls. f/ 2002-06-04 Gabriel Dos Reis <gdr@codesourcery.com> * bad.c (ffebad_start_): Adjust call to count_error. * Make-lang.in (f/bad.o): Depend on diagnostic.h * bad.c: #include diagnostic.h From-SVN: r54291
2002-06-05 21:35:45 +02:00
if (!quiet_flag)
{
if (rtl_dump_and_exit)
verbatim ("%s ", IDENTIFIER_POINTER (DECL_NAME (decl)));
else
verbatim (" %s", (*lang_hooks.decl_printable_name) (decl, 2));
fflush (stderr);
toplev.h (report_error_function): Remove. * toplev.h (report_error_function): Remove. * diagnostic.h (location_t): New datatype. (text_info): Likewise. (diagnostic_info): Likewise. (output_prefix): New macro. (diagnostic_last_function_changed): Likewise. (diagnostic_set_last_function): Likewise. (diagnostic_last_module_changed): Likewise. (diagnostic_set_last_module): Likewise. (report_diagnostic): Now macro. (diagnostic_set_info): Declare. * diagnostic.c (report_problematic_module): Rename to diagnostic_repor_current_module. (set_diagnostic_context): Remove. (count_error): Rename to diagnostic_error_count. (error_function_changed): Remove. (record_last_error_function): Likewise. (error_module_changed): Likewise. (record_last_error_module): Likewise. (context_as_prefix): Rename to diagnostic_build_prefix. (flush_diagnostic_buffer): Rename to diagnostic_flush_buffer. (diagnostic_set_info): New function. * objc/objc-act.c: #include diagnostic.h (error_with_ivar): Adjust call to count_error. (warn_with_method): Likewise. * objc/Make-lang.in (objc-act.o): Depend on diagnostic.h cp/ 2002-06-04 Gabriel Dos Reis <gdr@codesourcery.com> * error.c (cp_diagnostic_starter): Adjust call. (maybe_print_instantiation_context): Change prototype to take a 'diagnostic_info *'. (print_instantiation_full_context): Likewise. (print_instantiation_partial_context): Likewise. (cp_diagnostic_starter): Likewise. (cp_diagnostic_finalizer): Likewise. (cp_print_error_function): Likewise. (cp_printer): Take a secondary parameter as a 'text_info *'. Remove output_state savings. Adjust calls. f/ 2002-06-04 Gabriel Dos Reis <gdr@codesourcery.com> * bad.c (ffebad_start_): Adjust call to count_error. * Make-lang.in (f/bad.o): Depend on diagnostic.h * bad.c: #include diagnostic.h From-SVN: r54291
2002-06-05 21:35:45 +02:00
output_needs_newline (&global_dc->buffer) = true;
diagnostic_set_last_function (global_dc);
}
}
/* The default function to print out name of current function that caused
an error. */
void
lhd_print_error_function (context, file)
diagnostic_context *context;
const char *file;
{
toplev.h (report_error_function): Remove. * toplev.h (report_error_function): Remove. * diagnostic.h (location_t): New datatype. (text_info): Likewise. (diagnostic_info): Likewise. (output_prefix): New macro. (diagnostic_last_function_changed): Likewise. (diagnostic_set_last_function): Likewise. (diagnostic_last_module_changed): Likewise. (diagnostic_set_last_module): Likewise. (report_diagnostic): Now macro. (diagnostic_set_info): Declare. * diagnostic.c (report_problematic_module): Rename to diagnostic_repor_current_module. (set_diagnostic_context): Remove. (count_error): Rename to diagnostic_error_count. (error_function_changed): Remove. (record_last_error_function): Likewise. (error_module_changed): Likewise. (record_last_error_module): Likewise. (context_as_prefix): Rename to diagnostic_build_prefix. (flush_diagnostic_buffer): Rename to diagnostic_flush_buffer. (diagnostic_set_info): New function. * objc/objc-act.c: #include diagnostic.h (error_with_ivar): Adjust call to count_error. (warn_with_method): Likewise. * objc/Make-lang.in (objc-act.o): Depend on diagnostic.h cp/ 2002-06-04 Gabriel Dos Reis <gdr@codesourcery.com> * error.c (cp_diagnostic_starter): Adjust call. (maybe_print_instantiation_context): Change prototype to take a 'diagnostic_info *'. (print_instantiation_full_context): Likewise. (print_instantiation_partial_context): Likewise. (cp_diagnostic_starter): Likewise. (cp_diagnostic_finalizer): Likewise. (cp_print_error_function): Likewise. (cp_printer): Take a secondary parameter as a 'text_info *'. Remove output_state savings. Adjust calls. f/ 2002-06-04 Gabriel Dos Reis <gdr@codesourcery.com> * bad.c (ffebad_start_): Adjust call to count_error. * Make-lang.in (f/bad.o): Depend on diagnostic.h * bad.c: #include diagnostic.h From-SVN: r54291
2002-06-05 21:35:45 +02:00
if (diagnostic_last_function_changed (context))
{
toplev.h (report_error_function): Remove. * toplev.h (report_error_function): Remove. * diagnostic.h (location_t): New datatype. (text_info): Likewise. (diagnostic_info): Likewise. (output_prefix): New macro. (diagnostic_last_function_changed): Likewise. (diagnostic_set_last_function): Likewise. (diagnostic_last_module_changed): Likewise. (diagnostic_set_last_module): Likewise. (report_diagnostic): Now macro. (diagnostic_set_info): Declare. * diagnostic.c (report_problematic_module): Rename to diagnostic_repor_current_module. (set_diagnostic_context): Remove. (count_error): Rename to diagnostic_error_count. (error_function_changed): Remove. (record_last_error_function): Likewise. (error_module_changed): Likewise. (record_last_error_module): Likewise. (context_as_prefix): Rename to diagnostic_build_prefix. (flush_diagnostic_buffer): Rename to diagnostic_flush_buffer. (diagnostic_set_info): New function. * objc/objc-act.c: #include diagnostic.h (error_with_ivar): Adjust call to count_error. (warn_with_method): Likewise. * objc/Make-lang.in (objc-act.o): Depend on diagnostic.h cp/ 2002-06-04 Gabriel Dos Reis <gdr@codesourcery.com> * error.c (cp_diagnostic_starter): Adjust call. (maybe_print_instantiation_context): Change prototype to take a 'diagnostic_info *'. (print_instantiation_full_context): Likewise. (print_instantiation_partial_context): Likewise. (cp_diagnostic_starter): Likewise. (cp_diagnostic_finalizer): Likewise. (cp_print_error_function): Likewise. (cp_printer): Take a secondary parameter as a 'text_info *'. Remove output_state savings. Adjust calls. f/ 2002-06-04 Gabriel Dos Reis <gdr@codesourcery.com> * bad.c (ffebad_start_): Adjust call to count_error. * Make-lang.in (f/bad.o): Depend on diagnostic.h * bad.c: #include diagnostic.h From-SVN: r54291
2002-06-05 21:35:45 +02:00
const char *old_prefix = output_prefix (&context->buffer);
char *new_prefix = file ? build_message_string ("%s: ", file) : NULL;
toplev.h (report_error_function): Remove. * toplev.h (report_error_function): Remove. * diagnostic.h (location_t): New datatype. (text_info): Likewise. (diagnostic_info): Likewise. (output_prefix): New macro. (diagnostic_last_function_changed): Likewise. (diagnostic_set_last_function): Likewise. (diagnostic_last_module_changed): Likewise. (diagnostic_set_last_module): Likewise. (report_diagnostic): Now macro. (diagnostic_set_info): Declare. * diagnostic.c (report_problematic_module): Rename to diagnostic_repor_current_module. (set_diagnostic_context): Remove. (count_error): Rename to diagnostic_error_count. (error_function_changed): Remove. (record_last_error_function): Likewise. (error_module_changed): Likewise. (record_last_error_module): Likewise. (context_as_prefix): Rename to diagnostic_build_prefix. (flush_diagnostic_buffer): Rename to diagnostic_flush_buffer. (diagnostic_set_info): New function. * objc/objc-act.c: #include diagnostic.h (error_with_ivar): Adjust call to count_error. (warn_with_method): Likewise. * objc/Make-lang.in (objc-act.o): Depend on diagnostic.h cp/ 2002-06-04 Gabriel Dos Reis <gdr@codesourcery.com> * error.c (cp_diagnostic_starter): Adjust call. (maybe_print_instantiation_context): Change prototype to take a 'diagnostic_info *'. (print_instantiation_full_context): Likewise. (print_instantiation_partial_context): Likewise. (cp_diagnostic_starter): Likewise. (cp_diagnostic_finalizer): Likewise. (cp_print_error_function): Likewise. (cp_printer): Take a secondary parameter as a 'text_info *'. Remove output_state savings. Adjust calls. f/ 2002-06-04 Gabriel Dos Reis <gdr@codesourcery.com> * bad.c (ffebad_start_): Adjust call to count_error. * Make-lang.in (f/bad.o): Depend on diagnostic.h * bad.c: #include diagnostic.h From-SVN: r54291
2002-06-05 21:35:45 +02:00
output_set_prefix (&context->buffer, new_prefix);
if (current_function_decl == NULL)
toplev.h (report_error_function): Remove. * toplev.h (report_error_function): Remove. * diagnostic.h (location_t): New datatype. (text_info): Likewise. (diagnostic_info): Likewise. (output_prefix): New macro. (diagnostic_last_function_changed): Likewise. (diagnostic_set_last_function): Likewise. (diagnostic_last_module_changed): Likewise. (diagnostic_set_last_module): Likewise. (report_diagnostic): Now macro. (diagnostic_set_info): Declare. * diagnostic.c (report_problematic_module): Rename to diagnostic_repor_current_module. (set_diagnostic_context): Remove. (count_error): Rename to diagnostic_error_count. (error_function_changed): Remove. (record_last_error_function): Likewise. (error_module_changed): Likewise. (record_last_error_module): Likewise. (context_as_prefix): Rename to diagnostic_build_prefix. (flush_diagnostic_buffer): Rename to diagnostic_flush_buffer. (diagnostic_set_info): New function. * objc/objc-act.c: #include diagnostic.h (error_with_ivar): Adjust call to count_error. (warn_with_method): Likewise. * objc/Make-lang.in (objc-act.o): Depend on diagnostic.h cp/ 2002-06-04 Gabriel Dos Reis <gdr@codesourcery.com> * error.c (cp_diagnostic_starter): Adjust call. (maybe_print_instantiation_context): Change prototype to take a 'diagnostic_info *'. (print_instantiation_full_context): Likewise. (print_instantiation_partial_context): Likewise. (cp_diagnostic_starter): Likewise. (cp_diagnostic_finalizer): Likewise. (cp_print_error_function): Likewise. (cp_printer): Take a secondary parameter as a 'text_info *'. Remove output_state savings. Adjust calls. f/ 2002-06-04 Gabriel Dos Reis <gdr@codesourcery.com> * bad.c (ffebad_start_): Adjust call to count_error. * Make-lang.in (f/bad.o): Depend on diagnostic.h * bad.c: #include diagnostic.h From-SVN: r54291
2002-06-05 21:35:45 +02:00
output_add_string (&context->buffer, _("At top level:"));
else
{
if (TREE_CODE (TREE_TYPE (current_function_decl)) == METHOD_TYPE)
output_printf
toplev.h (report_error_function): Remove. * toplev.h (report_error_function): Remove. * diagnostic.h (location_t): New datatype. (text_info): Likewise. (diagnostic_info): Likewise. (output_prefix): New macro. (diagnostic_last_function_changed): Likewise. (diagnostic_set_last_function): Likewise. (diagnostic_last_module_changed): Likewise. (diagnostic_set_last_module): Likewise. (report_diagnostic): Now macro. (diagnostic_set_info): Declare. * diagnostic.c (report_problematic_module): Rename to diagnostic_repor_current_module. (set_diagnostic_context): Remove. (count_error): Rename to diagnostic_error_count. (error_function_changed): Remove. (record_last_error_function): Likewise. (error_module_changed): Likewise. (record_last_error_module): Likewise. (context_as_prefix): Rename to diagnostic_build_prefix. (flush_diagnostic_buffer): Rename to diagnostic_flush_buffer. (diagnostic_set_info): New function. * objc/objc-act.c: #include diagnostic.h (error_with_ivar): Adjust call to count_error. (warn_with_method): Likewise. * objc/Make-lang.in (objc-act.o): Depend on diagnostic.h cp/ 2002-06-04 Gabriel Dos Reis <gdr@codesourcery.com> * error.c (cp_diagnostic_starter): Adjust call. (maybe_print_instantiation_context): Change prototype to take a 'diagnostic_info *'. (print_instantiation_full_context): Likewise. (print_instantiation_partial_context): Likewise. (cp_diagnostic_starter): Likewise. (cp_diagnostic_finalizer): Likewise. (cp_print_error_function): Likewise. (cp_printer): Take a secondary parameter as a 'text_info *'. Remove output_state savings. Adjust calls. f/ 2002-06-04 Gabriel Dos Reis <gdr@codesourcery.com> * bad.c (ffebad_start_): Adjust call to count_error. * Make-lang.in (f/bad.o): Depend on diagnostic.h * bad.c: #include diagnostic.h From-SVN: r54291
2002-06-05 21:35:45 +02:00
(&context->buffer, "In member function `%s':",
(*lang_hooks.decl_printable_name) (current_function_decl, 2));
else
output_printf
toplev.h (report_error_function): Remove. * toplev.h (report_error_function): Remove. * diagnostic.h (location_t): New datatype. (text_info): Likewise. (diagnostic_info): Likewise. (output_prefix): New macro. (diagnostic_last_function_changed): Likewise. (diagnostic_set_last_function): Likewise. (diagnostic_last_module_changed): Likewise. (diagnostic_set_last_module): Likewise. (report_diagnostic): Now macro. (diagnostic_set_info): Declare. * diagnostic.c (report_problematic_module): Rename to diagnostic_repor_current_module. (set_diagnostic_context): Remove. (count_error): Rename to diagnostic_error_count. (error_function_changed): Remove. (record_last_error_function): Likewise. (error_module_changed): Likewise. (record_last_error_module): Likewise. (context_as_prefix): Rename to diagnostic_build_prefix. (flush_diagnostic_buffer): Rename to diagnostic_flush_buffer. (diagnostic_set_info): New function. * objc/objc-act.c: #include diagnostic.h (error_with_ivar): Adjust call to count_error. (warn_with_method): Likewise. * objc/Make-lang.in (objc-act.o): Depend on diagnostic.h cp/ 2002-06-04 Gabriel Dos Reis <gdr@codesourcery.com> * error.c (cp_diagnostic_starter): Adjust call. (maybe_print_instantiation_context): Change prototype to take a 'diagnostic_info *'. (print_instantiation_full_context): Likewise. (print_instantiation_partial_context): Likewise. (cp_diagnostic_starter): Likewise. (cp_diagnostic_finalizer): Likewise. (cp_print_error_function): Likewise. (cp_printer): Take a secondary parameter as a 'text_info *'. Remove output_state savings. Adjust calls. f/ 2002-06-04 Gabriel Dos Reis <gdr@codesourcery.com> * bad.c (ffebad_start_): Adjust call to count_error. * Make-lang.in (f/bad.o): Depend on diagnostic.h * bad.c: #include diagnostic.h From-SVN: r54291
2002-06-05 21:35:45 +02:00
(&context->buffer, "In function `%s':",
(*lang_hooks.decl_printable_name) (current_function_decl, 2));
}
toplev.h (report_error_function): Remove. * toplev.h (report_error_function): Remove. * diagnostic.h (location_t): New datatype. (text_info): Likewise. (diagnostic_info): Likewise. (output_prefix): New macro. (diagnostic_last_function_changed): Likewise. (diagnostic_set_last_function): Likewise. (diagnostic_last_module_changed): Likewise. (diagnostic_set_last_module): Likewise. (report_diagnostic): Now macro. (diagnostic_set_info): Declare. * diagnostic.c (report_problematic_module): Rename to diagnostic_repor_current_module. (set_diagnostic_context): Remove. (count_error): Rename to diagnostic_error_count. (error_function_changed): Remove. (record_last_error_function): Likewise. (error_module_changed): Likewise. (record_last_error_module): Likewise. (context_as_prefix): Rename to diagnostic_build_prefix. (flush_diagnostic_buffer): Rename to diagnostic_flush_buffer. (diagnostic_set_info): New function. * objc/objc-act.c: #include diagnostic.h (error_with_ivar): Adjust call to count_error. (warn_with_method): Likewise. * objc/Make-lang.in (objc-act.o): Depend on diagnostic.h cp/ 2002-06-04 Gabriel Dos Reis <gdr@codesourcery.com> * error.c (cp_diagnostic_starter): Adjust call. (maybe_print_instantiation_context): Change prototype to take a 'diagnostic_info *'. (print_instantiation_full_context): Likewise. (print_instantiation_partial_context): Likewise. (cp_diagnostic_starter): Likewise. (cp_diagnostic_finalizer): Likewise. (cp_print_error_function): Likewise. (cp_printer): Take a secondary parameter as a 'text_info *'. Remove output_state savings. Adjust calls. f/ 2002-06-04 Gabriel Dos Reis <gdr@codesourcery.com> * bad.c (ffebad_start_): Adjust call to count_error. * Make-lang.in (f/bad.o): Depend on diagnostic.h * bad.c: #include diagnostic.h From-SVN: r54291
2002-06-05 21:35:45 +02:00
output_add_newline (&context->buffer);
toplev.h (report_error_function): Remove. * toplev.h (report_error_function): Remove. * diagnostic.h (location_t): New datatype. (text_info): Likewise. (diagnostic_info): Likewise. (output_prefix): New macro. (diagnostic_last_function_changed): Likewise. (diagnostic_set_last_function): Likewise. (diagnostic_last_module_changed): Likewise. (diagnostic_set_last_module): Likewise. (report_diagnostic): Now macro. (diagnostic_set_info): Declare. * diagnostic.c (report_problematic_module): Rename to diagnostic_repor_current_module. (set_diagnostic_context): Remove. (count_error): Rename to diagnostic_error_count. (error_function_changed): Remove. (record_last_error_function): Likewise. (error_module_changed): Likewise. (record_last_error_module): Likewise. (context_as_prefix): Rename to diagnostic_build_prefix. (flush_diagnostic_buffer): Rename to diagnostic_flush_buffer. (diagnostic_set_info): New function. * objc/objc-act.c: #include diagnostic.h (error_with_ivar): Adjust call to count_error. (warn_with_method): Likewise. * objc/Make-lang.in (objc-act.o): Depend on diagnostic.h cp/ 2002-06-04 Gabriel Dos Reis <gdr@codesourcery.com> * error.c (cp_diagnostic_starter): Adjust call. (maybe_print_instantiation_context): Change prototype to take a 'diagnostic_info *'. (print_instantiation_full_context): Likewise. (print_instantiation_partial_context): Likewise. (cp_diagnostic_starter): Likewise. (cp_diagnostic_finalizer): Likewise. (cp_print_error_function): Likewise. (cp_printer): Take a secondary parameter as a 'text_info *'. Remove output_state savings. Adjust calls. f/ 2002-06-04 Gabriel Dos Reis <gdr@codesourcery.com> * bad.c (ffebad_start_): Adjust call to count_error. * Make-lang.in (f/bad.o): Depend on diagnostic.h * bad.c: #include diagnostic.h From-SVN: r54291
2002-06-05 21:35:45 +02:00
diagnostic_set_last_function (context);
output_buffer_to_stream (&context->buffer);
context->buffer.state.prefix = old_prefix;
free ((char*) new_prefix);
}
}
/* Prints out, if necessary, the name of the current function
that caused an error. Called from all error and warning functions.
We ignore the FILE parameter, as it cannot be relied upon. */
void
toplev.h (report_error_function): Remove. * toplev.h (report_error_function): Remove. * diagnostic.h (location_t): New datatype. (text_info): Likewise. (diagnostic_info): Likewise. (output_prefix): New macro. (diagnostic_last_function_changed): Likewise. (diagnostic_set_last_function): Likewise. (diagnostic_last_module_changed): Likewise. (diagnostic_set_last_module): Likewise. (report_diagnostic): Now macro. (diagnostic_set_info): Declare. * diagnostic.c (report_problematic_module): Rename to diagnostic_repor_current_module. (set_diagnostic_context): Remove. (count_error): Rename to diagnostic_error_count. (error_function_changed): Remove. (record_last_error_function): Likewise. (error_module_changed): Likewise. (record_last_error_module): Likewise. (context_as_prefix): Rename to diagnostic_build_prefix. (flush_diagnostic_buffer): Rename to diagnostic_flush_buffer. (diagnostic_set_info): New function. * objc/objc-act.c: #include diagnostic.h (error_with_ivar): Adjust call to count_error. (warn_with_method): Likewise. * objc/Make-lang.in (objc-act.o): Depend on diagnostic.h cp/ 2002-06-04 Gabriel Dos Reis <gdr@codesourcery.com> * error.c (cp_diagnostic_starter): Adjust call. (maybe_print_instantiation_context): Change prototype to take a 'diagnostic_info *'. (print_instantiation_full_context): Likewise. (print_instantiation_partial_context): Likewise. (cp_diagnostic_starter): Likewise. (cp_diagnostic_finalizer): Likewise. (cp_print_error_function): Likewise. (cp_printer): Take a secondary parameter as a 'text_info *'. Remove output_state savings. Adjust calls. f/ 2002-06-04 Gabriel Dos Reis <gdr@codesourcery.com> * bad.c (ffebad_start_): Adjust call to count_error. * Make-lang.in (f/bad.o): Depend on diagnostic.h * bad.c: #include diagnostic.h From-SVN: r54291
2002-06-05 21:35:45 +02:00
diagnostic_report_current_function (context)
diagnostic_context *context;
{
toplev.h (report_error_function): Remove. * toplev.h (report_error_function): Remove. * diagnostic.h (location_t): New datatype. (text_info): Likewise. (diagnostic_info): Likewise. (output_prefix): New macro. (diagnostic_last_function_changed): Likewise. (diagnostic_set_last_function): Likewise. (diagnostic_last_module_changed): Likewise. (diagnostic_set_last_module): Likewise. (report_diagnostic): Now macro. (diagnostic_set_info): Declare. * diagnostic.c (report_problematic_module): Rename to diagnostic_repor_current_module. (set_diagnostic_context): Remove. (count_error): Rename to diagnostic_error_count. (error_function_changed): Remove. (record_last_error_function): Likewise. (error_module_changed): Likewise. (record_last_error_module): Likewise. (context_as_prefix): Rename to diagnostic_build_prefix. (flush_diagnostic_buffer): Rename to diagnostic_flush_buffer. (diagnostic_set_info): New function. * objc/objc-act.c: #include diagnostic.h (error_with_ivar): Adjust call to count_error. (warn_with_method): Likewise. * objc/Make-lang.in (objc-act.o): Depend on diagnostic.h cp/ 2002-06-04 Gabriel Dos Reis <gdr@codesourcery.com> * error.c (cp_diagnostic_starter): Adjust call. (maybe_print_instantiation_context): Change prototype to take a 'diagnostic_info *'. (print_instantiation_full_context): Likewise. (print_instantiation_partial_context): Likewise. (cp_diagnostic_starter): Likewise. (cp_diagnostic_finalizer): Likewise. (cp_print_error_function): Likewise. (cp_printer): Take a secondary parameter as a 'text_info *'. Remove output_state savings. Adjust calls. f/ 2002-06-04 Gabriel Dos Reis <gdr@codesourcery.com> * bad.c (ffebad_start_): Adjust call to count_error. * Make-lang.in (f/bad.o): Depend on diagnostic.h * bad.c: #include diagnostic.h From-SVN: r54291
2002-06-05 21:35:45 +02:00
diagnostic_report_current_module (context);
(*lang_hooks.print_error_function) (context, input_filename);
}
void
diagnostic_report_current_module (context)
diagnostic_context *context;
{
struct file_stack *p;
if (output_needs_newline (&context->buffer))
{
output_add_newline (&context->buffer);
output_needs_newline (&context->buffer) = false;
}
if (input_file_stack && input_file_stack->next != 0
&& diagnostic_last_module_changed (context))
{
for (p = input_file_stack->next; p; p = p->next)
if (p == input_file_stack->next)
output_verbatim (&context->buffer,
"In file included from %s:%d",
p->location.file, p->location.line);
else
output_verbatim (&context->buffer,
",\n from %s:%d",
p->location.file, p->location.line);
output_verbatim (&context->buffer, ":\n");
diagnostic_set_last_module (context);
}
}
diagnostic.h (set_internal_error_function): Renamed. * diagnostic.h (set_internal_error_function): Renamed. * toplev.h (internal_error): Renamed from fatal. (pfatal_with_name): Deleted. (fatal_io_error): Now has printf-style arguments. * diagnostic.c (pfatal_with_name): Deleted. (fatal_io_error): Rework to have args in printf-style. (set_internal_error_function): Renamed from set_fatal_function. (internal_error): Renamed from fatal. (error_recursion, fancy_abort): Call internal_error instead of fatal. * dwarf2out.c (get_cfa_from_loc_descr): Likewise. * emit-rtl.c (gen_realpart, gen_imagpart): Likewise. * expr.c (check_max_integer_computation_mode, expand_expr): Likewise. * flow.c (verify_flow_info): Likewise. * config/arm/arm.c (thumb_unexpanded_epilogue): Likewise. * config/mips/mips.c (save_restore_insns): Likewise. * cp/init.c (build_java_class_ref): Likewise. (dsp16xx_reg_class_from_letter): Likewise. (limit_reload_class, double_reg_to_memory): Likewise. (print_operand_address, emit_1600_code_shift): Likewise. (gen_tst_reg, gen_compare_reg): Likewise. * config/m68hc11/m68hc11.c (m68hc11_emit_libcall): Likewise. * cp/decl.c (pushdecl): Likewise. * java/check-init.c (check_init): Likewise. * java/expr.c (java_lang_expand_expr): Likewise. * java/jcf-parse.c (get_constant): Likewise. * java/mangle.c (java_mangle_decl): Likewise. * java/parse.y (make_nested_class_name, java_complete_lhs): Likewise. (operator_string): Likewise. * except.c (duplicate_eh_handlers): Call abort instead of fatal. * flow.c (verify_flow_info): Likewise. * ch/convert.c (convert): Likewise. * ch/except.c (pop_handler, chill_check_no_handlers): Likewise. * ch/expr.c (chill_expand_expr): Likewise. * ch/parse.c (peek_token_, pushback_token, require): Likewise. * config/arm/arm.c (thumb_load_double_from_address): Likewise. * config/avr/avr.c (pttreg_to_str, unique_section): Likewise. (avr_normalize_condition): Likewise. * config/c4x/c4x.c (c4x_emit_libcall, c4x_valid_operands): Likewise. * config/dsp16xx/dsp16xx.c (dsp16xx_reg_class_from_letter): Likewise. (limit_reload_class, double_reg_to_memory): Likewise. (print_operand_address, emit_1600_code_shift): Likewise. (gen_tst_reg, gen_compare_reg): Likewise. * config/m68hc11/m68hc11.c (m68hc11_emit_libcall): Likewise. * cp/decl.c (pushdecl): Likewise. * java/check-init.c (check_init): Likewise. * java/class.c (build_class_ref): Likewise. * java/constants.c (write_constant_pool): Likewise. * java/decl.c (start_java_method): Likewise. * java/expr.c (push_type, java_stack_pop, java_stack_swap): Likewise. (java_stack_dup, encode_newarray_type): Likewise. (build_java_array_length_access): Likewise. (build_java_check_indexed_type, expand_java_pushc): Likewise. (build_java_soft_divmod, build_invokeinterface): Likewise. * java/java-tree.h (INNER_CLASS_P): Likewise. * java/jcf-parse.c (parse_signature, get_name_constant): Likewise. (give_name_to_class, get_class_constant): Likewise. * java/jcf-write.c (CHECK_PUT, CHECK_OP, get_access_flags): Likewise. (find_constant_index, generate_bytecode_conditional): Likewise. (generate_bytecode_insns, perform_relocations): Likewise. * java/lex.c (java_unget_unicode, java_lex): Likewise. * java/mangle.c (mangle_type, mangle_record_type): Likewise. (mangle_pointer_type, mangle_array_type, init_mangling): Likewise. (finish_mangling): Likewise. * java/parse.h (MARK_FINAL_PARMS): Likewise. * java/parse.y (pop_current_osb, unreachable_stmt_error): Likewise. (obtain_incomplete_type, java_complete_class): Likewise. (java_check_regular_methods, java_complete_expand_method): Likewise. (cut_identifier_in_qualified, check_deprecation): Likewise. (patch_invoke, find_applicable_accessible_methods_list): Likewise. (java_complete_lhs, lookup_name_in_blocks): Likewise. (check_final_variable_indirect_assignment, build_unaryop): Likewise. * java/typeck.c (set_local_type, parse_signature_type): Likewise. (parse_signature_string, build_java_signature): Likewise; (set_java_signature): Likewise. * java/verify.c (type_stack_dup, CHECK_PC_IN_RANGE): Likewise. * c-parse.in (methoddef): Call fatal_error instead of fatal. * objc/objc-act.c (build_ivar_chain): Likewise. * cp/except.c (decl_is_java_type): Likewise. * cp/init.c (build_java_class_ref): Likewise. * cp/init.c (build_new_1): Likewise. * f/com.c (ffecom_init_0): Likewise. * java/class.c (add_method, build_static_field_ref): Likewise. * java/expr.c (build_known_method_ref, expand_invoke): Likewise. * java/jcf-parse.c (get_constant, jcf_parse): Likewise. * java/lex.c (java_new_new_lexer): Likewise. * java/jv-scan.c (main): Likewise. (fatal_error): Renamed from fatal. * dwarfout.c (dwarfout_init): Call fatal_io_error instead of pfatal_with_name. * graph.c (clean_graph_dump_file): Likewise. * profile.c (init_branch_prob): Likewise. * ch/grant.c (write_grant_file): Likewise. * ch/lex.c (init_parse, same_file, yywrap): Likewise. * f/com.c (init_parse): Likewise. * java/jcf-parse.c (yyparse): Likewise. * objc/objc-act.c (objc_init): Likewise. * java/jcf-parse.c (jcf_parse_source): Call fatal_io_error, not fatal. (yyparse): Likewise. * java/jcf-write.c (make_class_file_name, write_classfile): Likewise. * java/lex.c (java_get_line_col): Likewise. * hash.c (hash_allocate): Don't check for failure returns from obstack functions that can't fail. (hash_table_init_n, hash_table_init): Likewise; also now return void. * hash.h (hash_table_init_n, hash_table_init): Now return void. * cp/decl.c (build_typename_type): hash_table_init now returns void. * ch/lang.c (GNU_xref_begin, GNU_xref_end): Deleted. * ch/lex.c (convert_bitstring): Delete check for alloca failure. * config/dsp16xx/dsp16xx.c (dsp16xx_invalid_register_for_compare): Deleted. * config/dsp16xx/dsp16xx.md (unnamed cmphi): Call abort instead of it. * f/com.c (ffecom_decode_include_option_): Make errors non-fatal. * f/lex.c (ffelex_cfelex_, ffelex_get_directive_line_): Likewise. (ffelex_hash_): Likewise. * config/arm/arm.c (arm_override_options): Likewise. * config/avr/avr.c (avr_override_options): Likewise. * config/c4x/c4x.c (c4x_expand_prologue): Likewise. * config/dsp16xx/dsp16xx.c (function_prologue): Likewise. * config/h8300/h8300.c (h8300_init_once): Likewise. * config/mips/mips.c (override_options): Likewise. * config/i386/i386.c (override_options): Likewise, rework. * config/m68k/m68k.c (override_options): Likewise. * cp/decl.c (init_decl_processing): Likewise. * java/jcf-parse.c (load_class): Likewise. * config/dsp16xx/dsp16xx.c (print_operand): Call output_operand_lossage instead of fatal. * config/mips/mips.c (print_operand): Likewise. * java/lex.c (byteswap_init, need_byteswap): Only #ifdef HAVE_ICONV. * objc/objc_act.c (objc_check_decl): Remove unneeded fatal call. (get_object_reference): Likewise. From-SVN: r39443
2001-02-04 23:44:12 +01:00
static void
default_diagnostic_starter (context, diagnostic)
diagnostic_context *context;
diagnostic_info *diagnostic;
{
diagnostic_report_current_function (context);
output_set_prefix (&context->buffer, diagnostic_build_prefix (diagnostic));
}
static void
default_diagnostic_finalizer (context, diagnostic)
diagnostic_context *context;
diagnostic_info *diagnostic __attribute__((unused));
{
output_destroy_prefix (&context->buffer);
}
/* Report a diagnostic message (an error or a warning) as specified by
DC. This function is *the* subroutine in terms of which front-ends
should implement their specific diagnostic handling modules. The
front-end independent format specifiers are exactly those described
in the documentation of output_format. */
diagnostic.h (set_internal_error_function): Renamed. * diagnostic.h (set_internal_error_function): Renamed. * toplev.h (internal_error): Renamed from fatal. (pfatal_with_name): Deleted. (fatal_io_error): Now has printf-style arguments. * diagnostic.c (pfatal_with_name): Deleted. (fatal_io_error): Rework to have args in printf-style. (set_internal_error_function): Renamed from set_fatal_function. (internal_error): Renamed from fatal. (error_recursion, fancy_abort): Call internal_error instead of fatal. * dwarf2out.c (get_cfa_from_loc_descr): Likewise. * emit-rtl.c (gen_realpart, gen_imagpart): Likewise. * expr.c (check_max_integer_computation_mode, expand_expr): Likewise. * flow.c (verify_flow_info): Likewise. * config/arm/arm.c (thumb_unexpanded_epilogue): Likewise. * config/mips/mips.c (save_restore_insns): Likewise. * cp/init.c (build_java_class_ref): Likewise. (dsp16xx_reg_class_from_letter): Likewise. (limit_reload_class, double_reg_to_memory): Likewise. (print_operand_address, emit_1600_code_shift): Likewise. (gen_tst_reg, gen_compare_reg): Likewise. * config/m68hc11/m68hc11.c (m68hc11_emit_libcall): Likewise. * cp/decl.c (pushdecl): Likewise. * java/check-init.c (check_init): Likewise. * java/expr.c (java_lang_expand_expr): Likewise. * java/jcf-parse.c (get_constant): Likewise. * java/mangle.c (java_mangle_decl): Likewise. * java/parse.y (make_nested_class_name, java_complete_lhs): Likewise. (operator_string): Likewise. * except.c (duplicate_eh_handlers): Call abort instead of fatal. * flow.c (verify_flow_info): Likewise. * ch/convert.c (convert): Likewise. * ch/except.c (pop_handler, chill_check_no_handlers): Likewise. * ch/expr.c (chill_expand_expr): Likewise. * ch/parse.c (peek_token_, pushback_token, require): Likewise. * config/arm/arm.c (thumb_load_double_from_address): Likewise. * config/avr/avr.c (pttreg_to_str, unique_section): Likewise. (avr_normalize_condition): Likewise. * config/c4x/c4x.c (c4x_emit_libcall, c4x_valid_operands): Likewise. * config/dsp16xx/dsp16xx.c (dsp16xx_reg_class_from_letter): Likewise. (limit_reload_class, double_reg_to_memory): Likewise. (print_operand_address, emit_1600_code_shift): Likewise. (gen_tst_reg, gen_compare_reg): Likewise. * config/m68hc11/m68hc11.c (m68hc11_emit_libcall): Likewise. * cp/decl.c (pushdecl): Likewise. * java/check-init.c (check_init): Likewise. * java/class.c (build_class_ref): Likewise. * java/constants.c (write_constant_pool): Likewise. * java/decl.c (start_java_method): Likewise. * java/expr.c (push_type, java_stack_pop, java_stack_swap): Likewise. (java_stack_dup, encode_newarray_type): Likewise. (build_java_array_length_access): Likewise. (build_java_check_indexed_type, expand_java_pushc): Likewise. (build_java_soft_divmod, build_invokeinterface): Likewise. * java/java-tree.h (INNER_CLASS_P): Likewise. * java/jcf-parse.c (parse_signature, get_name_constant): Likewise. (give_name_to_class, get_class_constant): Likewise. * java/jcf-write.c (CHECK_PUT, CHECK_OP, get_access_flags): Likewise. (find_constant_index, generate_bytecode_conditional): Likewise. (generate_bytecode_insns, perform_relocations): Likewise. * java/lex.c (java_unget_unicode, java_lex): Likewise. * java/mangle.c (mangle_type, mangle_record_type): Likewise. (mangle_pointer_type, mangle_array_type, init_mangling): Likewise. (finish_mangling): Likewise. * java/parse.h (MARK_FINAL_PARMS): Likewise. * java/parse.y (pop_current_osb, unreachable_stmt_error): Likewise. (obtain_incomplete_type, java_complete_class): Likewise. (java_check_regular_methods, java_complete_expand_method): Likewise. (cut_identifier_in_qualified, check_deprecation): Likewise. (patch_invoke, find_applicable_accessible_methods_list): Likewise. (java_complete_lhs, lookup_name_in_blocks): Likewise. (check_final_variable_indirect_assignment, build_unaryop): Likewise. * java/typeck.c (set_local_type, parse_signature_type): Likewise. (parse_signature_string, build_java_signature): Likewise; (set_java_signature): Likewise. * java/verify.c (type_stack_dup, CHECK_PC_IN_RANGE): Likewise. * c-parse.in (methoddef): Call fatal_error instead of fatal. * objc/objc-act.c (build_ivar_chain): Likewise. * cp/except.c (decl_is_java_type): Likewise. * cp/init.c (build_java_class_ref): Likewise. * cp/init.c (build_new_1): Likewise. * f/com.c (ffecom_init_0): Likewise. * java/class.c (add_method, build_static_field_ref): Likewise. * java/expr.c (build_known_method_ref, expand_invoke): Likewise. * java/jcf-parse.c (get_constant, jcf_parse): Likewise. * java/lex.c (java_new_new_lexer): Likewise. * java/jv-scan.c (main): Likewise. (fatal_error): Renamed from fatal. * dwarfout.c (dwarfout_init): Call fatal_io_error instead of pfatal_with_name. * graph.c (clean_graph_dump_file): Likewise. * profile.c (init_branch_prob): Likewise. * ch/grant.c (write_grant_file): Likewise. * ch/lex.c (init_parse, same_file, yywrap): Likewise. * f/com.c (init_parse): Likewise. * java/jcf-parse.c (yyparse): Likewise. * objc/objc-act.c (objc_init): Likewise. * java/jcf-parse.c (jcf_parse_source): Call fatal_io_error, not fatal. (yyparse): Likewise. * java/jcf-write.c (make_class_file_name, write_classfile): Likewise. * java/lex.c (java_get_line_col): Likewise. * hash.c (hash_allocate): Don't check for failure returns from obstack functions that can't fail. (hash_table_init_n, hash_table_init): Likewise; also now return void. * hash.h (hash_table_init_n, hash_table_init): Now return void. * cp/decl.c (build_typename_type): hash_table_init now returns void. * ch/lang.c (GNU_xref_begin, GNU_xref_end): Deleted. * ch/lex.c (convert_bitstring): Delete check for alloca failure. * config/dsp16xx/dsp16xx.c (dsp16xx_invalid_register_for_compare): Deleted. * config/dsp16xx/dsp16xx.md (unnamed cmphi): Call abort instead of it. * f/com.c (ffecom_decode_include_option_): Make errors non-fatal. * f/lex.c (ffelex_cfelex_, ffelex_get_directive_line_): Likewise. (ffelex_hash_): Likewise. * config/arm/arm.c (arm_override_options): Likewise. * config/avr/avr.c (avr_override_options): Likewise. * config/c4x/c4x.c (c4x_expand_prologue): Likewise. * config/dsp16xx/dsp16xx.c (function_prologue): Likewise. * config/h8300/h8300.c (h8300_init_once): Likewise. * config/mips/mips.c (override_options): Likewise. * config/i386/i386.c (override_options): Likewise, rework. * config/m68k/m68k.c (override_options): Likewise. * cp/decl.c (init_decl_processing): Likewise. * java/jcf-parse.c (load_class): Likewise. * config/dsp16xx/dsp16xx.c (print_operand): Call output_operand_lossage instead of fatal. * config/mips/mips.c (print_operand): Likewise. * java/lex.c (byteswap_init, need_byteswap): Only #ifdef HAVE_ICONV. * objc/objc_act.c (objc_check_decl): Remove unneeded fatal call. (get_object_reference): Likewise. From-SVN: r39443
2001-02-04 23:44:12 +01:00
void
diagnostic_report_diagnostic (context, diagnostic)
diagnostic_context *context;
diagnostic_info *diagnostic;
diagnostic.h (set_internal_error_function): Renamed. * diagnostic.h (set_internal_error_function): Renamed. * toplev.h (internal_error): Renamed from fatal. (pfatal_with_name): Deleted. (fatal_io_error): Now has printf-style arguments. * diagnostic.c (pfatal_with_name): Deleted. (fatal_io_error): Rework to have args in printf-style. (set_internal_error_function): Renamed from set_fatal_function. (internal_error): Renamed from fatal. (error_recursion, fancy_abort): Call internal_error instead of fatal. * dwarf2out.c (get_cfa_from_loc_descr): Likewise. * emit-rtl.c (gen_realpart, gen_imagpart): Likewise. * expr.c (check_max_integer_computation_mode, expand_expr): Likewise. * flow.c (verify_flow_info): Likewise. * config/arm/arm.c (thumb_unexpanded_epilogue): Likewise. * config/mips/mips.c (save_restore_insns): Likewise. * cp/init.c (build_java_class_ref): Likewise. (dsp16xx_reg_class_from_letter): Likewise. (limit_reload_class, double_reg_to_memory): Likewise. (print_operand_address, emit_1600_code_shift): Likewise. (gen_tst_reg, gen_compare_reg): Likewise. * config/m68hc11/m68hc11.c (m68hc11_emit_libcall): Likewise. * cp/decl.c (pushdecl): Likewise. * java/check-init.c (check_init): Likewise. * java/expr.c (java_lang_expand_expr): Likewise. * java/jcf-parse.c (get_constant): Likewise. * java/mangle.c (java_mangle_decl): Likewise. * java/parse.y (make_nested_class_name, java_complete_lhs): Likewise. (operator_string): Likewise. * except.c (duplicate_eh_handlers): Call abort instead of fatal. * flow.c (verify_flow_info): Likewise. * ch/convert.c (convert): Likewise. * ch/except.c (pop_handler, chill_check_no_handlers): Likewise. * ch/expr.c (chill_expand_expr): Likewise. * ch/parse.c (peek_token_, pushback_token, require): Likewise. * config/arm/arm.c (thumb_load_double_from_address): Likewise. * config/avr/avr.c (pttreg_to_str, unique_section): Likewise. (avr_normalize_condition): Likewise. * config/c4x/c4x.c (c4x_emit_libcall, c4x_valid_operands): Likewise. * config/dsp16xx/dsp16xx.c (dsp16xx_reg_class_from_letter): Likewise. (limit_reload_class, double_reg_to_memory): Likewise. (print_operand_address, emit_1600_code_shift): Likewise. (gen_tst_reg, gen_compare_reg): Likewise. * config/m68hc11/m68hc11.c (m68hc11_emit_libcall): Likewise. * cp/decl.c (pushdecl): Likewise. * java/check-init.c (check_init): Likewise. * java/class.c (build_class_ref): Likewise. * java/constants.c (write_constant_pool): Likewise. * java/decl.c (start_java_method): Likewise. * java/expr.c (push_type, java_stack_pop, java_stack_swap): Likewise. (java_stack_dup, encode_newarray_type): Likewise. (build_java_array_length_access): Likewise. (build_java_check_indexed_type, expand_java_pushc): Likewise. (build_java_soft_divmod, build_invokeinterface): Likewise. * java/java-tree.h (INNER_CLASS_P): Likewise. * java/jcf-parse.c (parse_signature, get_name_constant): Likewise. (give_name_to_class, get_class_constant): Likewise. * java/jcf-write.c (CHECK_PUT, CHECK_OP, get_access_flags): Likewise. (find_constant_index, generate_bytecode_conditional): Likewise. (generate_bytecode_insns, perform_relocations): Likewise. * java/lex.c (java_unget_unicode, java_lex): Likewise. * java/mangle.c (mangle_type, mangle_record_type): Likewise. (mangle_pointer_type, mangle_array_type, init_mangling): Likewise. (finish_mangling): Likewise. * java/parse.h (MARK_FINAL_PARMS): Likewise. * java/parse.y (pop_current_osb, unreachable_stmt_error): Likewise. (obtain_incomplete_type, java_complete_class): Likewise. (java_check_regular_methods, java_complete_expand_method): Likewise. (cut_identifier_in_qualified, check_deprecation): Likewise. (patch_invoke, find_applicable_accessible_methods_list): Likewise. (java_complete_lhs, lookup_name_in_blocks): Likewise. (check_final_variable_indirect_assignment, build_unaryop): Likewise. * java/typeck.c (set_local_type, parse_signature_type): Likewise. (parse_signature_string, build_java_signature): Likewise; (set_java_signature): Likewise. * java/verify.c (type_stack_dup, CHECK_PC_IN_RANGE): Likewise. * c-parse.in (methoddef): Call fatal_error instead of fatal. * objc/objc-act.c (build_ivar_chain): Likewise. * cp/except.c (decl_is_java_type): Likewise. * cp/init.c (build_java_class_ref): Likewise. * cp/init.c (build_new_1): Likewise. * f/com.c (ffecom_init_0): Likewise. * java/class.c (add_method, build_static_field_ref): Likewise. * java/expr.c (build_known_method_ref, expand_invoke): Likewise. * java/jcf-parse.c (get_constant, jcf_parse): Likewise. * java/lex.c (java_new_new_lexer): Likewise. * java/jv-scan.c (main): Likewise. (fatal_error): Renamed from fatal. * dwarfout.c (dwarfout_init): Call fatal_io_error instead of pfatal_with_name. * graph.c (clean_graph_dump_file): Likewise. * profile.c (init_branch_prob): Likewise. * ch/grant.c (write_grant_file): Likewise. * ch/lex.c (init_parse, same_file, yywrap): Likewise. * f/com.c (init_parse): Likewise. * java/jcf-parse.c (yyparse): Likewise. * objc/objc-act.c (objc_init): Likewise. * java/jcf-parse.c (jcf_parse_source): Call fatal_io_error, not fatal. (yyparse): Likewise. * java/jcf-write.c (make_class_file_name, write_classfile): Likewise. * java/lex.c (java_get_line_col): Likewise. * hash.c (hash_allocate): Don't check for failure returns from obstack functions that can't fail. (hash_table_init_n, hash_table_init): Likewise; also now return void. * hash.h (hash_table_init_n, hash_table_init): Now return void. * cp/decl.c (build_typename_type): hash_table_init now returns void. * ch/lang.c (GNU_xref_begin, GNU_xref_end): Deleted. * ch/lex.c (convert_bitstring): Delete check for alloca failure. * config/dsp16xx/dsp16xx.c (dsp16xx_invalid_register_for_compare): Deleted. * config/dsp16xx/dsp16xx.md (unnamed cmphi): Call abort instead of it. * f/com.c (ffecom_decode_include_option_): Make errors non-fatal. * f/lex.c (ffelex_cfelex_, ffelex_get_directive_line_): Likewise. (ffelex_hash_): Likewise. * config/arm/arm.c (arm_override_options): Likewise. * config/avr/avr.c (avr_override_options): Likewise. * config/c4x/c4x.c (c4x_expand_prologue): Likewise. * config/dsp16xx/dsp16xx.c (function_prologue): Likewise. * config/h8300/h8300.c (h8300_init_once): Likewise. * config/mips/mips.c (override_options): Likewise. * config/i386/i386.c (override_options): Likewise, rework. * config/m68k/m68k.c (override_options): Likewise. * cp/decl.c (init_decl_processing): Likewise. * java/jcf-parse.c (load_class): Likewise. * config/dsp16xx/dsp16xx.c (print_operand): Call output_operand_lossage instead of fatal. * config/mips/mips.c (print_operand): Likewise. * java/lex.c (byteswap_init, need_byteswap): Only #ifdef HAVE_ICONV. * objc/objc_act.c (objc_check_decl): Remove unneeded fatal call. (get_object_reference): Likewise. From-SVN: r39443
2001-02-04 23:44:12 +01:00
{
if (context->lock++)
error_recursion (context);
diagnostic.h (set_internal_error_function): Renamed. * diagnostic.h (set_internal_error_function): Renamed. * toplev.h (internal_error): Renamed from fatal. (pfatal_with_name): Deleted. (fatal_io_error): Now has printf-style arguments. * diagnostic.c (pfatal_with_name): Deleted. (fatal_io_error): Rework to have args in printf-style. (set_internal_error_function): Renamed from set_fatal_function. (internal_error): Renamed from fatal. (error_recursion, fancy_abort): Call internal_error instead of fatal. * dwarf2out.c (get_cfa_from_loc_descr): Likewise. * emit-rtl.c (gen_realpart, gen_imagpart): Likewise. * expr.c (check_max_integer_computation_mode, expand_expr): Likewise. * flow.c (verify_flow_info): Likewise. * config/arm/arm.c (thumb_unexpanded_epilogue): Likewise. * config/mips/mips.c (save_restore_insns): Likewise. * cp/init.c (build_java_class_ref): Likewise. (dsp16xx_reg_class_from_letter): Likewise. (limit_reload_class, double_reg_to_memory): Likewise. (print_operand_address, emit_1600_code_shift): Likewise. (gen_tst_reg, gen_compare_reg): Likewise. * config/m68hc11/m68hc11.c (m68hc11_emit_libcall): Likewise. * cp/decl.c (pushdecl): Likewise. * java/check-init.c (check_init): Likewise. * java/expr.c (java_lang_expand_expr): Likewise. * java/jcf-parse.c (get_constant): Likewise. * java/mangle.c (java_mangle_decl): Likewise. * java/parse.y (make_nested_class_name, java_complete_lhs): Likewise. (operator_string): Likewise. * except.c (duplicate_eh_handlers): Call abort instead of fatal. * flow.c (verify_flow_info): Likewise. * ch/convert.c (convert): Likewise. * ch/except.c (pop_handler, chill_check_no_handlers): Likewise. * ch/expr.c (chill_expand_expr): Likewise. * ch/parse.c (peek_token_, pushback_token, require): Likewise. * config/arm/arm.c (thumb_load_double_from_address): Likewise. * config/avr/avr.c (pttreg_to_str, unique_section): Likewise. (avr_normalize_condition): Likewise. * config/c4x/c4x.c (c4x_emit_libcall, c4x_valid_operands): Likewise. * config/dsp16xx/dsp16xx.c (dsp16xx_reg_class_from_letter): Likewise. (limit_reload_class, double_reg_to_memory): Likewise. (print_operand_address, emit_1600_code_shift): Likewise. (gen_tst_reg, gen_compare_reg): Likewise. * config/m68hc11/m68hc11.c (m68hc11_emit_libcall): Likewise. * cp/decl.c (pushdecl): Likewise. * java/check-init.c (check_init): Likewise. * java/class.c (build_class_ref): Likewise. * java/constants.c (write_constant_pool): Likewise. * java/decl.c (start_java_method): Likewise. * java/expr.c (push_type, java_stack_pop, java_stack_swap): Likewise. (java_stack_dup, encode_newarray_type): Likewise. (build_java_array_length_access): Likewise. (build_java_check_indexed_type, expand_java_pushc): Likewise. (build_java_soft_divmod, build_invokeinterface): Likewise. * java/java-tree.h (INNER_CLASS_P): Likewise. * java/jcf-parse.c (parse_signature, get_name_constant): Likewise. (give_name_to_class, get_class_constant): Likewise. * java/jcf-write.c (CHECK_PUT, CHECK_OP, get_access_flags): Likewise. (find_constant_index, generate_bytecode_conditional): Likewise. (generate_bytecode_insns, perform_relocations): Likewise. * java/lex.c (java_unget_unicode, java_lex): Likewise. * java/mangle.c (mangle_type, mangle_record_type): Likewise. (mangle_pointer_type, mangle_array_type, init_mangling): Likewise. (finish_mangling): Likewise. * java/parse.h (MARK_FINAL_PARMS): Likewise. * java/parse.y (pop_current_osb, unreachable_stmt_error): Likewise. (obtain_incomplete_type, java_complete_class): Likewise. (java_check_regular_methods, java_complete_expand_method): Likewise. (cut_identifier_in_qualified, check_deprecation): Likewise. (patch_invoke, find_applicable_accessible_methods_list): Likewise. (java_complete_lhs, lookup_name_in_blocks): Likewise. (check_final_variable_indirect_assignment, build_unaryop): Likewise. * java/typeck.c (set_local_type, parse_signature_type): Likewise. (parse_signature_string, build_java_signature): Likewise; (set_java_signature): Likewise. * java/verify.c (type_stack_dup, CHECK_PC_IN_RANGE): Likewise. * c-parse.in (methoddef): Call fatal_error instead of fatal. * objc/objc-act.c (build_ivar_chain): Likewise. * cp/except.c (decl_is_java_type): Likewise. * cp/init.c (build_java_class_ref): Likewise. * cp/init.c (build_new_1): Likewise. * f/com.c (ffecom_init_0): Likewise. * java/class.c (add_method, build_static_field_ref): Likewise. * java/expr.c (build_known_method_ref, expand_invoke): Likewise. * java/jcf-parse.c (get_constant, jcf_parse): Likewise. * java/lex.c (java_new_new_lexer): Likewise. * java/jv-scan.c (main): Likewise. (fatal_error): Renamed from fatal. * dwarfout.c (dwarfout_init): Call fatal_io_error instead of pfatal_with_name. * graph.c (clean_graph_dump_file): Likewise. * profile.c (init_branch_prob): Likewise. * ch/grant.c (write_grant_file): Likewise. * ch/lex.c (init_parse, same_file, yywrap): Likewise. * f/com.c (init_parse): Likewise. * java/jcf-parse.c (yyparse): Likewise. * objc/objc-act.c (objc_init): Likewise. * java/jcf-parse.c (jcf_parse_source): Call fatal_io_error, not fatal. (yyparse): Likewise. * java/jcf-write.c (make_class_file_name, write_classfile): Likewise. * java/lex.c (java_get_line_col): Likewise. * hash.c (hash_allocate): Don't check for failure returns from obstack functions that can't fail. (hash_table_init_n, hash_table_init): Likewise; also now return void. * hash.h (hash_table_init_n, hash_table_init): Now return void. * cp/decl.c (build_typename_type): hash_table_init now returns void. * ch/lang.c (GNU_xref_begin, GNU_xref_end): Deleted. * ch/lex.c (convert_bitstring): Delete check for alloca failure. * config/dsp16xx/dsp16xx.c (dsp16xx_invalid_register_for_compare): Deleted. * config/dsp16xx/dsp16xx.md (unnamed cmphi): Call abort instead of it. * f/com.c (ffecom_decode_include_option_): Make errors non-fatal. * f/lex.c (ffelex_cfelex_, ffelex_get_directive_line_): Likewise. (ffelex_hash_): Likewise. * config/arm/arm.c (arm_override_options): Likewise. * config/avr/avr.c (avr_override_options): Likewise. * config/c4x/c4x.c (c4x_expand_prologue): Likewise. * config/dsp16xx/dsp16xx.c (function_prologue): Likewise. * config/h8300/h8300.c (h8300_init_once): Likewise. * config/mips/mips.c (override_options): Likewise. * config/i386/i386.c (override_options): Likewise, rework. * config/m68k/m68k.c (override_options): Likewise. * cp/decl.c (init_decl_processing): Likewise. * java/jcf-parse.c (load_class): Likewise. * config/dsp16xx/dsp16xx.c (print_operand): Call output_operand_lossage instead of fatal. * config/mips/mips.c (print_operand): Likewise. * java/lex.c (byteswap_init, need_byteswap): Only #ifdef HAVE_ICONV. * objc/objc_act.c (objc_check_decl): Remove unneeded fatal call. (get_object_reference): Likewise. From-SVN: r39443
2001-02-04 23:44:12 +01:00
if (diagnostic_count_diagnostic (context, diagnostic->kind))
{
(*diagnostic_starter (context)) (context, diagnostic);
output_format (&context->buffer, &diagnostic->message);
(*diagnostic_finalizer (context)) (context, diagnostic);
output_flush (&context->buffer);
}
diagnostic.h (set_internal_error_function): Renamed. * diagnostic.h (set_internal_error_function): Renamed. * toplev.h (internal_error): Renamed from fatal. (pfatal_with_name): Deleted. (fatal_io_error): Now has printf-style arguments. * diagnostic.c (pfatal_with_name): Deleted. (fatal_io_error): Rework to have args in printf-style. (set_internal_error_function): Renamed from set_fatal_function. (internal_error): Renamed from fatal. (error_recursion, fancy_abort): Call internal_error instead of fatal. * dwarf2out.c (get_cfa_from_loc_descr): Likewise. * emit-rtl.c (gen_realpart, gen_imagpart): Likewise. * expr.c (check_max_integer_computation_mode, expand_expr): Likewise. * flow.c (verify_flow_info): Likewise. * config/arm/arm.c (thumb_unexpanded_epilogue): Likewise. * config/mips/mips.c (save_restore_insns): Likewise. * cp/init.c (build_java_class_ref): Likewise. (dsp16xx_reg_class_from_letter): Likewise. (limit_reload_class, double_reg_to_memory): Likewise. (print_operand_address, emit_1600_code_shift): Likewise. (gen_tst_reg, gen_compare_reg): Likewise. * config/m68hc11/m68hc11.c (m68hc11_emit_libcall): Likewise. * cp/decl.c (pushdecl): Likewise. * java/check-init.c (check_init): Likewise. * java/expr.c (java_lang_expand_expr): Likewise. * java/jcf-parse.c (get_constant): Likewise. * java/mangle.c (java_mangle_decl): Likewise. * java/parse.y (make_nested_class_name, java_complete_lhs): Likewise. (operator_string): Likewise. * except.c (duplicate_eh_handlers): Call abort instead of fatal. * flow.c (verify_flow_info): Likewise. * ch/convert.c (convert): Likewise. * ch/except.c (pop_handler, chill_check_no_handlers): Likewise. * ch/expr.c (chill_expand_expr): Likewise. * ch/parse.c (peek_token_, pushback_token, require): Likewise. * config/arm/arm.c (thumb_load_double_from_address): Likewise. * config/avr/avr.c (pttreg_to_str, unique_section): Likewise. (avr_normalize_condition): Likewise. * config/c4x/c4x.c (c4x_emit_libcall, c4x_valid_operands): Likewise. * config/dsp16xx/dsp16xx.c (dsp16xx_reg_class_from_letter): Likewise. (limit_reload_class, double_reg_to_memory): Likewise. (print_operand_address, emit_1600_code_shift): Likewise. (gen_tst_reg, gen_compare_reg): Likewise. * config/m68hc11/m68hc11.c (m68hc11_emit_libcall): Likewise. * cp/decl.c (pushdecl): Likewise. * java/check-init.c (check_init): Likewise. * java/class.c (build_class_ref): Likewise. * java/constants.c (write_constant_pool): Likewise. * java/decl.c (start_java_method): Likewise. * java/expr.c (push_type, java_stack_pop, java_stack_swap): Likewise. (java_stack_dup, encode_newarray_type): Likewise. (build_java_array_length_access): Likewise. (build_java_check_indexed_type, expand_java_pushc): Likewise. (build_java_soft_divmod, build_invokeinterface): Likewise. * java/java-tree.h (INNER_CLASS_P): Likewise. * java/jcf-parse.c (parse_signature, get_name_constant): Likewise. (give_name_to_class, get_class_constant): Likewise. * java/jcf-write.c (CHECK_PUT, CHECK_OP, get_access_flags): Likewise. (find_constant_index, generate_bytecode_conditional): Likewise. (generate_bytecode_insns, perform_relocations): Likewise. * java/lex.c (java_unget_unicode, java_lex): Likewise. * java/mangle.c (mangle_type, mangle_record_type): Likewise. (mangle_pointer_type, mangle_array_type, init_mangling): Likewise. (finish_mangling): Likewise. * java/parse.h (MARK_FINAL_PARMS): Likewise. * java/parse.y (pop_current_osb, unreachable_stmt_error): Likewise. (obtain_incomplete_type, java_complete_class): Likewise. (java_check_regular_methods, java_complete_expand_method): Likewise. (cut_identifier_in_qualified, check_deprecation): Likewise. (patch_invoke, find_applicable_accessible_methods_list): Likewise. (java_complete_lhs, lookup_name_in_blocks): Likewise. (check_final_variable_indirect_assignment, build_unaryop): Likewise. * java/typeck.c (set_local_type, parse_signature_type): Likewise. (parse_signature_string, build_java_signature): Likewise; (set_java_signature): Likewise. * java/verify.c (type_stack_dup, CHECK_PC_IN_RANGE): Likewise. * c-parse.in (methoddef): Call fatal_error instead of fatal. * objc/objc-act.c (build_ivar_chain): Likewise. * cp/except.c (decl_is_java_type): Likewise. * cp/init.c (build_java_class_ref): Likewise. * cp/init.c (build_new_1): Likewise. * f/com.c (ffecom_init_0): Likewise. * java/class.c (add_method, build_static_field_ref): Likewise. * java/expr.c (build_known_method_ref, expand_invoke): Likewise. * java/jcf-parse.c (get_constant, jcf_parse): Likewise. * java/lex.c (java_new_new_lexer): Likewise. * java/jv-scan.c (main): Likewise. (fatal_error): Renamed from fatal. * dwarfout.c (dwarfout_init): Call fatal_io_error instead of pfatal_with_name. * graph.c (clean_graph_dump_file): Likewise. * profile.c (init_branch_prob): Likewise. * ch/grant.c (write_grant_file): Likewise. * ch/lex.c (init_parse, same_file, yywrap): Likewise. * f/com.c (init_parse): Likewise. * java/jcf-parse.c (yyparse): Likewise. * objc/objc-act.c (objc_init): Likewise. * java/jcf-parse.c (jcf_parse_source): Call fatal_io_error, not fatal. (yyparse): Likewise. * java/jcf-write.c (make_class_file_name, write_classfile): Likewise. * java/lex.c (java_get_line_col): Likewise. * hash.c (hash_allocate): Don't check for failure returns from obstack functions that can't fail. (hash_table_init_n, hash_table_init): Likewise; also now return void. * hash.h (hash_table_init_n, hash_table_init): Now return void. * cp/decl.c (build_typename_type): hash_table_init now returns void. * ch/lang.c (GNU_xref_begin, GNU_xref_end): Deleted. * ch/lex.c (convert_bitstring): Delete check for alloca failure. * config/dsp16xx/dsp16xx.c (dsp16xx_invalid_register_for_compare): Deleted. * config/dsp16xx/dsp16xx.md (unnamed cmphi): Call abort instead of it. * f/com.c (ffecom_decode_include_option_): Make errors non-fatal. * f/lex.c (ffelex_cfelex_, ffelex_get_directive_line_): Likewise. (ffelex_hash_): Likewise. * config/arm/arm.c (arm_override_options): Likewise. * config/avr/avr.c (avr_override_options): Likewise. * config/c4x/c4x.c (c4x_expand_prologue): Likewise. * config/dsp16xx/dsp16xx.c (function_prologue): Likewise. * config/h8300/h8300.c (h8300_init_once): Likewise. * config/mips/mips.c (override_options): Likewise. * config/i386/i386.c (override_options): Likewise, rework. * config/m68k/m68k.c (override_options): Likewise. * cp/decl.c (init_decl_processing): Likewise. * java/jcf-parse.c (load_class): Likewise. * config/dsp16xx/dsp16xx.c (print_operand): Call output_operand_lossage instead of fatal. * config/mips/mips.c (print_operand): Likewise. * java/lex.c (byteswap_init, need_byteswap): Only #ifdef HAVE_ICONV. * objc/objc_act.c (objc_check_decl): Remove unneeded fatal call. (get_object_reference): Likewise. From-SVN: r39443
2001-02-04 23:44:12 +01:00
if (context->abort_on_error && diagnostic->kind <= DK_ERROR)
real_abort();
--context->lock;
diagnostic.h (set_internal_error_function): Renamed. * diagnostic.h (set_internal_error_function): Renamed. * toplev.h (internal_error): Renamed from fatal. (pfatal_with_name): Deleted. (fatal_io_error): Now has printf-style arguments. * diagnostic.c (pfatal_with_name): Deleted. (fatal_io_error): Rework to have args in printf-style. (set_internal_error_function): Renamed from set_fatal_function. (internal_error): Renamed from fatal. (error_recursion, fancy_abort): Call internal_error instead of fatal. * dwarf2out.c (get_cfa_from_loc_descr): Likewise. * emit-rtl.c (gen_realpart, gen_imagpart): Likewise. * expr.c (check_max_integer_computation_mode, expand_expr): Likewise. * flow.c (verify_flow_info): Likewise. * config/arm/arm.c (thumb_unexpanded_epilogue): Likewise. * config/mips/mips.c (save_restore_insns): Likewise. * cp/init.c (build_java_class_ref): Likewise. (dsp16xx_reg_class_from_letter): Likewise. (limit_reload_class, double_reg_to_memory): Likewise. (print_operand_address, emit_1600_code_shift): Likewise. (gen_tst_reg, gen_compare_reg): Likewise. * config/m68hc11/m68hc11.c (m68hc11_emit_libcall): Likewise. * cp/decl.c (pushdecl): Likewise. * java/check-init.c (check_init): Likewise. * java/expr.c (java_lang_expand_expr): Likewise. * java/jcf-parse.c (get_constant): Likewise. * java/mangle.c (java_mangle_decl): Likewise. * java/parse.y (make_nested_class_name, java_complete_lhs): Likewise. (operator_string): Likewise. * except.c (duplicate_eh_handlers): Call abort instead of fatal. * flow.c (verify_flow_info): Likewise. * ch/convert.c (convert): Likewise. * ch/except.c (pop_handler, chill_check_no_handlers): Likewise. * ch/expr.c (chill_expand_expr): Likewise. * ch/parse.c (peek_token_, pushback_token, require): Likewise. * config/arm/arm.c (thumb_load_double_from_address): Likewise. * config/avr/avr.c (pttreg_to_str, unique_section): Likewise. (avr_normalize_condition): Likewise. * config/c4x/c4x.c (c4x_emit_libcall, c4x_valid_operands): Likewise. * config/dsp16xx/dsp16xx.c (dsp16xx_reg_class_from_letter): Likewise. (limit_reload_class, double_reg_to_memory): Likewise. (print_operand_address, emit_1600_code_shift): Likewise. (gen_tst_reg, gen_compare_reg): Likewise. * config/m68hc11/m68hc11.c (m68hc11_emit_libcall): Likewise. * cp/decl.c (pushdecl): Likewise. * java/check-init.c (check_init): Likewise. * java/class.c (build_class_ref): Likewise. * java/constants.c (write_constant_pool): Likewise. * java/decl.c (start_java_method): Likewise. * java/expr.c (push_type, java_stack_pop, java_stack_swap): Likewise. (java_stack_dup, encode_newarray_type): Likewise. (build_java_array_length_access): Likewise. (build_java_check_indexed_type, expand_java_pushc): Likewise. (build_java_soft_divmod, build_invokeinterface): Likewise. * java/java-tree.h (INNER_CLASS_P): Likewise. * java/jcf-parse.c (parse_signature, get_name_constant): Likewise. (give_name_to_class, get_class_constant): Likewise. * java/jcf-write.c (CHECK_PUT, CHECK_OP, get_access_flags): Likewise. (find_constant_index, generate_bytecode_conditional): Likewise. (generate_bytecode_insns, perform_relocations): Likewise. * java/lex.c (java_unget_unicode, java_lex): Likewise. * java/mangle.c (mangle_type, mangle_record_type): Likewise. (mangle_pointer_type, mangle_array_type, init_mangling): Likewise. (finish_mangling): Likewise. * java/parse.h (MARK_FINAL_PARMS): Likewise. * java/parse.y (pop_current_osb, unreachable_stmt_error): Likewise. (obtain_incomplete_type, java_complete_class): Likewise. (java_check_regular_methods, java_complete_expand_method): Likewise. (cut_identifier_in_qualified, check_deprecation): Likewise. (patch_invoke, find_applicable_accessible_methods_list): Likewise. (java_complete_lhs, lookup_name_in_blocks): Likewise. (check_final_variable_indirect_assignment, build_unaryop): Likewise. * java/typeck.c (set_local_type, parse_signature_type): Likewise. (parse_signature_string, build_java_signature): Likewise; (set_java_signature): Likewise. * java/verify.c (type_stack_dup, CHECK_PC_IN_RANGE): Likewise. * c-parse.in (methoddef): Call fatal_error instead of fatal. * objc/objc-act.c (build_ivar_chain): Likewise. * cp/except.c (decl_is_java_type): Likewise. * cp/init.c (build_java_class_ref): Likewise. * cp/init.c (build_new_1): Likewise. * f/com.c (ffecom_init_0): Likewise. * java/class.c (add_method, build_static_field_ref): Likewise. * java/expr.c (build_known_method_ref, expand_invoke): Likewise. * java/jcf-parse.c (get_constant, jcf_parse): Likewise. * java/lex.c (java_new_new_lexer): Likewise. * java/jv-scan.c (main): Likewise. (fatal_error): Renamed from fatal. * dwarfout.c (dwarfout_init): Call fatal_io_error instead of pfatal_with_name. * graph.c (clean_graph_dump_file): Likewise. * profile.c (init_branch_prob): Likewise. * ch/grant.c (write_grant_file): Likewise. * ch/lex.c (init_parse, same_file, yywrap): Likewise. * f/com.c (init_parse): Likewise. * java/jcf-parse.c (yyparse): Likewise. * objc/objc-act.c (objc_init): Likewise. * java/jcf-parse.c (jcf_parse_source): Call fatal_io_error, not fatal. (yyparse): Likewise. * java/jcf-write.c (make_class_file_name, write_classfile): Likewise. * java/lex.c (java_get_line_col): Likewise. * hash.c (hash_allocate): Don't check for failure returns from obstack functions that can't fail. (hash_table_init_n, hash_table_init): Likewise; also now return void. * hash.h (hash_table_init_n, hash_table_init): Now return void. * cp/decl.c (build_typename_type): hash_table_init now returns void. * ch/lang.c (GNU_xref_begin, GNU_xref_end): Deleted. * ch/lex.c (convert_bitstring): Delete check for alloca failure. * config/dsp16xx/dsp16xx.c (dsp16xx_invalid_register_for_compare): Deleted. * config/dsp16xx/dsp16xx.md (unnamed cmphi): Call abort instead of it. * f/com.c (ffecom_decode_include_option_): Make errors non-fatal. * f/lex.c (ffelex_cfelex_, ffelex_get_directive_line_): Likewise. (ffelex_hash_): Likewise. * config/arm/arm.c (arm_override_options): Likewise. * config/avr/avr.c (avr_override_options): Likewise. * config/c4x/c4x.c (c4x_expand_prologue): Likewise. * config/dsp16xx/dsp16xx.c (function_prologue): Likewise. * config/h8300/h8300.c (h8300_init_once): Likewise. * config/mips/mips.c (override_options): Likewise. * config/i386/i386.c (override_options): Likewise, rework. * config/m68k/m68k.c (override_options): Likewise. * cp/decl.c (init_decl_processing): Likewise. * java/jcf-parse.c (load_class): Likewise. * config/dsp16xx/dsp16xx.c (print_operand): Call output_operand_lossage instead of fatal. * config/mips/mips.c (print_operand): Likewise. * java/lex.c (byteswap_init, need_byteswap): Only #ifdef HAVE_ICONV. * objc/objc_act.c (objc_check_decl): Remove unneeded fatal call. (get_object_reference): Likewise. From-SVN: r39443
2001-02-04 23:44:12 +01:00
}
/* Report a diagnostic MESSAGE at the declaration DECL.
MSG is a format string which uses %s to substitute the declaration
name; subsequent substitutions are a la output_format. */
static void
diagnostic_for_decl (diagnostic, decl)
diagnostic_info *diagnostic;
tree decl;
{
if (global_dc->lock++)
toplev.h (report_error_function): Remove. * toplev.h (report_error_function): Remove. * diagnostic.h (location_t): New datatype. (text_info): Likewise. (diagnostic_info): Likewise. (output_prefix): New macro. (diagnostic_last_function_changed): Likewise. (diagnostic_set_last_function): Likewise. (diagnostic_last_module_changed): Likewise. (diagnostic_set_last_module): Likewise. (report_diagnostic): Now macro. (diagnostic_set_info): Declare. * diagnostic.c (report_problematic_module): Rename to diagnostic_repor_current_module. (set_diagnostic_context): Remove. (count_error): Rename to diagnostic_error_count. (error_function_changed): Remove. (record_last_error_function): Likewise. (error_module_changed): Likewise. (record_last_error_module): Likewise. (context_as_prefix): Rename to diagnostic_build_prefix. (flush_diagnostic_buffer): Rename to diagnostic_flush_buffer. (diagnostic_set_info): New function. * objc/objc-act.c: #include diagnostic.h (error_with_ivar): Adjust call to count_error. (warn_with_method): Likewise. * objc/Make-lang.in (objc-act.o): Depend on diagnostic.h cp/ 2002-06-04 Gabriel Dos Reis <gdr@codesourcery.com> * error.c (cp_diagnostic_starter): Adjust call. (maybe_print_instantiation_context): Change prototype to take a 'diagnostic_info *'. (print_instantiation_full_context): Likewise. (print_instantiation_partial_context): Likewise. (cp_diagnostic_starter): Likewise. (cp_diagnostic_finalizer): Likewise. (cp_print_error_function): Likewise. (cp_printer): Take a secondary parameter as a 'text_info *'. Remove output_state savings. Adjust calls. f/ 2002-06-04 Gabriel Dos Reis <gdr@codesourcery.com> * bad.c (ffebad_start_): Adjust call to count_error. * Make-lang.in (f/bad.o): Depend on diagnostic.h * bad.c: #include diagnostic.h From-SVN: r54291
2002-06-05 21:35:45 +02:00
error_recursion (global_dc);
if (diagnostic_count_diagnostic (global_dc, diagnostic->kind))
{
diagnostic_report_current_function (global_dc);
output_set_prefix
(&global_dc->buffer, diagnostic_build_prefix (diagnostic));
format_with_decl (&global_dc->buffer, &diagnostic->message, decl);
output_flush (&global_dc->buffer);
output_destroy_prefix (&global_dc->buffer);
}
global_dc->lock--;
}
/* Given a partial pathname as input, return another pathname that
shares no directory elements with the pathname of __FILE__. This
is used by fancy_abort() to print `Internal compiler error in expr.c'
instead of `Internal compiler error in ../../GCC/gcc/expr.c'. */
const char *
trim_filename (name)
const char *name;
{
static const char this_file[] = __FILE__;
const char *p = name, *q = this_file;
/* First skip any "../" in each filename. This allows us to give a proper
reference to a file in a subdirectory. */
while (p[0] == '.' && p[1] == '.'
&& (p[2] == DIR_SEPARATOR
#ifdef DIR_SEPARATOR_2
|| p[2] == DIR_SEPARATOR_2
#endif
))
p += 3;
while (q[0] == '.' && q[1] == '.'
&& (q[2] == DIR_SEPARATOR
#ifdef DIR_SEPARATOR_2
|| p[2] == DIR_SEPARATOR_2
#endif
))
q += 3;
/* Now skip any parts the two filenames have in common. */
while (*p == *q && *p != 0 && *q != 0)
p++, q++;
/* Now go backwards until the previous directory separator. */
while (p > name && p[-1] != DIR_SEPARATOR
#ifdef DIR_SEPARATOR_2
&& p[-1] != DIR_SEPARATOR_2
#endif
)
p--;
return p;
}
/* Standard error reporting routines in increasing order of severity.
All of these take arguments like printf. */
/* Text to be emitted verbatim to the error message stream; this
produces no prefix and disables line-wrapping. Use rarely. */
void
verbatim VPARAMS ((const char *msgid, ...))
{
text_info text;
VA_OPEN (ap, msgid);
VA_FIXEDARG (ap, const char *, msgid);
text.format_spec = _(msgid);
text.args_ptr = &ap;
output_do_verbatim (&global_dc->buffer, &text);
output_buffer_to_stream (&global_dc->buffer);
VA_CLOSE (ap);
}
/* An informative note. Use this for additional details on an error
message. */
void
inform VPARAMS ((const char *msgid, ...))
{
toplev.h (report_error_function): Remove. * toplev.h (report_error_function): Remove. * diagnostic.h (location_t): New datatype. (text_info): Likewise. (diagnostic_info): Likewise. (output_prefix): New macro. (diagnostic_last_function_changed): Likewise. (diagnostic_set_last_function): Likewise. (diagnostic_last_module_changed): Likewise. (diagnostic_set_last_module): Likewise. (report_diagnostic): Now macro. (diagnostic_set_info): Declare. * diagnostic.c (report_problematic_module): Rename to diagnostic_repor_current_module. (set_diagnostic_context): Remove. (count_error): Rename to diagnostic_error_count. (error_function_changed): Remove. (record_last_error_function): Likewise. (error_module_changed): Likewise. (record_last_error_module): Likewise. (context_as_prefix): Rename to diagnostic_build_prefix. (flush_diagnostic_buffer): Rename to diagnostic_flush_buffer. (diagnostic_set_info): New function. * objc/objc-act.c: #include diagnostic.h (error_with_ivar): Adjust call to count_error. (warn_with_method): Likewise. * objc/Make-lang.in (objc-act.o): Depend on diagnostic.h cp/ 2002-06-04 Gabriel Dos Reis <gdr@codesourcery.com> * error.c (cp_diagnostic_starter): Adjust call. (maybe_print_instantiation_context): Change prototype to take a 'diagnostic_info *'. (print_instantiation_full_context): Likewise. (print_instantiation_partial_context): Likewise. (cp_diagnostic_starter): Likewise. (cp_diagnostic_finalizer): Likewise. (cp_print_error_function): Likewise. (cp_printer): Take a secondary parameter as a 'text_info *'. Remove output_state savings. Adjust calls. f/ 2002-06-04 Gabriel Dos Reis <gdr@codesourcery.com> * bad.c (ffebad_start_): Adjust call to count_error. * Make-lang.in (f/bad.o): Depend on diagnostic.h * bad.c: #include diagnostic.h From-SVN: r54291
2002-06-05 21:35:45 +02:00
diagnostic_info diagnostic;
VA_OPEN (ap, msgid);
VA_FIXEDARG (ap, const char *, msgid);
diagnostic_set_info (&diagnostic, msgid, &ap, input_filename, input_line,
DK_NOTE);
report_diagnostic (&diagnostic);
VA_CLOSE (ap);
}
/* A warning. Use this for code which is correct according to the
relevant language specification but is likely to be buggy anyway. */
void
warning VPARAMS ((const char *msgid, ...))
{
toplev.h (report_error_function): Remove. * toplev.h (report_error_function): Remove. * diagnostic.h (location_t): New datatype. (text_info): Likewise. (diagnostic_info): Likewise. (output_prefix): New macro. (diagnostic_last_function_changed): Likewise. (diagnostic_set_last_function): Likewise. (diagnostic_last_module_changed): Likewise. (diagnostic_set_last_module): Likewise. (report_diagnostic): Now macro. (diagnostic_set_info): Declare. * diagnostic.c (report_problematic_module): Rename to diagnostic_repor_current_module. (set_diagnostic_context): Remove. (count_error): Rename to diagnostic_error_count. (error_function_changed): Remove. (record_last_error_function): Likewise. (error_module_changed): Likewise. (record_last_error_module): Likewise. (context_as_prefix): Rename to diagnostic_build_prefix. (flush_diagnostic_buffer): Rename to diagnostic_flush_buffer. (diagnostic_set_info): New function. * objc/objc-act.c: #include diagnostic.h (error_with_ivar): Adjust call to count_error. (warn_with_method): Likewise. * objc/Make-lang.in (objc-act.o): Depend on diagnostic.h cp/ 2002-06-04 Gabriel Dos Reis <gdr@codesourcery.com> * error.c (cp_diagnostic_starter): Adjust call. (maybe_print_instantiation_context): Change prototype to take a 'diagnostic_info *'. (print_instantiation_full_context): Likewise. (print_instantiation_partial_context): Likewise. (cp_diagnostic_starter): Likewise. (cp_diagnostic_finalizer): Likewise. (cp_print_error_function): Likewise. (cp_printer): Take a secondary parameter as a 'text_info *'. Remove output_state savings. Adjust calls. f/ 2002-06-04 Gabriel Dos Reis <gdr@codesourcery.com> * bad.c (ffebad_start_): Adjust call to count_error. * Make-lang.in (f/bad.o): Depend on diagnostic.h * bad.c: #include diagnostic.h From-SVN: r54291
2002-06-05 21:35:45 +02:00
diagnostic_info diagnostic;
VA_OPEN (ap, msgid);
VA_FIXEDARG (ap, const char *, msgid);
input.h (lineno): Rename to ... * input.h (lineno): Rename to ... (input_line): ... here. * tree.h (lineno): Rename to ... (input_line): ... here. * scan.h (lineno): Rename to ... (input_line): ... here. * toplev.c (lineno): Rename to ... (input_line): ... here. (push_srcloc, pop_srcloc): Rename lineno to input_line. * c-common.c (c_expand_start_cond, fname_decl): Likewise. * c-decl.c (poplevel, pop_label_level, lookup_label, lookup_tag, store_parm_decls, c_expand_body_1): Likewise. * c-errors.c (pedwarn_c99): Likewise. * c-format.c (status_warning): Likewise. * c-lex.c (fe_file_change, cb_def_pragma, c_lex): Likewise. * c-opts.c (c_common_post_options, c_common_parse_file): Likewise. * c-parse.in (save_filename, maybe_type_qual, ifc): Likwise. * c-semantics.c (finish_stmt_tree, build_stmt, emit_local_var, gentrtl_goto_stmt, genrtl_expr_stmt_value, genrtl_decl_stmt, genrtl_if_stmt, genrtl_while_stmt, genrtl_do_stmt, genrtl_return_stmt, genrtl_for_stmt, build_break_stmt, build_continue_stmt, genrtl_switch_stmt, genrtl_asm_stmt, prep_stmt, find_reachable_label, expand_unreachable_stmt): Likewise. * coverage.c (create_coverage): Likewise. * diagnostic.c (pedwarn, sorry, error, fatal_error, internal_error, warning, diagnostic_report_current_module, inform): Likewise. * expr.c (expand_expr): Likewise. * integrate.c (expand_inline_function, output_inline_function): Likewise. * rtl-error.c (file_and_line_for_asm): Likewise. * tree-inline.c (find_alloca_call, find_builtin_longjmp_call, walk_tree): Likewise. * tree.c (make_node): Likewise. * ada, cp, f, java, objc, treelang: Likewise. ada * trans.c (build_unit_elab, set_lineno): Rename lineno to input_line. * utils.c (pushdecl, create_label_decl, begin_subprog_body, end_subprog_body): Likewise. * utils2.c (build_call_raise): Likewise. cp * class.c (finish_struct): Rename lineno to input_line. * decl.c (push_binding_level, pop_binding_level, suspend_binding_level, resume_binding_level, make_label_decl, use_label, start_function): Likewise. * decl2.c (warn_if_unknown_interface, start_static_initialization_or_destruction, generate_ctor_or_dtor_function, finish_file): Likewise. * error.c (cp_line_of, print_instantiation_full_context, print_instantiation_context): Likewise. * except.c (check_handlers_1, check_handlers): Likewise. * init.c (create_temporary_var): Likewise. * method.c (use_thunk, synthesize_method): Likewise. * parser.c (cp_lexer_set_source_position_from_token, cp_lexer_get_preprocessor_token): Likewise. * pt.c (push_tinst_level, pop_tinst_level, tsubst_friend_function, instantiate_class_template, tsubst_decl, tsubst, tsubst_expr, instantiate_decl): Likewise. * semantics.c (genrtl_try_block, finish_label_stmt, begin_class_definition, expand_body, genrtl_finish_function): Likewise. * tree.c (build_min_nt, build_min): Likewise. f * ansify.c (die_unless): Rename lineno to input_line. * com.c (ffecom_subscript_check_, ffecom_do_entry_, ffecom_gen_sfuncdef_, ffecom_start_progunit_, ffecom_sym_transform_, ffecom_sym_transform_assign_, bison_rule_pushlevel_, bison_rule_compstmt_, finish_function, store_parm_decls): Likewise. * intrin.c (ffeintrin_fulfill_generic): Likewise. * lex.c (ffelex_hash_, ffelex_include_, ffelex_next_line_, ffelex_file_fixed, ffelex_file_free): Likewise. * std.c (ffestd_exec_end): Likewise. * ste.c (ffeste_emit_line_note_, ffeste_start_block_, ffeste_start_stmt_): Likewise. * ste.h (ffeste_filelinenum, ffeste_set_line): Likewise. java * lex.h (lineno): Rename to ... (input_line): ... here * parse-scan.y (lineno): Rename to ... (input_line): ... here. (reset_report): Rename lineno to input_line. * check-init.c (check_init): Likewise. * class.c (push_class): Likewise. * decl.c (complete_start_java_method, end_java_method): Likewise. * expr.c (expand_byte_code): Likewise. * jcf-parse.c (give_name_to_class, parse_class_file): Likewise. * jcf-write.c (generate_bytecode_insns): Likewise. * lex.c (java_init_lex, java_allocate_new_line, do_java_lex): Likewise. * parse.h (YYNOT_TWICE): Likewise. * parse.y (empty_statement, expression_statement, java_pop_parser_context, java_parser_context_save_global, yyerror, register_fields, method_header, safe_layout_class, find_in_imports_on_demand, create_artificial_method, source_end_java_method, start_complete_expand_method, build_thisn_assign, java_complete_lhs, maybe_absorb_scoping_block): Likewise. objc * objc-act.c (objc_init): Rename lineno to input_line. (build_module_descriptor, build_selector_translation_table, build_protocol_template, build_method_prototype_list_template, build_category_template, build_selector_table, build_class_template, build_super_template, build_ivar_template, build_ivar_list_template, build_method_list_template, build_method_template, add_instance_variable): Likewise. treelang * tree1.c (treelang_init): Rename lineno to input_line. From-SVN: r66333
2003-05-01 18:13:36 +02:00
diagnostic_set_info (&diagnostic, msgid, &ap, input_filename, input_line,
toplev.h (report_error_function): Remove. * toplev.h (report_error_function): Remove. * diagnostic.h (location_t): New datatype. (text_info): Likewise. (diagnostic_info): Likewise. (output_prefix): New macro. (diagnostic_last_function_changed): Likewise. (diagnostic_set_last_function): Likewise. (diagnostic_last_module_changed): Likewise. (diagnostic_set_last_module): Likewise. (report_diagnostic): Now macro. (diagnostic_set_info): Declare. * diagnostic.c (report_problematic_module): Rename to diagnostic_repor_current_module. (set_diagnostic_context): Remove. (count_error): Rename to diagnostic_error_count. (error_function_changed): Remove. (record_last_error_function): Likewise. (error_module_changed): Likewise. (record_last_error_module): Likewise. (context_as_prefix): Rename to diagnostic_build_prefix. (flush_diagnostic_buffer): Rename to diagnostic_flush_buffer. (diagnostic_set_info): New function. * objc/objc-act.c: #include diagnostic.h (error_with_ivar): Adjust call to count_error. (warn_with_method): Likewise. * objc/Make-lang.in (objc-act.o): Depend on diagnostic.h cp/ 2002-06-04 Gabriel Dos Reis <gdr@codesourcery.com> * error.c (cp_diagnostic_starter): Adjust call. (maybe_print_instantiation_context): Change prototype to take a 'diagnostic_info *'. (print_instantiation_full_context): Likewise. (print_instantiation_partial_context): Likewise. (cp_diagnostic_starter): Likewise. (cp_diagnostic_finalizer): Likewise. (cp_print_error_function): Likewise. (cp_printer): Take a secondary parameter as a 'text_info *'. Remove output_state savings. Adjust calls. f/ 2002-06-04 Gabriel Dos Reis <gdr@codesourcery.com> * bad.c (ffebad_start_): Adjust call to count_error. * Make-lang.in (f/bad.o): Depend on diagnostic.h * bad.c: #include diagnostic.h From-SVN: r54291
2002-06-05 21:35:45 +02:00
DK_WARNING);
report_diagnostic (&diagnostic);
VA_CLOSE (ap);
}
/* A "pedantic" warning. Use this for code which triggers a
diagnostic which is required by the relevant language
specification, but which is considered unhelpful (i.e. there isn't
anything *really* wrong with the construct in the language as she
is spoke). It is a normal warning unless -pedantic-errors is
applied, which turns it into an error. Note that pedwarn-s still
happen if -pedantic is not given; you must write
"if (pedantic) pedwarn (...)" to get a warning enabled only under
-pedantic. All such warnings should, however, use pedwarn. */
void
pedwarn VPARAMS ((const char *msgid, ...))
{
diagnostic_info diagnostic;
VA_OPEN (ap, msgid);
VA_FIXEDARG (ap, const char *, msgid);
diagnostic_set_info (&diagnostic, _(msgid), &ap, input_filename, input_line,
pedantic_error_kind ());
report_diagnostic (&diagnostic);
VA_CLOSE (ap);
}
/* A hard error: the code is definitely ill-formed, and an object file
will not be produced. */
void
error VPARAMS ((const char *msgid, ...))
{
diagnostic_info diagnostic;
VA_OPEN (ap, msgid);
VA_FIXEDARG (ap, const char *, msgid);
diagnostic_set_info (&diagnostic, msgid, &ap, input_filename, input_line,
DK_ERROR);
report_diagnostic (&diagnostic);
VA_CLOSE (ap);
}
/* "Sorry, not implemented." Use for a language feature which is
required by the relevant specification but not implemented by GCC.
An object file will not be produced. */
void
sorry VPARAMS ((const char *msgid, ...))
{
diagnostic_info diagnostic;
VA_OPEN (ap, msgid);
VA_FIXEDARG (ap, const char *, msgid);
++sorrycount;
diagnostic_set_info (&diagnostic, _(msgid), &ap,
input_filename, input_line, DK_SORRY);
output_set_prefix
(&global_dc->buffer, diagnostic_build_prefix (&diagnostic));
output_format (&global_dc->buffer, &diagnostic.message);
output_flush (&global_dc->buffer);
VA_CLOSE (ap);
}
/* An error which is severe enough that we make no attempt to
continue. Do not use this for internal consistency checks; that's
internal_error. Use of this function should be rare. */
void
fatal_error VPARAMS ((const char *msgid, ...))
{
diagnostic_info diagnostic;
VA_OPEN (ap, msgid);
VA_FIXEDARG (ap, const char *, msgid);
diagnostic_set_info (&diagnostic, msgid, &ap, input_filename, input_line,
DK_FATAL);
report_diagnostic (&diagnostic);
VA_CLOSE (ap);
fnotice (stderr, "compilation terminated.\n");
exit (FATAL_EXIT_CODE);
}
/* An internal consistency check has failed. We make no attempt to
continue. Note that unless there is debugging value to be had from
a more specific message, or some other good reason, you should use
abort () instead of calling this function directly. */
void
internal_error VPARAMS ((const char *msgid, ...))
{
diagnostic_info diagnostic;
VA_OPEN (ap, msgid);
VA_FIXEDARG (ap, const char *, msgid);
if (global_dc->lock)
error_recursion (global_dc);
#ifndef ENABLE_CHECKING
if (errorcount > 0 || sorrycount > 0)
{
fnotice (stderr, "%s:%d: confused by earlier errors, bailing out\n",
input_filename, input_line);
exit (FATAL_EXIT_CODE);
}
#endif
if (global_dc->internal_error != 0)
(*global_dc->internal_error) (_(msgid), &ap);
diagnostic_set_info (&diagnostic, msgid, &ap, input_filename, input_line,
DK_ICE);
report_diagnostic (&diagnostic);
VA_CLOSE (ap);
fnotice (stderr,
"Please submit a full bug report,\n\
with preprocessed source if appropriate.\n\
See %s for instructions.\n", bug_report_url);
exit (FATAL_EXIT_CODE);
}
/* Variants of some of the above, which make reference to a particular
DECL node. These are deprecated. */
void
warning_with_decl VPARAMS ((tree decl, const char *msgid, ...))
{
diagnostic_info diagnostic;
VA_OPEN (ap, msgid);
VA_FIXEDARG (ap, tree, decl);
VA_FIXEDARG (ap, const char *, msgid);
diagnostic_set_info (&diagnostic, msgid, &ap,
DECL_SOURCE_FILE (decl), DECL_SOURCE_LINE (decl),
DK_WARNING);
diagnostic_for_decl (&diagnostic, decl);
VA_CLOSE (ap);
}
void
pedwarn_with_decl VPARAMS ((tree decl, const char *msgid, ...))
{
diagnostic_info diagnostic;
VA_OPEN (ap, msgid);
VA_FIXEDARG (ap, tree, decl);
VA_FIXEDARG (ap, const char *, msgid);
diagnostic_set_info (&diagnostic, _(msgid), &ap,
DECL_SOURCE_FILE (decl), DECL_SOURCE_LINE (decl),
pedantic_error_kind ());
/* We don't want -pedantic-errors to cause the compilation to fail from
"errors" in system header files. Sometimes fixincludes can't fix what's
broken (eg: unsigned char bitfields - fixing it may change the alignment
which will cause programs to mysteriously fail because the C library
or kernel uses the original layout). There's no point in issuing a
warning either, it's just unnecessary noise. */
if (!DECL_IN_SYSTEM_HEADER (decl))
diagnostic_for_decl (&diagnostic, decl);
VA_CLOSE (ap);
}
void
error_with_decl VPARAMS ((tree decl, const char *msgid, ...))
{
diagnostic_info diagnostic;
VA_OPEN (ap, msgid);
VA_FIXEDARG (ap, tree, decl);
VA_FIXEDARG (ap, const char *, msgid);
diagnostic_set_info (&diagnostic, msgid, &ap,
DECL_SOURCE_FILE (decl), DECL_SOURCE_LINE (decl),
DK_ERROR);
diagnostic_for_decl (&diagnostic, decl);
VA_CLOSE (ap);
}
/* Special case error functions. Most are implemented in terms of the
above, or should be. */
/* Print a diagnostic MSGID on FILE. This is just fprintf, except it
runs its second argument through gettext. */
void
fnotice VPARAMS ((FILE *file, const char *msgid, ...))
{
VA_OPEN (ap, msgid);
VA_FIXEDARG (ap, FILE *, file);
VA_FIXEDARG (ap, const char *, msgid);
vfprintf (file, _(msgid), ap);
VA_CLOSE (ap);
}
/* Warn about a use of an identifier which was marked deprecated. */
void
warn_deprecated_use (node)
tree node;
{
if (node == 0 || !warn_deprecated_decl)
return;
if (DECL_P (node))
warning ("`%s' is deprecated (declared at %s:%d)",
IDENTIFIER_POINTER (DECL_NAME (node)),
DECL_SOURCE_FILE (node), DECL_SOURCE_LINE (node));
else if (TYPE_P (node))
{
const char *what = NULL;
tree decl = TYPE_STUB_DECL (node);
if (TREE_CODE (TYPE_NAME (node)) == IDENTIFIER_NODE)
what = IDENTIFIER_POINTER (TYPE_NAME (node));
else if (TREE_CODE (TYPE_NAME (node)) == TYPE_DECL
&& DECL_NAME (TYPE_NAME (node)))
what = IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (node)));
if (what)
{
if (decl)
warning ("`%s' is deprecated (declared at %s:%d)", what,
DECL_SOURCE_FILE (decl), DECL_SOURCE_LINE (decl));
else
warning ("`%s' is deprecated", what);
}
else if (decl)
warning ("type is deprecated (declared at %s:%d)",
DECL_SOURCE_FILE (decl), DECL_SOURCE_LINE (decl));
else
warning ("type is deprecated");
}
}
/* Print a fatal I/O error message. Argument are like printf.
Also include a system error message based on `errno'. */
void
fatal_io_error VPARAMS ((const char *msgid, ...))
{
text_info text;
VA_OPEN (ap, msgid);
VA_FIXEDARG (ap, const char *, msgid);
text.format_spec = _(msgid);
text.args_ptr = &ap;
output_printf (&global_dc->buffer, "%s: %s: ", progname, xstrerror (errno));
output_format (&global_dc->buffer, &text);
output_flush (&global_dc->buffer);
VA_CLOSE (ap);
exit (FATAL_EXIT_CODE);
}
/* Inform the user that an error occurred while trying to report some
other error. This indicates catastrophic internal inconsistencies,
so give up now. But do try to flush out the previous error.
This mustn't use internal_error, that will cause infinite recursion. */
static void
error_recursion (context)
diagnostic_context *context;
{
if (context->lock < 3)
output_flush (&context->buffer);
fnotice (stderr,
"Internal compiler error: Error reporting routines re-entered.\n");
fnotice (stderr,
"Please submit a full bug report,\n\
with preprocessed source if appropriate.\n\
See %s for instructions.\n", bug_report_url);
exit (FATAL_EXIT_CODE);
}
/* Report an internal compiler error in a friendly manner. This is
the function that gets called upon use of abort() in the source
code generally, thanks to a special macro. */
void
fancy_abort (file, line, function)
const char *file;
int line;
const char *function;
{
internal_error ("in %s, at %s:%d", function, trim_filename (file), line);
}
/* Really call the system 'abort'. This has to go right at the end of
this file, so that there are no functions after it that call abort
and get the system abort instead of our macro. */
#undef abort
static void
real_abort ()
{
abort ();
}