gcc/gcc/diagnostic.c

711 lines
22 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
system.h (USE_MAPPED_LOCATION): Poison. gcc * system.h (USE_MAPPED_LOCATION): Poison. * Makefile.in (GTFILES): Put CPP_ID_DATA_H first. * tree-cfg.c (make_cond_expr_edges): Remove old location code. (make_goto_expr_edges): Likewise. (remove_bb): Likewise. (execute_warn_function_return): Likewise. * basic-block.h (struct edge_def) <goto_locus>: Change type to location_t. * c-common.c (fname_decl): Remove old location code. * tree-vect-transform.c (vect_finish_stmt_generation): Remove old location code. * rtl.h (ASM_OPERANDS_SOURCE_LOCATION): Remove old-location variant. (ASM_INPUT_SOURCE_LOCATION): Likewise. (gen_rtx_ASM_INPUT): Likewise. (gen_rtx_ASM_INPUT_loc): Likewise. (get_rtx_asm_OPERANDS): Remove. * cfglayout.c (insn_locators_alloc): Remove old location code. (set_curr_insn_source_location): Likewise. (curr_insn_locator): Likewise. * print-tree.c (print_node): Remove old location code. * tree-mudflap.c (mf_varname_tree): Remove old location code. (mf_file_function_line_tree): Remove test of USE_MAPPED_LOCATION. * cfgexpand.c (expand_gimple_cond_expr): Don't use location_from_locus. (construct_exit_block): Remove old location code. * emit-rtl.c (force_next_line_note): Remove old location code. * profile.c (branch_prob): Remove old location code. * tree-vectorizer.h (LOC, UNKNOWN_LOC, EXPR_LOC, LOC_FILE, LOC_LINE): Remove old-location variants. * langhooks.c (lhd_print_error_function): Remove old location code. * configure, config.in: Rebuilt. * configure.ac (--enable-mapped-location): Remove. * c-decl.c (c_init_decl_processing): Remove old location code. (finish_function): Likewise. * recog.c (decode_asm_operands): Remove old location code. * c-pch.c (c_common_read_pch): Remove old location code. * rtl.def (ASM_INPUT, ASM_OPERANDS): Remove old location variants. * gimple-low.c (lower_function_body): Remove old location code. * toplev.c (unknown_location): Remove. (push_srcloc): Remove old-location variant. (process_options): Remove old location code. (lang_dependent_init): Likewise. * input.h (UNKNOWN_LOCATION): Move definition. (location_t): Undeprecate. (source_locus): Remove. (location_from_locus): Remove. (struct location_s): Remove. Remove all old-location code. (input_line, input_filename): Remove. * final.c (final_scan_insn): Remove old location code. * diagnostic.c (diagnostic_build_prefix): Remove USE_MAPPED_LOCATION test. * tree.h (gimple_stmt) <locus>: Now a location_t. (tree_exp) <locus>: Likewise. (DECL_IS_BUILTIN): Remove old-location variant. (annotate_with_file_line, annotate_with_locus): Likewise. (expr_locus, set_expr_locus): Update. * tree.c (build1_stat): Remove old location code. (last_annotated_node): Remove. (annotate_with_file_line): Remove old-location variant. (annotate_with_locus): Likewise. (expr_location): Remove old location code. (set_expr_location): Likewise. (expr_has_location): Likewise. (expr_locus): Likewise. (set_expr_locus): Likewise. (expr_filename): Don't use location_from_locus. (expr_lineno): Likewise. * rtl-error.c (location_for_asm): Remove old location code. * c-lex.c (cb_line_change): Remove old location code. (fe_file_change): Likewise. (cb_def_pragma): Likewise. (c_lex_with_flags): Likewise. * gengtype.c (do_typedef): Don't special-case location types. (define_location_structures): Remove. (main): Don't call define_location_structures. * tree-pretty-print.c (dump_implicit_edges): Remove old location code. gcc/ada * misc.c (internal_error_function): Remove test of USE_MAPPED_LOCATION. * trans.c (gigi): Remove test of USE_MAPPED_LOCATION. (Sloc_to_locus): Remove old location code. gcc/cp * parser.c (eof_token): Remove old location code. (check_empty_body): Remove test of USE_MAPPED_LOCATION. * decl2.c (generate_ctor_or_dtor_function): Remove old location code. (cp_write_global_declarations): Likewise. * lex.c (cxx_init): Remove old location code. (handle_pragma_implementation): Remove test of USE_MAPPED_LOCATION. * pt.c (tsubst): Remove old location code. * error.c (cp_print_error_function): Remove test of USE_MAPPED_LOCATION. * decl.c (pop_label): Remove old location code. (finish_function): Likewise. gcc/fortran * trans-io.c (set_error_locus): Remove old location code. * trans-decl.c (gfc_set_decl_location): Remove old location code. * f95-lang.c (gfc_init): Remove test of USE_MAPPED_LOCATION. * scanner.c (gfc_gobble_whitespace): Remove old location code. (get_file): Likewise. (preprocessor_line): Likewise. (load_file): Likewise. (gfc_new_file): Likewise. * trans.c (gfc_trans_runtime_check): Remove old location code. (gfc_get_backend_locus): Likewise. (gfc_set_backend_locus): Likewise. * data.c (gfc_assign_data_value): Remove old location code. * error.c (show_locus): Remove old location code. * gfortran.h (gfc_linebuf): Remove old location code. (gfc_linebuf_linenum): Remove old-location variant. gcc/java * lang.c (java_post_options): Remove conditional. * expr.c (expand_byte_code): Remove old location code. * jcf-parse.c (set_source_filename): Remove old location code. (give_name_to_class): Likewise. (jcf_parse): Likewise. (duplicate_class_warning): Likewise. (parse_class_file): Likewise. (java_parse_file): Likewise. * decl.c (finish_method): Remove old location code. * class.c (push_class): Remove old location code. gcc/objc * objc-act.c (objc_init): Remove old location code. gcc/treelang * tree1.c (treelang_init): Remove old location code. (treelang_parse_file): Likewise. * lex.l (LINEMAP_POSITION_FOR_COLUMN): Remove. (update_lineno_charno): Remove old location code. From-SVN: r132679
2008-02-26 17:05:24 +01:00
Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
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 3, or (at your option) any later
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
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
along with GCC; see the file COPYING3. If not see
<http://www.gnu.org/licenses/>. */
/* 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 "version.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"
#include "opts.h"
re PR other/36901 (pedwarn() + -pedantic-errors + -w (inhibit_warnings) should not emit errors) 2008-08-09 Manuel Lopez-Ibanez <manu@gcc.gnu.org> PR 36901 * diagnostic.def (DK_PEDWARN, DK_PERMERROR): New. * diagnostic.c (pedantic_warning_kind, permissive_error_kind): Moved from diagnostic.h (diagnostic_report_diagnostic): Return bool. Handle DK_PEDWARN and DK_PERMERROR. (emit_diagnostic): New. (warning0, pedwarn0): Delete. (warning, warning_at, pedwarn, permerror): Return bool. * diagnostic.h (pedantic_warning_kind, permissive_error_kind): Moved to diagnostic.c. (struct diagnostic_context): Use correct type for classify_diagnostic. (diagnostic_report_diagnostic): Update declaration. (emit_diagnostic): Declare. * errors.c (warning): Return bool. * errors.h (warning): Update declaration. * toplev.h (warning0, pedwarn0): Delete. (warning, warning_at, pedwarn, permerror): Return bool. * c-errors.c (pedwarn_c99, pedwarn_c90): Use DK_PEDWARN. * c-decl.c (locate_old_decl): Delete 'diag' argument. Always use inform. Update all calls. (diagnose_mismatched_decls): Check return value of warning/pedwarn before giving informative note. (implicit_decl_warning): Likewise. * c-typeck.c (build_function_call): Likewise. * tree-sssa.c (warn_uninit): Likewise. * builtins.c (gimplify_va_arg_expr): Likewise. fortran/ * f95-lang.c (gfc_mark_addressable): Use "pedwarn (0," instead of 'pedwarn0'. cp/ * cp-tree.h (struct diagnostic_context, struct diagnostic_info): Delete forward declarations. Check that toplev.h has not been included before this file. Include toplev.h and diagnostic.h. * error.c (cp_cpp_error): Use DK_PEDWARN. (cxx_incomplete_type_diagnostic): Update declaration. (cxx_incomplete_type_error): Use DK_ERROR. * typeck2.c (cxx_incomplete_type_diagnostic): Take a diagnostic_t as argument. Use emit_diagnostic. (cxx_incomplete_type_error): Use DK_ERROR. (add_exception_specifier): Use diagnostic_t instead of custom codes. * typeck.c (complete_type_or_else): Update call to cxx_incomplete_type_diagnostic. * init.c (build_delete): Likewise. * call.c (diagnostic_fn_t): Remove unused typedef. (build_temp): Pass a pointer to diagnostic_t. (convert_like_real): Use emit_diagnostic. (joust): Check return value of warning before giving informative note. * friend.c (do_friend): Check return value of warning before giving informative note. * parser.c (cp_parser_template_id): Likewise. testsuite/ * gcc.dg/pr36901-1.c: New. * gcc.dg/pr36901-3.c: New. * gcc.dg/pr36901-2.c: New. * gcc.dg/pr36901-4.c: New. * gcc.dg/pr36901-system.h: New. * gcc.dg/pr36901.h: New. * gcc.target/powerpc/altivec-macros.c: Update. * gcc.target/i386/regparm.c: Update. * gcc.dg/funcdef-var-1.c: Update. * gcc.dg/parm-mismatch-1.c: Update. * gcc.dg/attr-noinline.c: Update. * gcc.dg/wtr-static-1.c: Update. * gcc.dg/redecl-11.c: Update. * gcc.dg/pr27953.c: Update. * gcc.dg/proto-1.c: Update. * gcc.dg/decl-3.c: Update. * gcc.dg/redecl-13.c: Update. * gcc.dg/pr15360-1.c: Update. * gcc.dg/redecl-15.c: Update. * gcc.dg/enum-compat-1.c: Update. * gcc.dg/dll-3.c: Update. * gcc.dg/array-5.c: Update. * gcc.dg/Wredundant-decls-2.c: Update. * gcc.dg/inline4.c: Update. * gcc.dg/redecl-2.c: Update. * gcc.dg/inline-14.c: Update. * gcc.dg/tls/diag-3.c: Update. * gcc.dg/funcdef-var-2.c: Update. * gcc.dg/20041213-1.c: Update. * gcc.dg/old-style-then-proto-1.c: Update. * gcc.dg/decl-2.c: Update. * gcc.dg/redecl-12.c: Update. * gcc.dg/decl-4.c: Update. * gcc.dg/Wshadow-1.c: Update. * gcc.dg/transparent-union-2.c: Update. * gcc.dg/visibility-7.c: Update. * gcc.dg/dll-2.c: Update. * gcc.dg/redecl-16.c: Update. * gcc.dg/inline1.c: Update. * gcc.dg/decl-8.c: Update. * gcc.dg/nested-redef-1.c: Update. * gcc.dg/inline3.c: Update. * gcc.dg/redecl-1.c: Update. * gcc.dg/inline5.c: Update. * gcc.dg/pr35899.c: Update. * gcc.dg/noncompile/label-lineno-1.c: Update. * gcc.dg/noncompile/label-1.c: Update. * gcc.dg/noncompile/20020220-1.c: Update. * gcc.dg/noncompile/redecl-1.c: Update. * gcc.dg/redecl-5.c: Update. * gcc.dg/qual-return-3.c: Update. * gcc.dg/label-decl-4.c: Update. From-SVN: r138893
2008-08-09 01:57:19 +02:00
#define pedantic_warning_kind() (flag_pedantic_errors ? DK_ERROR : DK_WARNING)
#define permissive_error_kind() (flag_permissive ? DK_WARNING : DK_ERROR)
/* Prototypes. */
Remove pedwarn_with_decl, warning_with_decl and error_with_decl from GCC. Remove pedwarn_with_decl, warning_with_decl and error_with_decl from GCC. * calls.c (try_to_integrate): Don't use xxx_with_decl. (expand_call): Likewise. * dwarfout.c (output_reg_number): Likewise. * expr.c (expand_expr): Likewise. * function.c (assign_temp): Likewise. (uninitialized_vars_warning): Likewise. (setjmp_args_warning): Likewise. (expand_function_end): Likewise. * stmt.c (fixup_gotos): Likewise. (warn_about_unused_variables): Likewise. (expand_end_bindings): Likewise. * stor-layout.c (layout_decl): Likewise. (place_field): Likewise. * toplev.c (check_global_declarations): Likewise. (rest_of_handle_inlining): Likewise. (default_tree_printer): New function. (general_init): Initialize diagnostic machinery before routing signals to the ICE machinery. Set default tree printer. * toplev.h (pedwarn_with_decl): Remove declaration. (warning_with_decl): Likewise. (error_with_decl): Likewise. (pedwarn): Remove attribute for the time being. * tree-inline.c (expand_call_inline): Don't use xxx_with_decl. * varasm.c (named_section): Likewise. (make_decl_rtl): Likewise. (assemble_variable): Likewise. (merge_weak): Likewise. (declare_weak): Likewise. * diagnostic.h: Move non-diagnostic stuff into pretty-print.h. * diagnostic.c: Move non-diagnostic stuff into pretty-print.c. (format_with_decl): Remove. (diagnostic_for_decl): Likewise. (pedwarn_with_decl): Likewise. (warning_with_decl): Likewise. (error_with_decl): Likewise. (diagnostic_initialize): Adjust. (diagnostic_count_diagnostic): Likewise. (announce_function): Likewise. (lhd_print_error_function): Likewise. (diagnostic_report_current_module): Likewise. (default_diagnostic_starter): Likewise. (diagnostic_report_diagnostic): Likewise. (default_diagnostic_finalizer): Likewise. (verbatim): Likewise. (error): Likewise. (warning): Likewise. * opts.c (common_handle_option): Likewise. * pretty-print.c: New file. * c-pretty-print.h (pp_base): Override. * c-pretty-print.c: Adjust use of macros throughout. (pp_buffer): New macro. (pp_newline): Likewise. * c-objc-common.c (c_tree_printer): Adjust prototype. Tidy. * Makefile.in (DIAGNOSTIC_H): New variable. (c-errors.o): Use it. (c-objc-common.o): Likewise. (c-common.o): Likewise. (c-opts.o): Likewise. (c-format.o): Likewise. (diagnostic.o): Likewise. (opts.o): Likewise. (toplev.o): Likewise. (rtl-error.o): Likewise. (dwarf2out.o): Likewise. (jump.o): Likewise. (pretty-print.o): New rule. cp/ * Make-lang.in (cp/error.o): Depend on DIAGNOSTIC_H. * error.c: Use the new pretty-printer fraamework. From-SVN: r69773
2003-07-25 11:52:32 +02:00
static char *build_message_string (const char *, ...) ATTRIBUTE_PRINTF_1;
static void default_diagnostic_starter (diagnostic_context *,
diagnostic_info *);
static void default_diagnostic_finalizer (diagnostic_context *,
diagnostic_info *);
static void error_recursion (diagnostic_context *) ATTRIBUTE_NORETURN;
static void diagnostic_action_after_output (diagnostic_context *,
diagnostic_info *);
static void real_abort (void) ATTRIBUTE_NORETURN;
/* A diagnostic_context surrogate for stderr. */
static diagnostic_context global_diagnostic_context;
diagnostic_context *global_dc = &global_diagnostic_context;
/* Return a malloc'd string containing MSG formatted a la printf. The
caller is responsible for freeing the memory. */
static char *
builtins.c (validate_arglist): Eliminate libiberty VA_ macros, always use stdarg. gcc: * builtins.c (validate_arglist): Eliminate libiberty VA_ macros, always use stdarg. * c-errors.c (pedwarn_c99): Likewise. * c-format.c (status_warning): Likewise. * c-semantics.c (build_stmt): Likewise. * calls.c (emit_library_call, emit_library_call_value): Likewise. * collect2.c (notice, fatal_perror, fatal, error): Likewise. * cpperror.c (cpp_error, cpp_error_with_line): Likewise. * diagnostic.c (build_message_string, output_printf, output_verbatim, verbatim, inform, warning, pedwarn, error, sorry, fatal_error, internal_error, warning_with_decl, pedwarn_with_decl, error_with_decl, fnotice): Likewise. * dwarf2asm.c (dw2_asm_output_data, dw2_asm_output_delta, dw2_asm_output_offset, dw2_asm_output_pcrel, dw2_asm_output_addr, dw2_asm_output_addr_rtx, dw2_asm_output_nstring, dw2_asm_output_data_uleb128, dw2_asm_output_data_sleb128, dw2_asm_output_delta_uleb128, dw2_asm_output_delta_sleb128, dw2_asm_output_encoded_addr_rtx): Likewise. * emit-rtl.c (gen_rtx, gen_rtvec): Likewise. * errors.c (warning, error, fatal, internal_error): Likewise. * final.c (output_operand_lossage, asm_fprintf): Likewise. * fix-header.c (fatal): Likewise. * gcc.c (fatal, error, notice): Likewise. * gcov.c (fnotice): Likewise. * genattrtab.c (attr_rtx, attr_printf): Likewise. * gengtype.c (error_at_line, xasprintf, oprintf): Likewise. * gensupport.c (message_with_line): Likewise. * mips-tfile.c (fatal, error): Likewise. * protoize.c (notice): Likewise. * ra-debug.c (ra_debug_msg): Likewise. * read-rtl.c (fatal_with_file_and_line): Likewise. * rtl-error.c (error_for_asm, warning_for_asm): Likewise. * tree.c (build, build_nt, build_function_type_list): Likewise. cp: * error.c (cp_error_at, cp_warning_at, cp_pedwarn_at): Eliminate libiberty VA_ macros, always use stdarg. * rtti.c (create_pseudo_type_info): Likewise. * tree.c (build_min_nt, build_min): Likewise. From-SVN: r66919
2003-05-18 00:21:35 +02:00
build_message_string (const char *msg, ...)
{
char *str;
builtins.c (validate_arglist): Eliminate libiberty VA_ macros, always use stdarg. gcc: * builtins.c (validate_arglist): Eliminate libiberty VA_ macros, always use stdarg. * c-errors.c (pedwarn_c99): Likewise. * c-format.c (status_warning): Likewise. * c-semantics.c (build_stmt): Likewise. * calls.c (emit_library_call, emit_library_call_value): Likewise. * collect2.c (notice, fatal_perror, fatal, error): Likewise. * cpperror.c (cpp_error, cpp_error_with_line): Likewise. * diagnostic.c (build_message_string, output_printf, output_verbatim, verbatim, inform, warning, pedwarn, error, sorry, fatal_error, internal_error, warning_with_decl, pedwarn_with_decl, error_with_decl, fnotice): Likewise. * dwarf2asm.c (dw2_asm_output_data, dw2_asm_output_delta, dw2_asm_output_offset, dw2_asm_output_pcrel, dw2_asm_output_addr, dw2_asm_output_addr_rtx, dw2_asm_output_nstring, dw2_asm_output_data_uleb128, dw2_asm_output_data_sleb128, dw2_asm_output_delta_uleb128, dw2_asm_output_delta_sleb128, dw2_asm_output_encoded_addr_rtx): Likewise. * emit-rtl.c (gen_rtx, gen_rtvec): Likewise. * errors.c (warning, error, fatal, internal_error): Likewise. * final.c (output_operand_lossage, asm_fprintf): Likewise. * fix-header.c (fatal): Likewise. * gcc.c (fatal, error, notice): Likewise. * gcov.c (fnotice): Likewise. * genattrtab.c (attr_rtx, attr_printf): Likewise. * gengtype.c (error_at_line, xasprintf, oprintf): Likewise. * gensupport.c (message_with_line): Likewise. * mips-tfile.c (fatal, error): Likewise. * protoize.c (notice): Likewise. * ra-debug.c (ra_debug_msg): Likewise. * read-rtl.c (fatal_with_file_and_line): Likewise. * rtl-error.c (error_for_asm, warning_for_asm): Likewise. * tree.c (build, build_nt, build_function_type_list): Likewise. cp: * error.c (cp_error_at, cp_warning_at, cp_pedwarn_at): Eliminate libiberty VA_ macros, always use stdarg. * rtti.c (create_pseudo_type_info): Likewise. * tree.c (build_min_nt, build_min): Likewise. From-SVN: r66919
2003-05-18 00:21:35 +02:00
va_list ap;
builtins.c (validate_arglist): Eliminate libiberty VA_ macros, always use stdarg. gcc: * builtins.c (validate_arglist): Eliminate libiberty VA_ macros, always use stdarg. * c-errors.c (pedwarn_c99): Likewise. * c-format.c (status_warning): Likewise. * c-semantics.c (build_stmt): Likewise. * calls.c (emit_library_call, emit_library_call_value): Likewise. * collect2.c (notice, fatal_perror, fatal, error): Likewise. * cpperror.c (cpp_error, cpp_error_with_line): Likewise. * diagnostic.c (build_message_string, output_printf, output_verbatim, verbatim, inform, warning, pedwarn, error, sorry, fatal_error, internal_error, warning_with_decl, pedwarn_with_decl, error_with_decl, fnotice): Likewise. * dwarf2asm.c (dw2_asm_output_data, dw2_asm_output_delta, dw2_asm_output_offset, dw2_asm_output_pcrel, dw2_asm_output_addr, dw2_asm_output_addr_rtx, dw2_asm_output_nstring, dw2_asm_output_data_uleb128, dw2_asm_output_data_sleb128, dw2_asm_output_delta_uleb128, dw2_asm_output_delta_sleb128, dw2_asm_output_encoded_addr_rtx): Likewise. * emit-rtl.c (gen_rtx, gen_rtvec): Likewise. * errors.c (warning, error, fatal, internal_error): Likewise. * final.c (output_operand_lossage, asm_fprintf): Likewise. * fix-header.c (fatal): Likewise. * gcc.c (fatal, error, notice): Likewise. * gcov.c (fnotice): Likewise. * genattrtab.c (attr_rtx, attr_printf): Likewise. * gengtype.c (error_at_line, xasprintf, oprintf): Likewise. * gensupport.c (message_with_line): Likewise. * mips-tfile.c (fatal, error): Likewise. * protoize.c (notice): Likewise. * ra-debug.c (ra_debug_msg): Likewise. * read-rtl.c (fatal_with_file_and_line): Likewise. * rtl-error.c (error_for_asm, warning_for_asm): Likewise. * tree.c (build, build_nt, build_function_type_list): Likewise. cp: * error.c (cp_error_at, cp_warning_at, cp_pedwarn_at): Eliminate libiberty VA_ macros, always use stdarg. * rtti.c (create_pseudo_type_info): Likewise. * tree.c (build_min_nt, build_min): Likewise. From-SVN: r66919
2003-05-18 00:21:35 +02:00
va_start (ap, msg);
vasprintf (&str, msg, ap);
builtins.c (validate_arglist): Eliminate libiberty VA_ macros, always use stdarg. gcc: * builtins.c (validate_arglist): Eliminate libiberty VA_ macros, always use stdarg. * c-errors.c (pedwarn_c99): Likewise. * c-format.c (status_warning): Likewise. * c-semantics.c (build_stmt): Likewise. * calls.c (emit_library_call, emit_library_call_value): Likewise. * collect2.c (notice, fatal_perror, fatal, error): Likewise. * cpperror.c (cpp_error, cpp_error_with_line): Likewise. * diagnostic.c (build_message_string, output_printf, output_verbatim, verbatim, inform, warning, pedwarn, error, sorry, fatal_error, internal_error, warning_with_decl, pedwarn_with_decl, error_with_decl, fnotice): Likewise. * dwarf2asm.c (dw2_asm_output_data, dw2_asm_output_delta, dw2_asm_output_offset, dw2_asm_output_pcrel, dw2_asm_output_addr, dw2_asm_output_addr_rtx, dw2_asm_output_nstring, dw2_asm_output_data_uleb128, dw2_asm_output_data_sleb128, dw2_asm_output_delta_uleb128, dw2_asm_output_delta_sleb128, dw2_asm_output_encoded_addr_rtx): Likewise. * emit-rtl.c (gen_rtx, gen_rtvec): Likewise. * errors.c (warning, error, fatal, internal_error): Likewise. * final.c (output_operand_lossage, asm_fprintf): Likewise. * fix-header.c (fatal): Likewise. * gcc.c (fatal, error, notice): Likewise. * gcov.c (fnotice): Likewise. * genattrtab.c (attr_rtx, attr_printf): Likewise. * gengtype.c (error_at_line, xasprintf, oprintf): Likewise. * gensupport.c (message_with_line): Likewise. * mips-tfile.c (fatal, error): Likewise. * protoize.c (notice): Likewise. * ra-debug.c (ra_debug_msg): Likewise. * read-rtl.c (fatal_with_file_and_line): Likewise. * rtl-error.c (error_for_asm, warning_for_asm): Likewise. * tree.c (build, build_nt, build_function_type_list): Likewise. cp: * error.c (cp_error_at, cp_warning_at, cp_pedwarn_at): Eliminate libiberty VA_ macros, always use stdarg. * rtti.c (create_pseudo_type_info): Likewise. * tree.c (build_min_nt, build_min): Likewise. From-SVN: r66919
2003-05-18 00:21:35 +02:00
va_end (ap);
return str;
}
/* Same as diagnostic_build_prefix, but only the source FILE is given. */
char *
file_name_as_prefix (const char *f)
{
return build_message_string ("%s: ", f);
}
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 (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
{
Remove pedwarn_with_decl, warning_with_decl and error_with_decl from GCC. Remove pedwarn_with_decl, warning_with_decl and error_with_decl from GCC. * calls.c (try_to_integrate): Don't use xxx_with_decl. (expand_call): Likewise. * dwarfout.c (output_reg_number): Likewise. * expr.c (expand_expr): Likewise. * function.c (assign_temp): Likewise. (uninitialized_vars_warning): Likewise. (setjmp_args_warning): Likewise. (expand_function_end): Likewise. * stmt.c (fixup_gotos): Likewise. (warn_about_unused_variables): Likewise. (expand_end_bindings): Likewise. * stor-layout.c (layout_decl): Likewise. (place_field): Likewise. * toplev.c (check_global_declarations): Likewise. (rest_of_handle_inlining): Likewise. (default_tree_printer): New function. (general_init): Initialize diagnostic machinery before routing signals to the ICE machinery. Set default tree printer. * toplev.h (pedwarn_with_decl): Remove declaration. (warning_with_decl): Likewise. (error_with_decl): Likewise. (pedwarn): Remove attribute for the time being. * tree-inline.c (expand_call_inline): Don't use xxx_with_decl. * varasm.c (named_section): Likewise. (make_decl_rtl): Likewise. (assemble_variable): Likewise. (merge_weak): Likewise. (declare_weak): Likewise. * diagnostic.h: Move non-diagnostic stuff into pretty-print.h. * diagnostic.c: Move non-diagnostic stuff into pretty-print.c. (format_with_decl): Remove. (diagnostic_for_decl): Likewise. (pedwarn_with_decl): Likewise. (warning_with_decl): Likewise. (error_with_decl): Likewise. (diagnostic_initialize): Adjust. (diagnostic_count_diagnostic): Likewise. (announce_function): Likewise. (lhd_print_error_function): Likewise. (diagnostic_report_current_module): Likewise. (default_diagnostic_starter): Likewise. (diagnostic_report_diagnostic): Likewise. (default_diagnostic_finalizer): Likewise. (verbatim): Likewise. (error): Likewise. (warning): Likewise. * opts.c (common_handle_option): Likewise. * pretty-print.c: New file. * c-pretty-print.h (pp_base): Override. * c-pretty-print.c: Adjust use of macros throughout. (pp_buffer): New macro. (pp_newline): Likewise. * c-objc-common.c (c_tree_printer): Adjust prototype. Tidy. * Makefile.in (DIAGNOSTIC_H): New variable. (c-errors.o): Use it. (c-objc-common.o): Likewise. (c-common.o): Likewise. (c-opts.o): Likewise. (c-format.o): Likewise. (diagnostic.o): Likewise. (opts.o): Likewise. (toplev.o): Likewise. (rtl-error.o): Likewise. (dwarf2out.o): Likewise. (jump.o): Likewise. (pretty-print.o): New rule. cp/ * Make-lang.in (cp/error.o): Depend on DIAGNOSTIC_H. * error.c: Use the new pretty-printer fraamework. From-SVN: r69773
2003-07-25 11:52:32 +02:00
/* Allocate a basic pretty-printer. Clients will replace this a
much more elaborated pretty-printer if they wish. */
tree-vrp.c: Use XNEW/XCNEW allocation wrappers. 2006-01-31 Marcin Dalecki <martin@dalecki.de> * tree-vrp.c: Use XNEW/XCNEW allocation wrappers. * regrename.c: Ditto. * tree-ssa-loop-im.c: Ditto. * tree-dump.c: Ditto. * tree-complex.c: Ditto. * genrecog.c: Ditto. * tree-ssa-threadupdate.c: Ditto. * tracer.c: Ditto. * java/class.c: Ditto. * java/jcf-parse.c: Ditto. * java/resource.c: Ditto. * java/except.c: Ditto. * java/jvspec.c: Ditto. * java/jcf-write.c: Ditto. * java/jcf-path.c: Ditto. * java/gjavah.c: Ditto. * java/zextract.c: Ditto. * java/jcf-io.c: Ditto. * java/jcf.h: Ditto. * java/buffer.c: Ditto. * java/lang.c: Ditto. * java/parse-scan.y: Ditto. * java/lex.c: Ditto. * java/lex.h: Ditto. * cfgloopmanip.c: Ditto. * postreload-gcse.c: Ditto. * tree-ssa-loop-manip.c: Ditto. * postreload.c: Ditto. * tree-ssa-loop-ch.c: Ditto. * loop.c: Ditto. * ipa-cp.c: Ditto. * cppspec.c: Ditto. * diagnostic.c: Ditto. * final.c: Ditto. * genoutput.c: Ditto. * gcc.c: Ditto. * cfghooks.c: Ditto. * cfgloopanal.c: Ditto. * objc/objc-act.c: Ditto. * gcov.c: Ditto. * genextract.c: Ditto. * genautomata.c: Ditto. * pretty-print.c: Ditto. * genemit.c: Ditto. * cgraphunit.c: Ditto. * flow.c: Ditto. * df-scan.c: Ditto. * haifa-sched.c: Ditto. * dominance.c: Ditto. * dbxout.c: Ditto. * tree-ssa-loop-ivopts.c: Ditto. * df-core.c: Ditto. * mode-switching.c: Ditto. * modulo-sched.c: Ditto. * graph.c: Ditto. * ipa-pure-const.c: Ditto. * cse.c: Ditto. * fix-header.c: Ditto. * web.c: Ditto. * tree-stdarg.c: Ditto. * ipa-utils.c: Ditto. * loop-init.c: Ditto. * ipa-inline.c: Ditto. * cfganal.c: Ditto. * global.c: Ditto. * alloc-pool.c: Ditto. * dwarf2out.c: Ditto. * opts.c: Ditto. * genattrtab.c: Ditto. * tree-ssa-loop-ivcanon.c: Ditto. * predict.c: Ditto. * timevar.c: Ditto. * lcm.c: Ditto. * fortran/gfortranspec.c: Ditto. * regmove.c: Ditto. * local-alloc.c: Ditto. * langhooks.c: Ditto. * function.c: Ditto. * tree-vectorizer.c: Ditto. * gcse.c: Ditto. * ipa-type-escape.c: Ditto. * alias.c: Ditto. * tree-if-conv.c: Ditto. * profile.c: Ditto. * ipa.c: Ditto. * tree-data-ref.c: Ditto. * loop-unroll.c: Ditto. * treelang/treetree.c: Ditto. * calls.c: Ditto. * bt-load.c: Ditto. * ggc-common.c: Ditto. * except.c: Ditto. * coverage.c: Ditto. * cselib.c: Ditto. * tree-cfgcleanup.c: Ditto. * tree-ssa-pre.c: Ditto. * cfgcleanup.c: Ditto. * loop-invariant.c: Ditto. * loop-iv.c: Ditto. * ipa-prop.c: Ditto. * print-tree.c: Ditto. * conflict.c: Ditto. * ggc-page.c: Ditto. * sched-deps.c: Ditto. * regclass.c: Ditto. * tree-object-size.c: Ditto. * combine.c: Ditto. * bb-reorder.c: Ditto. * resource.c: Ditto. * var-tracking.c: Ditto. * cfgloop.c: Ditto. * df-problems.c: Ditto. * reg-stack.c: Ditto. * tlink.c: Ditto. * gccspec.c: Ditto. * sched-rgn.c: Ditto. * tree-ssa-structalias.c: Ditto. * tree-ssa-reassoc.c: Ditto. * config/darwin-c.c: Ditto. * config/darwin.c: Ditto. * config/arm/arm.c: Ditto. * cfgrtl.c: Ditto. * collect2.c: Ditto. * reload1.c: Ditto. From-SVN: r110446
2006-01-31 20:56:55 +01:00
context->printer = XNEW (pretty_printer);
Remove pedwarn_with_decl, warning_with_decl and error_with_decl from GCC. Remove pedwarn_with_decl, warning_with_decl and error_with_decl from GCC. * calls.c (try_to_integrate): Don't use xxx_with_decl. (expand_call): Likewise. * dwarfout.c (output_reg_number): Likewise. * expr.c (expand_expr): Likewise. * function.c (assign_temp): Likewise. (uninitialized_vars_warning): Likewise. (setjmp_args_warning): Likewise. (expand_function_end): Likewise. * stmt.c (fixup_gotos): Likewise. (warn_about_unused_variables): Likewise. (expand_end_bindings): Likewise. * stor-layout.c (layout_decl): Likewise. (place_field): Likewise. * toplev.c (check_global_declarations): Likewise. (rest_of_handle_inlining): Likewise. (default_tree_printer): New function. (general_init): Initialize diagnostic machinery before routing signals to the ICE machinery. Set default tree printer. * toplev.h (pedwarn_with_decl): Remove declaration. (warning_with_decl): Likewise. (error_with_decl): Likewise. (pedwarn): Remove attribute for the time being. * tree-inline.c (expand_call_inline): Don't use xxx_with_decl. * varasm.c (named_section): Likewise. (make_decl_rtl): Likewise. (assemble_variable): Likewise. (merge_weak): Likewise. (declare_weak): Likewise. * diagnostic.h: Move non-diagnostic stuff into pretty-print.h. * diagnostic.c: Move non-diagnostic stuff into pretty-print.c. (format_with_decl): Remove. (diagnostic_for_decl): Likewise. (pedwarn_with_decl): Likewise. (warning_with_decl): Likewise. (error_with_decl): Likewise. (diagnostic_initialize): Adjust. (diagnostic_count_diagnostic): Likewise. (announce_function): Likewise. (lhd_print_error_function): Likewise. (diagnostic_report_current_module): Likewise. (default_diagnostic_starter): Likewise. (diagnostic_report_diagnostic): Likewise. (default_diagnostic_finalizer): Likewise. (verbatim): Likewise. (error): Likewise. (warning): Likewise. * opts.c (common_handle_option): Likewise. * pretty-print.c: New file. * c-pretty-print.h (pp_base): Override. * c-pretty-print.c: Adjust use of macros throughout. (pp_buffer): New macro. (pp_newline): Likewise. * c-objc-common.c (c_tree_printer): Adjust prototype. Tidy. * Makefile.in (DIAGNOSTIC_H): New variable. (c-errors.o): Use it. (c-objc-common.o): Likewise. (c-common.o): Likewise. (c-opts.o): Likewise. (c-format.o): Likewise. (diagnostic.o): Likewise. (opts.o): Likewise. (toplev.o): Likewise. (rtl-error.o): Likewise. (dwarf2out.o): Likewise. (jump.o): Likewise. (pretty-print.o): New rule. cp/ * Make-lang.in (cp/error.o): Depend on DIAGNOSTIC_H. * error.c: Use the new pretty-printer fraamework. From-SVN: r69773
2003-07-25 11:52:32 +02:00
pp_construct (context->printer, NULL, 0);
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. */
Remove pedwarn_with_decl, warning_with_decl and error_with_decl from GCC. Remove pedwarn_with_decl, warning_with_decl and error_with_decl from GCC. * calls.c (try_to_integrate): Don't use xxx_with_decl. (expand_call): Likewise. * dwarfout.c (output_reg_number): Likewise. * expr.c (expand_expr): Likewise. * function.c (assign_temp): Likewise. (uninitialized_vars_warning): Likewise. (setjmp_args_warning): Likewise. (expand_function_end): Likewise. * stmt.c (fixup_gotos): Likewise. (warn_about_unused_variables): Likewise. (expand_end_bindings): Likewise. * stor-layout.c (layout_decl): Likewise. (place_field): Likewise. * toplev.c (check_global_declarations): Likewise. (rest_of_handle_inlining): Likewise. (default_tree_printer): New function. (general_init): Initialize diagnostic machinery before routing signals to the ICE machinery. Set default tree printer. * toplev.h (pedwarn_with_decl): Remove declaration. (warning_with_decl): Likewise. (error_with_decl): Likewise. (pedwarn): Remove attribute for the time being. * tree-inline.c (expand_call_inline): Don't use xxx_with_decl. * varasm.c (named_section): Likewise. (make_decl_rtl): Likewise. (assemble_variable): Likewise. (merge_weak): Likewise. (declare_weak): Likewise. * diagnostic.h: Move non-diagnostic stuff into pretty-print.h. * diagnostic.c: Move non-diagnostic stuff into pretty-print.c. (format_with_decl): Remove. (diagnostic_for_decl): Likewise. (pedwarn_with_decl): Likewise. (warning_with_decl): Likewise. (error_with_decl): Likewise. (diagnostic_initialize): Adjust. (diagnostic_count_diagnostic): Likewise. (announce_function): Likewise. (lhd_print_error_function): Likewise. (diagnostic_report_current_module): Likewise. (default_diagnostic_starter): Likewise. (diagnostic_report_diagnostic): Likewise. (default_diagnostic_finalizer): Likewise. (verbatim): Likewise. (error): Likewise. (warning): Likewise. * opts.c (common_handle_option): Likewise. * pretty-print.c: New file. * c-pretty-print.h (pp_base): Override. * c-pretty-print.c: Adjust use of macros throughout. (pp_buffer): New macro. (pp_newline): Likewise. * c-objc-common.c (c_tree_printer): Adjust prototype. Tidy. * Makefile.in (DIAGNOSTIC_H): New variable. (c-errors.o): Use it. (c-objc-common.o): Likewise. (c-common.o): Likewise. (c-opts.o): Likewise. (c-format.o): Likewise. (diagnostic.o): Likewise. (opts.o): Likewise. (toplev.o): Likewise. (rtl-error.o): Likewise. (dwarf2out.o): Likewise. (jump.o): Likewise. (pretty-print.o): New rule. cp/ * Make-lang.in (cp/error.o): Depend on DIAGNOSTIC_H. * error.c: Use the new pretty-printer fraamework. From-SVN: r69773
2003-07-25 11:52:32 +02:00
context->printer->buffer->stream = 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
/* By default, we emit prefixes once per message. */
pretty-print.h (PP_NL_ARGMAX): New. gcc: * pretty-print.h (PP_NL_ARGMAX): New. (text_info): Add locus. (struct chunk_info): New. (output_buffer): Add formatted_obstack, chunk_obstack, and cur_chunk_array. Change obstack to a pointer. (pp_wrapping_mode_t, pp_wrapping_mode, pp_set_verbatim_wrapping): New. (struct pretty_print_info): Replace ideal_maximum_length and prefixing_rule with wrapping. (pp_line_cutoff, pp_prefixing_rule): Update to match. Update prototypes and wrapper macros throughout. * pretty-print.c (pp_formatted_text_data, pp_append_r) (pp_base_clear_output_area, pp_construct, pp_base_formatted_text) (pp_base_last_position_in_text, pp_base_newline, pp_base_character): Update for changes to pp structure. (pp_base_prepare_to_format, pp_base_format_text): Delete. (pp_base_format, pp_base_output_formatted_text): New functions. (pp_base_format_verbatim): Use pp_set_verbatim_wrapping. (pp_verbatim): Clear text.locus. (pp_printf): Likewise. Use pp_format and pp_output_formatted_text. * c-objc-common.c (c_tree_printer): Update function signature. * diagnostic.c (diagnostic_initialize): Update for changes to pp structure. (diagnostic_report_diagnostic): Call pp_format and then pp_output_formatted_text. (verbatim): Clear text.locus. * diagnostic.h (diagnostic_prefixing_rule, diagnostic_line_cutoff): Update for changes to pp structure. * c-lang.c: No need to include c-pretty-print.h. * Makefile.in: Remove bogus line containing only a tab. (c-lang.o): Update dependencies. * toplev.c (announce_function): Don't use verbatim. (default_tree_printer): Update signature. * objc/objc-lang.c: No need to include c-pretty-print.h. * objc/Make-lang.in: Update dependencies. gcc/cp: * cp-lang.c: No need to include cxx-pretty-print.h. * error.c (cp_printer): Update signature. No need to process flags. (print_instantiation_partial_context): Output last newline with pp_base_newline. * Make-lang.in: Update dependencies. gcc/objcp: * objcp-lang.c: No need to include cxx-pretty-print.h. * Make-lang.in: Update dependencies. Co-Authored-By: Jakub Jelinek <jakub@redhat.com> From-SVN: r101481
2005-07-01 01:09:06 +02:00
context->printer->wrapping.rule = DIAGNOSTICS_SHOW_PREFIX_ONCE;
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
Remove pedwarn_with_decl, warning_with_decl and error_with_decl from GCC. Remove pedwarn_with_decl, warning_with_decl and error_with_decl from GCC. * calls.c (try_to_integrate): Don't use xxx_with_decl. (expand_call): Likewise. * dwarfout.c (output_reg_number): Likewise. * expr.c (expand_expr): Likewise. * function.c (assign_temp): Likewise. (uninitialized_vars_warning): Likewise. (setjmp_args_warning): Likewise. (expand_function_end): Likewise. * stmt.c (fixup_gotos): Likewise. (warn_about_unused_variables): Likewise. (expand_end_bindings): Likewise. * stor-layout.c (layout_decl): Likewise. (place_field): Likewise. * toplev.c (check_global_declarations): Likewise. (rest_of_handle_inlining): Likewise. (default_tree_printer): New function. (general_init): Initialize diagnostic machinery before routing signals to the ICE machinery. Set default tree printer. * toplev.h (pedwarn_with_decl): Remove declaration. (warning_with_decl): Likewise. (error_with_decl): Likewise. (pedwarn): Remove attribute for the time being. * tree-inline.c (expand_call_inline): Don't use xxx_with_decl. * varasm.c (named_section): Likewise. (make_decl_rtl): Likewise. (assemble_variable): Likewise. (merge_weak): Likewise. (declare_weak): Likewise. * diagnostic.h: Move non-diagnostic stuff into pretty-print.h. * diagnostic.c: Move non-diagnostic stuff into pretty-print.c. (format_with_decl): Remove. (diagnostic_for_decl): Likewise. (pedwarn_with_decl): Likewise. (warning_with_decl): Likewise. (error_with_decl): Likewise. (diagnostic_initialize): Adjust. (diagnostic_count_diagnostic): Likewise. (announce_function): Likewise. (lhd_print_error_function): Likewise. (diagnostic_report_current_module): Likewise. (default_diagnostic_starter): Likewise. (diagnostic_report_diagnostic): Likewise. (default_diagnostic_finalizer): Likewise. (verbatim): Likewise. (error): Likewise. (warning): Likewise. * opts.c (common_handle_option): Likewise. * pretty-print.c: New file. * c-pretty-print.h (pp_base): Override. * c-pretty-print.c: Adjust use of macros throughout. (pp_buffer): New macro. (pp_newline): Likewise. * c-objc-common.c (c_tree_printer): Adjust prototype. Tidy. * Makefile.in (DIAGNOSTIC_H): New variable. (c-errors.o): Use it. (c-objc-common.o): Likewise. (c-common.o): Likewise. (c-opts.o): Likewise. (c-format.o): Likewise. (diagnostic.o): Likewise. (opts.o): Likewise. (toplev.o): Likewise. (rtl-error.o): Likewise. (dwarf2out.o): Likewise. (jump.o): Likewise. (pretty-print.o): New rule. cp/ * Make-lang.in (cp/error.o): Depend on DIAGNOSTIC_H. * error.c: Use the new pretty-printer fraamework. From-SVN: r69773
2003-07-25 11:52:32 +02:00
memset (context->diagnostic_count, 0, sizeof context->diagnostic_count);
context->issue_warnings_are_errors_message = true;
context->warning_as_error_requested = false;
memset (context->classify_diagnostic, DK_UNSPECIFIED,
sizeof context->classify_diagnostic);
context->show_option_requested = false;
Remove pedwarn_with_decl, warning_with_decl and error_with_decl from GCC. Remove pedwarn_with_decl, warning_with_decl and error_with_decl from GCC. * calls.c (try_to_integrate): Don't use xxx_with_decl. (expand_call): Likewise. * dwarfout.c (output_reg_number): Likewise. * expr.c (expand_expr): Likewise. * function.c (assign_temp): Likewise. (uninitialized_vars_warning): Likewise. (setjmp_args_warning): Likewise. (expand_function_end): Likewise. * stmt.c (fixup_gotos): Likewise. (warn_about_unused_variables): Likewise. (expand_end_bindings): Likewise. * stor-layout.c (layout_decl): Likewise. (place_field): Likewise. * toplev.c (check_global_declarations): Likewise. (rest_of_handle_inlining): Likewise. (default_tree_printer): New function. (general_init): Initialize diagnostic machinery before routing signals to the ICE machinery. Set default tree printer. * toplev.h (pedwarn_with_decl): Remove declaration. (warning_with_decl): Likewise. (error_with_decl): Likewise. (pedwarn): Remove attribute for the time being. * tree-inline.c (expand_call_inline): Don't use xxx_with_decl. * varasm.c (named_section): Likewise. (make_decl_rtl): Likewise. (assemble_variable): Likewise. (merge_weak): Likewise. (declare_weak): Likewise. * diagnostic.h: Move non-diagnostic stuff into pretty-print.h. * diagnostic.c: Move non-diagnostic stuff into pretty-print.c. (format_with_decl): Remove. (diagnostic_for_decl): Likewise. (pedwarn_with_decl): Likewise. (warning_with_decl): Likewise. (error_with_decl): Likewise. (diagnostic_initialize): Adjust. (diagnostic_count_diagnostic): Likewise. (announce_function): Likewise. (lhd_print_error_function): Likewise. (diagnostic_report_current_module): Likewise. (default_diagnostic_starter): Likewise. (diagnostic_report_diagnostic): Likewise. (default_diagnostic_finalizer): Likewise. (verbatim): Likewise. (error): Likewise. (warning): Likewise. * opts.c (common_handle_option): Likewise. * pretty-print.c: New file. * c-pretty-print.h (pp_base): Override. * c-pretty-print.c: Adjust use of macros throughout. (pp_buffer): New macro. (pp_newline): Likewise. * c-objc-common.c (c_tree_printer): Adjust prototype. Tidy. * Makefile.in (DIAGNOSTIC_H): New variable. (c-errors.o): Use it. (c-objc-common.o): Likewise. (c-common.o): Likewise. (c-opts.o): Likewise. (c-format.o): Likewise. (diagnostic.o): Likewise. (opts.o): Likewise. (toplev.o): Likewise. (rtl-error.o): Likewise. (dwarf2out.o): Likewise. (jump.o): Likewise. (pretty-print.o): New rule. cp/ * Make-lang.in (cp/error.o): Depend on DIAGNOSTIC_H. * error.c: Use the new pretty-printer fraamework. From-SVN: r69773
2003-07-25 11:52:32 +02:00
context->abort_on_error = false;
context->internal_error = 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
diagnostic_starter (context) = default_diagnostic_starter;
diagnostic_finalizer (context) = default_diagnostic_finalizer;
Remove pedwarn_with_decl, warning_with_decl and error_with_decl from GCC. Remove pedwarn_with_decl, warning_with_decl and error_with_decl from GCC. * calls.c (try_to_integrate): Don't use xxx_with_decl. (expand_call): Likewise. * dwarfout.c (output_reg_number): Likewise. * expr.c (expand_expr): Likewise. * function.c (assign_temp): Likewise. (uninitialized_vars_warning): Likewise. (setjmp_args_warning): Likewise. (expand_function_end): Likewise. * stmt.c (fixup_gotos): Likewise. (warn_about_unused_variables): Likewise. (expand_end_bindings): Likewise. * stor-layout.c (layout_decl): Likewise. (place_field): Likewise. * toplev.c (check_global_declarations): Likewise. (rest_of_handle_inlining): Likewise. (default_tree_printer): New function. (general_init): Initialize diagnostic machinery before routing signals to the ICE machinery. Set default tree printer. * toplev.h (pedwarn_with_decl): Remove declaration. (warning_with_decl): Likewise. (error_with_decl): Likewise. (pedwarn): Remove attribute for the time being. * tree-inline.c (expand_call_inline): Don't use xxx_with_decl. * varasm.c (named_section): Likewise. (make_decl_rtl): Likewise. (assemble_variable): Likewise. (merge_weak): Likewise. (declare_weak): Likewise. * diagnostic.h: Move non-diagnostic stuff into pretty-print.h. * diagnostic.c: Move non-diagnostic stuff into pretty-print.c. (format_with_decl): Remove. (diagnostic_for_decl): Likewise. (pedwarn_with_decl): Likewise. (warning_with_decl): Likewise. (error_with_decl): Likewise. (diagnostic_initialize): Adjust. (diagnostic_count_diagnostic): Likewise. (announce_function): Likewise. (lhd_print_error_function): Likewise. (diagnostic_report_current_module): Likewise. (default_diagnostic_starter): Likewise. (diagnostic_report_diagnostic): Likewise. (default_diagnostic_finalizer): Likewise. (verbatim): Likewise. (error): Likewise. (warning): Likewise. * opts.c (common_handle_option): Likewise. * pretty-print.c: New file. * c-pretty-print.h (pp_base): Override. * c-pretty-print.c: Adjust use of macros throughout. (pp_buffer): New macro. (pp_newline): Likewise. * c-objc-common.c (c_tree_printer): Adjust prototype. Tidy. * Makefile.in (DIAGNOSTIC_H): New variable. (c-errors.o): Use it. (c-objc-common.o): Likewise. (c-common.o): Likewise. (c-opts.o): Likewise. (c-format.o): Likewise. (diagnostic.o): Likewise. (opts.o): Likewise. (toplev.o): Likewise. (rtl-error.o): Likewise. (dwarf2out.o): Likewise. (jump.o): Likewise. (pretty-print.o): New rule. cp/ * Make-lang.in (cp/error.o): Depend on DIAGNOSTIC_H. * error.c: Use the new pretty-printer fraamework. From-SVN: r69773
2003-07-25 11:52:32 +02:00
context->last_module = 0;
context->last_function = NULL;
context->lock = 0;
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 DIAGNOSTIC, where the message MSG has already been
translated. */
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_translated (diagnostic_info *diagnostic, const char *msg,
va_list *args, location_t location,
diagnostic_t 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->message.err_no = errno;
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->message.args_ptr = args;
diagnostic->message.format_spec = msg;
diagnostic->location = location;
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;
diagnostic->option_index = 0;
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 DIAGNOSTIC, where the message GMSGID has not yet been
translated. */
void
diagnostic_set_info (diagnostic_info *diagnostic, const char *gmsgid,
va_list *args, location_t location,
diagnostic_t kind)
{
diagnostic_set_info_translated (diagnostic, _(gmsgid), args, location, 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
/* Return a malloc'd string describing a location. The caller is
responsible for freeing the memory. */
char *
diagnostic_build_prefix (diagnostic_info *diagnostic)
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 const char *const diagnostic_kind_text[] = {
#define DEFINE_DIAGNOSTIC_KIND(K, T) (T),
#include "diagnostic.def"
#undef DEFINE_DIAGNOSTIC_KIND
"must-not-happen"
};
const char *text = _(diagnostic_kind_text[diagnostic->kind]);
expanded_location s = expand_location (diagnostic->location);
dbxout.c (dbxout_type, [...]): Use gcc_assert and gcc_unreachable. * dbxout.c (dbxout_type, dbxout_type_name, dbxout_symbol): Use gcc_assert and gcc_unreachable. * ddg.c (create_ddg_dependence, add_deps_for_def, add_deps_for_use, create_ddg, add_edge_to_ddg): Likewise. * df.c (df_ref_unlink, df_ref_record, df_uses_record, df_reg_def_chain_create, df_reg_use_chain_create, df_analyze, df_insn_delete, df_refs_reg_replace, df_ref_reg_replace, df_insns_modify, df_pattern_emit_before, df_bb_reg_live_start_p, df_bb_reg_live_end_p, df_bb_regs_lives_compare, df_bb_single_def_use_insn_find, dataflow_set_a_op_b, dataflow_set_copy, hybrid_search, diagnostic.c, diagnostic_build_prefix, diagnostic_count_diagnostic): Likewise. * dojump.c (do_jump): Likewise. * dominance.c (calc_dfs_tree_nonrec, calc_dfs_tree, compute_dom_fast_query, calculate_dominance_info, free_dominance_info, get_immediate_dominator, set_immediate_dominator, get_dominated_by, redirect_immediate_dominators, nearest_common_dominator, dominated_by_p, verify_dominators, recount_dominator, iterate_fix_dominators, add_to_dominance_info, delete_from_dominance_info): Likewise. * dwarf2asm.c (size_of_encoded_value, eh_data_format_name, dw2_asm_output_delta_uleb128, dw2_asm_output_delta_sleb128, dw2_force_const_mem, dw2_asm_output_encoded_addr_rtx): Likewise. * dwarf2out.c (expand_builtin_init_dwarf_reg_sizes, reg_save, initial_return_save, stack_adjust_offset, dwarf2out_stack_adjust, flush_queued_reg_saves, dwarf2out_frame_debug_expr, dwarf2out_frame_debug, dw_cfi_oprnd1_desc, output_cfi, output_call_frame_info, output_loc_operands, build_cfa_loc, decl_ultimate_origin, AT_flag, AT_int, AT_unsigned, AT_string, AT_string_form, add_AT_specification, AT_ref, set_AT_ref_external, AT_loc, AT_loc_list, AT_addr, AT_lbl, add_child_die, splice_child_die, attr_checksum, same_dw_val_p, break_out_includes, build_abbrev_table, size_of_die, mark_dies, unmark_dies, value_format, output_loc_list, output_die, output_pubnames, output_aranges, base_type_die, is_base_type, modified_type_die, dbx_reg_number, multiple_reg_loc_descriptor, mem_loc_descriptor, loc_descriptor, loc_descriptor_from_tree_1, field_byte_offset, add_data_member_location_attribute, add_const_value_attribute, rtl_for_decl_location, add_location_or_const_value_attribute, add_byte_size_attribute, add_bit_offset_attribute, add_bit_size_attribute, add_abstract_origin_attribute, pop_decl_scope, scope_die_for, decl_start_label, gen_formal_parameter_die, gen_type_die_for_member, gen_subprogram_die, gen_label_die, gen_typedef_die, gen_type_die, gen_tagged_type_instantiation_die, force_decl_die, force_type_die, gen_decl_die, dwarf2out_imported_module_or_decl, prune_unused_types_prune, dwarf2out_finish): Likewise. From-SVN: r87176
2004-09-08 09:47:45 +02:00
gcc_assert (diagnostic->kind < DK_LAST_DIAGNOSTIC_KIND);
return
(s.file == NULL
? build_message_string ("%s: %s", progname, text)
: flag_show_column && s.column != 0
? build_message_string ("%s:%d:%d: %s", s.file, s.line, s.column, text)
: build_message_string ("%s:%d: %s", s.file, s.line, 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.c (diagnostic_for_decl): Take a diagnostic_context argument. * diagnostic.c (diagnostic_for_decl): Take a diagnostic_context argument. Restructure to be consistent with diagnostic_report_diagnostic. (diagnostic_count_diagnostic): Now static. Take a diagnostic_info argument, not just a diagnostic_t. Some code moved here from internal_error. Move a case label for clarity. (diagnostic_action_after_output): New function. Code moved here from internal_error and fatal_error. (bug_report_request): New #define so that this text appears in only one place. (diagnostic_report_diagnostic): Update to match changes to diagnostic_count_diagnostic. Call diagnostic_action_after_output. (diagnostic_set_info): Call gettext here. (pedwarn): Update comment. Don't call gettext here. (sorry): Use report_diagnostic. Don't call gettext here. (fatal_error): Remove final fnotice and exit, but call real_abort to prevent warnings about noreturn function returning. (internal_error): Likewise. Don't do ICE suppression here nor call context->internal_error. (warning_with_decl): Suppress for decls in system headers. Adjust call to diagnostic_for_decl. (pedwarn_with_decl): Likewise. (error_with_decl): Adjust call to diagnostic_for_decl. (error_recursion): Use bug_report_request. * diagnostic.h: Remove prototype of diagnostic_count_diagnostic. * objc/objc-act.c (error_with_ivar, warn_with_method): Don't call diagnostic_count_diagnostic. f: * bad.c: Don't call diagnostic_count_diagnostic. From-SVN: r66728
2003-05-12 20:32:18 +02:00
/* Take any action which is expected to happen after the diagnostic
is written out. This function does not always return. */
static void
diagnostic_action_after_output (diagnostic_context *context,
diagnostic_info *diagnostic)
diagnostic.c (diagnostic_for_decl): Take a diagnostic_context argument. * diagnostic.c (diagnostic_for_decl): Take a diagnostic_context argument. Restructure to be consistent with diagnostic_report_diagnostic. (diagnostic_count_diagnostic): Now static. Take a diagnostic_info argument, not just a diagnostic_t. Some code moved here from internal_error. Move a case label for clarity. (diagnostic_action_after_output): New function. Code moved here from internal_error and fatal_error. (bug_report_request): New #define so that this text appears in only one place. (diagnostic_report_diagnostic): Update to match changes to diagnostic_count_diagnostic. Call diagnostic_action_after_output. (diagnostic_set_info): Call gettext here. (pedwarn): Update comment. Don't call gettext here. (sorry): Use report_diagnostic. Don't call gettext here. (fatal_error): Remove final fnotice and exit, but call real_abort to prevent warnings about noreturn function returning. (internal_error): Likewise. Don't do ICE suppression here nor call context->internal_error. (warning_with_decl): Suppress for decls in system headers. Adjust call to diagnostic_for_decl. (pedwarn_with_decl): Likewise. (error_with_decl): Adjust call to diagnostic_for_decl. (error_recursion): Use bug_report_request. * diagnostic.h: Remove prototype of diagnostic_count_diagnostic. * objc/objc-act.c (error_with_ivar, warn_with_method): Don't call diagnostic_count_diagnostic. f: * bad.c: Don't call diagnostic_count_diagnostic. From-SVN: r66728
2003-05-12 20:32:18 +02:00
{
switch (diagnostic->kind)
{
case DK_DEBUG:
case DK_NOTE:
case DK_ANACHRONISM:
case DK_WARNING:
break;
case DK_ERROR:
case DK_SORRY:
if (context->abort_on_error)
real_abort ();
if (flag_fatal_errors)
{
fnotice (stderr, "compilation terminated due to -Wfatal-errors.\n");
exit (FATAL_EXIT_CODE);
}
diagnostic.c (diagnostic_for_decl): Take a diagnostic_context argument. * diagnostic.c (diagnostic_for_decl): Take a diagnostic_context argument. Restructure to be consistent with diagnostic_report_diagnostic. (diagnostic_count_diagnostic): Now static. Take a diagnostic_info argument, not just a diagnostic_t. Some code moved here from internal_error. Move a case label for clarity. (diagnostic_action_after_output): New function. Code moved here from internal_error and fatal_error. (bug_report_request): New #define so that this text appears in only one place. (diagnostic_report_diagnostic): Update to match changes to diagnostic_count_diagnostic. Call diagnostic_action_after_output. (diagnostic_set_info): Call gettext here. (pedwarn): Update comment. Don't call gettext here. (sorry): Use report_diagnostic. Don't call gettext here. (fatal_error): Remove final fnotice and exit, but call real_abort to prevent warnings about noreturn function returning. (internal_error): Likewise. Don't do ICE suppression here nor call context->internal_error. (warning_with_decl): Suppress for decls in system headers. Adjust call to diagnostic_for_decl. (pedwarn_with_decl): Likewise. (error_with_decl): Adjust call to diagnostic_for_decl. (error_recursion): Use bug_report_request. * diagnostic.h: Remove prototype of diagnostic_count_diagnostic. * objc/objc-act.c (error_with_ivar, warn_with_method): Don't call diagnostic_count_diagnostic. f: * bad.c: Don't call diagnostic_count_diagnostic. From-SVN: r66728
2003-05-12 20:32:18 +02:00
break;
case DK_ICE:
if (context->abort_on_error)
real_abort ();
fnotice (stderr, "Please submit a full bug report,\n"
"with preprocessed source if appropriate.\n"
"See %s for instructions.\n", bug_report_url);
exit (ICE_EXIT_CODE);
diagnostic.c (diagnostic_for_decl): Take a diagnostic_context argument. * diagnostic.c (diagnostic_for_decl): Take a diagnostic_context argument. Restructure to be consistent with diagnostic_report_diagnostic. (diagnostic_count_diagnostic): Now static. Take a diagnostic_info argument, not just a diagnostic_t. Some code moved here from internal_error. Move a case label for clarity. (diagnostic_action_after_output): New function. Code moved here from internal_error and fatal_error. (bug_report_request): New #define so that this text appears in only one place. (diagnostic_report_diagnostic): Update to match changes to diagnostic_count_diagnostic. Call diagnostic_action_after_output. (diagnostic_set_info): Call gettext here. (pedwarn): Update comment. Don't call gettext here. (sorry): Use report_diagnostic. Don't call gettext here. (fatal_error): Remove final fnotice and exit, but call real_abort to prevent warnings about noreturn function returning. (internal_error): Likewise. Don't do ICE suppression here nor call context->internal_error. (warning_with_decl): Suppress for decls in system headers. Adjust call to diagnostic_for_decl. (pedwarn_with_decl): Likewise. (error_with_decl): Adjust call to diagnostic_for_decl. (error_recursion): Use bug_report_request. * diagnostic.h: Remove prototype of diagnostic_count_diagnostic. * objc/objc-act.c (error_with_ivar, warn_with_method): Don't call diagnostic_count_diagnostic. f: * bad.c: Don't call diagnostic_count_diagnostic. From-SVN: r66728
2003-05-12 20:32:18 +02:00
case DK_FATAL:
if (context->abort_on_error)
real_abort ();
fnotice (stderr, "compilation terminated.\n");
exit (FATAL_EXIT_CODE);
default:
gcc_unreachable ();
diagnostic.c (diagnostic_for_decl): Take a diagnostic_context argument. * diagnostic.c (diagnostic_for_decl): Take a diagnostic_context argument. Restructure to be consistent with diagnostic_report_diagnostic. (diagnostic_count_diagnostic): Now static. Take a diagnostic_info argument, not just a diagnostic_t. Some code moved here from internal_error. Move a case label for clarity. (diagnostic_action_after_output): New function. Code moved here from internal_error and fatal_error. (bug_report_request): New #define so that this text appears in only one place. (diagnostic_report_diagnostic): Update to match changes to diagnostic_count_diagnostic. Call diagnostic_action_after_output. (diagnostic_set_info): Call gettext here. (pedwarn): Update comment. Don't call gettext here. (sorry): Use report_diagnostic. Don't call gettext here. (fatal_error): Remove final fnotice and exit, but call real_abort to prevent warnings about noreturn function returning. (internal_error): Likewise. Don't do ICE suppression here nor call context->internal_error. (warning_with_decl): Suppress for decls in system headers. Adjust call to diagnostic_for_decl. (pedwarn_with_decl): Likewise. (error_with_decl): Adjust call to diagnostic_for_decl. (error_recursion): Use bug_report_request. * diagnostic.h: Remove prototype of diagnostic_count_diagnostic. * objc/objc-act.c (error_with_ivar, warn_with_method): Don't call diagnostic_count_diagnostic. f: * bad.c: Don't call diagnostic_count_diagnostic. From-SVN: r66728
2003-05-12 20:32:18 +02:00
}
}
/* Prints out, if necessary, the name of the current function
that caused an error. Called from all error and warning functions. */
void
builtins.c (expand_builtin, [...]): Use new %K format string specifier for diagnostics. * builtins.c (expand_builtin, expand_builtin_object_size, expand_builtin_memory_chk, maybe_emit_chk_warning, maybe_emit_sprintf_chk_warning): Use new %K format string specifier for diagnostics. * expr.c (expand_expr_real_1): Likewise. * langhooks-def.h (struct diagnostic_info): Add forward decl. (lhd_print_error_function): Add third argument. * langhooks.h (struct diagnostic_info): Add forward decl. (struct lang_hooks): Add third argument to print_error_function. * diagnostic.h (diagnostic_info): Add abstract_origin field. (diagnostic_last_function_changed, diagnostic_set_last_function): Add second argument. (diagnostic_report_current_function): Likewise. * toplev.c (announce_function): Pass NULL as second argument to diagnostic_set_last_function. * diagnostic.c (diagnostic_report_current_function): Add second argument, pass it as third argument to lang_hooks.print_error_function. (default_diagnostic_starter): Pass DIAGNOSTIC as second argument to diagnostic_report_current_function. (diagnostic_report_diagnostic): Initialize diagnostic->abstract_origin and message.abstract_origin. (verbatim): Initialize abstract_origin. * pretty-print.h (text_info): Add abstract_origin field. * pretty-print.c (pp_base_format): Handle %K. * langhooks.c (lhd_print_error_function): Add third argument. If diagnostic->abstract_origin, print virtual backtrace. * c-format.c (gcc_diag_char_table, gcc_tdiag_char_table, gcc_cdiag_char_table, gcc_cxxdiag_char_table): Support %K. (init_dynamic_diag_info): Likewise. cp/ * error.c (cxx_print_error_function): Add third argument, pass it over to lhd_print_error_function. (cp_print_error_function): If diagnostic->abstract_origin, print virtual backtrace. * cp-tree.h (struct diagnostic_info): New forward decl. (cxx_print_error_function): Add third argument. java/ * lang.c (java_print_error_function): Add third argument. testsuite/ * lib/prune.exp: Prune also "^In function .*$" lines and "^ inlined from .*$" lines. From-SVN: r128830
2007-09-27 09:24:58 +02:00
diagnostic_report_current_function (diagnostic_context *context,
diagnostic_info *diagnostic)
{
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);
builtins.c (expand_builtin, [...]): Use new %K format string specifier for diagnostics. * builtins.c (expand_builtin, expand_builtin_object_size, expand_builtin_memory_chk, maybe_emit_chk_warning, maybe_emit_sprintf_chk_warning): Use new %K format string specifier for diagnostics. * expr.c (expand_expr_real_1): Likewise. * langhooks-def.h (struct diagnostic_info): Add forward decl. (lhd_print_error_function): Add third argument. * langhooks.h (struct diagnostic_info): Add forward decl. (struct lang_hooks): Add third argument to print_error_function. * diagnostic.h (diagnostic_info): Add abstract_origin field. (diagnostic_last_function_changed, diagnostic_set_last_function): Add second argument. (diagnostic_report_current_function): Likewise. * toplev.c (announce_function): Pass NULL as second argument to diagnostic_set_last_function. * diagnostic.c (diagnostic_report_current_function): Add second argument, pass it as third argument to lang_hooks.print_error_function. (default_diagnostic_starter): Pass DIAGNOSTIC as second argument to diagnostic_report_current_function. (diagnostic_report_diagnostic): Initialize diagnostic->abstract_origin and message.abstract_origin. (verbatim): Initialize abstract_origin. * pretty-print.h (text_info): Add abstract_origin field. * pretty-print.c (pp_base_format): Handle %K. * langhooks.c (lhd_print_error_function): Add third argument. If diagnostic->abstract_origin, print virtual backtrace. * c-format.c (gcc_diag_char_table, gcc_tdiag_char_table, gcc_cdiag_char_table, gcc_cxxdiag_char_table): Support %K. (init_dynamic_diag_info): Likewise. cp/ * error.c (cxx_print_error_function): Add third argument, pass it over to lhd_print_error_function. (cp_print_error_function): If diagnostic->abstract_origin, print virtual backtrace. * cp-tree.h (struct diagnostic_info): New forward decl. (cxx_print_error_function): Add third argument. java/ * lang.c (java_print_error_function): Add third argument. testsuite/ * lib/prune.exp: Prune also "^In function .*$" lines and "^ inlined from .*$" lines. From-SVN: r128830
2007-09-27 09:24:58 +02:00
lang_hooks.print_error_function (context, input_filename, diagnostic);
}
void
diagnostic_report_current_module (diagnostic_context *context)
{
const struct line_map *map;
Remove pedwarn_with_decl, warning_with_decl and error_with_decl from GCC. Remove pedwarn_with_decl, warning_with_decl and error_with_decl from GCC. * calls.c (try_to_integrate): Don't use xxx_with_decl. (expand_call): Likewise. * dwarfout.c (output_reg_number): Likewise. * expr.c (expand_expr): Likewise. * function.c (assign_temp): Likewise. (uninitialized_vars_warning): Likewise. (setjmp_args_warning): Likewise. (expand_function_end): Likewise. * stmt.c (fixup_gotos): Likewise. (warn_about_unused_variables): Likewise. (expand_end_bindings): Likewise. * stor-layout.c (layout_decl): Likewise. (place_field): Likewise. * toplev.c (check_global_declarations): Likewise. (rest_of_handle_inlining): Likewise. (default_tree_printer): New function. (general_init): Initialize diagnostic machinery before routing signals to the ICE machinery. Set default tree printer. * toplev.h (pedwarn_with_decl): Remove declaration. (warning_with_decl): Likewise. (error_with_decl): Likewise. (pedwarn): Remove attribute for the time being. * tree-inline.c (expand_call_inline): Don't use xxx_with_decl. * varasm.c (named_section): Likewise. (make_decl_rtl): Likewise. (assemble_variable): Likewise. (merge_weak): Likewise. (declare_weak): Likewise. * diagnostic.h: Move non-diagnostic stuff into pretty-print.h. * diagnostic.c: Move non-diagnostic stuff into pretty-print.c. (format_with_decl): Remove. (diagnostic_for_decl): Likewise. (pedwarn_with_decl): Likewise. (warning_with_decl): Likewise. (error_with_decl): Likewise. (diagnostic_initialize): Adjust. (diagnostic_count_diagnostic): Likewise. (announce_function): Likewise. (lhd_print_error_function): Likewise. (diagnostic_report_current_module): Likewise. (default_diagnostic_starter): Likewise. (diagnostic_report_diagnostic): Likewise. (default_diagnostic_finalizer): Likewise. (verbatim): Likewise. (error): Likewise. (warning): Likewise. * opts.c (common_handle_option): Likewise. * pretty-print.c: New file. * c-pretty-print.h (pp_base): Override. * c-pretty-print.c: Adjust use of macros throughout. (pp_buffer): New macro. (pp_newline): Likewise. * c-objc-common.c (c_tree_printer): Adjust prototype. Tidy. * Makefile.in (DIAGNOSTIC_H): New variable. (c-errors.o): Use it. (c-objc-common.o): Likewise. (c-common.o): Likewise. (c-opts.o): Likewise. (c-format.o): Likewise. (diagnostic.o): Likewise. (opts.o): Likewise. (toplev.o): Likewise. (rtl-error.o): Likewise. (dwarf2out.o): Likewise. (jump.o): Likewise. (pretty-print.o): New rule. cp/ * Make-lang.in (cp/error.o): Depend on DIAGNOSTIC_H. * error.c: Use the new pretty-printer fraamework. From-SVN: r69773
2003-07-25 11:52:32 +02:00
if (pp_needs_newline (context->printer))
{
Remove pedwarn_with_decl, warning_with_decl and error_with_decl from GCC. Remove pedwarn_with_decl, warning_with_decl and error_with_decl from GCC. * calls.c (try_to_integrate): Don't use xxx_with_decl. (expand_call): Likewise. * dwarfout.c (output_reg_number): Likewise. * expr.c (expand_expr): Likewise. * function.c (assign_temp): Likewise. (uninitialized_vars_warning): Likewise. (setjmp_args_warning): Likewise. (expand_function_end): Likewise. * stmt.c (fixup_gotos): Likewise. (warn_about_unused_variables): Likewise. (expand_end_bindings): Likewise. * stor-layout.c (layout_decl): Likewise. (place_field): Likewise. * toplev.c (check_global_declarations): Likewise. (rest_of_handle_inlining): Likewise. (default_tree_printer): New function. (general_init): Initialize diagnostic machinery before routing signals to the ICE machinery. Set default tree printer. * toplev.h (pedwarn_with_decl): Remove declaration. (warning_with_decl): Likewise. (error_with_decl): Likewise. (pedwarn): Remove attribute for the time being. * tree-inline.c (expand_call_inline): Don't use xxx_with_decl. * varasm.c (named_section): Likewise. (make_decl_rtl): Likewise. (assemble_variable): Likewise. (merge_weak): Likewise. (declare_weak): Likewise. * diagnostic.h: Move non-diagnostic stuff into pretty-print.h. * diagnostic.c: Move non-diagnostic stuff into pretty-print.c. (format_with_decl): Remove. (diagnostic_for_decl): Likewise. (pedwarn_with_decl): Likewise. (warning_with_decl): Likewise. (error_with_decl): Likewise. (diagnostic_initialize): Adjust. (diagnostic_count_diagnostic): Likewise. (announce_function): Likewise. (lhd_print_error_function): Likewise. (diagnostic_report_current_module): Likewise. (default_diagnostic_starter): Likewise. (diagnostic_report_diagnostic): Likewise. (default_diagnostic_finalizer): Likewise. (verbatim): Likewise. (error): Likewise. (warning): Likewise. * opts.c (common_handle_option): Likewise. * pretty-print.c: New file. * c-pretty-print.h (pp_base): Override. * c-pretty-print.c: Adjust use of macros throughout. (pp_buffer): New macro. (pp_newline): Likewise. * c-objc-common.c (c_tree_printer): Adjust prototype. Tidy. * Makefile.in (DIAGNOSTIC_H): New variable. (c-errors.o): Use it. (c-objc-common.o): Likewise. (c-common.o): Likewise. (c-opts.o): Likewise. (c-format.o): Likewise. (diagnostic.o): Likewise. (opts.o): Likewise. (toplev.o): Likewise. (rtl-error.o): Likewise. (dwarf2out.o): Likewise. (jump.o): Likewise. (pretty-print.o): New rule. cp/ * Make-lang.in (cp/error.o): Depend on DIAGNOSTIC_H. * error.c: Use the new pretty-printer fraamework. From-SVN: r69773
2003-07-25 11:52:32 +02:00
pp_newline (context->printer);
pp_needs_newline (context->printer) = false;
}
if (input_location <= BUILTINS_LOCATION)
return;
map = linemap_lookup (line_table, input_location);
if (map && diagnostic_last_module_changed (context, map))
{
diagnostic_set_last_module (context, map);
if (! MAIN_FILE_P (map))
{
map = INCLUDED_FROM (line_table, map);
pp_verbatim (context->printer,
"In file included from %s:%d",
map->to_file, LAST_SOURCE_LINE (map));
while (! MAIN_FILE_P (map))
{
map = INCLUDED_FROM (line_table, map);
pp_verbatim (context->printer,
",\n from %s:%d",
map->to_file, LAST_SOURCE_LINE (map));
}
pp_verbatim (context->printer, ":");
pp_newline (context->printer);
}
}
}
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 (diagnostic_context *context,
diagnostic_info *diagnostic)
{
builtins.c (expand_builtin, [...]): Use new %K format string specifier for diagnostics. * builtins.c (expand_builtin, expand_builtin_object_size, expand_builtin_memory_chk, maybe_emit_chk_warning, maybe_emit_sprintf_chk_warning): Use new %K format string specifier for diagnostics. * expr.c (expand_expr_real_1): Likewise. * langhooks-def.h (struct diagnostic_info): Add forward decl. (lhd_print_error_function): Add third argument. * langhooks.h (struct diagnostic_info): Add forward decl. (struct lang_hooks): Add third argument to print_error_function. * diagnostic.h (diagnostic_info): Add abstract_origin field. (diagnostic_last_function_changed, diagnostic_set_last_function): Add second argument. (diagnostic_report_current_function): Likewise. * toplev.c (announce_function): Pass NULL as second argument to diagnostic_set_last_function. * diagnostic.c (diagnostic_report_current_function): Add second argument, pass it as third argument to lang_hooks.print_error_function. (default_diagnostic_starter): Pass DIAGNOSTIC as second argument to diagnostic_report_current_function. (diagnostic_report_diagnostic): Initialize diagnostic->abstract_origin and message.abstract_origin. (verbatim): Initialize abstract_origin. * pretty-print.h (text_info): Add abstract_origin field. * pretty-print.c (pp_base_format): Handle %K. * langhooks.c (lhd_print_error_function): Add third argument. If diagnostic->abstract_origin, print virtual backtrace. * c-format.c (gcc_diag_char_table, gcc_tdiag_char_table, gcc_cdiag_char_table, gcc_cxxdiag_char_table): Support %K. (init_dynamic_diag_info): Likewise. cp/ * error.c (cxx_print_error_function): Add third argument, pass it over to lhd_print_error_function. (cp_print_error_function): If diagnostic->abstract_origin, print virtual backtrace. * cp-tree.h (struct diagnostic_info): New forward decl. (cxx_print_error_function): Add third argument. java/ * lang.c (java_print_error_function): Add third argument. testsuite/ * lib/prune.exp: Prune also "^In function .*$" lines and "^ inlined from .*$" lines. From-SVN: r128830
2007-09-27 09:24:58 +02:00
diagnostic_report_current_function (context, diagnostic);
Remove pedwarn_with_decl, warning_with_decl and error_with_decl from GCC. Remove pedwarn_with_decl, warning_with_decl and error_with_decl from GCC. * calls.c (try_to_integrate): Don't use xxx_with_decl. (expand_call): Likewise. * dwarfout.c (output_reg_number): Likewise. * expr.c (expand_expr): Likewise. * function.c (assign_temp): Likewise. (uninitialized_vars_warning): Likewise. (setjmp_args_warning): Likewise. (expand_function_end): Likewise. * stmt.c (fixup_gotos): Likewise. (warn_about_unused_variables): Likewise. (expand_end_bindings): Likewise. * stor-layout.c (layout_decl): Likewise. (place_field): Likewise. * toplev.c (check_global_declarations): Likewise. (rest_of_handle_inlining): Likewise. (default_tree_printer): New function. (general_init): Initialize diagnostic machinery before routing signals to the ICE machinery. Set default tree printer. * toplev.h (pedwarn_with_decl): Remove declaration. (warning_with_decl): Likewise. (error_with_decl): Likewise. (pedwarn): Remove attribute for the time being. * tree-inline.c (expand_call_inline): Don't use xxx_with_decl. * varasm.c (named_section): Likewise. (make_decl_rtl): Likewise. (assemble_variable): Likewise. (merge_weak): Likewise. (declare_weak): Likewise. * diagnostic.h: Move non-diagnostic stuff into pretty-print.h. * diagnostic.c: Move non-diagnostic stuff into pretty-print.c. (format_with_decl): Remove. (diagnostic_for_decl): Likewise. (pedwarn_with_decl): Likewise. (warning_with_decl): Likewise. (error_with_decl): Likewise. (diagnostic_initialize): Adjust. (diagnostic_count_diagnostic): Likewise. (announce_function): Likewise. (lhd_print_error_function): Likewise. (diagnostic_report_current_module): Likewise. (default_diagnostic_starter): Likewise. (diagnostic_report_diagnostic): Likewise. (default_diagnostic_finalizer): Likewise. (verbatim): Likewise. (error): Likewise. (warning): Likewise. * opts.c (common_handle_option): Likewise. * pretty-print.c: New file. * c-pretty-print.h (pp_base): Override. * c-pretty-print.c: Adjust use of macros throughout. (pp_buffer): New macro. (pp_newline): Likewise. * c-objc-common.c (c_tree_printer): Adjust prototype. Tidy. * Makefile.in (DIAGNOSTIC_H): New variable. (c-errors.o): Use it. (c-objc-common.o): Likewise. (c-common.o): Likewise. (c-opts.o): Likewise. (c-format.o): Likewise. (diagnostic.o): Likewise. (opts.o): Likewise. (toplev.o): Likewise. (rtl-error.o): Likewise. (dwarf2out.o): Likewise. (jump.o): Likewise. (pretty-print.o): New rule. cp/ * Make-lang.in (cp/error.o): Depend on DIAGNOSTIC_H. * error.c: Use the new pretty-printer fraamework. From-SVN: r69773
2003-07-25 11:52:32 +02:00
pp_set_prefix (context->printer, diagnostic_build_prefix (diagnostic));
}
static void
default_diagnostic_finalizer (diagnostic_context *context,
diagnostic_info *diagnostic ATTRIBUTE_UNUSED)
{
Remove pedwarn_with_decl, warning_with_decl and error_with_decl from GCC. Remove pedwarn_with_decl, warning_with_decl and error_with_decl from GCC. * calls.c (try_to_integrate): Don't use xxx_with_decl. (expand_call): Likewise. * dwarfout.c (output_reg_number): Likewise. * expr.c (expand_expr): Likewise. * function.c (assign_temp): Likewise. (uninitialized_vars_warning): Likewise. (setjmp_args_warning): Likewise. (expand_function_end): Likewise. * stmt.c (fixup_gotos): Likewise. (warn_about_unused_variables): Likewise. (expand_end_bindings): Likewise. * stor-layout.c (layout_decl): Likewise. (place_field): Likewise. * toplev.c (check_global_declarations): Likewise. (rest_of_handle_inlining): Likewise. (default_tree_printer): New function. (general_init): Initialize diagnostic machinery before routing signals to the ICE machinery. Set default tree printer. * toplev.h (pedwarn_with_decl): Remove declaration. (warning_with_decl): Likewise. (error_with_decl): Likewise. (pedwarn): Remove attribute for the time being. * tree-inline.c (expand_call_inline): Don't use xxx_with_decl. * varasm.c (named_section): Likewise. (make_decl_rtl): Likewise. (assemble_variable): Likewise. (merge_weak): Likewise. (declare_weak): Likewise. * diagnostic.h: Move non-diagnostic stuff into pretty-print.h. * diagnostic.c: Move non-diagnostic stuff into pretty-print.c. (format_with_decl): Remove. (diagnostic_for_decl): Likewise. (pedwarn_with_decl): Likewise. (warning_with_decl): Likewise. (error_with_decl): Likewise. (diagnostic_initialize): Adjust. (diagnostic_count_diagnostic): Likewise. (announce_function): Likewise. (lhd_print_error_function): Likewise. (diagnostic_report_current_module): Likewise. (default_diagnostic_starter): Likewise. (diagnostic_report_diagnostic): Likewise. (default_diagnostic_finalizer): Likewise. (verbatim): Likewise. (error): Likewise. (warning): Likewise. * opts.c (common_handle_option): Likewise. * pretty-print.c: New file. * c-pretty-print.h (pp_base): Override. * c-pretty-print.c: Adjust use of macros throughout. (pp_buffer): New macro. (pp_newline): Likewise. * c-objc-common.c (c_tree_printer): Adjust prototype. Tidy. * Makefile.in (DIAGNOSTIC_H): New variable. (c-errors.o): Use it. (c-objc-common.o): Likewise. (c-common.o): Likewise. (c-opts.o): Likewise. (c-format.o): Likewise. (diagnostic.o): Likewise. (opts.o): Likewise. (toplev.o): Likewise. (rtl-error.o): Likewise. (dwarf2out.o): Likewise. (jump.o): Likewise. (pretty-print.o): New rule. cp/ * Make-lang.in (cp/error.o): Depend on DIAGNOSTIC_H. * error.c: Use the new pretty-printer fraamework. From-SVN: r69773
2003-07-25 11:52:32 +02:00
pp_destroy_prefix (context->printer);
}
/* Interface to specify diagnostic kind overrides. Returns the
previous setting, or DK_UNSPECIFIED if the parameters are out of
range. */
diagnostic_t
diagnostic_classify_diagnostic (diagnostic_context *context,
int option_index,
diagnostic_t new_kind)
{
diagnostic_t old_kind;
if (option_index <= 0
|| option_index >= N_OPTS
|| new_kind >= DK_LAST_DIAGNOSTIC_KIND)
return DK_UNSPECIFIED;
old_kind = context->classify_diagnostic[option_index];
context->classify_diagnostic[option_index] = new_kind;
return old_kind;
}
/* 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
re PR other/36901 (pedwarn() + -pedantic-errors + -w (inhibit_warnings) should not emit errors) 2008-08-09 Manuel Lopez-Ibanez <manu@gcc.gnu.org> PR 36901 * diagnostic.def (DK_PEDWARN, DK_PERMERROR): New. * diagnostic.c (pedantic_warning_kind, permissive_error_kind): Moved from diagnostic.h (diagnostic_report_diagnostic): Return bool. Handle DK_PEDWARN and DK_PERMERROR. (emit_diagnostic): New. (warning0, pedwarn0): Delete. (warning, warning_at, pedwarn, permerror): Return bool. * diagnostic.h (pedantic_warning_kind, permissive_error_kind): Moved to diagnostic.c. (struct diagnostic_context): Use correct type for classify_diagnostic. (diagnostic_report_diagnostic): Update declaration. (emit_diagnostic): Declare. * errors.c (warning): Return bool. * errors.h (warning): Update declaration. * toplev.h (warning0, pedwarn0): Delete. (warning, warning_at, pedwarn, permerror): Return bool. * c-errors.c (pedwarn_c99, pedwarn_c90): Use DK_PEDWARN. * c-decl.c (locate_old_decl): Delete 'diag' argument. Always use inform. Update all calls. (diagnose_mismatched_decls): Check return value of warning/pedwarn before giving informative note. (implicit_decl_warning): Likewise. * c-typeck.c (build_function_call): Likewise. * tree-sssa.c (warn_uninit): Likewise. * builtins.c (gimplify_va_arg_expr): Likewise. fortran/ * f95-lang.c (gfc_mark_addressable): Use "pedwarn (0," instead of 'pedwarn0'. cp/ * cp-tree.h (struct diagnostic_context, struct diagnostic_info): Delete forward declarations. Check that toplev.h has not been included before this file. Include toplev.h and diagnostic.h. * error.c (cp_cpp_error): Use DK_PEDWARN. (cxx_incomplete_type_diagnostic): Update declaration. (cxx_incomplete_type_error): Use DK_ERROR. * typeck2.c (cxx_incomplete_type_diagnostic): Take a diagnostic_t as argument. Use emit_diagnostic. (cxx_incomplete_type_error): Use DK_ERROR. (add_exception_specifier): Use diagnostic_t instead of custom codes. * typeck.c (complete_type_or_else): Update call to cxx_incomplete_type_diagnostic. * init.c (build_delete): Likewise. * call.c (diagnostic_fn_t): Remove unused typedef. (build_temp): Pass a pointer to diagnostic_t. (convert_like_real): Use emit_diagnostic. (joust): Check return value of warning before giving informative note. * friend.c (do_friend): Check return value of warning before giving informative note. * parser.c (cp_parser_template_id): Likewise. testsuite/ * gcc.dg/pr36901-1.c: New. * gcc.dg/pr36901-3.c: New. * gcc.dg/pr36901-2.c: New. * gcc.dg/pr36901-4.c: New. * gcc.dg/pr36901-system.h: New. * gcc.dg/pr36901.h: New. * gcc.target/powerpc/altivec-macros.c: Update. * gcc.target/i386/regparm.c: Update. * gcc.dg/funcdef-var-1.c: Update. * gcc.dg/parm-mismatch-1.c: Update. * gcc.dg/attr-noinline.c: Update. * gcc.dg/wtr-static-1.c: Update. * gcc.dg/redecl-11.c: Update. * gcc.dg/pr27953.c: Update. * gcc.dg/proto-1.c: Update. * gcc.dg/decl-3.c: Update. * gcc.dg/redecl-13.c: Update. * gcc.dg/pr15360-1.c: Update. * gcc.dg/redecl-15.c: Update. * gcc.dg/enum-compat-1.c: Update. * gcc.dg/dll-3.c: Update. * gcc.dg/array-5.c: Update. * gcc.dg/Wredundant-decls-2.c: Update. * gcc.dg/inline4.c: Update. * gcc.dg/redecl-2.c: Update. * gcc.dg/inline-14.c: Update. * gcc.dg/tls/diag-3.c: Update. * gcc.dg/funcdef-var-2.c: Update. * gcc.dg/20041213-1.c: Update. * gcc.dg/old-style-then-proto-1.c: Update. * gcc.dg/decl-2.c: Update. * gcc.dg/redecl-12.c: Update. * gcc.dg/decl-4.c: Update. * gcc.dg/Wshadow-1.c: Update. * gcc.dg/transparent-union-2.c: Update. * gcc.dg/visibility-7.c: Update. * gcc.dg/dll-2.c: Update. * gcc.dg/redecl-16.c: Update. * gcc.dg/inline1.c: Update. * gcc.dg/decl-8.c: Update. * gcc.dg/nested-redef-1.c: Update. * gcc.dg/inline3.c: Update. * gcc.dg/redecl-1.c: Update. * gcc.dg/inline5.c: Update. * gcc.dg/pr35899.c: Update. * gcc.dg/noncompile/label-lineno-1.c: Update. * gcc.dg/noncompile/label-1.c: Update. * gcc.dg/noncompile/20020220-1.c: Update. * gcc.dg/noncompile/redecl-1.c: Update. * gcc.dg/redecl-5.c: Update. * gcc.dg/qual-return-3.c: Update. * gcc.dg/label-decl-4.c: Update. From-SVN: r138893
2008-08-09 01:57:19 +02:00
in the documentation of output_format.
Return true if a diagnostic was printed, false otherwise. */
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
re PR other/36901 (pedwarn() + -pedantic-errors + -w (inhibit_warnings) should not emit errors) 2008-08-09 Manuel Lopez-Ibanez <manu@gcc.gnu.org> PR 36901 * diagnostic.def (DK_PEDWARN, DK_PERMERROR): New. * diagnostic.c (pedantic_warning_kind, permissive_error_kind): Moved from diagnostic.h (diagnostic_report_diagnostic): Return bool. Handle DK_PEDWARN and DK_PERMERROR. (emit_diagnostic): New. (warning0, pedwarn0): Delete. (warning, warning_at, pedwarn, permerror): Return bool. * diagnostic.h (pedantic_warning_kind, permissive_error_kind): Moved to diagnostic.c. (struct diagnostic_context): Use correct type for classify_diagnostic. (diagnostic_report_diagnostic): Update declaration. (emit_diagnostic): Declare. * errors.c (warning): Return bool. * errors.h (warning): Update declaration. * toplev.h (warning0, pedwarn0): Delete. (warning, warning_at, pedwarn, permerror): Return bool. * c-errors.c (pedwarn_c99, pedwarn_c90): Use DK_PEDWARN. * c-decl.c (locate_old_decl): Delete 'diag' argument. Always use inform. Update all calls. (diagnose_mismatched_decls): Check return value of warning/pedwarn before giving informative note. (implicit_decl_warning): Likewise. * c-typeck.c (build_function_call): Likewise. * tree-sssa.c (warn_uninit): Likewise. * builtins.c (gimplify_va_arg_expr): Likewise. fortran/ * f95-lang.c (gfc_mark_addressable): Use "pedwarn (0," instead of 'pedwarn0'. cp/ * cp-tree.h (struct diagnostic_context, struct diagnostic_info): Delete forward declarations. Check that toplev.h has not been included before this file. Include toplev.h and diagnostic.h. * error.c (cp_cpp_error): Use DK_PEDWARN. (cxx_incomplete_type_diagnostic): Update declaration. (cxx_incomplete_type_error): Use DK_ERROR. * typeck2.c (cxx_incomplete_type_diagnostic): Take a diagnostic_t as argument. Use emit_diagnostic. (cxx_incomplete_type_error): Use DK_ERROR. (add_exception_specifier): Use diagnostic_t instead of custom codes. * typeck.c (complete_type_or_else): Update call to cxx_incomplete_type_diagnostic. * init.c (build_delete): Likewise. * call.c (diagnostic_fn_t): Remove unused typedef. (build_temp): Pass a pointer to diagnostic_t. (convert_like_real): Use emit_diagnostic. (joust): Check return value of warning before giving informative note. * friend.c (do_friend): Check return value of warning before giving informative note. * parser.c (cp_parser_template_id): Likewise. testsuite/ * gcc.dg/pr36901-1.c: New. * gcc.dg/pr36901-3.c: New. * gcc.dg/pr36901-2.c: New. * gcc.dg/pr36901-4.c: New. * gcc.dg/pr36901-system.h: New. * gcc.dg/pr36901.h: New. * gcc.target/powerpc/altivec-macros.c: Update. * gcc.target/i386/regparm.c: Update. * gcc.dg/funcdef-var-1.c: Update. * gcc.dg/parm-mismatch-1.c: Update. * gcc.dg/attr-noinline.c: Update. * gcc.dg/wtr-static-1.c: Update. * gcc.dg/redecl-11.c: Update. * gcc.dg/pr27953.c: Update. * gcc.dg/proto-1.c: Update. * gcc.dg/decl-3.c: Update. * gcc.dg/redecl-13.c: Update. * gcc.dg/pr15360-1.c: Update. * gcc.dg/redecl-15.c: Update. * gcc.dg/enum-compat-1.c: Update. * gcc.dg/dll-3.c: Update. * gcc.dg/array-5.c: Update. * gcc.dg/Wredundant-decls-2.c: Update. * gcc.dg/inline4.c: Update. * gcc.dg/redecl-2.c: Update. * gcc.dg/inline-14.c: Update. * gcc.dg/tls/diag-3.c: Update. * gcc.dg/funcdef-var-2.c: Update. * gcc.dg/20041213-1.c: Update. * gcc.dg/old-style-then-proto-1.c: Update. * gcc.dg/decl-2.c: Update. * gcc.dg/redecl-12.c: Update. * gcc.dg/decl-4.c: Update. * gcc.dg/Wshadow-1.c: Update. * gcc.dg/transparent-union-2.c: Update. * gcc.dg/visibility-7.c: Update. * gcc.dg/dll-2.c: Update. * gcc.dg/redecl-16.c: Update. * gcc.dg/inline1.c: Update. * gcc.dg/decl-8.c: Update. * gcc.dg/nested-redef-1.c: Update. * gcc.dg/inline3.c: Update. * gcc.dg/redecl-1.c: Update. * gcc.dg/inline5.c: Update. * gcc.dg/pr35899.c: Update. * gcc.dg/noncompile/label-lineno-1.c: Update. * gcc.dg/noncompile/label-1.c: Update. * gcc.dg/noncompile/20020220-1.c: Update. * gcc.dg/noncompile/redecl-1.c: Update. * gcc.dg/redecl-5.c: Update. * gcc.dg/qual-return-3.c: Update. * gcc.dg/label-decl-4.c: Update. From-SVN: r138893
2008-08-09 01:57:19 +02:00
bool
diagnostic_report_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
{
Makefile.in: Replace toplev.h with TOPLEV_H. 2007-07-21 Rafael Avila de Espindola <espindola@google.com> * Makefile.in: Replace toplev.h with TOPLEV_H. * c-decl.c (merge_decls): Don't set DECL_IN_SYSTEM_HEADER. * c-lex.c (fe_file_change): Don't set in_system_header. * c-parser.c (c_token): Remove in_system_header. (c_lex_one_token): Don't set in_system_header. (c_parser_set_source_position_from_token): Don't set in_system_header. * diagnostic.c (diagnostic_report_diagnostic): Use location from diagnostic_info. (warning_at): New. * diagnostic.h (diagnostic_report_warnings_p): Add LOC argument. * flags.h (in_system_header): Remove. * function.c (saved_in_system_header): Remove. (push_cfun): Don't set in_system_header. (pop_cfun): Don't set in_system_header. (push_struct_function): Don't set in_system_header. * input.h (expanded_location): Add sysp. (in_system_header_at): New. (in_system_header): New. * toplev.c (in_system_header): Remove. * toplev.h: Include input.h (warning_at): New. * tree-cfg.c (execute_warn_function_return): Call warning_at. * tree-ssa.c (warn_uninit): Call warning_at. (warn_uninitialized_var): Update calls to warn_uninit. (warn_uninitialized_phi): Update calls to warn_uninit. * tree.c (make_node_stat): Don't set DECL_IN_SYSTEM_HEADER. (expand_location): Initialize xloc.sysp. * tree.h (DECL_IN_SYSTEM_HEADER): Use in_system_header_at. (tree_decl_with_vis): Remove in_system_header_flag. 2007-07-21 Rafael Avila de Espindola <espindola@google.com> * parser.c (cp_token): Remove in_system_header. (eof_token): Remove in_system_header. (cp_lexer_get_preprocessor_token): Don't set in_system_header. (cp_lexer_set_source_position_from_token): Don't set in_system_header. (cp_parser_member_declaration): Use in_system_header_at. * pt.c (lookup_template_class): Don't set DECL_IN_SYSTEM_HEADER. (pop_tinst_level): Don't set in_system_header. (instantiate_class_template): Don't set in_system_header. (instantiate_decl): Don't set in_system_header. (instantiate_pending_templates): Don't set in_system_header. From-SVN: r138031
2008-07-21 16:29:27 +02:00
location_t location = diagnostic->location;
bool maybe_print_warnings_as_errors_message = false;
const char *saved_format_spec;
/* Give preference to being able to inhibit warnings, before they
get reclassified to something else. */
re PR other/36901 (pedwarn() + -pedantic-errors + -w (inhibit_warnings) should not emit errors) 2008-08-09 Manuel Lopez-Ibanez <manu@gcc.gnu.org> PR 36901 * diagnostic.def (DK_PEDWARN, DK_PERMERROR): New. * diagnostic.c (pedantic_warning_kind, permissive_error_kind): Moved from diagnostic.h (diagnostic_report_diagnostic): Return bool. Handle DK_PEDWARN and DK_PERMERROR. (emit_diagnostic): New. (warning0, pedwarn0): Delete. (warning, warning_at, pedwarn, permerror): Return bool. * diagnostic.h (pedantic_warning_kind, permissive_error_kind): Moved to diagnostic.c. (struct diagnostic_context): Use correct type for classify_diagnostic. (diagnostic_report_diagnostic): Update declaration. (emit_diagnostic): Declare. * errors.c (warning): Return bool. * errors.h (warning): Update declaration. * toplev.h (warning0, pedwarn0): Delete. (warning, warning_at, pedwarn, permerror): Return bool. * c-errors.c (pedwarn_c99, pedwarn_c90): Use DK_PEDWARN. * c-decl.c (locate_old_decl): Delete 'diag' argument. Always use inform. Update all calls. (diagnose_mismatched_decls): Check return value of warning/pedwarn before giving informative note. (implicit_decl_warning): Likewise. * c-typeck.c (build_function_call): Likewise. * tree-sssa.c (warn_uninit): Likewise. * builtins.c (gimplify_va_arg_expr): Likewise. fortran/ * f95-lang.c (gfc_mark_addressable): Use "pedwarn (0," instead of 'pedwarn0'. cp/ * cp-tree.h (struct diagnostic_context, struct diagnostic_info): Delete forward declarations. Check that toplev.h has not been included before this file. Include toplev.h and diagnostic.h. * error.c (cp_cpp_error): Use DK_PEDWARN. (cxx_incomplete_type_diagnostic): Update declaration. (cxx_incomplete_type_error): Use DK_ERROR. * typeck2.c (cxx_incomplete_type_diagnostic): Take a diagnostic_t as argument. Use emit_diagnostic. (cxx_incomplete_type_error): Use DK_ERROR. (add_exception_specifier): Use diagnostic_t instead of custom codes. * typeck.c (complete_type_or_else): Update call to cxx_incomplete_type_diagnostic. * init.c (build_delete): Likewise. * call.c (diagnostic_fn_t): Remove unused typedef. (build_temp): Pass a pointer to diagnostic_t. (convert_like_real): Use emit_diagnostic. (joust): Check return value of warning before giving informative note. * friend.c (do_friend): Check return value of warning before giving informative note. * parser.c (cp_parser_template_id): Likewise. testsuite/ * gcc.dg/pr36901-1.c: New. * gcc.dg/pr36901-3.c: New. * gcc.dg/pr36901-2.c: New. * gcc.dg/pr36901-4.c: New. * gcc.dg/pr36901-system.h: New. * gcc.dg/pr36901.h: New. * gcc.target/powerpc/altivec-macros.c: Update. * gcc.target/i386/regparm.c: Update. * gcc.dg/funcdef-var-1.c: Update. * gcc.dg/parm-mismatch-1.c: Update. * gcc.dg/attr-noinline.c: Update. * gcc.dg/wtr-static-1.c: Update. * gcc.dg/redecl-11.c: Update. * gcc.dg/pr27953.c: Update. * gcc.dg/proto-1.c: Update. * gcc.dg/decl-3.c: Update. * gcc.dg/redecl-13.c: Update. * gcc.dg/pr15360-1.c: Update. * gcc.dg/redecl-15.c: Update. * gcc.dg/enum-compat-1.c: Update. * gcc.dg/dll-3.c: Update. * gcc.dg/array-5.c: Update. * gcc.dg/Wredundant-decls-2.c: Update. * gcc.dg/inline4.c: Update. * gcc.dg/redecl-2.c: Update. * gcc.dg/inline-14.c: Update. * gcc.dg/tls/diag-3.c: Update. * gcc.dg/funcdef-var-2.c: Update. * gcc.dg/20041213-1.c: Update. * gcc.dg/old-style-then-proto-1.c: Update. * gcc.dg/decl-2.c: Update. * gcc.dg/redecl-12.c: Update. * gcc.dg/decl-4.c: Update. * gcc.dg/Wshadow-1.c: Update. * gcc.dg/transparent-union-2.c: Update. * gcc.dg/visibility-7.c: Update. * gcc.dg/dll-2.c: Update. * gcc.dg/redecl-16.c: Update. * gcc.dg/inline1.c: Update. * gcc.dg/decl-8.c: Update. * gcc.dg/nested-redef-1.c: Update. * gcc.dg/inline3.c: Update. * gcc.dg/redecl-1.c: Update. * gcc.dg/inline5.c: Update. * gcc.dg/pr35899.c: Update. * gcc.dg/noncompile/label-lineno-1.c: Update. * gcc.dg/noncompile/label-1.c: Update. * gcc.dg/noncompile/20020220-1.c: Update. * gcc.dg/noncompile/redecl-1.c: Update. * gcc.dg/redecl-5.c: Update. * gcc.dg/qual-return-3.c: Update. * gcc.dg/label-decl-4.c: Update. From-SVN: r138893
2008-08-09 01:57:19 +02:00
if ((diagnostic->kind == DK_WARNING || diagnostic->kind == DK_PEDWARN)
Makefile.in: Replace toplev.h with TOPLEV_H. 2007-07-21 Rafael Avila de Espindola <espindola@google.com> * Makefile.in: Replace toplev.h with TOPLEV_H. * c-decl.c (merge_decls): Don't set DECL_IN_SYSTEM_HEADER. * c-lex.c (fe_file_change): Don't set in_system_header. * c-parser.c (c_token): Remove in_system_header. (c_lex_one_token): Don't set in_system_header. (c_parser_set_source_position_from_token): Don't set in_system_header. * diagnostic.c (diagnostic_report_diagnostic): Use location from diagnostic_info. (warning_at): New. * diagnostic.h (diagnostic_report_warnings_p): Add LOC argument. * flags.h (in_system_header): Remove. * function.c (saved_in_system_header): Remove. (push_cfun): Don't set in_system_header. (pop_cfun): Don't set in_system_header. (push_struct_function): Don't set in_system_header. * input.h (expanded_location): Add sysp. (in_system_header_at): New. (in_system_header): New. * toplev.c (in_system_header): Remove. * toplev.h: Include input.h (warning_at): New. * tree-cfg.c (execute_warn_function_return): Call warning_at. * tree-ssa.c (warn_uninit): Call warning_at. (warn_uninitialized_var): Update calls to warn_uninit. (warn_uninitialized_phi): Update calls to warn_uninit. * tree.c (make_node_stat): Don't set DECL_IN_SYSTEM_HEADER. (expand_location): Initialize xloc.sysp. * tree.h (DECL_IN_SYSTEM_HEADER): Use in_system_header_at. (tree_decl_with_vis): Remove in_system_header_flag. 2007-07-21 Rafael Avila de Espindola <espindola@google.com> * parser.c (cp_token): Remove in_system_header. (eof_token): Remove in_system_header. (cp_lexer_get_preprocessor_token): Don't set in_system_header. (cp_lexer_set_source_position_from_token): Don't set in_system_header. (cp_parser_member_declaration): Use in_system_header_at. * pt.c (lookup_template_class): Don't set DECL_IN_SYSTEM_HEADER. (pop_tinst_level): Don't set in_system_header. (instantiate_class_template): Don't set in_system_header. (instantiate_decl): Don't set in_system_header. (instantiate_pending_templates): Don't set in_system_header. From-SVN: r138031
2008-07-21 16:29:27 +02:00
&& !diagnostic_report_warnings_p (location))
re PR other/36901 (pedwarn() + -pedantic-errors + -w (inhibit_warnings) should not emit errors) 2008-08-09 Manuel Lopez-Ibanez <manu@gcc.gnu.org> PR 36901 * diagnostic.def (DK_PEDWARN, DK_PERMERROR): New. * diagnostic.c (pedantic_warning_kind, permissive_error_kind): Moved from diagnostic.h (diagnostic_report_diagnostic): Return bool. Handle DK_PEDWARN and DK_PERMERROR. (emit_diagnostic): New. (warning0, pedwarn0): Delete. (warning, warning_at, pedwarn, permerror): Return bool. * diagnostic.h (pedantic_warning_kind, permissive_error_kind): Moved to diagnostic.c. (struct diagnostic_context): Use correct type for classify_diagnostic. (diagnostic_report_diagnostic): Update declaration. (emit_diagnostic): Declare. * errors.c (warning): Return bool. * errors.h (warning): Update declaration. * toplev.h (warning0, pedwarn0): Delete. (warning, warning_at, pedwarn, permerror): Return bool. * c-errors.c (pedwarn_c99, pedwarn_c90): Use DK_PEDWARN. * c-decl.c (locate_old_decl): Delete 'diag' argument. Always use inform. Update all calls. (diagnose_mismatched_decls): Check return value of warning/pedwarn before giving informative note. (implicit_decl_warning): Likewise. * c-typeck.c (build_function_call): Likewise. * tree-sssa.c (warn_uninit): Likewise. * builtins.c (gimplify_va_arg_expr): Likewise. fortran/ * f95-lang.c (gfc_mark_addressable): Use "pedwarn (0," instead of 'pedwarn0'. cp/ * cp-tree.h (struct diagnostic_context, struct diagnostic_info): Delete forward declarations. Check that toplev.h has not been included before this file. Include toplev.h and diagnostic.h. * error.c (cp_cpp_error): Use DK_PEDWARN. (cxx_incomplete_type_diagnostic): Update declaration. (cxx_incomplete_type_error): Use DK_ERROR. * typeck2.c (cxx_incomplete_type_diagnostic): Take a diagnostic_t as argument. Use emit_diagnostic. (cxx_incomplete_type_error): Use DK_ERROR. (add_exception_specifier): Use diagnostic_t instead of custom codes. * typeck.c (complete_type_or_else): Update call to cxx_incomplete_type_diagnostic. * init.c (build_delete): Likewise. * call.c (diagnostic_fn_t): Remove unused typedef. (build_temp): Pass a pointer to diagnostic_t. (convert_like_real): Use emit_diagnostic. (joust): Check return value of warning before giving informative note. * friend.c (do_friend): Check return value of warning before giving informative note. * parser.c (cp_parser_template_id): Likewise. testsuite/ * gcc.dg/pr36901-1.c: New. * gcc.dg/pr36901-3.c: New. * gcc.dg/pr36901-2.c: New. * gcc.dg/pr36901-4.c: New. * gcc.dg/pr36901-system.h: New. * gcc.dg/pr36901.h: New. * gcc.target/powerpc/altivec-macros.c: Update. * gcc.target/i386/regparm.c: Update. * gcc.dg/funcdef-var-1.c: Update. * gcc.dg/parm-mismatch-1.c: Update. * gcc.dg/attr-noinline.c: Update. * gcc.dg/wtr-static-1.c: Update. * gcc.dg/redecl-11.c: Update. * gcc.dg/pr27953.c: Update. * gcc.dg/proto-1.c: Update. * gcc.dg/decl-3.c: Update. * gcc.dg/redecl-13.c: Update. * gcc.dg/pr15360-1.c: Update. * gcc.dg/redecl-15.c: Update. * gcc.dg/enum-compat-1.c: Update. * gcc.dg/dll-3.c: Update. * gcc.dg/array-5.c: Update. * gcc.dg/Wredundant-decls-2.c: Update. * gcc.dg/inline4.c: Update. * gcc.dg/redecl-2.c: Update. * gcc.dg/inline-14.c: Update. * gcc.dg/tls/diag-3.c: Update. * gcc.dg/funcdef-var-2.c: Update. * gcc.dg/20041213-1.c: Update. * gcc.dg/old-style-then-proto-1.c: Update. * gcc.dg/decl-2.c: Update. * gcc.dg/redecl-12.c: Update. * gcc.dg/decl-4.c: Update. * gcc.dg/Wshadow-1.c: Update. * gcc.dg/transparent-union-2.c: Update. * gcc.dg/visibility-7.c: Update. * gcc.dg/dll-2.c: Update. * gcc.dg/redecl-16.c: Update. * gcc.dg/inline1.c: Update. * gcc.dg/decl-8.c: Update. * gcc.dg/nested-redef-1.c: Update. * gcc.dg/inline3.c: Update. * gcc.dg/redecl-1.c: Update. * gcc.dg/inline5.c: Update. * gcc.dg/pr35899.c: Update. * gcc.dg/noncompile/label-lineno-1.c: Update. * gcc.dg/noncompile/label-1.c: Update. * gcc.dg/noncompile/20020220-1.c: Update. * gcc.dg/noncompile/redecl-1.c: Update. * gcc.dg/redecl-5.c: Update. * gcc.dg/qual-return-3.c: Update. * gcc.dg/label-decl-4.c: Update. From-SVN: r138893
2008-08-09 01:57:19 +02:00
return false;
if (diagnostic->kind == DK_PEDWARN)
diagnostic->kind = pedantic_warning_kind ();
if (context->lock > 0)
{
/* If we're reporting an ICE in the middle of some other error,
try to flush out the previous error, then let this one
through. Don't do this more than once. */
if (diagnostic->kind == DK_ICE && context->lock == 1)
pp_flush (context->printer);
else
error_recursion (context);
}
/* If the user requested that warnings be treated as errors, so be
it. Note that we do this before the next block so that
individual warnings can be overridden back to warnings with
-Wno-error=*. */
if (context->warning_as_error_requested
&& diagnostic->kind == DK_WARNING)
{
diagnostic->kind = DK_ERROR;
maybe_print_warnings_as_errors_message = true;
}
if (diagnostic->option_index)
{
/* This tests if the user provided the appropriate -Wfoo or
-Wno-foo option. */
if (! option_enabled (diagnostic->option_index))
re PR other/36901 (pedwarn() + -pedantic-errors + -w (inhibit_warnings) should not emit errors) 2008-08-09 Manuel Lopez-Ibanez <manu@gcc.gnu.org> PR 36901 * diagnostic.def (DK_PEDWARN, DK_PERMERROR): New. * diagnostic.c (pedantic_warning_kind, permissive_error_kind): Moved from diagnostic.h (diagnostic_report_diagnostic): Return bool. Handle DK_PEDWARN and DK_PERMERROR. (emit_diagnostic): New. (warning0, pedwarn0): Delete. (warning, warning_at, pedwarn, permerror): Return bool. * diagnostic.h (pedantic_warning_kind, permissive_error_kind): Moved to diagnostic.c. (struct diagnostic_context): Use correct type for classify_diagnostic. (diagnostic_report_diagnostic): Update declaration. (emit_diagnostic): Declare. * errors.c (warning): Return bool. * errors.h (warning): Update declaration. * toplev.h (warning0, pedwarn0): Delete. (warning, warning_at, pedwarn, permerror): Return bool. * c-errors.c (pedwarn_c99, pedwarn_c90): Use DK_PEDWARN. * c-decl.c (locate_old_decl): Delete 'diag' argument. Always use inform. Update all calls. (diagnose_mismatched_decls): Check return value of warning/pedwarn before giving informative note. (implicit_decl_warning): Likewise. * c-typeck.c (build_function_call): Likewise. * tree-sssa.c (warn_uninit): Likewise. * builtins.c (gimplify_va_arg_expr): Likewise. fortran/ * f95-lang.c (gfc_mark_addressable): Use "pedwarn (0," instead of 'pedwarn0'. cp/ * cp-tree.h (struct diagnostic_context, struct diagnostic_info): Delete forward declarations. Check that toplev.h has not been included before this file. Include toplev.h and diagnostic.h. * error.c (cp_cpp_error): Use DK_PEDWARN. (cxx_incomplete_type_diagnostic): Update declaration. (cxx_incomplete_type_error): Use DK_ERROR. * typeck2.c (cxx_incomplete_type_diagnostic): Take a diagnostic_t as argument. Use emit_diagnostic. (cxx_incomplete_type_error): Use DK_ERROR. (add_exception_specifier): Use diagnostic_t instead of custom codes. * typeck.c (complete_type_or_else): Update call to cxx_incomplete_type_diagnostic. * init.c (build_delete): Likewise. * call.c (diagnostic_fn_t): Remove unused typedef. (build_temp): Pass a pointer to diagnostic_t. (convert_like_real): Use emit_diagnostic. (joust): Check return value of warning before giving informative note. * friend.c (do_friend): Check return value of warning before giving informative note. * parser.c (cp_parser_template_id): Likewise. testsuite/ * gcc.dg/pr36901-1.c: New. * gcc.dg/pr36901-3.c: New. * gcc.dg/pr36901-2.c: New. * gcc.dg/pr36901-4.c: New. * gcc.dg/pr36901-system.h: New. * gcc.dg/pr36901.h: New. * gcc.target/powerpc/altivec-macros.c: Update. * gcc.target/i386/regparm.c: Update. * gcc.dg/funcdef-var-1.c: Update. * gcc.dg/parm-mismatch-1.c: Update. * gcc.dg/attr-noinline.c: Update. * gcc.dg/wtr-static-1.c: Update. * gcc.dg/redecl-11.c: Update. * gcc.dg/pr27953.c: Update. * gcc.dg/proto-1.c: Update. * gcc.dg/decl-3.c: Update. * gcc.dg/redecl-13.c: Update. * gcc.dg/pr15360-1.c: Update. * gcc.dg/redecl-15.c: Update. * gcc.dg/enum-compat-1.c: Update. * gcc.dg/dll-3.c: Update. * gcc.dg/array-5.c: Update. * gcc.dg/Wredundant-decls-2.c: Update. * gcc.dg/inline4.c: Update. * gcc.dg/redecl-2.c: Update. * gcc.dg/inline-14.c: Update. * gcc.dg/tls/diag-3.c: Update. * gcc.dg/funcdef-var-2.c: Update. * gcc.dg/20041213-1.c: Update. * gcc.dg/old-style-then-proto-1.c: Update. * gcc.dg/decl-2.c: Update. * gcc.dg/redecl-12.c: Update. * gcc.dg/decl-4.c: Update. * gcc.dg/Wshadow-1.c: Update. * gcc.dg/transparent-union-2.c: Update. * gcc.dg/visibility-7.c: Update. * gcc.dg/dll-2.c: Update. * gcc.dg/redecl-16.c: Update. * gcc.dg/inline1.c: Update. * gcc.dg/decl-8.c: Update. * gcc.dg/nested-redef-1.c: Update. * gcc.dg/inline3.c: Update. * gcc.dg/redecl-1.c: Update. * gcc.dg/inline5.c: Update. * gcc.dg/pr35899.c: Update. * gcc.dg/noncompile/label-lineno-1.c: Update. * gcc.dg/noncompile/label-1.c: Update. * gcc.dg/noncompile/20020220-1.c: Update. * gcc.dg/noncompile/redecl-1.c: Update. * gcc.dg/redecl-5.c: Update. * gcc.dg/qual-return-3.c: Update. * gcc.dg/label-decl-4.c: Update. From-SVN: r138893
2008-08-09 01:57:19 +02:00
return false;
/* This tests if the user provided the appropriate -Werror=foo
option. */
if (context->classify_diagnostic[diagnostic->option_index] != DK_UNSPECIFIED)
{
diagnostic->kind = context->classify_diagnostic[diagnostic->option_index];
maybe_print_warnings_as_errors_message = false;
}
/* This allows for future extensions, like temporarily disabling
warnings for ranges of source code. */
if (diagnostic->kind == DK_IGNORED)
re PR other/36901 (pedwarn() + -pedantic-errors + -w (inhibit_warnings) should not emit errors) 2008-08-09 Manuel Lopez-Ibanez <manu@gcc.gnu.org> PR 36901 * diagnostic.def (DK_PEDWARN, DK_PERMERROR): New. * diagnostic.c (pedantic_warning_kind, permissive_error_kind): Moved from diagnostic.h (diagnostic_report_diagnostic): Return bool. Handle DK_PEDWARN and DK_PERMERROR. (emit_diagnostic): New. (warning0, pedwarn0): Delete. (warning, warning_at, pedwarn, permerror): Return bool. * diagnostic.h (pedantic_warning_kind, permissive_error_kind): Moved to diagnostic.c. (struct diagnostic_context): Use correct type for classify_diagnostic. (diagnostic_report_diagnostic): Update declaration. (emit_diagnostic): Declare. * errors.c (warning): Return bool. * errors.h (warning): Update declaration. * toplev.h (warning0, pedwarn0): Delete. (warning, warning_at, pedwarn, permerror): Return bool. * c-errors.c (pedwarn_c99, pedwarn_c90): Use DK_PEDWARN. * c-decl.c (locate_old_decl): Delete 'diag' argument. Always use inform. Update all calls. (diagnose_mismatched_decls): Check return value of warning/pedwarn before giving informative note. (implicit_decl_warning): Likewise. * c-typeck.c (build_function_call): Likewise. * tree-sssa.c (warn_uninit): Likewise. * builtins.c (gimplify_va_arg_expr): Likewise. fortran/ * f95-lang.c (gfc_mark_addressable): Use "pedwarn (0," instead of 'pedwarn0'. cp/ * cp-tree.h (struct diagnostic_context, struct diagnostic_info): Delete forward declarations. Check that toplev.h has not been included before this file. Include toplev.h and diagnostic.h. * error.c (cp_cpp_error): Use DK_PEDWARN. (cxx_incomplete_type_diagnostic): Update declaration. (cxx_incomplete_type_error): Use DK_ERROR. * typeck2.c (cxx_incomplete_type_diagnostic): Take a diagnostic_t as argument. Use emit_diagnostic. (cxx_incomplete_type_error): Use DK_ERROR. (add_exception_specifier): Use diagnostic_t instead of custom codes. * typeck.c (complete_type_or_else): Update call to cxx_incomplete_type_diagnostic. * init.c (build_delete): Likewise. * call.c (diagnostic_fn_t): Remove unused typedef. (build_temp): Pass a pointer to diagnostic_t. (convert_like_real): Use emit_diagnostic. (joust): Check return value of warning before giving informative note. * friend.c (do_friend): Check return value of warning before giving informative note. * parser.c (cp_parser_template_id): Likewise. testsuite/ * gcc.dg/pr36901-1.c: New. * gcc.dg/pr36901-3.c: New. * gcc.dg/pr36901-2.c: New. * gcc.dg/pr36901-4.c: New. * gcc.dg/pr36901-system.h: New. * gcc.dg/pr36901.h: New. * gcc.target/powerpc/altivec-macros.c: Update. * gcc.target/i386/regparm.c: Update. * gcc.dg/funcdef-var-1.c: Update. * gcc.dg/parm-mismatch-1.c: Update. * gcc.dg/attr-noinline.c: Update. * gcc.dg/wtr-static-1.c: Update. * gcc.dg/redecl-11.c: Update. * gcc.dg/pr27953.c: Update. * gcc.dg/proto-1.c: Update. * gcc.dg/decl-3.c: Update. * gcc.dg/redecl-13.c: Update. * gcc.dg/pr15360-1.c: Update. * gcc.dg/redecl-15.c: Update. * gcc.dg/enum-compat-1.c: Update. * gcc.dg/dll-3.c: Update. * gcc.dg/array-5.c: Update. * gcc.dg/Wredundant-decls-2.c: Update. * gcc.dg/inline4.c: Update. * gcc.dg/redecl-2.c: Update. * gcc.dg/inline-14.c: Update. * gcc.dg/tls/diag-3.c: Update. * gcc.dg/funcdef-var-2.c: Update. * gcc.dg/20041213-1.c: Update. * gcc.dg/old-style-then-proto-1.c: Update. * gcc.dg/decl-2.c: Update. * gcc.dg/redecl-12.c: Update. * gcc.dg/decl-4.c: Update. * gcc.dg/Wshadow-1.c: Update. * gcc.dg/transparent-union-2.c: Update. * gcc.dg/visibility-7.c: Update. * gcc.dg/dll-2.c: Update. * gcc.dg/redecl-16.c: Update. * gcc.dg/inline1.c: Update. * gcc.dg/decl-8.c: Update. * gcc.dg/nested-redef-1.c: Update. * gcc.dg/inline3.c: Update. * gcc.dg/redecl-1.c: Update. * gcc.dg/inline5.c: Update. * gcc.dg/pr35899.c: Update. * gcc.dg/noncompile/label-lineno-1.c: Update. * gcc.dg/noncompile/label-1.c: Update. * gcc.dg/noncompile/20020220-1.c: Update. * gcc.dg/noncompile/redecl-1.c: Update. * gcc.dg/redecl-5.c: Update. * gcc.dg/qual-return-3.c: Update. * gcc.dg/label-decl-4.c: Update. From-SVN: r138893
2008-08-09 01:57:19 +02:00
return false;
}
/* If we changed the kind due to -Werror, and didn't override it, we
need to print this message. */
if (context->issue_warnings_are_errors_message
&& maybe_print_warnings_as_errors_message)
{
pp_verbatim (context->printer,
"%s: warnings being treated as errors\n", progname);
context->issue_warnings_are_errors_message = false;
}
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
if (diagnostic->kind == DK_ICE)
{
#ifndef ENABLE_CHECKING
/* When not checking, ICEs are converted to fatal errors when an
error has already occurred. This is counteracted by
abort_on_error. */
if ((diagnostic_kind_count (context, DK_ERROR) > 0
|| diagnostic_kind_count (context, DK_SORRY) > 0)
&& !context->abort_on_error)
{
expanded_location s = expand_location (diagnostic->location);
fnotice (stderr, "%s:%d: confused by earlier errors, bailing out\n",
s.file, s.line);
exit (ICE_EXIT_CODE);
}
#endif
if (context->internal_error)
(*context->internal_error) (diagnostic->message.format_spec,
diagnostic->message.args_ptr);
}
++diagnostic_kind_count (context, diagnostic->kind);
saved_format_spec = diagnostic->message.format_spec;
if (context->show_option_requested && diagnostic->option_index)
diagnostic->message.format_spec
= ACONCAT ((diagnostic->message.format_spec,
" [", cl_options[diagnostic->option_index].opt_text, "]", NULL));
diagnostic->message.locus = &diagnostic->location;
diagnostic->message.abstract_origin = &diagnostic->abstract_origin;
diagnostic->abstract_origin = NULL;
pp_format (context->printer, &diagnostic->message);
(*diagnostic_starter (context)) (context, diagnostic);
pp_output_formatted_text (context->printer);
(*diagnostic_finalizer (context)) (context, diagnostic);
pp_flush (context->printer);
diagnostic_action_after_output (context, diagnostic);
diagnostic->message.format_spec = saved_format_spec;
diagnostic->abstract_origin = NULL;
diagnostic.c (diagnostic_for_decl): Take a diagnostic_context argument. * diagnostic.c (diagnostic_for_decl): Take a diagnostic_context argument. Restructure to be consistent with diagnostic_report_diagnostic. (diagnostic_count_diagnostic): Now static. Take a diagnostic_info argument, not just a diagnostic_t. Some code moved here from internal_error. Move a case label for clarity. (diagnostic_action_after_output): New function. Code moved here from internal_error and fatal_error. (bug_report_request): New #define so that this text appears in only one place. (diagnostic_report_diagnostic): Update to match changes to diagnostic_count_diagnostic. Call diagnostic_action_after_output. (diagnostic_set_info): Call gettext here. (pedwarn): Update comment. Don't call gettext here. (sorry): Use report_diagnostic. Don't call gettext here. (fatal_error): Remove final fnotice and exit, but call real_abort to prevent warnings about noreturn function returning. (internal_error): Likewise. Don't do ICE suppression here nor call context->internal_error. (warning_with_decl): Suppress for decls in system headers. Adjust call to diagnostic_for_decl. (pedwarn_with_decl): Likewise. (error_with_decl): Adjust call to diagnostic_for_decl. (error_recursion): Use bug_report_request. * diagnostic.h: Remove prototype of diagnostic_count_diagnostic. * objc/objc-act.c (error_with_ivar, warn_with_method): Don't call diagnostic_count_diagnostic. f: * bad.c: Don't call diagnostic_count_diagnostic. From-SVN: r66728
2003-05-12 20:32:18 +02:00
context->lock--;
re PR other/36901 (pedwarn() + -pedantic-errors + -w (inhibit_warnings) should not emit errors) 2008-08-09 Manuel Lopez-Ibanez <manu@gcc.gnu.org> PR 36901 * diagnostic.def (DK_PEDWARN, DK_PERMERROR): New. * diagnostic.c (pedantic_warning_kind, permissive_error_kind): Moved from diagnostic.h (diagnostic_report_diagnostic): Return bool. Handle DK_PEDWARN and DK_PERMERROR. (emit_diagnostic): New. (warning0, pedwarn0): Delete. (warning, warning_at, pedwarn, permerror): Return bool. * diagnostic.h (pedantic_warning_kind, permissive_error_kind): Moved to diagnostic.c. (struct diagnostic_context): Use correct type for classify_diagnostic. (diagnostic_report_diagnostic): Update declaration. (emit_diagnostic): Declare. * errors.c (warning): Return bool. * errors.h (warning): Update declaration. * toplev.h (warning0, pedwarn0): Delete. (warning, warning_at, pedwarn, permerror): Return bool. * c-errors.c (pedwarn_c99, pedwarn_c90): Use DK_PEDWARN. * c-decl.c (locate_old_decl): Delete 'diag' argument. Always use inform. Update all calls. (diagnose_mismatched_decls): Check return value of warning/pedwarn before giving informative note. (implicit_decl_warning): Likewise. * c-typeck.c (build_function_call): Likewise. * tree-sssa.c (warn_uninit): Likewise. * builtins.c (gimplify_va_arg_expr): Likewise. fortran/ * f95-lang.c (gfc_mark_addressable): Use "pedwarn (0," instead of 'pedwarn0'. cp/ * cp-tree.h (struct diagnostic_context, struct diagnostic_info): Delete forward declarations. Check that toplev.h has not been included before this file. Include toplev.h and diagnostic.h. * error.c (cp_cpp_error): Use DK_PEDWARN. (cxx_incomplete_type_diagnostic): Update declaration. (cxx_incomplete_type_error): Use DK_ERROR. * typeck2.c (cxx_incomplete_type_diagnostic): Take a diagnostic_t as argument. Use emit_diagnostic. (cxx_incomplete_type_error): Use DK_ERROR. (add_exception_specifier): Use diagnostic_t instead of custom codes. * typeck.c (complete_type_or_else): Update call to cxx_incomplete_type_diagnostic. * init.c (build_delete): Likewise. * call.c (diagnostic_fn_t): Remove unused typedef. (build_temp): Pass a pointer to diagnostic_t. (convert_like_real): Use emit_diagnostic. (joust): Check return value of warning before giving informative note. * friend.c (do_friend): Check return value of warning before giving informative note. * parser.c (cp_parser_template_id): Likewise. testsuite/ * gcc.dg/pr36901-1.c: New. * gcc.dg/pr36901-3.c: New. * gcc.dg/pr36901-2.c: New. * gcc.dg/pr36901-4.c: New. * gcc.dg/pr36901-system.h: New. * gcc.dg/pr36901.h: New. * gcc.target/powerpc/altivec-macros.c: Update. * gcc.target/i386/regparm.c: Update. * gcc.dg/funcdef-var-1.c: Update. * gcc.dg/parm-mismatch-1.c: Update. * gcc.dg/attr-noinline.c: Update. * gcc.dg/wtr-static-1.c: Update. * gcc.dg/redecl-11.c: Update. * gcc.dg/pr27953.c: Update. * gcc.dg/proto-1.c: Update. * gcc.dg/decl-3.c: Update. * gcc.dg/redecl-13.c: Update. * gcc.dg/pr15360-1.c: Update. * gcc.dg/redecl-15.c: Update. * gcc.dg/enum-compat-1.c: Update. * gcc.dg/dll-3.c: Update. * gcc.dg/array-5.c: Update. * gcc.dg/Wredundant-decls-2.c: Update. * gcc.dg/inline4.c: Update. * gcc.dg/redecl-2.c: Update. * gcc.dg/inline-14.c: Update. * gcc.dg/tls/diag-3.c: Update. * gcc.dg/funcdef-var-2.c: Update. * gcc.dg/20041213-1.c: Update. * gcc.dg/old-style-then-proto-1.c: Update. * gcc.dg/decl-2.c: Update. * gcc.dg/redecl-12.c: Update. * gcc.dg/decl-4.c: Update. * gcc.dg/Wshadow-1.c: Update. * gcc.dg/transparent-union-2.c: Update. * gcc.dg/visibility-7.c: Update. * gcc.dg/dll-2.c: Update. * gcc.dg/redecl-16.c: Update. * gcc.dg/inline1.c: Update. * gcc.dg/decl-8.c: Update. * gcc.dg/nested-redef-1.c: Update. * gcc.dg/inline3.c: Update. * gcc.dg/redecl-1.c: Update. * gcc.dg/inline5.c: Update. * gcc.dg/pr35899.c: Update. * gcc.dg/noncompile/label-lineno-1.c: Update. * gcc.dg/noncompile/label-1.c: Update. * gcc.dg/noncompile/20020220-1.c: Update. * gcc.dg/noncompile/redecl-1.c: Update. * gcc.dg/redecl-5.c: Update. * gcc.dg/qual-return-3.c: Update. * gcc.dg/label-decl-4.c: Update. From-SVN: r138893
2008-08-09 01:57:19 +02:00
return true;
}
/* 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 (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] == '.' && IS_DIR_SEPARATOR (p[2]))
p += 3;
while (q[0] == '.' && q[1] == '.' && IS_DIR_SEPARATOR (q[2]))
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 && !IS_DIR_SEPARATOR (p[-1]))
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
exgettext: Handle gmsgid and cmsgid arguments specially, as gcc-internal-format and c-format. gcc/po/ * exgettext: Handle gmsgid and cmsgid arguments specially, as gcc-internal-format and c-format. Because of xgettext bug, invoke xgettext once with --language=c, once with --language=GCC-source and then merge together. Fail if xgettext is not 0.14.5 or later. gcc/ * intl.h (G_): New macro. * rtl-error.c (error_for_asm, warning_for_asm): Use gmsgid instead of msgid for argument name. * tree-ssa.c (warn_uninit): Likewise. * c-parser.c (c_parser_error): Likewise. * config/rs6000/rs6000-c.c (SYNTAX_ERROR): Likewise. * config/darwin-c.c (BAD): Likewise. * config/c4x/c4x-c.c (BAD): Likewise. * c-pragma.c (GCC_BAD, GCC_BAD2): Likewise. * c-errors.c (pedwarn_c99, pedwarn_c90): Likewise. * c-common.c (c_parse_error): Likewise. * diagnostic.c (diagnostic_set_info, verbatim, inform, warning, warning0, pedwarn, error, sorry, fatal_error, internal_error): Likewise. (fnotice): Use cmsgid instead of msgid for argument name. * gcov.c (fnotice): Likewise. * protoize.c (notice): Likewise. * final.c (output_operand_lossage): Likewise. * gcc.c (fatal, notice): Likewise. (error): Use gmsgid instead of msgid for argument name. * collect2.c (notice, fatal_perror, fatal): Use cmsgid instead of msgid for argument name. (error): Use gmsgid instead of msgid for argument name. * c-decl.c (locate_old_decl, implicit_decl_warning): Use G_() instead of N_(). * c-typeck.c (readonly_error, convert_for_assignment): Likewise. * tree-inline.c (inline_forbidden_p_1): Likewise. * ABOUT-GCC-NLS: Require gettext 0.14.5 or later. Mention the new conventions for marking translations. * doc/install.texi: Mention gettext 0.14.5 or later requirement. gcc/cp/ * error.c (locate_error): Use gmsgid instead of msgid for argument name. (cp_error_at, cp_warning_at, cp_pedwarn_at): Likewise. gcc/java/ * jv-scan.c (fatal_error, warning, warning0): Use gmsgid instead of msgid for argument name. * gjavah.c (error): Likewise. * java-tree.h (parse_error_context): Likewise. * parse.y (parse_error_context, parse_warning_context, issue_warning_error_from_context): Likewise. From-SVN: r100676
2005-06-06 21:31:40 +02:00
verbatim (const char *gmsgid, ...)
{
text_info text;
builtins.c (validate_arglist): Eliminate libiberty VA_ macros, always use stdarg. gcc: * builtins.c (validate_arglist): Eliminate libiberty VA_ macros, always use stdarg. * c-errors.c (pedwarn_c99): Likewise. * c-format.c (status_warning): Likewise. * c-semantics.c (build_stmt): Likewise. * calls.c (emit_library_call, emit_library_call_value): Likewise. * collect2.c (notice, fatal_perror, fatal, error): Likewise. * cpperror.c (cpp_error, cpp_error_with_line): Likewise. * diagnostic.c (build_message_string, output_printf, output_verbatim, verbatim, inform, warning, pedwarn, error, sorry, fatal_error, internal_error, warning_with_decl, pedwarn_with_decl, error_with_decl, fnotice): Likewise. * dwarf2asm.c (dw2_asm_output_data, dw2_asm_output_delta, dw2_asm_output_offset, dw2_asm_output_pcrel, dw2_asm_output_addr, dw2_asm_output_addr_rtx, dw2_asm_output_nstring, dw2_asm_output_data_uleb128, dw2_asm_output_data_sleb128, dw2_asm_output_delta_uleb128, dw2_asm_output_delta_sleb128, dw2_asm_output_encoded_addr_rtx): Likewise. * emit-rtl.c (gen_rtx, gen_rtvec): Likewise. * errors.c (warning, error, fatal, internal_error): Likewise. * final.c (output_operand_lossage, asm_fprintf): Likewise. * fix-header.c (fatal): Likewise. * gcc.c (fatal, error, notice): Likewise. * gcov.c (fnotice): Likewise. * genattrtab.c (attr_rtx, attr_printf): Likewise. * gengtype.c (error_at_line, xasprintf, oprintf): Likewise. * gensupport.c (message_with_line): Likewise. * mips-tfile.c (fatal, error): Likewise. * protoize.c (notice): Likewise. * ra-debug.c (ra_debug_msg): Likewise. * read-rtl.c (fatal_with_file_and_line): Likewise. * rtl-error.c (error_for_asm, warning_for_asm): Likewise. * tree.c (build, build_nt, build_function_type_list): Likewise. cp: * error.c (cp_error_at, cp_warning_at, cp_pedwarn_at): Eliminate libiberty VA_ macros, always use stdarg. * rtti.c (create_pseudo_type_info): Likewise. * tree.c (build_min_nt, build_min): Likewise. From-SVN: r66919
2003-05-18 00:21:35 +02:00
va_list ap;
exgettext: Handle gmsgid and cmsgid arguments specially, as gcc-internal-format and c-format. gcc/po/ * exgettext: Handle gmsgid and cmsgid arguments specially, as gcc-internal-format and c-format. Because of xgettext bug, invoke xgettext once with --language=c, once with --language=GCC-source and then merge together. Fail if xgettext is not 0.14.5 or later. gcc/ * intl.h (G_): New macro. * rtl-error.c (error_for_asm, warning_for_asm): Use gmsgid instead of msgid for argument name. * tree-ssa.c (warn_uninit): Likewise. * c-parser.c (c_parser_error): Likewise. * config/rs6000/rs6000-c.c (SYNTAX_ERROR): Likewise. * config/darwin-c.c (BAD): Likewise. * config/c4x/c4x-c.c (BAD): Likewise. * c-pragma.c (GCC_BAD, GCC_BAD2): Likewise. * c-errors.c (pedwarn_c99, pedwarn_c90): Likewise. * c-common.c (c_parse_error): Likewise. * diagnostic.c (diagnostic_set_info, verbatim, inform, warning, warning0, pedwarn, error, sorry, fatal_error, internal_error): Likewise. (fnotice): Use cmsgid instead of msgid for argument name. * gcov.c (fnotice): Likewise. * protoize.c (notice): Likewise. * final.c (output_operand_lossage): Likewise. * gcc.c (fatal, notice): Likewise. (error): Use gmsgid instead of msgid for argument name. * collect2.c (notice, fatal_perror, fatal): Use cmsgid instead of msgid for argument name. (error): Use gmsgid instead of msgid for argument name. * c-decl.c (locate_old_decl, implicit_decl_warning): Use G_() instead of N_(). * c-typeck.c (readonly_error, convert_for_assignment): Likewise. * tree-inline.c (inline_forbidden_p_1): Likewise. * ABOUT-GCC-NLS: Require gettext 0.14.5 or later. Mention the new conventions for marking translations. * doc/install.texi: Mention gettext 0.14.5 or later requirement. gcc/cp/ * error.c (locate_error): Use gmsgid instead of msgid for argument name. (cp_error_at, cp_warning_at, cp_pedwarn_at): Likewise. gcc/java/ * jv-scan.c (fatal_error, warning, warning0): Use gmsgid instead of msgid for argument name. * gjavah.c (error): Likewise. * java-tree.h (parse_error_context): Likewise. * parse.y (parse_error_context, parse_warning_context, issue_warning_error_from_context): Likewise. From-SVN: r100676
2005-06-06 21:31:40 +02:00
va_start (ap, gmsgid);
text.err_no = errno;
text.args_ptr = &ap;
exgettext: Handle gmsgid and cmsgid arguments specially, as gcc-internal-format and c-format. gcc/po/ * exgettext: Handle gmsgid and cmsgid arguments specially, as gcc-internal-format and c-format. Because of xgettext bug, invoke xgettext once with --language=c, once with --language=GCC-source and then merge together. Fail if xgettext is not 0.14.5 or later. gcc/ * intl.h (G_): New macro. * rtl-error.c (error_for_asm, warning_for_asm): Use gmsgid instead of msgid for argument name. * tree-ssa.c (warn_uninit): Likewise. * c-parser.c (c_parser_error): Likewise. * config/rs6000/rs6000-c.c (SYNTAX_ERROR): Likewise. * config/darwin-c.c (BAD): Likewise. * config/c4x/c4x-c.c (BAD): Likewise. * c-pragma.c (GCC_BAD, GCC_BAD2): Likewise. * c-errors.c (pedwarn_c99, pedwarn_c90): Likewise. * c-common.c (c_parse_error): Likewise. * diagnostic.c (diagnostic_set_info, verbatim, inform, warning, warning0, pedwarn, error, sorry, fatal_error, internal_error): Likewise. (fnotice): Use cmsgid instead of msgid for argument name. * gcov.c (fnotice): Likewise. * protoize.c (notice): Likewise. * final.c (output_operand_lossage): Likewise. * gcc.c (fatal, notice): Likewise. (error): Use gmsgid instead of msgid for argument name. * collect2.c (notice, fatal_perror, fatal): Use cmsgid instead of msgid for argument name. (error): Use gmsgid instead of msgid for argument name. * c-decl.c (locate_old_decl, implicit_decl_warning): Use G_() instead of N_(). * c-typeck.c (readonly_error, convert_for_assignment): Likewise. * tree-inline.c (inline_forbidden_p_1): Likewise. * ABOUT-GCC-NLS: Require gettext 0.14.5 or later. Mention the new conventions for marking translations. * doc/install.texi: Mention gettext 0.14.5 or later requirement. gcc/cp/ * error.c (locate_error): Use gmsgid instead of msgid for argument name. (cp_error_at, cp_warning_at, cp_pedwarn_at): Likewise. gcc/java/ * jv-scan.c (fatal_error, warning, warning0): Use gmsgid instead of msgid for argument name. * gjavah.c (error): Likewise. * java-tree.h (parse_error_context): Likewise. * parse.y (parse_error_context, parse_warning_context, issue_warning_error_from_context): Likewise. From-SVN: r100676
2005-06-06 21:31:40 +02:00
text.format_spec = _(gmsgid);
pretty-print.h (PP_NL_ARGMAX): New. gcc: * pretty-print.h (PP_NL_ARGMAX): New. (text_info): Add locus. (struct chunk_info): New. (output_buffer): Add formatted_obstack, chunk_obstack, and cur_chunk_array. Change obstack to a pointer. (pp_wrapping_mode_t, pp_wrapping_mode, pp_set_verbatim_wrapping): New. (struct pretty_print_info): Replace ideal_maximum_length and prefixing_rule with wrapping. (pp_line_cutoff, pp_prefixing_rule): Update to match. Update prototypes and wrapper macros throughout. * pretty-print.c (pp_formatted_text_data, pp_append_r) (pp_base_clear_output_area, pp_construct, pp_base_formatted_text) (pp_base_last_position_in_text, pp_base_newline, pp_base_character): Update for changes to pp structure. (pp_base_prepare_to_format, pp_base_format_text): Delete. (pp_base_format, pp_base_output_formatted_text): New functions. (pp_base_format_verbatim): Use pp_set_verbatim_wrapping. (pp_verbatim): Clear text.locus. (pp_printf): Likewise. Use pp_format and pp_output_formatted_text. * c-objc-common.c (c_tree_printer): Update function signature. * diagnostic.c (diagnostic_initialize): Update for changes to pp structure. (diagnostic_report_diagnostic): Call pp_format and then pp_output_formatted_text. (verbatim): Clear text.locus. * diagnostic.h (diagnostic_prefixing_rule, diagnostic_line_cutoff): Update for changes to pp structure. * c-lang.c: No need to include c-pretty-print.h. * Makefile.in: Remove bogus line containing only a tab. (c-lang.o): Update dependencies. * toplev.c (announce_function): Don't use verbatim. (default_tree_printer): Update signature. * objc/objc-lang.c: No need to include c-pretty-print.h. * objc/Make-lang.in: Update dependencies. gcc/cp: * cp-lang.c: No need to include cxx-pretty-print.h. * error.c (cp_printer): Update signature. No need to process flags. (print_instantiation_partial_context): Output last newline with pp_base_newline. * Make-lang.in: Update dependencies. gcc/objcp: * objcp-lang.c: No need to include cxx-pretty-print.h. * Make-lang.in: Update dependencies. Co-Authored-By: Jakub Jelinek <jakub@redhat.com> From-SVN: r101481
2005-07-01 01:09:06 +02:00
text.locus = NULL;
builtins.c (expand_builtin, [...]): Use new %K format string specifier for diagnostics. * builtins.c (expand_builtin, expand_builtin_object_size, expand_builtin_memory_chk, maybe_emit_chk_warning, maybe_emit_sprintf_chk_warning): Use new %K format string specifier for diagnostics. * expr.c (expand_expr_real_1): Likewise. * langhooks-def.h (struct diagnostic_info): Add forward decl. (lhd_print_error_function): Add third argument. * langhooks.h (struct diagnostic_info): Add forward decl. (struct lang_hooks): Add third argument to print_error_function. * diagnostic.h (diagnostic_info): Add abstract_origin field. (diagnostic_last_function_changed, diagnostic_set_last_function): Add second argument. (diagnostic_report_current_function): Likewise. * toplev.c (announce_function): Pass NULL as second argument to diagnostic_set_last_function. * diagnostic.c (diagnostic_report_current_function): Add second argument, pass it as third argument to lang_hooks.print_error_function. (default_diagnostic_starter): Pass DIAGNOSTIC as second argument to diagnostic_report_current_function. (diagnostic_report_diagnostic): Initialize diagnostic->abstract_origin and message.abstract_origin. (verbatim): Initialize abstract_origin. * pretty-print.h (text_info): Add abstract_origin field. * pretty-print.c (pp_base_format): Handle %K. * langhooks.c (lhd_print_error_function): Add third argument. If diagnostic->abstract_origin, print virtual backtrace. * c-format.c (gcc_diag_char_table, gcc_tdiag_char_table, gcc_cdiag_char_table, gcc_cxxdiag_char_table): Support %K. (init_dynamic_diag_info): Likewise. cp/ * error.c (cxx_print_error_function): Add third argument, pass it over to lhd_print_error_function. (cp_print_error_function): If diagnostic->abstract_origin, print virtual backtrace. * cp-tree.h (struct diagnostic_info): New forward decl. (cxx_print_error_function): Add third argument. java/ * lang.c (java_print_error_function): Add third argument. testsuite/ * lib/prune.exp: Prune also "^In function .*$" lines and "^ inlined from .*$" lines. From-SVN: r128830
2007-09-27 09:24:58 +02:00
text.abstract_origin = NULL;
Remove pedwarn_with_decl, warning_with_decl and error_with_decl from GCC. Remove pedwarn_with_decl, warning_with_decl and error_with_decl from GCC. * calls.c (try_to_integrate): Don't use xxx_with_decl. (expand_call): Likewise. * dwarfout.c (output_reg_number): Likewise. * expr.c (expand_expr): Likewise. * function.c (assign_temp): Likewise. (uninitialized_vars_warning): Likewise. (setjmp_args_warning): Likewise. (expand_function_end): Likewise. * stmt.c (fixup_gotos): Likewise. (warn_about_unused_variables): Likewise. (expand_end_bindings): Likewise. * stor-layout.c (layout_decl): Likewise. (place_field): Likewise. * toplev.c (check_global_declarations): Likewise. (rest_of_handle_inlining): Likewise. (default_tree_printer): New function. (general_init): Initialize diagnostic machinery before routing signals to the ICE machinery. Set default tree printer. * toplev.h (pedwarn_with_decl): Remove declaration. (warning_with_decl): Likewise. (error_with_decl): Likewise. (pedwarn): Remove attribute for the time being. * tree-inline.c (expand_call_inline): Don't use xxx_with_decl. * varasm.c (named_section): Likewise. (make_decl_rtl): Likewise. (assemble_variable): Likewise. (merge_weak): Likewise. (declare_weak): Likewise. * diagnostic.h: Move non-diagnostic stuff into pretty-print.h. * diagnostic.c: Move non-diagnostic stuff into pretty-print.c. (format_with_decl): Remove. (diagnostic_for_decl): Likewise. (pedwarn_with_decl): Likewise. (warning_with_decl): Likewise. (error_with_decl): Likewise. (diagnostic_initialize): Adjust. (diagnostic_count_diagnostic): Likewise. (announce_function): Likewise. (lhd_print_error_function): Likewise. (diagnostic_report_current_module): Likewise. (default_diagnostic_starter): Likewise. (diagnostic_report_diagnostic): Likewise. (default_diagnostic_finalizer): Likewise. (verbatim): Likewise. (error): Likewise. (warning): Likewise. * opts.c (common_handle_option): Likewise. * pretty-print.c: New file. * c-pretty-print.h (pp_base): Override. * c-pretty-print.c: Adjust use of macros throughout. (pp_buffer): New macro. (pp_newline): Likewise. * c-objc-common.c (c_tree_printer): Adjust prototype. Tidy. * Makefile.in (DIAGNOSTIC_H): New variable. (c-errors.o): Use it. (c-objc-common.o): Likewise. (c-common.o): Likewise. (c-opts.o): Likewise. (c-format.o): Likewise. (diagnostic.o): Likewise. (opts.o): Likewise. (toplev.o): Likewise. (rtl-error.o): Likewise. (dwarf2out.o): Likewise. (jump.o): Likewise. (pretty-print.o): New rule. cp/ * Make-lang.in (cp/error.o): Depend on DIAGNOSTIC_H. * error.c: Use the new pretty-printer fraamework. From-SVN: r69773
2003-07-25 11:52:32 +02:00
pp_format_verbatim (global_dc->printer, &text);
pp_flush (global_dc->printer);
builtins.c (validate_arglist): Eliminate libiberty VA_ macros, always use stdarg. gcc: * builtins.c (validate_arglist): Eliminate libiberty VA_ macros, always use stdarg. * c-errors.c (pedwarn_c99): Likewise. * c-format.c (status_warning): Likewise. * c-semantics.c (build_stmt): Likewise. * calls.c (emit_library_call, emit_library_call_value): Likewise. * collect2.c (notice, fatal_perror, fatal, error): Likewise. * cpperror.c (cpp_error, cpp_error_with_line): Likewise. * diagnostic.c (build_message_string, output_printf, output_verbatim, verbatim, inform, warning, pedwarn, error, sorry, fatal_error, internal_error, warning_with_decl, pedwarn_with_decl, error_with_decl, fnotice): Likewise. * dwarf2asm.c (dw2_asm_output_data, dw2_asm_output_delta, dw2_asm_output_offset, dw2_asm_output_pcrel, dw2_asm_output_addr, dw2_asm_output_addr_rtx, dw2_asm_output_nstring, dw2_asm_output_data_uleb128, dw2_asm_output_data_sleb128, dw2_asm_output_delta_uleb128, dw2_asm_output_delta_sleb128, dw2_asm_output_encoded_addr_rtx): Likewise. * emit-rtl.c (gen_rtx, gen_rtvec): Likewise. * errors.c (warning, error, fatal, internal_error): Likewise. * final.c (output_operand_lossage, asm_fprintf): Likewise. * fix-header.c (fatal): Likewise. * gcc.c (fatal, error, notice): Likewise. * gcov.c (fnotice): Likewise. * genattrtab.c (attr_rtx, attr_printf): Likewise. * gengtype.c (error_at_line, xasprintf, oprintf): Likewise. * gensupport.c (message_with_line): Likewise. * mips-tfile.c (fatal, error): Likewise. * protoize.c (notice): Likewise. * ra-debug.c (ra_debug_msg): Likewise. * read-rtl.c (fatal_with_file_and_line): Likewise. * rtl-error.c (error_for_asm, warning_for_asm): Likewise. * tree.c (build, build_nt, build_function_type_list): Likewise. cp: * error.c (cp_error_at, cp_warning_at, cp_pedwarn_at): Eliminate libiberty VA_ macros, always use stdarg. * rtti.c (create_pseudo_type_info): Likewise. * tree.c (build_min_nt, build_min): Likewise. From-SVN: r66919
2003-05-18 00:21:35 +02:00
va_end (ap);
}
re PR other/36901 (pedwarn() + -pedantic-errors + -w (inhibit_warnings) should not emit errors) 2008-08-09 Manuel Lopez-Ibanez <manu@gcc.gnu.org> PR 36901 * diagnostic.def (DK_PEDWARN, DK_PERMERROR): New. * diagnostic.c (pedantic_warning_kind, permissive_error_kind): Moved from diagnostic.h (diagnostic_report_diagnostic): Return bool. Handle DK_PEDWARN and DK_PERMERROR. (emit_diagnostic): New. (warning0, pedwarn0): Delete. (warning, warning_at, pedwarn, permerror): Return bool. * diagnostic.h (pedantic_warning_kind, permissive_error_kind): Moved to diagnostic.c. (struct diagnostic_context): Use correct type for classify_diagnostic. (diagnostic_report_diagnostic): Update declaration. (emit_diagnostic): Declare. * errors.c (warning): Return bool. * errors.h (warning): Update declaration. * toplev.h (warning0, pedwarn0): Delete. (warning, warning_at, pedwarn, permerror): Return bool. * c-errors.c (pedwarn_c99, pedwarn_c90): Use DK_PEDWARN. * c-decl.c (locate_old_decl): Delete 'diag' argument. Always use inform. Update all calls. (diagnose_mismatched_decls): Check return value of warning/pedwarn before giving informative note. (implicit_decl_warning): Likewise. * c-typeck.c (build_function_call): Likewise. * tree-sssa.c (warn_uninit): Likewise. * builtins.c (gimplify_va_arg_expr): Likewise. fortran/ * f95-lang.c (gfc_mark_addressable): Use "pedwarn (0," instead of 'pedwarn0'. cp/ * cp-tree.h (struct diagnostic_context, struct diagnostic_info): Delete forward declarations. Check that toplev.h has not been included before this file. Include toplev.h and diagnostic.h. * error.c (cp_cpp_error): Use DK_PEDWARN. (cxx_incomplete_type_diagnostic): Update declaration. (cxx_incomplete_type_error): Use DK_ERROR. * typeck2.c (cxx_incomplete_type_diagnostic): Take a diagnostic_t as argument. Use emit_diagnostic. (cxx_incomplete_type_error): Use DK_ERROR. (add_exception_specifier): Use diagnostic_t instead of custom codes. * typeck.c (complete_type_or_else): Update call to cxx_incomplete_type_diagnostic. * init.c (build_delete): Likewise. * call.c (diagnostic_fn_t): Remove unused typedef. (build_temp): Pass a pointer to diagnostic_t. (convert_like_real): Use emit_diagnostic. (joust): Check return value of warning before giving informative note. * friend.c (do_friend): Check return value of warning before giving informative note. * parser.c (cp_parser_template_id): Likewise. testsuite/ * gcc.dg/pr36901-1.c: New. * gcc.dg/pr36901-3.c: New. * gcc.dg/pr36901-2.c: New. * gcc.dg/pr36901-4.c: New. * gcc.dg/pr36901-system.h: New. * gcc.dg/pr36901.h: New. * gcc.target/powerpc/altivec-macros.c: Update. * gcc.target/i386/regparm.c: Update. * gcc.dg/funcdef-var-1.c: Update. * gcc.dg/parm-mismatch-1.c: Update. * gcc.dg/attr-noinline.c: Update. * gcc.dg/wtr-static-1.c: Update. * gcc.dg/redecl-11.c: Update. * gcc.dg/pr27953.c: Update. * gcc.dg/proto-1.c: Update. * gcc.dg/decl-3.c: Update. * gcc.dg/redecl-13.c: Update. * gcc.dg/pr15360-1.c: Update. * gcc.dg/redecl-15.c: Update. * gcc.dg/enum-compat-1.c: Update. * gcc.dg/dll-3.c: Update. * gcc.dg/array-5.c: Update. * gcc.dg/Wredundant-decls-2.c: Update. * gcc.dg/inline4.c: Update. * gcc.dg/redecl-2.c: Update. * gcc.dg/inline-14.c: Update. * gcc.dg/tls/diag-3.c: Update. * gcc.dg/funcdef-var-2.c: Update. * gcc.dg/20041213-1.c: Update. * gcc.dg/old-style-then-proto-1.c: Update. * gcc.dg/decl-2.c: Update. * gcc.dg/redecl-12.c: Update. * gcc.dg/decl-4.c: Update. * gcc.dg/Wshadow-1.c: Update. * gcc.dg/transparent-union-2.c: Update. * gcc.dg/visibility-7.c: Update. * gcc.dg/dll-2.c: Update. * gcc.dg/redecl-16.c: Update. * gcc.dg/inline1.c: Update. * gcc.dg/decl-8.c: Update. * gcc.dg/nested-redef-1.c: Update. * gcc.dg/inline3.c: Update. * gcc.dg/redecl-1.c: Update. * gcc.dg/inline5.c: Update. * gcc.dg/pr35899.c: Update. * gcc.dg/noncompile/label-lineno-1.c: Update. * gcc.dg/noncompile/label-1.c: Update. * gcc.dg/noncompile/20020220-1.c: Update. * gcc.dg/noncompile/redecl-1.c: Update. * gcc.dg/redecl-5.c: Update. * gcc.dg/qual-return-3.c: Update. * gcc.dg/label-decl-4.c: Update. From-SVN: r138893
2008-08-09 01:57:19 +02:00
bool
emit_diagnostic (diagnostic_t kind, location_t location, int opt,
const char *gmsgid, ...)
{
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;
builtins.c (validate_arglist): Eliminate libiberty VA_ macros, always use stdarg. gcc: * builtins.c (validate_arglist): Eliminate libiberty VA_ macros, always use stdarg. * c-errors.c (pedwarn_c99): Likewise. * c-format.c (status_warning): Likewise. * c-semantics.c (build_stmt): Likewise. * calls.c (emit_library_call, emit_library_call_value): Likewise. * collect2.c (notice, fatal_perror, fatal, error): Likewise. * cpperror.c (cpp_error, cpp_error_with_line): Likewise. * diagnostic.c (build_message_string, output_printf, output_verbatim, verbatim, inform, warning, pedwarn, error, sorry, fatal_error, internal_error, warning_with_decl, pedwarn_with_decl, error_with_decl, fnotice): Likewise. * dwarf2asm.c (dw2_asm_output_data, dw2_asm_output_delta, dw2_asm_output_offset, dw2_asm_output_pcrel, dw2_asm_output_addr, dw2_asm_output_addr_rtx, dw2_asm_output_nstring, dw2_asm_output_data_uleb128, dw2_asm_output_data_sleb128, dw2_asm_output_delta_uleb128, dw2_asm_output_delta_sleb128, dw2_asm_output_encoded_addr_rtx): Likewise. * emit-rtl.c (gen_rtx, gen_rtvec): Likewise. * errors.c (warning, error, fatal, internal_error): Likewise. * final.c (output_operand_lossage, asm_fprintf): Likewise. * fix-header.c (fatal): Likewise. * gcc.c (fatal, error, notice): Likewise. * gcov.c (fnotice): Likewise. * genattrtab.c (attr_rtx, attr_printf): Likewise. * gengtype.c (error_at_line, xasprintf, oprintf): Likewise. * gensupport.c (message_with_line): Likewise. * mips-tfile.c (fatal, error): Likewise. * protoize.c (notice): Likewise. * ra-debug.c (ra_debug_msg): Likewise. * read-rtl.c (fatal_with_file_and_line): Likewise. * rtl-error.c (error_for_asm, warning_for_asm): Likewise. * tree.c (build, build_nt, build_function_type_list): Likewise. cp: * error.c (cp_error_at, cp_warning_at, cp_pedwarn_at): Eliminate libiberty VA_ macros, always use stdarg. * rtti.c (create_pseudo_type_info): Likewise. * tree.c (build_min_nt, build_min): Likewise. From-SVN: r66919
2003-05-18 00:21:35 +02:00
va_list ap;
exgettext: Handle gmsgid and cmsgid arguments specially, as gcc-internal-format and c-format. gcc/po/ * exgettext: Handle gmsgid and cmsgid arguments specially, as gcc-internal-format and c-format. Because of xgettext bug, invoke xgettext once with --language=c, once with --language=GCC-source and then merge together. Fail if xgettext is not 0.14.5 or later. gcc/ * intl.h (G_): New macro. * rtl-error.c (error_for_asm, warning_for_asm): Use gmsgid instead of msgid for argument name. * tree-ssa.c (warn_uninit): Likewise. * c-parser.c (c_parser_error): Likewise. * config/rs6000/rs6000-c.c (SYNTAX_ERROR): Likewise. * config/darwin-c.c (BAD): Likewise. * config/c4x/c4x-c.c (BAD): Likewise. * c-pragma.c (GCC_BAD, GCC_BAD2): Likewise. * c-errors.c (pedwarn_c99, pedwarn_c90): Likewise. * c-common.c (c_parse_error): Likewise. * diagnostic.c (diagnostic_set_info, verbatim, inform, warning, warning0, pedwarn, error, sorry, fatal_error, internal_error): Likewise. (fnotice): Use cmsgid instead of msgid for argument name. * gcov.c (fnotice): Likewise. * protoize.c (notice): Likewise. * final.c (output_operand_lossage): Likewise. * gcc.c (fatal, notice): Likewise. (error): Use gmsgid instead of msgid for argument name. * collect2.c (notice, fatal_perror, fatal): Use cmsgid instead of msgid for argument name. (error): Use gmsgid instead of msgid for argument name. * c-decl.c (locate_old_decl, implicit_decl_warning): Use G_() instead of N_(). * c-typeck.c (readonly_error, convert_for_assignment): Likewise. * tree-inline.c (inline_forbidden_p_1): Likewise. * ABOUT-GCC-NLS: Require gettext 0.14.5 or later. Mention the new conventions for marking translations. * doc/install.texi: Mention gettext 0.14.5 or later requirement. gcc/cp/ * error.c (locate_error): Use gmsgid instead of msgid for argument name. (cp_error_at, cp_warning_at, cp_pedwarn_at): Likewise. gcc/java/ * jv-scan.c (fatal_error, warning, warning0): Use gmsgid instead of msgid for argument name. * gjavah.c (error): Likewise. * java-tree.h (parse_error_context): Likewise. * parse.y (parse_error_context, parse_warning_context, issue_warning_error_from_context): Likewise. From-SVN: r100676
2005-06-06 21:31:40 +02:00
va_start (ap, gmsgid);
re PR other/36901 (pedwarn() + -pedantic-errors + -w (inhibit_warnings) should not emit errors) 2008-08-09 Manuel Lopez-Ibanez <manu@gcc.gnu.org> PR 36901 * diagnostic.def (DK_PEDWARN, DK_PERMERROR): New. * diagnostic.c (pedantic_warning_kind, permissive_error_kind): Moved from diagnostic.h (diagnostic_report_diagnostic): Return bool. Handle DK_PEDWARN and DK_PERMERROR. (emit_diagnostic): New. (warning0, pedwarn0): Delete. (warning, warning_at, pedwarn, permerror): Return bool. * diagnostic.h (pedantic_warning_kind, permissive_error_kind): Moved to diagnostic.c. (struct diagnostic_context): Use correct type for classify_diagnostic. (diagnostic_report_diagnostic): Update declaration. (emit_diagnostic): Declare. * errors.c (warning): Return bool. * errors.h (warning): Update declaration. * toplev.h (warning0, pedwarn0): Delete. (warning, warning_at, pedwarn, permerror): Return bool. * c-errors.c (pedwarn_c99, pedwarn_c90): Use DK_PEDWARN. * c-decl.c (locate_old_decl): Delete 'diag' argument. Always use inform. Update all calls. (diagnose_mismatched_decls): Check return value of warning/pedwarn before giving informative note. (implicit_decl_warning): Likewise. * c-typeck.c (build_function_call): Likewise. * tree-sssa.c (warn_uninit): Likewise. * builtins.c (gimplify_va_arg_expr): Likewise. fortran/ * f95-lang.c (gfc_mark_addressable): Use "pedwarn (0," instead of 'pedwarn0'. cp/ * cp-tree.h (struct diagnostic_context, struct diagnostic_info): Delete forward declarations. Check that toplev.h has not been included before this file. Include toplev.h and diagnostic.h. * error.c (cp_cpp_error): Use DK_PEDWARN. (cxx_incomplete_type_diagnostic): Update declaration. (cxx_incomplete_type_error): Use DK_ERROR. * typeck2.c (cxx_incomplete_type_diagnostic): Take a diagnostic_t as argument. Use emit_diagnostic. (cxx_incomplete_type_error): Use DK_ERROR. (add_exception_specifier): Use diagnostic_t instead of custom codes. * typeck.c (complete_type_or_else): Update call to cxx_incomplete_type_diagnostic. * init.c (build_delete): Likewise. * call.c (diagnostic_fn_t): Remove unused typedef. (build_temp): Pass a pointer to diagnostic_t. (convert_like_real): Use emit_diagnostic. (joust): Check return value of warning before giving informative note. * friend.c (do_friend): Check return value of warning before giving informative note. * parser.c (cp_parser_template_id): Likewise. testsuite/ * gcc.dg/pr36901-1.c: New. * gcc.dg/pr36901-3.c: New. * gcc.dg/pr36901-2.c: New. * gcc.dg/pr36901-4.c: New. * gcc.dg/pr36901-system.h: New. * gcc.dg/pr36901.h: New. * gcc.target/powerpc/altivec-macros.c: Update. * gcc.target/i386/regparm.c: Update. * gcc.dg/funcdef-var-1.c: Update. * gcc.dg/parm-mismatch-1.c: Update. * gcc.dg/attr-noinline.c: Update. * gcc.dg/wtr-static-1.c: Update. * gcc.dg/redecl-11.c: Update. * gcc.dg/pr27953.c: Update. * gcc.dg/proto-1.c: Update. * gcc.dg/decl-3.c: Update. * gcc.dg/redecl-13.c: Update. * gcc.dg/pr15360-1.c: Update. * gcc.dg/redecl-15.c: Update. * gcc.dg/enum-compat-1.c: Update. * gcc.dg/dll-3.c: Update. * gcc.dg/array-5.c: Update. * gcc.dg/Wredundant-decls-2.c: Update. * gcc.dg/inline4.c: Update. * gcc.dg/redecl-2.c: Update. * gcc.dg/inline-14.c: Update. * gcc.dg/tls/diag-3.c: Update. * gcc.dg/funcdef-var-2.c: Update. * gcc.dg/20041213-1.c: Update. * gcc.dg/old-style-then-proto-1.c: Update. * gcc.dg/decl-2.c: Update. * gcc.dg/redecl-12.c: Update. * gcc.dg/decl-4.c: Update. * gcc.dg/Wshadow-1.c: Update. * gcc.dg/transparent-union-2.c: Update. * gcc.dg/visibility-7.c: Update. * gcc.dg/dll-2.c: Update. * gcc.dg/redecl-16.c: Update. * gcc.dg/inline1.c: Update. * gcc.dg/decl-8.c: Update. * gcc.dg/nested-redef-1.c: Update. * gcc.dg/inline3.c: Update. * gcc.dg/redecl-1.c: Update. * gcc.dg/inline5.c: Update. * gcc.dg/pr35899.c: Update. * gcc.dg/noncompile/label-lineno-1.c: Update. * gcc.dg/noncompile/label-1.c: Update. * gcc.dg/noncompile/20020220-1.c: Update. * gcc.dg/noncompile/redecl-1.c: Update. * gcc.dg/redecl-5.c: Update. * gcc.dg/qual-return-3.c: Update. * gcc.dg/label-decl-4.c: Update. From-SVN: r138893
2008-08-09 01:57:19 +02:00
if (kind == DK_PERMERROR)
{
diagnostic_set_info (&diagnostic, gmsgid, &ap, location,
permissive_error_kind ());
diagnostic.option_index = OPT_fpermissive;
}
else {
diagnostic_set_info (&diagnostic, gmsgid, &ap, location, kind);
if (kind == DK_WARNING || kind == DK_PEDWARN)
diagnostic.option_index = opt;
}
builtins.c (validate_arglist): Eliminate libiberty VA_ macros, always use stdarg. gcc: * builtins.c (validate_arglist): Eliminate libiberty VA_ macros, always use stdarg. * c-errors.c (pedwarn_c99): Likewise. * c-format.c (status_warning): Likewise. * c-semantics.c (build_stmt): Likewise. * calls.c (emit_library_call, emit_library_call_value): Likewise. * collect2.c (notice, fatal_perror, fatal, error): Likewise. * cpperror.c (cpp_error, cpp_error_with_line): Likewise. * diagnostic.c (build_message_string, output_printf, output_verbatim, verbatim, inform, warning, pedwarn, error, sorry, fatal_error, internal_error, warning_with_decl, pedwarn_with_decl, error_with_decl, fnotice): Likewise. * dwarf2asm.c (dw2_asm_output_data, dw2_asm_output_delta, dw2_asm_output_offset, dw2_asm_output_pcrel, dw2_asm_output_addr, dw2_asm_output_addr_rtx, dw2_asm_output_nstring, dw2_asm_output_data_uleb128, dw2_asm_output_data_sleb128, dw2_asm_output_delta_uleb128, dw2_asm_output_delta_sleb128, dw2_asm_output_encoded_addr_rtx): Likewise. * emit-rtl.c (gen_rtx, gen_rtvec): Likewise. * errors.c (warning, error, fatal, internal_error): Likewise. * final.c (output_operand_lossage, asm_fprintf): Likewise. * fix-header.c (fatal): Likewise. * gcc.c (fatal, error, notice): Likewise. * gcov.c (fnotice): Likewise. * genattrtab.c (attr_rtx, attr_printf): Likewise. * gengtype.c (error_at_line, xasprintf, oprintf): Likewise. * gensupport.c (message_with_line): Likewise. * mips-tfile.c (fatal, error): Likewise. * protoize.c (notice): Likewise. * ra-debug.c (ra_debug_msg): Likewise. * read-rtl.c (fatal_with_file_and_line): Likewise. * rtl-error.c (error_for_asm, warning_for_asm): Likewise. * tree.c (build, build_nt, build_function_type_list): Likewise. cp: * error.c (cp_error_at, cp_warning_at, cp_pedwarn_at): Eliminate libiberty VA_ macros, always use stdarg. * rtti.c (create_pseudo_type_info): Likewise. * tree.c (build_min_nt, build_min): Likewise. From-SVN: r66919
2003-05-18 00:21:35 +02:00
va_end (ap);
re PR other/36901 (pedwarn() + -pedantic-errors + -w (inhibit_warnings) should not emit errors) 2008-08-09 Manuel Lopez-Ibanez <manu@gcc.gnu.org> PR 36901 * diagnostic.def (DK_PEDWARN, DK_PERMERROR): New. * diagnostic.c (pedantic_warning_kind, permissive_error_kind): Moved from diagnostic.h (diagnostic_report_diagnostic): Return bool. Handle DK_PEDWARN and DK_PERMERROR. (emit_diagnostic): New. (warning0, pedwarn0): Delete. (warning, warning_at, pedwarn, permerror): Return bool. * diagnostic.h (pedantic_warning_kind, permissive_error_kind): Moved to diagnostic.c. (struct diagnostic_context): Use correct type for classify_diagnostic. (diagnostic_report_diagnostic): Update declaration. (emit_diagnostic): Declare. * errors.c (warning): Return bool. * errors.h (warning): Update declaration. * toplev.h (warning0, pedwarn0): Delete. (warning, warning_at, pedwarn, permerror): Return bool. * c-errors.c (pedwarn_c99, pedwarn_c90): Use DK_PEDWARN. * c-decl.c (locate_old_decl): Delete 'diag' argument. Always use inform. Update all calls. (diagnose_mismatched_decls): Check return value of warning/pedwarn before giving informative note. (implicit_decl_warning): Likewise. * c-typeck.c (build_function_call): Likewise. * tree-sssa.c (warn_uninit): Likewise. * builtins.c (gimplify_va_arg_expr): Likewise. fortran/ * f95-lang.c (gfc_mark_addressable): Use "pedwarn (0," instead of 'pedwarn0'. cp/ * cp-tree.h (struct diagnostic_context, struct diagnostic_info): Delete forward declarations. Check that toplev.h has not been included before this file. Include toplev.h and diagnostic.h. * error.c (cp_cpp_error): Use DK_PEDWARN. (cxx_incomplete_type_diagnostic): Update declaration. (cxx_incomplete_type_error): Use DK_ERROR. * typeck2.c (cxx_incomplete_type_diagnostic): Take a diagnostic_t as argument. Use emit_diagnostic. (cxx_incomplete_type_error): Use DK_ERROR. (add_exception_specifier): Use diagnostic_t instead of custom codes. * typeck.c (complete_type_or_else): Update call to cxx_incomplete_type_diagnostic. * init.c (build_delete): Likewise. * call.c (diagnostic_fn_t): Remove unused typedef. (build_temp): Pass a pointer to diagnostic_t. (convert_like_real): Use emit_diagnostic. (joust): Check return value of warning before giving informative note. * friend.c (do_friend): Check return value of warning before giving informative note. * parser.c (cp_parser_template_id): Likewise. testsuite/ * gcc.dg/pr36901-1.c: New. * gcc.dg/pr36901-3.c: New. * gcc.dg/pr36901-2.c: New. * gcc.dg/pr36901-4.c: New. * gcc.dg/pr36901-system.h: New. * gcc.dg/pr36901.h: New. * gcc.target/powerpc/altivec-macros.c: Update. * gcc.target/i386/regparm.c: Update. * gcc.dg/funcdef-var-1.c: Update. * gcc.dg/parm-mismatch-1.c: Update. * gcc.dg/attr-noinline.c: Update. * gcc.dg/wtr-static-1.c: Update. * gcc.dg/redecl-11.c: Update. * gcc.dg/pr27953.c: Update. * gcc.dg/proto-1.c: Update. * gcc.dg/decl-3.c: Update. * gcc.dg/redecl-13.c: Update. * gcc.dg/pr15360-1.c: Update. * gcc.dg/redecl-15.c: Update. * gcc.dg/enum-compat-1.c: Update. * gcc.dg/dll-3.c: Update. * gcc.dg/array-5.c: Update. * gcc.dg/Wredundant-decls-2.c: Update. * gcc.dg/inline4.c: Update. * gcc.dg/redecl-2.c: Update. * gcc.dg/inline-14.c: Update. * gcc.dg/tls/diag-3.c: Update. * gcc.dg/funcdef-var-2.c: Update. * gcc.dg/20041213-1.c: Update. * gcc.dg/old-style-then-proto-1.c: Update. * gcc.dg/decl-2.c: Update. * gcc.dg/redecl-12.c: Update. * gcc.dg/decl-4.c: Update. * gcc.dg/Wshadow-1.c: Update. * gcc.dg/transparent-union-2.c: Update. * gcc.dg/visibility-7.c: Update. * gcc.dg/dll-2.c: Update. * gcc.dg/redecl-16.c: Update. * gcc.dg/inline1.c: Update. * gcc.dg/decl-8.c: Update. * gcc.dg/nested-redef-1.c: Update. * gcc.dg/inline3.c: Update. * gcc.dg/redecl-1.c: Update. * gcc.dg/inline5.c: Update. * gcc.dg/pr35899.c: Update. * gcc.dg/noncompile/label-lineno-1.c: Update. * gcc.dg/noncompile/label-1.c: Update. * gcc.dg/noncompile/20020220-1.c: Update. * gcc.dg/noncompile/redecl-1.c: Update. * gcc.dg/redecl-5.c: Update. * gcc.dg/qual-return-3.c: Update. * gcc.dg/label-decl-4.c: Update. From-SVN: r138893
2008-08-09 01:57:19 +02:00
return report_diagnostic (&diagnostic);
}
/* An informative note at LOCATION. Use this for additional details on an error
re PR other/36901 (pedwarn() + -pedantic-errors + -w (inhibit_warnings) should not emit errors) 2008-08-09 Manuel Lopez-Ibanez <manu@gcc.gnu.org> PR 36901 * diagnostic.def (DK_PEDWARN, DK_PERMERROR): New. * diagnostic.c (pedantic_warning_kind, permissive_error_kind): Moved from diagnostic.h (diagnostic_report_diagnostic): Return bool. Handle DK_PEDWARN and DK_PERMERROR. (emit_diagnostic): New. (warning0, pedwarn0): Delete. (warning, warning_at, pedwarn, permerror): Return bool. * diagnostic.h (pedantic_warning_kind, permissive_error_kind): Moved to diagnostic.c. (struct diagnostic_context): Use correct type for classify_diagnostic. (diagnostic_report_diagnostic): Update declaration. (emit_diagnostic): Declare. * errors.c (warning): Return bool. * errors.h (warning): Update declaration. * toplev.h (warning0, pedwarn0): Delete. (warning, warning_at, pedwarn, permerror): Return bool. * c-errors.c (pedwarn_c99, pedwarn_c90): Use DK_PEDWARN. * c-decl.c (locate_old_decl): Delete 'diag' argument. Always use inform. Update all calls. (diagnose_mismatched_decls): Check return value of warning/pedwarn before giving informative note. (implicit_decl_warning): Likewise. * c-typeck.c (build_function_call): Likewise. * tree-sssa.c (warn_uninit): Likewise. * builtins.c (gimplify_va_arg_expr): Likewise. fortran/ * f95-lang.c (gfc_mark_addressable): Use "pedwarn (0," instead of 'pedwarn0'. cp/ * cp-tree.h (struct diagnostic_context, struct diagnostic_info): Delete forward declarations. Check that toplev.h has not been included before this file. Include toplev.h and diagnostic.h. * error.c (cp_cpp_error): Use DK_PEDWARN. (cxx_incomplete_type_diagnostic): Update declaration. (cxx_incomplete_type_error): Use DK_ERROR. * typeck2.c (cxx_incomplete_type_diagnostic): Take a diagnostic_t as argument. Use emit_diagnostic. (cxx_incomplete_type_error): Use DK_ERROR. (add_exception_specifier): Use diagnostic_t instead of custom codes. * typeck.c (complete_type_or_else): Update call to cxx_incomplete_type_diagnostic. * init.c (build_delete): Likewise. * call.c (diagnostic_fn_t): Remove unused typedef. (build_temp): Pass a pointer to diagnostic_t. (convert_like_real): Use emit_diagnostic. (joust): Check return value of warning before giving informative note. * friend.c (do_friend): Check return value of warning before giving informative note. * parser.c (cp_parser_template_id): Likewise. testsuite/ * gcc.dg/pr36901-1.c: New. * gcc.dg/pr36901-3.c: New. * gcc.dg/pr36901-2.c: New. * gcc.dg/pr36901-4.c: New. * gcc.dg/pr36901-system.h: New. * gcc.dg/pr36901.h: New. * gcc.target/powerpc/altivec-macros.c: Update. * gcc.target/i386/regparm.c: Update. * gcc.dg/funcdef-var-1.c: Update. * gcc.dg/parm-mismatch-1.c: Update. * gcc.dg/attr-noinline.c: Update. * gcc.dg/wtr-static-1.c: Update. * gcc.dg/redecl-11.c: Update. * gcc.dg/pr27953.c: Update. * gcc.dg/proto-1.c: Update. * gcc.dg/decl-3.c: Update. * gcc.dg/redecl-13.c: Update. * gcc.dg/pr15360-1.c: Update. * gcc.dg/redecl-15.c: Update. * gcc.dg/enum-compat-1.c: Update. * gcc.dg/dll-3.c: Update. * gcc.dg/array-5.c: Update. * gcc.dg/Wredundant-decls-2.c: Update. * gcc.dg/inline4.c: Update. * gcc.dg/redecl-2.c: Update. * gcc.dg/inline-14.c: Update. * gcc.dg/tls/diag-3.c: Update. * gcc.dg/funcdef-var-2.c: Update. * gcc.dg/20041213-1.c: Update. * gcc.dg/old-style-then-proto-1.c: Update. * gcc.dg/decl-2.c: Update. * gcc.dg/redecl-12.c: Update. * gcc.dg/decl-4.c: Update. * gcc.dg/Wshadow-1.c: Update. * gcc.dg/transparent-union-2.c: Update. * gcc.dg/visibility-7.c: Update. * gcc.dg/dll-2.c: Update. * gcc.dg/redecl-16.c: Update. * gcc.dg/inline1.c: Update. * gcc.dg/decl-8.c: Update. * gcc.dg/nested-redef-1.c: Update. * gcc.dg/inline3.c: Update. * gcc.dg/redecl-1.c: Update. * gcc.dg/inline5.c: Update. * gcc.dg/pr35899.c: Update. * gcc.dg/noncompile/label-lineno-1.c: Update. * gcc.dg/noncompile/label-1.c: Update. * gcc.dg/noncompile/20020220-1.c: Update. * gcc.dg/noncompile/redecl-1.c: Update. * gcc.dg/redecl-5.c: Update. * gcc.dg/qual-return-3.c: Update. * gcc.dg/label-decl-4.c: Update. From-SVN: r138893
2008-08-09 01:57:19 +02:00
message. */
void
inform (location_t location, const char *gmsgid, ...)
diagnostic.c (warning): Accept parameter to classify warning option. * diagnostic.c (warning): Accept parameter to classify warning option. (warning0): New, for when a pointer to an error() like function is needed. * errors.c (warning): Likewise. * errors.h (warning, warning0): Adjust prototypes. * toplev.h (warning, warning0): Likewise. * attribs.c, builtins.c, c-common.c, c-decl.c, c-format.c, c-gimplify.c, c-lex.c, c-objc-common.c, c-opts.c, c-parser.c, c-pragma.c, c-typeck.c, calls.c, cgraph.c, coverage.c, emit-rtl.c, fold-const.c, fortran/trans-decl.c, function.c, gcse.c, genautomata.c, haifa-sched.c, opts.c, passes.c, regclass.c, reload1.c, stmt.c, stor-layout.c, toplev.c, tree-cfg.c, tree-dump.c, tree-inline.c, tree-mudflap.c, tree-optimize.c, tree-ssa.c, tree.c, varasm.c: Adjust warning() callers. * config/alpha/alpha.c, config/arc/arc.c, config/arm/arm.c, config/avr/avr.c, config/bfin/bfin.c, config/c4x/c4x-c.c, config/c4x/c4x.c, config/cris/cris.c, config/darwin-c.c, config/darwin.c, config/darwin.h, config/h8300/h8300.c, config/i386/cygming.h, config/i386/djgpp.h, config/i386/i386.c, config/i386/winnt.c, config/ia64/ia64-c.c, config/ia64/ia64.c, config/ip2k/ip2k.c, config/m32r/m32r.c, config/m68hc11/m68hc11.c, config/m68k/m68k.c, config/mcore/mcore.c, config/mips/mips.c, config/mmix/mmix.c, config/ns32k/ns32k.c, config/pa/pa-hpux11.h, config/pa/pa.c, config/rs6000/aix43.h, config/rs6000/aix51.h, config/rs6000/aix52.h, config/rs6000/darwin.h, config/rs6000/rs6000-c.c, config/rs6000/rs6000.c, config/s390/s390.c, config/sh/sh.c, config/sh/sh.h, config/sh/symbian.c, config/sol2-c.c, config/sol2.c, config/stormy16/stormy16.c, config/v850/v850-c.c, config/v850/v850.c, config/xtensa/xtensa.c: Adjust warning() callers. * ada/misc.c: Adjust warning() callers. * cp/call.c, cp/class.c, cp/cvt.c, cp/decl.c, cp/decl2.c, cp/except.c, cp/friend.c, cp/init.c, cp/lex.c, cp/mangle.c, cp/method.c, cp/name-lookup.c, cp/parser.c, cp/repo.c, cp/rtti.c, cp/tree.c, cp/typeck.c, cp/typeck2.c: Adjust warning() callers. * fortran/trans-decl.c: Adjust warning() callers. * java/class.c, java/decl.c, java/expr.c, java/jcf-io.c, java/jcf-parse.c, java/jv-scan.c, java/parse.y: Adjust warning() callers. * objc/objc-act.c: Adjust warning() callers. * treelang/parse.y: Adjust warning() callers. From-SVN: r98633
2005-04-23 23:29:07 +02:00
{
diagnostic_info diagnostic;
va_list ap;
exgettext: Handle gmsgid and cmsgid arguments specially, as gcc-internal-format and c-format. gcc/po/ * exgettext: Handle gmsgid and cmsgid arguments specially, as gcc-internal-format and c-format. Because of xgettext bug, invoke xgettext once with --language=c, once with --language=GCC-source and then merge together. Fail if xgettext is not 0.14.5 or later. gcc/ * intl.h (G_): New macro. * rtl-error.c (error_for_asm, warning_for_asm): Use gmsgid instead of msgid for argument name. * tree-ssa.c (warn_uninit): Likewise. * c-parser.c (c_parser_error): Likewise. * config/rs6000/rs6000-c.c (SYNTAX_ERROR): Likewise. * config/darwin-c.c (BAD): Likewise. * config/c4x/c4x-c.c (BAD): Likewise. * c-pragma.c (GCC_BAD, GCC_BAD2): Likewise. * c-errors.c (pedwarn_c99, pedwarn_c90): Likewise. * c-common.c (c_parse_error): Likewise. * diagnostic.c (diagnostic_set_info, verbatim, inform, warning, warning0, pedwarn, error, sorry, fatal_error, internal_error): Likewise. (fnotice): Use cmsgid instead of msgid for argument name. * gcov.c (fnotice): Likewise. * protoize.c (notice): Likewise. * final.c (output_operand_lossage): Likewise. * gcc.c (fatal, notice): Likewise. (error): Use gmsgid instead of msgid for argument name. * collect2.c (notice, fatal_perror, fatal): Use cmsgid instead of msgid for argument name. (error): Use gmsgid instead of msgid for argument name. * c-decl.c (locate_old_decl, implicit_decl_warning): Use G_() instead of N_(). * c-typeck.c (readonly_error, convert_for_assignment): Likewise. * tree-inline.c (inline_forbidden_p_1): Likewise. * ABOUT-GCC-NLS: Require gettext 0.14.5 or later. Mention the new conventions for marking translations. * doc/install.texi: Mention gettext 0.14.5 or later requirement. gcc/cp/ * error.c (locate_error): Use gmsgid instead of msgid for argument name. (cp_error_at, cp_warning_at, cp_pedwarn_at): Likewise. gcc/java/ * jv-scan.c (fatal_error, warning, warning0): Use gmsgid instead of msgid for argument name. * gjavah.c (error): Likewise. * java-tree.h (parse_error_context): Likewise. * parse.y (parse_error_context, parse_warning_context, issue_warning_error_from_context): Likewise. From-SVN: r100676
2005-06-06 21:31:40 +02:00
va_start (ap, gmsgid);
diagnostic_set_info (&diagnostic, gmsgid, &ap, location, DK_NOTE);
diagnostic.c (warning): Accept parameter to classify warning option. * diagnostic.c (warning): Accept parameter to classify warning option. (warning0): New, for when a pointer to an error() like function is needed. * errors.c (warning): Likewise. * errors.h (warning, warning0): Adjust prototypes. * toplev.h (warning, warning0): Likewise. * attribs.c, builtins.c, c-common.c, c-decl.c, c-format.c, c-gimplify.c, c-lex.c, c-objc-common.c, c-opts.c, c-parser.c, c-pragma.c, c-typeck.c, calls.c, cgraph.c, coverage.c, emit-rtl.c, fold-const.c, fortran/trans-decl.c, function.c, gcse.c, genautomata.c, haifa-sched.c, opts.c, passes.c, regclass.c, reload1.c, stmt.c, stor-layout.c, toplev.c, tree-cfg.c, tree-dump.c, tree-inline.c, tree-mudflap.c, tree-optimize.c, tree-ssa.c, tree.c, varasm.c: Adjust warning() callers. * config/alpha/alpha.c, config/arc/arc.c, config/arm/arm.c, config/avr/avr.c, config/bfin/bfin.c, config/c4x/c4x-c.c, config/c4x/c4x.c, config/cris/cris.c, config/darwin-c.c, config/darwin.c, config/darwin.h, config/h8300/h8300.c, config/i386/cygming.h, config/i386/djgpp.h, config/i386/i386.c, config/i386/winnt.c, config/ia64/ia64-c.c, config/ia64/ia64.c, config/ip2k/ip2k.c, config/m32r/m32r.c, config/m68hc11/m68hc11.c, config/m68k/m68k.c, config/mcore/mcore.c, config/mips/mips.c, config/mmix/mmix.c, config/ns32k/ns32k.c, config/pa/pa-hpux11.h, config/pa/pa.c, config/rs6000/aix43.h, config/rs6000/aix51.h, config/rs6000/aix52.h, config/rs6000/darwin.h, config/rs6000/rs6000-c.c, config/rs6000/rs6000.c, config/s390/s390.c, config/sh/sh.c, config/sh/sh.h, config/sh/symbian.c, config/sol2-c.c, config/sol2.c, config/stormy16/stormy16.c, config/v850/v850-c.c, config/v850/v850.c, config/xtensa/xtensa.c: Adjust warning() callers. * ada/misc.c: Adjust warning() callers. * cp/call.c, cp/class.c, cp/cvt.c, cp/decl.c, cp/decl2.c, cp/except.c, cp/friend.c, cp/init.c, cp/lex.c, cp/mangle.c, cp/method.c, cp/name-lookup.c, cp/parser.c, cp/repo.c, cp/rtti.c, cp/tree.c, cp/typeck.c, cp/typeck2.c: Adjust warning() callers. * fortran/trans-decl.c: Adjust warning() callers. * java/class.c, java/decl.c, java/expr.c, java/jcf-io.c, java/jcf-parse.c, java/jv-scan.c, java/parse.y: Adjust warning() callers. * objc/objc-act.c: Adjust warning() callers. * treelang/parse.y: Adjust warning() callers. From-SVN: r98633
2005-04-23 23:29:07 +02:00
report_diagnostic (&diagnostic);
va_end (ap);
}
re PR other/36901 (pedwarn() + -pedantic-errors + -w (inhibit_warnings) should not emit errors) 2008-08-09 Manuel Lopez-Ibanez <manu@gcc.gnu.org> PR 36901 * diagnostic.def (DK_PEDWARN, DK_PERMERROR): New. * diagnostic.c (pedantic_warning_kind, permissive_error_kind): Moved from diagnostic.h (diagnostic_report_diagnostic): Return bool. Handle DK_PEDWARN and DK_PERMERROR. (emit_diagnostic): New. (warning0, pedwarn0): Delete. (warning, warning_at, pedwarn, permerror): Return bool. * diagnostic.h (pedantic_warning_kind, permissive_error_kind): Moved to diagnostic.c. (struct diagnostic_context): Use correct type for classify_diagnostic. (diagnostic_report_diagnostic): Update declaration. (emit_diagnostic): Declare. * errors.c (warning): Return bool. * errors.h (warning): Update declaration. * toplev.h (warning0, pedwarn0): Delete. (warning, warning_at, pedwarn, permerror): Return bool. * c-errors.c (pedwarn_c99, pedwarn_c90): Use DK_PEDWARN. * c-decl.c (locate_old_decl): Delete 'diag' argument. Always use inform. Update all calls. (diagnose_mismatched_decls): Check return value of warning/pedwarn before giving informative note. (implicit_decl_warning): Likewise. * c-typeck.c (build_function_call): Likewise. * tree-sssa.c (warn_uninit): Likewise. * builtins.c (gimplify_va_arg_expr): Likewise. fortran/ * f95-lang.c (gfc_mark_addressable): Use "pedwarn (0," instead of 'pedwarn0'. cp/ * cp-tree.h (struct diagnostic_context, struct diagnostic_info): Delete forward declarations. Check that toplev.h has not been included before this file. Include toplev.h and diagnostic.h. * error.c (cp_cpp_error): Use DK_PEDWARN. (cxx_incomplete_type_diagnostic): Update declaration. (cxx_incomplete_type_error): Use DK_ERROR. * typeck2.c (cxx_incomplete_type_diagnostic): Take a diagnostic_t as argument. Use emit_diagnostic. (cxx_incomplete_type_error): Use DK_ERROR. (add_exception_specifier): Use diagnostic_t instead of custom codes. * typeck.c (complete_type_or_else): Update call to cxx_incomplete_type_diagnostic. * init.c (build_delete): Likewise. * call.c (diagnostic_fn_t): Remove unused typedef. (build_temp): Pass a pointer to diagnostic_t. (convert_like_real): Use emit_diagnostic. (joust): Check return value of warning before giving informative note. * friend.c (do_friend): Check return value of warning before giving informative note. * parser.c (cp_parser_template_id): Likewise. testsuite/ * gcc.dg/pr36901-1.c: New. * gcc.dg/pr36901-3.c: New. * gcc.dg/pr36901-2.c: New. * gcc.dg/pr36901-4.c: New. * gcc.dg/pr36901-system.h: New. * gcc.dg/pr36901.h: New. * gcc.target/powerpc/altivec-macros.c: Update. * gcc.target/i386/regparm.c: Update. * gcc.dg/funcdef-var-1.c: Update. * gcc.dg/parm-mismatch-1.c: Update. * gcc.dg/attr-noinline.c: Update. * gcc.dg/wtr-static-1.c: Update. * gcc.dg/redecl-11.c: Update. * gcc.dg/pr27953.c: Update. * gcc.dg/proto-1.c: Update. * gcc.dg/decl-3.c: Update. * gcc.dg/redecl-13.c: Update. * gcc.dg/pr15360-1.c: Update. * gcc.dg/redecl-15.c: Update. * gcc.dg/enum-compat-1.c: Update. * gcc.dg/dll-3.c: Update. * gcc.dg/array-5.c: Update. * gcc.dg/Wredundant-decls-2.c: Update. * gcc.dg/inline4.c: Update. * gcc.dg/redecl-2.c: Update. * gcc.dg/inline-14.c: Update. * gcc.dg/tls/diag-3.c: Update. * gcc.dg/funcdef-var-2.c: Update. * gcc.dg/20041213-1.c: Update. * gcc.dg/old-style-then-proto-1.c: Update. * gcc.dg/decl-2.c: Update. * gcc.dg/redecl-12.c: Update. * gcc.dg/decl-4.c: Update. * gcc.dg/Wshadow-1.c: Update. * gcc.dg/transparent-union-2.c: Update. * gcc.dg/visibility-7.c: Update. * gcc.dg/dll-2.c: Update. * gcc.dg/redecl-16.c: Update. * gcc.dg/inline1.c: Update. * gcc.dg/decl-8.c: Update. * gcc.dg/nested-redef-1.c: Update. * gcc.dg/inline3.c: Update. * gcc.dg/redecl-1.c: Update. * gcc.dg/inline5.c: Update. * gcc.dg/pr35899.c: Update. * gcc.dg/noncompile/label-lineno-1.c: Update. * gcc.dg/noncompile/label-1.c: Update. * gcc.dg/noncompile/20020220-1.c: Update. * gcc.dg/noncompile/redecl-1.c: Update. * gcc.dg/redecl-5.c: Update. * gcc.dg/qual-return-3.c: Update. * gcc.dg/label-decl-4.c: Update. From-SVN: r138893
2008-08-09 01:57:19 +02:00
/* A warning at INPUT_LOCATION. Use this for code which is correct according
to the relevant language specification but is likely to be buggy anyway.
Returns true if the warning was printed, false if it was inhibited. */
bool
warning (int opt, const char *gmsgid, ...)
{
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;
builtins.c (validate_arglist): Eliminate libiberty VA_ macros, always use stdarg. gcc: * builtins.c (validate_arglist): Eliminate libiberty VA_ macros, always use stdarg. * c-errors.c (pedwarn_c99): Likewise. * c-format.c (status_warning): Likewise. * c-semantics.c (build_stmt): Likewise. * calls.c (emit_library_call, emit_library_call_value): Likewise. * collect2.c (notice, fatal_perror, fatal, error): Likewise. * cpperror.c (cpp_error, cpp_error_with_line): Likewise. * diagnostic.c (build_message_string, output_printf, output_verbatim, verbatim, inform, warning, pedwarn, error, sorry, fatal_error, internal_error, warning_with_decl, pedwarn_with_decl, error_with_decl, fnotice): Likewise. * dwarf2asm.c (dw2_asm_output_data, dw2_asm_output_delta, dw2_asm_output_offset, dw2_asm_output_pcrel, dw2_asm_output_addr, dw2_asm_output_addr_rtx, dw2_asm_output_nstring, dw2_asm_output_data_uleb128, dw2_asm_output_data_sleb128, dw2_asm_output_delta_uleb128, dw2_asm_output_delta_sleb128, dw2_asm_output_encoded_addr_rtx): Likewise. * emit-rtl.c (gen_rtx, gen_rtvec): Likewise. * errors.c (warning, error, fatal, internal_error): Likewise. * final.c (output_operand_lossage, asm_fprintf): Likewise. * fix-header.c (fatal): Likewise. * gcc.c (fatal, error, notice): Likewise. * gcov.c (fnotice): Likewise. * genattrtab.c (attr_rtx, attr_printf): Likewise. * gengtype.c (error_at_line, xasprintf, oprintf): Likewise. * gensupport.c (message_with_line): Likewise. * mips-tfile.c (fatal, error): Likewise. * protoize.c (notice): Likewise. * ra-debug.c (ra_debug_msg): Likewise. * read-rtl.c (fatal_with_file_and_line): Likewise. * rtl-error.c (error_for_asm, warning_for_asm): Likewise. * tree.c (build, build_nt, build_function_type_list): Likewise. cp: * error.c (cp_error_at, cp_warning_at, cp_pedwarn_at): Eliminate libiberty VA_ macros, always use stdarg. * rtti.c (create_pseudo_type_info): Likewise. * tree.c (build_min_nt, build_min): Likewise. From-SVN: r66919
2003-05-18 00:21:35 +02:00
va_list ap;
exgettext: Handle gmsgid and cmsgid arguments specially, as gcc-internal-format and c-format. gcc/po/ * exgettext: Handle gmsgid and cmsgid arguments specially, as gcc-internal-format and c-format. Because of xgettext bug, invoke xgettext once with --language=c, once with --language=GCC-source and then merge together. Fail if xgettext is not 0.14.5 or later. gcc/ * intl.h (G_): New macro. * rtl-error.c (error_for_asm, warning_for_asm): Use gmsgid instead of msgid for argument name. * tree-ssa.c (warn_uninit): Likewise. * c-parser.c (c_parser_error): Likewise. * config/rs6000/rs6000-c.c (SYNTAX_ERROR): Likewise. * config/darwin-c.c (BAD): Likewise. * config/c4x/c4x-c.c (BAD): Likewise. * c-pragma.c (GCC_BAD, GCC_BAD2): Likewise. * c-errors.c (pedwarn_c99, pedwarn_c90): Likewise. * c-common.c (c_parse_error): Likewise. * diagnostic.c (diagnostic_set_info, verbatim, inform, warning, warning0, pedwarn, error, sorry, fatal_error, internal_error): Likewise. (fnotice): Use cmsgid instead of msgid for argument name. * gcov.c (fnotice): Likewise. * protoize.c (notice): Likewise. * final.c (output_operand_lossage): Likewise. * gcc.c (fatal, notice): Likewise. (error): Use gmsgid instead of msgid for argument name. * collect2.c (notice, fatal_perror, fatal): Use cmsgid instead of msgid for argument name. (error): Use gmsgid instead of msgid for argument name. * c-decl.c (locate_old_decl, implicit_decl_warning): Use G_() instead of N_(). * c-typeck.c (readonly_error, convert_for_assignment): Likewise. * tree-inline.c (inline_forbidden_p_1): Likewise. * ABOUT-GCC-NLS: Require gettext 0.14.5 or later. Mention the new conventions for marking translations. * doc/install.texi: Mention gettext 0.14.5 or later requirement. gcc/cp/ * error.c (locate_error): Use gmsgid instead of msgid for argument name. (cp_error_at, cp_warning_at, cp_pedwarn_at): Likewise. gcc/java/ * jv-scan.c (fatal_error, warning, warning0): Use gmsgid instead of msgid for argument name. * gjavah.c (error): Likewise. * java-tree.h (parse_error_context): Likewise. * parse.y (parse_error_context, parse_warning_context, issue_warning_error_from_context): Likewise. From-SVN: r100676
2005-06-06 21:31:40 +02:00
va_start (ap, gmsgid);
diagnostic_set_info (&diagnostic, gmsgid, &ap, input_location, DK_WARNING);
re PR other/36901 (pedwarn() + -pedantic-errors + -w (inhibit_warnings) should not emit errors) 2008-08-09 Manuel Lopez-Ibanez <manu@gcc.gnu.org> PR 36901 * diagnostic.def (DK_PEDWARN, DK_PERMERROR): New. * diagnostic.c (pedantic_warning_kind, permissive_error_kind): Moved from diagnostic.h (diagnostic_report_diagnostic): Return bool. Handle DK_PEDWARN and DK_PERMERROR. (emit_diagnostic): New. (warning0, pedwarn0): Delete. (warning, warning_at, pedwarn, permerror): Return bool. * diagnostic.h (pedantic_warning_kind, permissive_error_kind): Moved to diagnostic.c. (struct diagnostic_context): Use correct type for classify_diagnostic. (diagnostic_report_diagnostic): Update declaration. (emit_diagnostic): Declare. * errors.c (warning): Return bool. * errors.h (warning): Update declaration. * toplev.h (warning0, pedwarn0): Delete. (warning, warning_at, pedwarn, permerror): Return bool. * c-errors.c (pedwarn_c99, pedwarn_c90): Use DK_PEDWARN. * c-decl.c (locate_old_decl): Delete 'diag' argument. Always use inform. Update all calls. (diagnose_mismatched_decls): Check return value of warning/pedwarn before giving informative note. (implicit_decl_warning): Likewise. * c-typeck.c (build_function_call): Likewise. * tree-sssa.c (warn_uninit): Likewise. * builtins.c (gimplify_va_arg_expr): Likewise. fortran/ * f95-lang.c (gfc_mark_addressable): Use "pedwarn (0," instead of 'pedwarn0'. cp/ * cp-tree.h (struct diagnostic_context, struct diagnostic_info): Delete forward declarations. Check that toplev.h has not been included before this file. Include toplev.h and diagnostic.h. * error.c (cp_cpp_error): Use DK_PEDWARN. (cxx_incomplete_type_diagnostic): Update declaration. (cxx_incomplete_type_error): Use DK_ERROR. * typeck2.c (cxx_incomplete_type_diagnostic): Take a diagnostic_t as argument. Use emit_diagnostic. (cxx_incomplete_type_error): Use DK_ERROR. (add_exception_specifier): Use diagnostic_t instead of custom codes. * typeck.c (complete_type_or_else): Update call to cxx_incomplete_type_diagnostic. * init.c (build_delete): Likewise. * call.c (diagnostic_fn_t): Remove unused typedef. (build_temp): Pass a pointer to diagnostic_t. (convert_like_real): Use emit_diagnostic. (joust): Check return value of warning before giving informative note. * friend.c (do_friend): Check return value of warning before giving informative note. * parser.c (cp_parser_template_id): Likewise. testsuite/ * gcc.dg/pr36901-1.c: New. * gcc.dg/pr36901-3.c: New. * gcc.dg/pr36901-2.c: New. * gcc.dg/pr36901-4.c: New. * gcc.dg/pr36901-system.h: New. * gcc.dg/pr36901.h: New. * gcc.target/powerpc/altivec-macros.c: Update. * gcc.target/i386/regparm.c: Update. * gcc.dg/funcdef-var-1.c: Update. * gcc.dg/parm-mismatch-1.c: Update. * gcc.dg/attr-noinline.c: Update. * gcc.dg/wtr-static-1.c: Update. * gcc.dg/redecl-11.c: Update. * gcc.dg/pr27953.c: Update. * gcc.dg/proto-1.c: Update. * gcc.dg/decl-3.c: Update. * gcc.dg/redecl-13.c: Update. * gcc.dg/pr15360-1.c: Update. * gcc.dg/redecl-15.c: Update. * gcc.dg/enum-compat-1.c: Update. * gcc.dg/dll-3.c: Update. * gcc.dg/array-5.c: Update. * gcc.dg/Wredundant-decls-2.c: Update. * gcc.dg/inline4.c: Update. * gcc.dg/redecl-2.c: Update. * gcc.dg/inline-14.c: Update. * gcc.dg/tls/diag-3.c: Update. * gcc.dg/funcdef-var-2.c: Update. * gcc.dg/20041213-1.c: Update. * gcc.dg/old-style-then-proto-1.c: Update. * gcc.dg/decl-2.c: Update. * gcc.dg/redecl-12.c: Update. * gcc.dg/decl-4.c: Update. * gcc.dg/Wshadow-1.c: Update. * gcc.dg/transparent-union-2.c: Update. * gcc.dg/visibility-7.c: Update. * gcc.dg/dll-2.c: Update. * gcc.dg/redecl-16.c: Update. * gcc.dg/inline1.c: Update. * gcc.dg/decl-8.c: Update. * gcc.dg/nested-redef-1.c: Update. * gcc.dg/inline3.c: Update. * gcc.dg/redecl-1.c: Update. * gcc.dg/inline5.c: Update. * gcc.dg/pr35899.c: Update. * gcc.dg/noncompile/label-lineno-1.c: Update. * gcc.dg/noncompile/label-1.c: Update. * gcc.dg/noncompile/20020220-1.c: Update. * gcc.dg/noncompile/redecl-1.c: Update. * gcc.dg/redecl-5.c: Update. * gcc.dg/qual-return-3.c: Update. * gcc.dg/label-decl-4.c: Update. From-SVN: r138893
2008-08-09 01:57:19 +02:00
diagnostic.option_index = opt;
builtins.c (validate_arglist): Eliminate libiberty VA_ macros, always use stdarg. gcc: * builtins.c (validate_arglist): Eliminate libiberty VA_ macros, always use stdarg. * c-errors.c (pedwarn_c99): Likewise. * c-format.c (status_warning): Likewise. * c-semantics.c (build_stmt): Likewise. * calls.c (emit_library_call, emit_library_call_value): Likewise. * collect2.c (notice, fatal_perror, fatal, error): Likewise. * cpperror.c (cpp_error, cpp_error_with_line): Likewise. * diagnostic.c (build_message_string, output_printf, output_verbatim, verbatim, inform, warning, pedwarn, error, sorry, fatal_error, internal_error, warning_with_decl, pedwarn_with_decl, error_with_decl, fnotice): Likewise. * dwarf2asm.c (dw2_asm_output_data, dw2_asm_output_delta, dw2_asm_output_offset, dw2_asm_output_pcrel, dw2_asm_output_addr, dw2_asm_output_addr_rtx, dw2_asm_output_nstring, dw2_asm_output_data_uleb128, dw2_asm_output_data_sleb128, dw2_asm_output_delta_uleb128, dw2_asm_output_delta_sleb128, dw2_asm_output_encoded_addr_rtx): Likewise. * emit-rtl.c (gen_rtx, gen_rtvec): Likewise. * errors.c (warning, error, fatal, internal_error): Likewise. * final.c (output_operand_lossage, asm_fprintf): Likewise. * fix-header.c (fatal): Likewise. * gcc.c (fatal, error, notice): Likewise. * gcov.c (fnotice): Likewise. * genattrtab.c (attr_rtx, attr_printf): Likewise. * gengtype.c (error_at_line, xasprintf, oprintf): Likewise. * gensupport.c (message_with_line): Likewise. * mips-tfile.c (fatal, error): Likewise. * protoize.c (notice): Likewise. * ra-debug.c (ra_debug_msg): Likewise. * read-rtl.c (fatal_with_file_and_line): Likewise. * rtl-error.c (error_for_asm, warning_for_asm): Likewise. * tree.c (build, build_nt, build_function_type_list): Likewise. cp: * error.c (cp_error_at, cp_warning_at, cp_pedwarn_at): Eliminate libiberty VA_ macros, always use stdarg. * rtti.c (create_pseudo_type_info): Likewise. * tree.c (build_min_nt, build_min): Likewise. From-SVN: r66919
2003-05-18 00:21:35 +02:00
va_end (ap);
re PR other/36901 (pedwarn() + -pedantic-errors + -w (inhibit_warnings) should not emit errors) 2008-08-09 Manuel Lopez-Ibanez <manu@gcc.gnu.org> PR 36901 * diagnostic.def (DK_PEDWARN, DK_PERMERROR): New. * diagnostic.c (pedantic_warning_kind, permissive_error_kind): Moved from diagnostic.h (diagnostic_report_diagnostic): Return bool. Handle DK_PEDWARN and DK_PERMERROR. (emit_diagnostic): New. (warning0, pedwarn0): Delete. (warning, warning_at, pedwarn, permerror): Return bool. * diagnostic.h (pedantic_warning_kind, permissive_error_kind): Moved to diagnostic.c. (struct diagnostic_context): Use correct type for classify_diagnostic. (diagnostic_report_diagnostic): Update declaration. (emit_diagnostic): Declare. * errors.c (warning): Return bool. * errors.h (warning): Update declaration. * toplev.h (warning0, pedwarn0): Delete. (warning, warning_at, pedwarn, permerror): Return bool. * c-errors.c (pedwarn_c99, pedwarn_c90): Use DK_PEDWARN. * c-decl.c (locate_old_decl): Delete 'diag' argument. Always use inform. Update all calls. (diagnose_mismatched_decls): Check return value of warning/pedwarn before giving informative note. (implicit_decl_warning): Likewise. * c-typeck.c (build_function_call): Likewise. * tree-sssa.c (warn_uninit): Likewise. * builtins.c (gimplify_va_arg_expr): Likewise. fortran/ * f95-lang.c (gfc_mark_addressable): Use "pedwarn (0," instead of 'pedwarn0'. cp/ * cp-tree.h (struct diagnostic_context, struct diagnostic_info): Delete forward declarations. Check that toplev.h has not been included before this file. Include toplev.h and diagnostic.h. * error.c (cp_cpp_error): Use DK_PEDWARN. (cxx_incomplete_type_diagnostic): Update declaration. (cxx_incomplete_type_error): Use DK_ERROR. * typeck2.c (cxx_incomplete_type_diagnostic): Take a diagnostic_t as argument. Use emit_diagnostic. (cxx_incomplete_type_error): Use DK_ERROR. (add_exception_specifier): Use diagnostic_t instead of custom codes. * typeck.c (complete_type_or_else): Update call to cxx_incomplete_type_diagnostic. * init.c (build_delete): Likewise. * call.c (diagnostic_fn_t): Remove unused typedef. (build_temp): Pass a pointer to diagnostic_t. (convert_like_real): Use emit_diagnostic. (joust): Check return value of warning before giving informative note. * friend.c (do_friend): Check return value of warning before giving informative note. * parser.c (cp_parser_template_id): Likewise. testsuite/ * gcc.dg/pr36901-1.c: New. * gcc.dg/pr36901-3.c: New. * gcc.dg/pr36901-2.c: New. * gcc.dg/pr36901-4.c: New. * gcc.dg/pr36901-system.h: New. * gcc.dg/pr36901.h: New. * gcc.target/powerpc/altivec-macros.c: Update. * gcc.target/i386/regparm.c: Update. * gcc.dg/funcdef-var-1.c: Update. * gcc.dg/parm-mismatch-1.c: Update. * gcc.dg/attr-noinline.c: Update. * gcc.dg/wtr-static-1.c: Update. * gcc.dg/redecl-11.c: Update. * gcc.dg/pr27953.c: Update. * gcc.dg/proto-1.c: Update. * gcc.dg/decl-3.c: Update. * gcc.dg/redecl-13.c: Update. * gcc.dg/pr15360-1.c: Update. * gcc.dg/redecl-15.c: Update. * gcc.dg/enum-compat-1.c: Update. * gcc.dg/dll-3.c: Update. * gcc.dg/array-5.c: Update. * gcc.dg/Wredundant-decls-2.c: Update. * gcc.dg/inline4.c: Update. * gcc.dg/redecl-2.c: Update. * gcc.dg/inline-14.c: Update. * gcc.dg/tls/diag-3.c: Update. * gcc.dg/funcdef-var-2.c: Update. * gcc.dg/20041213-1.c: Update. * gcc.dg/old-style-then-proto-1.c: Update. * gcc.dg/decl-2.c: Update. * gcc.dg/redecl-12.c: Update. * gcc.dg/decl-4.c: Update. * gcc.dg/Wshadow-1.c: Update. * gcc.dg/transparent-union-2.c: Update. * gcc.dg/visibility-7.c: Update. * gcc.dg/dll-2.c: Update. * gcc.dg/redecl-16.c: Update. * gcc.dg/inline1.c: Update. * gcc.dg/decl-8.c: Update. * gcc.dg/nested-redef-1.c: Update. * gcc.dg/inline3.c: Update. * gcc.dg/redecl-1.c: Update. * gcc.dg/inline5.c: Update. * gcc.dg/pr35899.c: Update. * gcc.dg/noncompile/label-lineno-1.c: Update. * gcc.dg/noncompile/label-1.c: Update. * gcc.dg/noncompile/20020220-1.c: Update. * gcc.dg/noncompile/redecl-1.c: Update. * gcc.dg/redecl-5.c: Update. * gcc.dg/qual-return-3.c: Update. * gcc.dg/label-decl-4.c: Update. From-SVN: r138893
2008-08-09 01:57:19 +02:00
return report_diagnostic (&diagnostic);
}
Makefile.in: Replace toplev.h with TOPLEV_H. 2007-07-21 Rafael Avila de Espindola <espindola@google.com> * Makefile.in: Replace toplev.h with TOPLEV_H. * c-decl.c (merge_decls): Don't set DECL_IN_SYSTEM_HEADER. * c-lex.c (fe_file_change): Don't set in_system_header. * c-parser.c (c_token): Remove in_system_header. (c_lex_one_token): Don't set in_system_header. (c_parser_set_source_position_from_token): Don't set in_system_header. * diagnostic.c (diagnostic_report_diagnostic): Use location from diagnostic_info. (warning_at): New. * diagnostic.h (diagnostic_report_warnings_p): Add LOC argument. * flags.h (in_system_header): Remove. * function.c (saved_in_system_header): Remove. (push_cfun): Don't set in_system_header. (pop_cfun): Don't set in_system_header. (push_struct_function): Don't set in_system_header. * input.h (expanded_location): Add sysp. (in_system_header_at): New. (in_system_header): New. * toplev.c (in_system_header): Remove. * toplev.h: Include input.h (warning_at): New. * tree-cfg.c (execute_warn_function_return): Call warning_at. * tree-ssa.c (warn_uninit): Call warning_at. (warn_uninitialized_var): Update calls to warn_uninit. (warn_uninitialized_phi): Update calls to warn_uninit. * tree.c (make_node_stat): Don't set DECL_IN_SYSTEM_HEADER. (expand_location): Initialize xloc.sysp. * tree.h (DECL_IN_SYSTEM_HEADER): Use in_system_header_at. (tree_decl_with_vis): Remove in_system_header_flag. 2007-07-21 Rafael Avila de Espindola <espindola@google.com> * parser.c (cp_token): Remove in_system_header. (eof_token): Remove in_system_header. (cp_lexer_get_preprocessor_token): Don't set in_system_header. (cp_lexer_set_source_position_from_token): Don't set in_system_header. (cp_parser_member_declaration): Use in_system_header_at. * pt.c (lookup_template_class): Don't set DECL_IN_SYSTEM_HEADER. (pop_tinst_level): Don't set in_system_header. (instantiate_class_template): Don't set in_system_header. (instantiate_decl): Don't set in_system_header. (instantiate_pending_templates): Don't set in_system_header. From-SVN: r138031
2008-07-21 16:29:27 +02:00
/* A warning at LOCATION. Use this for code which is correct according to the
re PR other/36901 (pedwarn() + -pedantic-errors + -w (inhibit_warnings) should not emit errors) 2008-08-09 Manuel Lopez-Ibanez <manu@gcc.gnu.org> PR 36901 * diagnostic.def (DK_PEDWARN, DK_PERMERROR): New. * diagnostic.c (pedantic_warning_kind, permissive_error_kind): Moved from diagnostic.h (diagnostic_report_diagnostic): Return bool. Handle DK_PEDWARN and DK_PERMERROR. (emit_diagnostic): New. (warning0, pedwarn0): Delete. (warning, warning_at, pedwarn, permerror): Return bool. * diagnostic.h (pedantic_warning_kind, permissive_error_kind): Moved to diagnostic.c. (struct diagnostic_context): Use correct type for classify_diagnostic. (diagnostic_report_diagnostic): Update declaration. (emit_diagnostic): Declare. * errors.c (warning): Return bool. * errors.h (warning): Update declaration. * toplev.h (warning0, pedwarn0): Delete. (warning, warning_at, pedwarn, permerror): Return bool. * c-errors.c (pedwarn_c99, pedwarn_c90): Use DK_PEDWARN. * c-decl.c (locate_old_decl): Delete 'diag' argument. Always use inform. Update all calls. (diagnose_mismatched_decls): Check return value of warning/pedwarn before giving informative note. (implicit_decl_warning): Likewise. * c-typeck.c (build_function_call): Likewise. * tree-sssa.c (warn_uninit): Likewise. * builtins.c (gimplify_va_arg_expr): Likewise. fortran/ * f95-lang.c (gfc_mark_addressable): Use "pedwarn (0," instead of 'pedwarn0'. cp/ * cp-tree.h (struct diagnostic_context, struct diagnostic_info): Delete forward declarations. Check that toplev.h has not been included before this file. Include toplev.h and diagnostic.h. * error.c (cp_cpp_error): Use DK_PEDWARN. (cxx_incomplete_type_diagnostic): Update declaration. (cxx_incomplete_type_error): Use DK_ERROR. * typeck2.c (cxx_incomplete_type_diagnostic): Take a diagnostic_t as argument. Use emit_diagnostic. (cxx_incomplete_type_error): Use DK_ERROR. (add_exception_specifier): Use diagnostic_t instead of custom codes. * typeck.c (complete_type_or_else): Update call to cxx_incomplete_type_diagnostic. * init.c (build_delete): Likewise. * call.c (diagnostic_fn_t): Remove unused typedef. (build_temp): Pass a pointer to diagnostic_t. (convert_like_real): Use emit_diagnostic. (joust): Check return value of warning before giving informative note. * friend.c (do_friend): Check return value of warning before giving informative note. * parser.c (cp_parser_template_id): Likewise. testsuite/ * gcc.dg/pr36901-1.c: New. * gcc.dg/pr36901-3.c: New. * gcc.dg/pr36901-2.c: New. * gcc.dg/pr36901-4.c: New. * gcc.dg/pr36901-system.h: New. * gcc.dg/pr36901.h: New. * gcc.target/powerpc/altivec-macros.c: Update. * gcc.target/i386/regparm.c: Update. * gcc.dg/funcdef-var-1.c: Update. * gcc.dg/parm-mismatch-1.c: Update. * gcc.dg/attr-noinline.c: Update. * gcc.dg/wtr-static-1.c: Update. * gcc.dg/redecl-11.c: Update. * gcc.dg/pr27953.c: Update. * gcc.dg/proto-1.c: Update. * gcc.dg/decl-3.c: Update. * gcc.dg/redecl-13.c: Update. * gcc.dg/pr15360-1.c: Update. * gcc.dg/redecl-15.c: Update. * gcc.dg/enum-compat-1.c: Update. * gcc.dg/dll-3.c: Update. * gcc.dg/array-5.c: Update. * gcc.dg/Wredundant-decls-2.c: Update. * gcc.dg/inline4.c: Update. * gcc.dg/redecl-2.c: Update. * gcc.dg/inline-14.c: Update. * gcc.dg/tls/diag-3.c: Update. * gcc.dg/funcdef-var-2.c: Update. * gcc.dg/20041213-1.c: Update. * gcc.dg/old-style-then-proto-1.c: Update. * gcc.dg/decl-2.c: Update. * gcc.dg/redecl-12.c: Update. * gcc.dg/decl-4.c: Update. * gcc.dg/Wshadow-1.c: Update. * gcc.dg/transparent-union-2.c: Update. * gcc.dg/visibility-7.c: Update. * gcc.dg/dll-2.c: Update. * gcc.dg/redecl-16.c: Update. * gcc.dg/inline1.c: Update. * gcc.dg/decl-8.c: Update. * gcc.dg/nested-redef-1.c: Update. * gcc.dg/inline3.c: Update. * gcc.dg/redecl-1.c: Update. * gcc.dg/inline5.c: Update. * gcc.dg/pr35899.c: Update. * gcc.dg/noncompile/label-lineno-1.c: Update. * gcc.dg/noncompile/label-1.c: Update. * gcc.dg/noncompile/20020220-1.c: Update. * gcc.dg/noncompile/redecl-1.c: Update. * gcc.dg/redecl-5.c: Update. * gcc.dg/qual-return-3.c: Update. * gcc.dg/label-decl-4.c: Update. From-SVN: r138893
2008-08-09 01:57:19 +02:00
relevant language specification but is likely to be buggy anyway.
Returns true if the warning was printed, false if it was inhibited. */
bool
Makefile.in: Replace toplev.h with TOPLEV_H. 2007-07-21 Rafael Avila de Espindola <espindola@google.com> * Makefile.in: Replace toplev.h with TOPLEV_H. * c-decl.c (merge_decls): Don't set DECL_IN_SYSTEM_HEADER. * c-lex.c (fe_file_change): Don't set in_system_header. * c-parser.c (c_token): Remove in_system_header. (c_lex_one_token): Don't set in_system_header. (c_parser_set_source_position_from_token): Don't set in_system_header. * diagnostic.c (diagnostic_report_diagnostic): Use location from diagnostic_info. (warning_at): New. * diagnostic.h (diagnostic_report_warnings_p): Add LOC argument. * flags.h (in_system_header): Remove. * function.c (saved_in_system_header): Remove. (push_cfun): Don't set in_system_header. (pop_cfun): Don't set in_system_header. (push_struct_function): Don't set in_system_header. * input.h (expanded_location): Add sysp. (in_system_header_at): New. (in_system_header): New. * toplev.c (in_system_header): Remove. * toplev.h: Include input.h (warning_at): New. * tree-cfg.c (execute_warn_function_return): Call warning_at. * tree-ssa.c (warn_uninit): Call warning_at. (warn_uninitialized_var): Update calls to warn_uninit. (warn_uninitialized_phi): Update calls to warn_uninit. * tree.c (make_node_stat): Don't set DECL_IN_SYSTEM_HEADER. (expand_location): Initialize xloc.sysp. * tree.h (DECL_IN_SYSTEM_HEADER): Use in_system_header_at. (tree_decl_with_vis): Remove in_system_header_flag. 2007-07-21 Rafael Avila de Espindola <espindola@google.com> * parser.c (cp_token): Remove in_system_header. (eof_token): Remove in_system_header. (cp_lexer_get_preprocessor_token): Don't set in_system_header. (cp_lexer_set_source_position_from_token): Don't set in_system_header. (cp_parser_member_declaration): Use in_system_header_at. * pt.c (lookup_template_class): Don't set DECL_IN_SYSTEM_HEADER. (pop_tinst_level): Don't set in_system_header. (instantiate_class_template): Don't set in_system_header. (instantiate_decl): Don't set in_system_header. (instantiate_pending_templates): Don't set in_system_header. From-SVN: r138031
2008-07-21 16:29:27 +02:00
warning_at (location_t location, int opt, const char *gmsgid, ...)
{
diagnostic_info diagnostic;
va_list ap;
va_start (ap, gmsgid);
diagnostic_set_info (&diagnostic, gmsgid, &ap, location, DK_WARNING);
diagnostic.option_index = opt;
va_end (ap);
re PR other/36901 (pedwarn() + -pedantic-errors + -w (inhibit_warnings) should not emit errors) 2008-08-09 Manuel Lopez-Ibanez <manu@gcc.gnu.org> PR 36901 * diagnostic.def (DK_PEDWARN, DK_PERMERROR): New. * diagnostic.c (pedantic_warning_kind, permissive_error_kind): Moved from diagnostic.h (diagnostic_report_diagnostic): Return bool. Handle DK_PEDWARN and DK_PERMERROR. (emit_diagnostic): New. (warning0, pedwarn0): Delete. (warning, warning_at, pedwarn, permerror): Return bool. * diagnostic.h (pedantic_warning_kind, permissive_error_kind): Moved to diagnostic.c. (struct diagnostic_context): Use correct type for classify_diagnostic. (diagnostic_report_diagnostic): Update declaration. (emit_diagnostic): Declare. * errors.c (warning): Return bool. * errors.h (warning): Update declaration. * toplev.h (warning0, pedwarn0): Delete. (warning, warning_at, pedwarn, permerror): Return bool. * c-errors.c (pedwarn_c99, pedwarn_c90): Use DK_PEDWARN. * c-decl.c (locate_old_decl): Delete 'diag' argument. Always use inform. Update all calls. (diagnose_mismatched_decls): Check return value of warning/pedwarn before giving informative note. (implicit_decl_warning): Likewise. * c-typeck.c (build_function_call): Likewise. * tree-sssa.c (warn_uninit): Likewise. * builtins.c (gimplify_va_arg_expr): Likewise. fortran/ * f95-lang.c (gfc_mark_addressable): Use "pedwarn (0," instead of 'pedwarn0'. cp/ * cp-tree.h (struct diagnostic_context, struct diagnostic_info): Delete forward declarations. Check that toplev.h has not been included before this file. Include toplev.h and diagnostic.h. * error.c (cp_cpp_error): Use DK_PEDWARN. (cxx_incomplete_type_diagnostic): Update declaration. (cxx_incomplete_type_error): Use DK_ERROR. * typeck2.c (cxx_incomplete_type_diagnostic): Take a diagnostic_t as argument. Use emit_diagnostic. (cxx_incomplete_type_error): Use DK_ERROR. (add_exception_specifier): Use diagnostic_t instead of custom codes. * typeck.c (complete_type_or_else): Update call to cxx_incomplete_type_diagnostic. * init.c (build_delete): Likewise. * call.c (diagnostic_fn_t): Remove unused typedef. (build_temp): Pass a pointer to diagnostic_t. (convert_like_real): Use emit_diagnostic. (joust): Check return value of warning before giving informative note. * friend.c (do_friend): Check return value of warning before giving informative note. * parser.c (cp_parser_template_id): Likewise. testsuite/ * gcc.dg/pr36901-1.c: New. * gcc.dg/pr36901-3.c: New. * gcc.dg/pr36901-2.c: New. * gcc.dg/pr36901-4.c: New. * gcc.dg/pr36901-system.h: New. * gcc.dg/pr36901.h: New. * gcc.target/powerpc/altivec-macros.c: Update. * gcc.target/i386/regparm.c: Update. * gcc.dg/funcdef-var-1.c: Update. * gcc.dg/parm-mismatch-1.c: Update. * gcc.dg/attr-noinline.c: Update. * gcc.dg/wtr-static-1.c: Update. * gcc.dg/redecl-11.c: Update. * gcc.dg/pr27953.c: Update. * gcc.dg/proto-1.c: Update. * gcc.dg/decl-3.c: Update. * gcc.dg/redecl-13.c: Update. * gcc.dg/pr15360-1.c: Update. * gcc.dg/redecl-15.c: Update. * gcc.dg/enum-compat-1.c: Update. * gcc.dg/dll-3.c: Update. * gcc.dg/array-5.c: Update. * gcc.dg/Wredundant-decls-2.c: Update. * gcc.dg/inline4.c: Update. * gcc.dg/redecl-2.c: Update. * gcc.dg/inline-14.c: Update. * gcc.dg/tls/diag-3.c: Update. * gcc.dg/funcdef-var-2.c: Update. * gcc.dg/20041213-1.c: Update. * gcc.dg/old-style-then-proto-1.c: Update. * gcc.dg/decl-2.c: Update. * gcc.dg/redecl-12.c: Update. * gcc.dg/decl-4.c: Update. * gcc.dg/Wshadow-1.c: Update. * gcc.dg/transparent-union-2.c: Update. * gcc.dg/visibility-7.c: Update. * gcc.dg/dll-2.c: Update. * gcc.dg/redecl-16.c: Update. * gcc.dg/inline1.c: Update. * gcc.dg/decl-8.c: Update. * gcc.dg/nested-redef-1.c: Update. * gcc.dg/inline3.c: Update. * gcc.dg/redecl-1.c: Update. * gcc.dg/inline5.c: Update. * gcc.dg/pr35899.c: Update. * gcc.dg/noncompile/label-lineno-1.c: Update. * gcc.dg/noncompile/label-1.c: Update. * gcc.dg/noncompile/20020220-1.c: Update. * gcc.dg/noncompile/redecl-1.c: Update. * gcc.dg/redecl-5.c: Update. * gcc.dg/qual-return-3.c: Update. * gcc.dg/label-decl-4.c: Update. From-SVN: r138893
2008-08-09 01:57:19 +02:00
return report_diagnostic (&diagnostic);
Makefile.in: Replace toplev.h with TOPLEV_H. 2007-07-21 Rafael Avila de Espindola <espindola@google.com> * Makefile.in: Replace toplev.h with TOPLEV_H. * c-decl.c (merge_decls): Don't set DECL_IN_SYSTEM_HEADER. * c-lex.c (fe_file_change): Don't set in_system_header. * c-parser.c (c_token): Remove in_system_header. (c_lex_one_token): Don't set in_system_header. (c_parser_set_source_position_from_token): Don't set in_system_header. * diagnostic.c (diagnostic_report_diagnostic): Use location from diagnostic_info. (warning_at): New. * diagnostic.h (diagnostic_report_warnings_p): Add LOC argument. * flags.h (in_system_header): Remove. * function.c (saved_in_system_header): Remove. (push_cfun): Don't set in_system_header. (pop_cfun): Don't set in_system_header. (push_struct_function): Don't set in_system_header. * input.h (expanded_location): Add sysp. (in_system_header_at): New. (in_system_header): New. * toplev.c (in_system_header): Remove. * toplev.h: Include input.h (warning_at): New. * tree-cfg.c (execute_warn_function_return): Call warning_at. * tree-ssa.c (warn_uninit): Call warning_at. (warn_uninitialized_var): Update calls to warn_uninit. (warn_uninitialized_phi): Update calls to warn_uninit. * tree.c (make_node_stat): Don't set DECL_IN_SYSTEM_HEADER. (expand_location): Initialize xloc.sysp. * tree.h (DECL_IN_SYSTEM_HEADER): Use in_system_header_at. (tree_decl_with_vis): Remove in_system_header_flag. 2007-07-21 Rafael Avila de Espindola <espindola@google.com> * parser.c (cp_token): Remove in_system_header. (eof_token): Remove in_system_header. (cp_lexer_get_preprocessor_token): Don't set in_system_header. (cp_lexer_set_source_position_from_token): Don't set in_system_header. (cp_parser_member_declaration): Use in_system_header_at. * pt.c (lookup_template_class): Don't set DECL_IN_SYSTEM_HEADER. (pop_tinst_level): Don't set in_system_header. (instantiate_class_template): Don't set in_system_header. (instantiate_decl): Don't set in_system_header. (instantiate_pending_templates): Don't set in_system_header. From-SVN: r138031
2008-07-21 16:29:27 +02:00
}
/* A "pedantic" warning at LOCATION: issues a warning unless
-pedantic-errors was given on the command line, in which case it
issues an error. Use this for diagnostics required by the relevant
language standard, if you have chosen not to make them errors.
diagnostic.c (diagnostic_for_decl): Take a diagnostic_context argument. * diagnostic.c (diagnostic_for_decl): Take a diagnostic_context argument. Restructure to be consistent with diagnostic_report_diagnostic. (diagnostic_count_diagnostic): Now static. Take a diagnostic_info argument, not just a diagnostic_t. Some code moved here from internal_error. Move a case label for clarity. (diagnostic_action_after_output): New function. Code moved here from internal_error and fatal_error. (bug_report_request): New #define so that this text appears in only one place. (diagnostic_report_diagnostic): Update to match changes to diagnostic_count_diagnostic. Call diagnostic_action_after_output. (diagnostic_set_info): Call gettext here. (pedwarn): Update comment. Don't call gettext here. (sorry): Use report_diagnostic. Don't call gettext here. (fatal_error): Remove final fnotice and exit, but call real_abort to prevent warnings about noreturn function returning. (internal_error): Likewise. Don't do ICE suppression here nor call context->internal_error. (warning_with_decl): Suppress for decls in system headers. Adjust call to diagnostic_for_decl. (pedwarn_with_decl): Likewise. (error_with_decl): Adjust call to diagnostic_for_decl. (error_recursion): Use bug_report_request. * diagnostic.h: Remove prototype of diagnostic_count_diagnostic. * objc/objc-act.c (error_with_ivar, warn_with_method): Don't call diagnostic_count_diagnostic. f: * bad.c: Don't call diagnostic_count_diagnostic. From-SVN: r66728
2003-05-12 20:32:18 +02:00
Note that these diagnostics are issued independent of the setting
of the -pedantic command-line switch. To get a warning enabled
only with that switch, use either "if (pedantic) pedwarn
(OPT_pedantic,...)" or just "pedwarn (OPT_pedantic,..)". To get a
re PR other/36901 (pedwarn() + -pedantic-errors + -w (inhibit_warnings) should not emit errors) 2008-08-09 Manuel Lopez-Ibanez <manu@gcc.gnu.org> PR 36901 * diagnostic.def (DK_PEDWARN, DK_PERMERROR): New. * diagnostic.c (pedantic_warning_kind, permissive_error_kind): Moved from diagnostic.h (diagnostic_report_diagnostic): Return bool. Handle DK_PEDWARN and DK_PERMERROR. (emit_diagnostic): New. (warning0, pedwarn0): Delete. (warning, warning_at, pedwarn, permerror): Return bool. * diagnostic.h (pedantic_warning_kind, permissive_error_kind): Moved to diagnostic.c. (struct diagnostic_context): Use correct type for classify_diagnostic. (diagnostic_report_diagnostic): Update declaration. (emit_diagnostic): Declare. * errors.c (warning): Return bool. * errors.h (warning): Update declaration. * toplev.h (warning0, pedwarn0): Delete. (warning, warning_at, pedwarn, permerror): Return bool. * c-errors.c (pedwarn_c99, pedwarn_c90): Use DK_PEDWARN. * c-decl.c (locate_old_decl): Delete 'diag' argument. Always use inform. Update all calls. (diagnose_mismatched_decls): Check return value of warning/pedwarn before giving informative note. (implicit_decl_warning): Likewise. * c-typeck.c (build_function_call): Likewise. * tree-sssa.c (warn_uninit): Likewise. * builtins.c (gimplify_va_arg_expr): Likewise. fortran/ * f95-lang.c (gfc_mark_addressable): Use "pedwarn (0," instead of 'pedwarn0'. cp/ * cp-tree.h (struct diagnostic_context, struct diagnostic_info): Delete forward declarations. Check that toplev.h has not been included before this file. Include toplev.h and diagnostic.h. * error.c (cp_cpp_error): Use DK_PEDWARN. (cxx_incomplete_type_diagnostic): Update declaration. (cxx_incomplete_type_error): Use DK_ERROR. * typeck2.c (cxx_incomplete_type_diagnostic): Take a diagnostic_t as argument. Use emit_diagnostic. (cxx_incomplete_type_error): Use DK_ERROR. (add_exception_specifier): Use diagnostic_t instead of custom codes. * typeck.c (complete_type_or_else): Update call to cxx_incomplete_type_diagnostic. * init.c (build_delete): Likewise. * call.c (diagnostic_fn_t): Remove unused typedef. (build_temp): Pass a pointer to diagnostic_t. (convert_like_real): Use emit_diagnostic. (joust): Check return value of warning before giving informative note. * friend.c (do_friend): Check return value of warning before giving informative note. * parser.c (cp_parser_template_id): Likewise. testsuite/ * gcc.dg/pr36901-1.c: New. * gcc.dg/pr36901-3.c: New. * gcc.dg/pr36901-2.c: New. * gcc.dg/pr36901-4.c: New. * gcc.dg/pr36901-system.h: New. * gcc.dg/pr36901.h: New. * gcc.target/powerpc/altivec-macros.c: Update. * gcc.target/i386/regparm.c: Update. * gcc.dg/funcdef-var-1.c: Update. * gcc.dg/parm-mismatch-1.c: Update. * gcc.dg/attr-noinline.c: Update. * gcc.dg/wtr-static-1.c: Update. * gcc.dg/redecl-11.c: Update. * gcc.dg/pr27953.c: Update. * gcc.dg/proto-1.c: Update. * gcc.dg/decl-3.c: Update. * gcc.dg/redecl-13.c: Update. * gcc.dg/pr15360-1.c: Update. * gcc.dg/redecl-15.c: Update. * gcc.dg/enum-compat-1.c: Update. * gcc.dg/dll-3.c: Update. * gcc.dg/array-5.c: Update. * gcc.dg/Wredundant-decls-2.c: Update. * gcc.dg/inline4.c: Update. * gcc.dg/redecl-2.c: Update. * gcc.dg/inline-14.c: Update. * gcc.dg/tls/diag-3.c: Update. * gcc.dg/funcdef-var-2.c: Update. * gcc.dg/20041213-1.c: Update. * gcc.dg/old-style-then-proto-1.c: Update. * gcc.dg/decl-2.c: Update. * gcc.dg/redecl-12.c: Update. * gcc.dg/decl-4.c: Update. * gcc.dg/Wshadow-1.c: Update. * gcc.dg/transparent-union-2.c: Update. * gcc.dg/visibility-7.c: Update. * gcc.dg/dll-2.c: Update. * gcc.dg/redecl-16.c: Update. * gcc.dg/inline1.c: Update. * gcc.dg/decl-8.c: Update. * gcc.dg/nested-redef-1.c: Update. * gcc.dg/inline3.c: Update. * gcc.dg/redecl-1.c: Update. * gcc.dg/inline5.c: Update. * gcc.dg/pr35899.c: Update. * gcc.dg/noncompile/label-lineno-1.c: Update. * gcc.dg/noncompile/label-1.c: Update. * gcc.dg/noncompile/20020220-1.c: Update. * gcc.dg/noncompile/redecl-1.c: Update. * gcc.dg/redecl-5.c: Update. * gcc.dg/qual-return-3.c: Update. * gcc.dg/label-decl-4.c: Update. From-SVN: r138893
2008-08-09 01:57:19 +02:00
pedwarn independently of the -pedantic switch use "pedwarn (0,...)".
re PR other/36901 (pedwarn() + -pedantic-errors + -w (inhibit_warnings) should not emit errors) 2008-08-09 Manuel Lopez-Ibanez <manu@gcc.gnu.org> PR 36901 * diagnostic.def (DK_PEDWARN, DK_PERMERROR): New. * diagnostic.c (pedantic_warning_kind, permissive_error_kind): Moved from diagnostic.h (diagnostic_report_diagnostic): Return bool. Handle DK_PEDWARN and DK_PERMERROR. (emit_diagnostic): New. (warning0, pedwarn0): Delete. (warning, warning_at, pedwarn, permerror): Return bool. * diagnostic.h (pedantic_warning_kind, permissive_error_kind): Moved to diagnostic.c. (struct diagnostic_context): Use correct type for classify_diagnostic. (diagnostic_report_diagnostic): Update declaration. (emit_diagnostic): Declare. * errors.c (warning): Return bool. * errors.h (warning): Update declaration. * toplev.h (warning0, pedwarn0): Delete. (warning, warning_at, pedwarn, permerror): Return bool. * c-errors.c (pedwarn_c99, pedwarn_c90): Use DK_PEDWARN. * c-decl.c (locate_old_decl): Delete 'diag' argument. Always use inform. Update all calls. (diagnose_mismatched_decls): Check return value of warning/pedwarn before giving informative note. (implicit_decl_warning): Likewise. * c-typeck.c (build_function_call): Likewise. * tree-sssa.c (warn_uninit): Likewise. * builtins.c (gimplify_va_arg_expr): Likewise. fortran/ * f95-lang.c (gfc_mark_addressable): Use "pedwarn (0," instead of 'pedwarn0'. cp/ * cp-tree.h (struct diagnostic_context, struct diagnostic_info): Delete forward declarations. Check that toplev.h has not been included before this file. Include toplev.h and diagnostic.h. * error.c (cp_cpp_error): Use DK_PEDWARN. (cxx_incomplete_type_diagnostic): Update declaration. (cxx_incomplete_type_error): Use DK_ERROR. * typeck2.c (cxx_incomplete_type_diagnostic): Take a diagnostic_t as argument. Use emit_diagnostic. (cxx_incomplete_type_error): Use DK_ERROR. (add_exception_specifier): Use diagnostic_t instead of custom codes. * typeck.c (complete_type_or_else): Update call to cxx_incomplete_type_diagnostic. * init.c (build_delete): Likewise. * call.c (diagnostic_fn_t): Remove unused typedef. (build_temp): Pass a pointer to diagnostic_t. (convert_like_real): Use emit_diagnostic. (joust): Check return value of warning before giving informative note. * friend.c (do_friend): Check return value of warning before giving informative note. * parser.c (cp_parser_template_id): Likewise. testsuite/ * gcc.dg/pr36901-1.c: New. * gcc.dg/pr36901-3.c: New. * gcc.dg/pr36901-2.c: New. * gcc.dg/pr36901-4.c: New. * gcc.dg/pr36901-system.h: New. * gcc.dg/pr36901.h: New. * gcc.target/powerpc/altivec-macros.c: Update. * gcc.target/i386/regparm.c: Update. * gcc.dg/funcdef-var-1.c: Update. * gcc.dg/parm-mismatch-1.c: Update. * gcc.dg/attr-noinline.c: Update. * gcc.dg/wtr-static-1.c: Update. * gcc.dg/redecl-11.c: Update. * gcc.dg/pr27953.c: Update. * gcc.dg/proto-1.c: Update. * gcc.dg/decl-3.c: Update. * gcc.dg/redecl-13.c: Update. * gcc.dg/pr15360-1.c: Update. * gcc.dg/redecl-15.c: Update. * gcc.dg/enum-compat-1.c: Update. * gcc.dg/dll-3.c: Update. * gcc.dg/array-5.c: Update. * gcc.dg/Wredundant-decls-2.c: Update. * gcc.dg/inline4.c: Update. * gcc.dg/redecl-2.c: Update. * gcc.dg/inline-14.c: Update. * gcc.dg/tls/diag-3.c: Update. * gcc.dg/funcdef-var-2.c: Update. * gcc.dg/20041213-1.c: Update. * gcc.dg/old-style-then-proto-1.c: Update. * gcc.dg/decl-2.c: Update. * gcc.dg/redecl-12.c: Update. * gcc.dg/decl-4.c: Update. * gcc.dg/Wshadow-1.c: Update. * gcc.dg/transparent-union-2.c: Update. * gcc.dg/visibility-7.c: Update. * gcc.dg/dll-2.c: Update. * gcc.dg/redecl-16.c: Update. * gcc.dg/inline1.c: Update. * gcc.dg/decl-8.c: Update. * gcc.dg/nested-redef-1.c: Update. * gcc.dg/inline3.c: Update. * gcc.dg/redecl-1.c: Update. * gcc.dg/inline5.c: Update. * gcc.dg/pr35899.c: Update. * gcc.dg/noncompile/label-lineno-1.c: Update. * gcc.dg/noncompile/label-1.c: Update. * gcc.dg/noncompile/20020220-1.c: Update. * gcc.dg/noncompile/redecl-1.c: Update. * gcc.dg/redecl-5.c: Update. * gcc.dg/qual-return-3.c: Update. * gcc.dg/label-decl-4.c: Update. From-SVN: r138893
2008-08-09 01:57:19 +02:00
Returns true if the warning was printed, false if it was inhibited. */
bool
pedwarn (location_t location, int opt, const char *gmsgid, ...)
{
diagnostic_info diagnostic;
va_list ap;
va_start (ap, gmsgid);
diagnostic_set_info (&diagnostic, gmsgid, &ap, location, DK_PEDWARN);
diagnostic.option_index = opt;
va_end (ap);
return report_diagnostic (&diagnostic);
}
/* A "permissive" error at LOCATION: issues an error unless
-fpermissive was given on the command line, in which case it issues
a warning. Use this for things that really should be errors but we
re PR other/36901 (pedwarn() + -pedantic-errors + -w (inhibit_warnings) should not emit errors) 2008-08-09 Manuel Lopez-Ibanez <manu@gcc.gnu.org> PR 36901 * diagnostic.def (DK_PEDWARN, DK_PERMERROR): New. * diagnostic.c (pedantic_warning_kind, permissive_error_kind): Moved from diagnostic.h (diagnostic_report_diagnostic): Return bool. Handle DK_PEDWARN and DK_PERMERROR. (emit_diagnostic): New. (warning0, pedwarn0): Delete. (warning, warning_at, pedwarn, permerror): Return bool. * diagnostic.h (pedantic_warning_kind, permissive_error_kind): Moved to diagnostic.c. (struct diagnostic_context): Use correct type for classify_diagnostic. (diagnostic_report_diagnostic): Update declaration. (emit_diagnostic): Declare. * errors.c (warning): Return bool. * errors.h (warning): Update declaration. * toplev.h (warning0, pedwarn0): Delete. (warning, warning_at, pedwarn, permerror): Return bool. * c-errors.c (pedwarn_c99, pedwarn_c90): Use DK_PEDWARN. * c-decl.c (locate_old_decl): Delete 'diag' argument. Always use inform. Update all calls. (diagnose_mismatched_decls): Check return value of warning/pedwarn before giving informative note. (implicit_decl_warning): Likewise. * c-typeck.c (build_function_call): Likewise. * tree-sssa.c (warn_uninit): Likewise. * builtins.c (gimplify_va_arg_expr): Likewise. fortran/ * f95-lang.c (gfc_mark_addressable): Use "pedwarn (0," instead of 'pedwarn0'. cp/ * cp-tree.h (struct diagnostic_context, struct diagnostic_info): Delete forward declarations. Check that toplev.h has not been included before this file. Include toplev.h and diagnostic.h. * error.c (cp_cpp_error): Use DK_PEDWARN. (cxx_incomplete_type_diagnostic): Update declaration. (cxx_incomplete_type_error): Use DK_ERROR. * typeck2.c (cxx_incomplete_type_diagnostic): Take a diagnostic_t as argument. Use emit_diagnostic. (cxx_incomplete_type_error): Use DK_ERROR. (add_exception_specifier): Use diagnostic_t instead of custom codes. * typeck.c (complete_type_or_else): Update call to cxx_incomplete_type_diagnostic. * init.c (build_delete): Likewise. * call.c (diagnostic_fn_t): Remove unused typedef. (build_temp): Pass a pointer to diagnostic_t. (convert_like_real): Use emit_diagnostic. (joust): Check return value of warning before giving informative note. * friend.c (do_friend): Check return value of warning before giving informative note. * parser.c (cp_parser_template_id): Likewise. testsuite/ * gcc.dg/pr36901-1.c: New. * gcc.dg/pr36901-3.c: New. * gcc.dg/pr36901-2.c: New. * gcc.dg/pr36901-4.c: New. * gcc.dg/pr36901-system.h: New. * gcc.dg/pr36901.h: New. * gcc.target/powerpc/altivec-macros.c: Update. * gcc.target/i386/regparm.c: Update. * gcc.dg/funcdef-var-1.c: Update. * gcc.dg/parm-mismatch-1.c: Update. * gcc.dg/attr-noinline.c: Update. * gcc.dg/wtr-static-1.c: Update. * gcc.dg/redecl-11.c: Update. * gcc.dg/pr27953.c: Update. * gcc.dg/proto-1.c: Update. * gcc.dg/decl-3.c: Update. * gcc.dg/redecl-13.c: Update. * gcc.dg/pr15360-1.c: Update. * gcc.dg/redecl-15.c: Update. * gcc.dg/enum-compat-1.c: Update. * gcc.dg/dll-3.c: Update. * gcc.dg/array-5.c: Update. * gcc.dg/Wredundant-decls-2.c: Update. * gcc.dg/inline4.c: Update. * gcc.dg/redecl-2.c: Update. * gcc.dg/inline-14.c: Update. * gcc.dg/tls/diag-3.c: Update. * gcc.dg/funcdef-var-2.c: Update. * gcc.dg/20041213-1.c: Update. * gcc.dg/old-style-then-proto-1.c: Update. * gcc.dg/decl-2.c: Update. * gcc.dg/redecl-12.c: Update. * gcc.dg/decl-4.c: Update. * gcc.dg/Wshadow-1.c: Update. * gcc.dg/transparent-union-2.c: Update. * gcc.dg/visibility-7.c: Update. * gcc.dg/dll-2.c: Update. * gcc.dg/redecl-16.c: Update. * gcc.dg/inline1.c: Update. * gcc.dg/decl-8.c: Update. * gcc.dg/nested-redef-1.c: Update. * gcc.dg/inline3.c: Update. * gcc.dg/redecl-1.c: Update. * gcc.dg/inline5.c: Update. * gcc.dg/pr35899.c: Update. * gcc.dg/noncompile/label-lineno-1.c: Update. * gcc.dg/noncompile/label-1.c: Update. * gcc.dg/noncompile/20020220-1.c: Update. * gcc.dg/noncompile/redecl-1.c: Update. * gcc.dg/redecl-5.c: Update. * gcc.dg/qual-return-3.c: Update. * gcc.dg/label-decl-4.c: Update. From-SVN: r138893
2008-08-09 01:57:19 +02:00
want to support legacy code.
re PR other/36901 (pedwarn() + -pedantic-errors + -w (inhibit_warnings) should not emit errors) 2008-08-09 Manuel Lopez-Ibanez <manu@gcc.gnu.org> PR 36901 * diagnostic.def (DK_PEDWARN, DK_PERMERROR): New. * diagnostic.c (pedantic_warning_kind, permissive_error_kind): Moved from diagnostic.h (diagnostic_report_diagnostic): Return bool. Handle DK_PEDWARN and DK_PERMERROR. (emit_diagnostic): New. (warning0, pedwarn0): Delete. (warning, warning_at, pedwarn, permerror): Return bool. * diagnostic.h (pedantic_warning_kind, permissive_error_kind): Moved to diagnostic.c. (struct diagnostic_context): Use correct type for classify_diagnostic. (diagnostic_report_diagnostic): Update declaration. (emit_diagnostic): Declare. * errors.c (warning): Return bool. * errors.h (warning): Update declaration. * toplev.h (warning0, pedwarn0): Delete. (warning, warning_at, pedwarn, permerror): Return bool. * c-errors.c (pedwarn_c99, pedwarn_c90): Use DK_PEDWARN. * c-decl.c (locate_old_decl): Delete 'diag' argument. Always use inform. Update all calls. (diagnose_mismatched_decls): Check return value of warning/pedwarn before giving informative note. (implicit_decl_warning): Likewise. * c-typeck.c (build_function_call): Likewise. * tree-sssa.c (warn_uninit): Likewise. * builtins.c (gimplify_va_arg_expr): Likewise. fortran/ * f95-lang.c (gfc_mark_addressable): Use "pedwarn (0," instead of 'pedwarn0'. cp/ * cp-tree.h (struct diagnostic_context, struct diagnostic_info): Delete forward declarations. Check that toplev.h has not been included before this file. Include toplev.h and diagnostic.h. * error.c (cp_cpp_error): Use DK_PEDWARN. (cxx_incomplete_type_diagnostic): Update declaration. (cxx_incomplete_type_error): Use DK_ERROR. * typeck2.c (cxx_incomplete_type_diagnostic): Take a diagnostic_t as argument. Use emit_diagnostic. (cxx_incomplete_type_error): Use DK_ERROR. (add_exception_specifier): Use diagnostic_t instead of custom codes. * typeck.c (complete_type_or_else): Update call to cxx_incomplete_type_diagnostic. * init.c (build_delete): Likewise. * call.c (diagnostic_fn_t): Remove unused typedef. (build_temp): Pass a pointer to diagnostic_t. (convert_like_real): Use emit_diagnostic. (joust): Check return value of warning before giving informative note. * friend.c (do_friend): Check return value of warning before giving informative note. * parser.c (cp_parser_template_id): Likewise. testsuite/ * gcc.dg/pr36901-1.c: New. * gcc.dg/pr36901-3.c: New. * gcc.dg/pr36901-2.c: New. * gcc.dg/pr36901-4.c: New. * gcc.dg/pr36901-system.h: New. * gcc.dg/pr36901.h: New. * gcc.target/powerpc/altivec-macros.c: Update. * gcc.target/i386/regparm.c: Update. * gcc.dg/funcdef-var-1.c: Update. * gcc.dg/parm-mismatch-1.c: Update. * gcc.dg/attr-noinline.c: Update. * gcc.dg/wtr-static-1.c: Update. * gcc.dg/redecl-11.c: Update. * gcc.dg/pr27953.c: Update. * gcc.dg/proto-1.c: Update. * gcc.dg/decl-3.c: Update. * gcc.dg/redecl-13.c: Update. * gcc.dg/pr15360-1.c: Update. * gcc.dg/redecl-15.c: Update. * gcc.dg/enum-compat-1.c: Update. * gcc.dg/dll-3.c: Update. * gcc.dg/array-5.c: Update. * gcc.dg/Wredundant-decls-2.c: Update. * gcc.dg/inline4.c: Update. * gcc.dg/redecl-2.c: Update. * gcc.dg/inline-14.c: Update. * gcc.dg/tls/diag-3.c: Update. * gcc.dg/funcdef-var-2.c: Update. * gcc.dg/20041213-1.c: Update. * gcc.dg/old-style-then-proto-1.c: Update. * gcc.dg/decl-2.c: Update. * gcc.dg/redecl-12.c: Update. * gcc.dg/decl-4.c: Update. * gcc.dg/Wshadow-1.c: Update. * gcc.dg/transparent-union-2.c: Update. * gcc.dg/visibility-7.c: Update. * gcc.dg/dll-2.c: Update. * gcc.dg/redecl-16.c: Update. * gcc.dg/inline1.c: Update. * gcc.dg/decl-8.c: Update. * gcc.dg/nested-redef-1.c: Update. * gcc.dg/inline3.c: Update. * gcc.dg/redecl-1.c: Update. * gcc.dg/inline5.c: Update. * gcc.dg/pr35899.c: Update. * gcc.dg/noncompile/label-lineno-1.c: Update. * gcc.dg/noncompile/label-1.c: Update. * gcc.dg/noncompile/20020220-1.c: Update. * gcc.dg/noncompile/redecl-1.c: Update. * gcc.dg/redecl-5.c: Update. * gcc.dg/qual-return-3.c: Update. * gcc.dg/label-decl-4.c: Update. From-SVN: r138893
2008-08-09 01:57:19 +02:00
Returns true if the warning was printed, false if it was inhibited. */
bool
permerror (location_t location, const char *gmsgid, ...)
{
diagnostic_info diagnostic;
va_list ap;
va_start (ap, gmsgid);
diagnostic_set_info (&diagnostic, gmsgid, &ap, location,
re PR other/36901 (pedwarn() + -pedantic-errors + -w (inhibit_warnings) should not emit errors) 2008-08-09 Manuel Lopez-Ibanez <manu@gcc.gnu.org> PR 36901 * diagnostic.def (DK_PEDWARN, DK_PERMERROR): New. * diagnostic.c (pedantic_warning_kind, permissive_error_kind): Moved from diagnostic.h (diagnostic_report_diagnostic): Return bool. Handle DK_PEDWARN and DK_PERMERROR. (emit_diagnostic): New. (warning0, pedwarn0): Delete. (warning, warning_at, pedwarn, permerror): Return bool. * diagnostic.h (pedantic_warning_kind, permissive_error_kind): Moved to diagnostic.c. (struct diagnostic_context): Use correct type for classify_diagnostic. (diagnostic_report_diagnostic): Update declaration. (emit_diagnostic): Declare. * errors.c (warning): Return bool. * errors.h (warning): Update declaration. * toplev.h (warning0, pedwarn0): Delete. (warning, warning_at, pedwarn, permerror): Return bool. * c-errors.c (pedwarn_c99, pedwarn_c90): Use DK_PEDWARN. * c-decl.c (locate_old_decl): Delete 'diag' argument. Always use inform. Update all calls. (diagnose_mismatched_decls): Check return value of warning/pedwarn before giving informative note. (implicit_decl_warning): Likewise. * c-typeck.c (build_function_call): Likewise. * tree-sssa.c (warn_uninit): Likewise. * builtins.c (gimplify_va_arg_expr): Likewise. fortran/ * f95-lang.c (gfc_mark_addressable): Use "pedwarn (0," instead of 'pedwarn0'. cp/ * cp-tree.h (struct diagnostic_context, struct diagnostic_info): Delete forward declarations. Check that toplev.h has not been included before this file. Include toplev.h and diagnostic.h. * error.c (cp_cpp_error): Use DK_PEDWARN. (cxx_incomplete_type_diagnostic): Update declaration. (cxx_incomplete_type_error): Use DK_ERROR. * typeck2.c (cxx_incomplete_type_diagnostic): Take a diagnostic_t as argument. Use emit_diagnostic. (cxx_incomplete_type_error): Use DK_ERROR. (add_exception_specifier): Use diagnostic_t instead of custom codes. * typeck.c (complete_type_or_else): Update call to cxx_incomplete_type_diagnostic. * init.c (build_delete): Likewise. * call.c (diagnostic_fn_t): Remove unused typedef. (build_temp): Pass a pointer to diagnostic_t. (convert_like_real): Use emit_diagnostic. (joust): Check return value of warning before giving informative note. * friend.c (do_friend): Check return value of warning before giving informative note. * parser.c (cp_parser_template_id): Likewise. testsuite/ * gcc.dg/pr36901-1.c: New. * gcc.dg/pr36901-3.c: New. * gcc.dg/pr36901-2.c: New. * gcc.dg/pr36901-4.c: New. * gcc.dg/pr36901-system.h: New. * gcc.dg/pr36901.h: New. * gcc.target/powerpc/altivec-macros.c: Update. * gcc.target/i386/regparm.c: Update. * gcc.dg/funcdef-var-1.c: Update. * gcc.dg/parm-mismatch-1.c: Update. * gcc.dg/attr-noinline.c: Update. * gcc.dg/wtr-static-1.c: Update. * gcc.dg/redecl-11.c: Update. * gcc.dg/pr27953.c: Update. * gcc.dg/proto-1.c: Update. * gcc.dg/decl-3.c: Update. * gcc.dg/redecl-13.c: Update. * gcc.dg/pr15360-1.c: Update. * gcc.dg/redecl-15.c: Update. * gcc.dg/enum-compat-1.c: Update. * gcc.dg/dll-3.c: Update. * gcc.dg/array-5.c: Update. * gcc.dg/Wredundant-decls-2.c: Update. * gcc.dg/inline4.c: Update. * gcc.dg/redecl-2.c: Update. * gcc.dg/inline-14.c: Update. * gcc.dg/tls/diag-3.c: Update. * gcc.dg/funcdef-var-2.c: Update. * gcc.dg/20041213-1.c: Update. * gcc.dg/old-style-then-proto-1.c: Update. * gcc.dg/decl-2.c: Update. * gcc.dg/redecl-12.c: Update. * gcc.dg/decl-4.c: Update. * gcc.dg/Wshadow-1.c: Update. * gcc.dg/transparent-union-2.c: Update. * gcc.dg/visibility-7.c: Update. * gcc.dg/dll-2.c: Update. * gcc.dg/redecl-16.c: Update. * gcc.dg/inline1.c: Update. * gcc.dg/decl-8.c: Update. * gcc.dg/nested-redef-1.c: Update. * gcc.dg/inline3.c: Update. * gcc.dg/redecl-1.c: Update. * gcc.dg/inline5.c: Update. * gcc.dg/pr35899.c: Update. * gcc.dg/noncompile/label-lineno-1.c: Update. * gcc.dg/noncompile/label-1.c: Update. * gcc.dg/noncompile/20020220-1.c: Update. * gcc.dg/noncompile/redecl-1.c: Update. * gcc.dg/redecl-5.c: Update. * gcc.dg/qual-return-3.c: Update. * gcc.dg/label-decl-4.c: Update. From-SVN: r138893
2008-08-09 01:57:19 +02:00
permissive_error_kind ());
diagnostic.option_index = OPT_fpermissive;
va_end (ap);
re PR other/36901 (pedwarn() + -pedantic-errors + -w (inhibit_warnings) should not emit errors) 2008-08-09 Manuel Lopez-Ibanez <manu@gcc.gnu.org> PR 36901 * diagnostic.def (DK_PEDWARN, DK_PERMERROR): New. * diagnostic.c (pedantic_warning_kind, permissive_error_kind): Moved from diagnostic.h (diagnostic_report_diagnostic): Return bool. Handle DK_PEDWARN and DK_PERMERROR. (emit_diagnostic): New. (warning0, pedwarn0): Delete. (warning, warning_at, pedwarn, permerror): Return bool. * diagnostic.h (pedantic_warning_kind, permissive_error_kind): Moved to diagnostic.c. (struct diagnostic_context): Use correct type for classify_diagnostic. (diagnostic_report_diagnostic): Update declaration. (emit_diagnostic): Declare. * errors.c (warning): Return bool. * errors.h (warning): Update declaration. * toplev.h (warning0, pedwarn0): Delete. (warning, warning_at, pedwarn, permerror): Return bool. * c-errors.c (pedwarn_c99, pedwarn_c90): Use DK_PEDWARN. * c-decl.c (locate_old_decl): Delete 'diag' argument. Always use inform. Update all calls. (diagnose_mismatched_decls): Check return value of warning/pedwarn before giving informative note. (implicit_decl_warning): Likewise. * c-typeck.c (build_function_call): Likewise. * tree-sssa.c (warn_uninit): Likewise. * builtins.c (gimplify_va_arg_expr): Likewise. fortran/ * f95-lang.c (gfc_mark_addressable): Use "pedwarn (0," instead of 'pedwarn0'. cp/ * cp-tree.h (struct diagnostic_context, struct diagnostic_info): Delete forward declarations. Check that toplev.h has not been included before this file. Include toplev.h and diagnostic.h. * error.c (cp_cpp_error): Use DK_PEDWARN. (cxx_incomplete_type_diagnostic): Update declaration. (cxx_incomplete_type_error): Use DK_ERROR. * typeck2.c (cxx_incomplete_type_diagnostic): Take a diagnostic_t as argument. Use emit_diagnostic. (cxx_incomplete_type_error): Use DK_ERROR. (add_exception_specifier): Use diagnostic_t instead of custom codes. * typeck.c (complete_type_or_else): Update call to cxx_incomplete_type_diagnostic. * init.c (build_delete): Likewise. * call.c (diagnostic_fn_t): Remove unused typedef. (build_temp): Pass a pointer to diagnostic_t. (convert_like_real): Use emit_diagnostic. (joust): Check return value of warning before giving informative note. * friend.c (do_friend): Check return value of warning before giving informative note. * parser.c (cp_parser_template_id): Likewise. testsuite/ * gcc.dg/pr36901-1.c: New. * gcc.dg/pr36901-3.c: New. * gcc.dg/pr36901-2.c: New. * gcc.dg/pr36901-4.c: New. * gcc.dg/pr36901-system.h: New. * gcc.dg/pr36901.h: New. * gcc.target/powerpc/altivec-macros.c: Update. * gcc.target/i386/regparm.c: Update. * gcc.dg/funcdef-var-1.c: Update. * gcc.dg/parm-mismatch-1.c: Update. * gcc.dg/attr-noinline.c: Update. * gcc.dg/wtr-static-1.c: Update. * gcc.dg/redecl-11.c: Update. * gcc.dg/pr27953.c: Update. * gcc.dg/proto-1.c: Update. * gcc.dg/decl-3.c: Update. * gcc.dg/redecl-13.c: Update. * gcc.dg/pr15360-1.c: Update. * gcc.dg/redecl-15.c: Update. * gcc.dg/enum-compat-1.c: Update. * gcc.dg/dll-3.c: Update. * gcc.dg/array-5.c: Update. * gcc.dg/Wredundant-decls-2.c: Update. * gcc.dg/inline4.c: Update. * gcc.dg/redecl-2.c: Update. * gcc.dg/inline-14.c: Update. * gcc.dg/tls/diag-3.c: Update. * gcc.dg/funcdef-var-2.c: Update. * gcc.dg/20041213-1.c: Update. * gcc.dg/old-style-then-proto-1.c: Update. * gcc.dg/decl-2.c: Update. * gcc.dg/redecl-12.c: Update. * gcc.dg/decl-4.c: Update. * gcc.dg/Wshadow-1.c: Update. * gcc.dg/transparent-union-2.c: Update. * gcc.dg/visibility-7.c: Update. * gcc.dg/dll-2.c: Update. * gcc.dg/redecl-16.c: Update. * gcc.dg/inline1.c: Update. * gcc.dg/decl-8.c: Update. * gcc.dg/nested-redef-1.c: Update. * gcc.dg/inline3.c: Update. * gcc.dg/redecl-1.c: Update. * gcc.dg/inline5.c: Update. * gcc.dg/pr35899.c: Update. * gcc.dg/noncompile/label-lineno-1.c: Update. * gcc.dg/noncompile/label-1.c: Update. * gcc.dg/noncompile/20020220-1.c: Update. * gcc.dg/noncompile/redecl-1.c: Update. * gcc.dg/redecl-5.c: Update. * gcc.dg/qual-return-3.c: Update. * gcc.dg/label-decl-4.c: Update. From-SVN: r138893
2008-08-09 01:57:19 +02:00
return report_diagnostic (&diagnostic);
}
/* A hard error: the code is definitely ill-formed, and an object file
will not be produced. */
void
exgettext: Handle gmsgid and cmsgid arguments specially, as gcc-internal-format and c-format. gcc/po/ * exgettext: Handle gmsgid and cmsgid arguments specially, as gcc-internal-format and c-format. Because of xgettext bug, invoke xgettext once with --language=c, once with --language=GCC-source and then merge together. Fail if xgettext is not 0.14.5 or later. gcc/ * intl.h (G_): New macro. * rtl-error.c (error_for_asm, warning_for_asm): Use gmsgid instead of msgid for argument name. * tree-ssa.c (warn_uninit): Likewise. * c-parser.c (c_parser_error): Likewise. * config/rs6000/rs6000-c.c (SYNTAX_ERROR): Likewise. * config/darwin-c.c (BAD): Likewise. * config/c4x/c4x-c.c (BAD): Likewise. * c-pragma.c (GCC_BAD, GCC_BAD2): Likewise. * c-errors.c (pedwarn_c99, pedwarn_c90): Likewise. * c-common.c (c_parse_error): Likewise. * diagnostic.c (diagnostic_set_info, verbatim, inform, warning, warning0, pedwarn, error, sorry, fatal_error, internal_error): Likewise. (fnotice): Use cmsgid instead of msgid for argument name. * gcov.c (fnotice): Likewise. * protoize.c (notice): Likewise. * final.c (output_operand_lossage): Likewise. * gcc.c (fatal, notice): Likewise. (error): Use gmsgid instead of msgid for argument name. * collect2.c (notice, fatal_perror, fatal): Use cmsgid instead of msgid for argument name. (error): Use gmsgid instead of msgid for argument name. * c-decl.c (locate_old_decl, implicit_decl_warning): Use G_() instead of N_(). * c-typeck.c (readonly_error, convert_for_assignment): Likewise. * tree-inline.c (inline_forbidden_p_1): Likewise. * ABOUT-GCC-NLS: Require gettext 0.14.5 or later. Mention the new conventions for marking translations. * doc/install.texi: Mention gettext 0.14.5 or later requirement. gcc/cp/ * error.c (locate_error): Use gmsgid instead of msgid for argument name. (cp_error_at, cp_warning_at, cp_pedwarn_at): Likewise. gcc/java/ * jv-scan.c (fatal_error, warning, warning0): Use gmsgid instead of msgid for argument name. * gjavah.c (error): Likewise. * java-tree.h (parse_error_context): Likewise. * parse.y (parse_error_context, parse_warning_context, issue_warning_error_from_context): Likewise. From-SVN: r100676
2005-06-06 21:31:40 +02:00
error (const char *gmsgid, ...)
{
diagnostic_info diagnostic;
builtins.c (validate_arglist): Eliminate libiberty VA_ macros, always use stdarg. gcc: * builtins.c (validate_arglist): Eliminate libiberty VA_ macros, always use stdarg. * c-errors.c (pedwarn_c99): Likewise. * c-format.c (status_warning): Likewise. * c-semantics.c (build_stmt): Likewise. * calls.c (emit_library_call, emit_library_call_value): Likewise. * collect2.c (notice, fatal_perror, fatal, error): Likewise. * cpperror.c (cpp_error, cpp_error_with_line): Likewise. * diagnostic.c (build_message_string, output_printf, output_verbatim, verbatim, inform, warning, pedwarn, error, sorry, fatal_error, internal_error, warning_with_decl, pedwarn_with_decl, error_with_decl, fnotice): Likewise. * dwarf2asm.c (dw2_asm_output_data, dw2_asm_output_delta, dw2_asm_output_offset, dw2_asm_output_pcrel, dw2_asm_output_addr, dw2_asm_output_addr_rtx, dw2_asm_output_nstring, dw2_asm_output_data_uleb128, dw2_asm_output_data_sleb128, dw2_asm_output_delta_uleb128, dw2_asm_output_delta_sleb128, dw2_asm_output_encoded_addr_rtx): Likewise. * emit-rtl.c (gen_rtx, gen_rtvec): Likewise. * errors.c (warning, error, fatal, internal_error): Likewise. * final.c (output_operand_lossage, asm_fprintf): Likewise. * fix-header.c (fatal): Likewise. * gcc.c (fatal, error, notice): Likewise. * gcov.c (fnotice): Likewise. * genattrtab.c (attr_rtx, attr_printf): Likewise. * gengtype.c (error_at_line, xasprintf, oprintf): Likewise. * gensupport.c (message_with_line): Likewise. * mips-tfile.c (fatal, error): Likewise. * protoize.c (notice): Likewise. * ra-debug.c (ra_debug_msg): Likewise. * read-rtl.c (fatal_with_file_and_line): Likewise. * rtl-error.c (error_for_asm, warning_for_asm): Likewise. * tree.c (build, build_nt, build_function_type_list): Likewise. cp: * error.c (cp_error_at, cp_warning_at, cp_pedwarn_at): Eliminate libiberty VA_ macros, always use stdarg. * rtti.c (create_pseudo_type_info): Likewise. * tree.c (build_min_nt, build_min): Likewise. From-SVN: r66919
2003-05-18 00:21:35 +02:00
va_list ap;
exgettext: Handle gmsgid and cmsgid arguments specially, as gcc-internal-format and c-format. gcc/po/ * exgettext: Handle gmsgid and cmsgid arguments specially, as gcc-internal-format and c-format. Because of xgettext bug, invoke xgettext once with --language=c, once with --language=GCC-source and then merge together. Fail if xgettext is not 0.14.5 or later. gcc/ * intl.h (G_): New macro. * rtl-error.c (error_for_asm, warning_for_asm): Use gmsgid instead of msgid for argument name. * tree-ssa.c (warn_uninit): Likewise. * c-parser.c (c_parser_error): Likewise. * config/rs6000/rs6000-c.c (SYNTAX_ERROR): Likewise. * config/darwin-c.c (BAD): Likewise. * config/c4x/c4x-c.c (BAD): Likewise. * c-pragma.c (GCC_BAD, GCC_BAD2): Likewise. * c-errors.c (pedwarn_c99, pedwarn_c90): Likewise. * c-common.c (c_parse_error): Likewise. * diagnostic.c (diagnostic_set_info, verbatim, inform, warning, warning0, pedwarn, error, sorry, fatal_error, internal_error): Likewise. (fnotice): Use cmsgid instead of msgid for argument name. * gcov.c (fnotice): Likewise. * protoize.c (notice): Likewise. * final.c (output_operand_lossage): Likewise. * gcc.c (fatal, notice): Likewise. (error): Use gmsgid instead of msgid for argument name. * collect2.c (notice, fatal_perror, fatal): Use cmsgid instead of msgid for argument name. (error): Use gmsgid instead of msgid for argument name. * c-decl.c (locate_old_decl, implicit_decl_warning): Use G_() instead of N_(). * c-typeck.c (readonly_error, convert_for_assignment): Likewise. * tree-inline.c (inline_forbidden_p_1): Likewise. * ABOUT-GCC-NLS: Require gettext 0.14.5 or later. Mention the new conventions for marking translations. * doc/install.texi: Mention gettext 0.14.5 or later requirement. gcc/cp/ * error.c (locate_error): Use gmsgid instead of msgid for argument name. (cp_error_at, cp_warning_at, cp_pedwarn_at): Likewise. gcc/java/ * jv-scan.c (fatal_error, warning, warning0): Use gmsgid instead of msgid for argument name. * gjavah.c (error): Likewise. * java-tree.h (parse_error_context): Likewise. * parse.y (parse_error_context, parse_warning_context, issue_warning_error_from_context): Likewise. From-SVN: r100676
2005-06-06 21:31:40 +02:00
va_start (ap, gmsgid);
diagnostic_set_info (&diagnostic, gmsgid, &ap, input_location, DK_ERROR);
report_diagnostic (&diagnostic);
builtins.c (validate_arglist): Eliminate libiberty VA_ macros, always use stdarg. gcc: * builtins.c (validate_arglist): Eliminate libiberty VA_ macros, always use stdarg. * c-errors.c (pedwarn_c99): Likewise. * c-format.c (status_warning): Likewise. * c-semantics.c (build_stmt): Likewise. * calls.c (emit_library_call, emit_library_call_value): Likewise. * collect2.c (notice, fatal_perror, fatal, error): Likewise. * cpperror.c (cpp_error, cpp_error_with_line): Likewise. * diagnostic.c (build_message_string, output_printf, output_verbatim, verbatim, inform, warning, pedwarn, error, sorry, fatal_error, internal_error, warning_with_decl, pedwarn_with_decl, error_with_decl, fnotice): Likewise. * dwarf2asm.c (dw2_asm_output_data, dw2_asm_output_delta, dw2_asm_output_offset, dw2_asm_output_pcrel, dw2_asm_output_addr, dw2_asm_output_addr_rtx, dw2_asm_output_nstring, dw2_asm_output_data_uleb128, dw2_asm_output_data_sleb128, dw2_asm_output_delta_uleb128, dw2_asm_output_delta_sleb128, dw2_asm_output_encoded_addr_rtx): Likewise. * emit-rtl.c (gen_rtx, gen_rtvec): Likewise. * errors.c (warning, error, fatal, internal_error): Likewise. * final.c (output_operand_lossage, asm_fprintf): Likewise. * fix-header.c (fatal): Likewise. * gcc.c (fatal, error, notice): Likewise. * gcov.c (fnotice): Likewise. * genattrtab.c (attr_rtx, attr_printf): Likewise. * gengtype.c (error_at_line, xasprintf, oprintf): Likewise. * gensupport.c (message_with_line): Likewise. * mips-tfile.c (fatal, error): Likewise. * protoize.c (notice): Likewise. * ra-debug.c (ra_debug_msg): Likewise. * read-rtl.c (fatal_with_file_and_line): Likewise. * rtl-error.c (error_for_asm, warning_for_asm): Likewise. * tree.c (build, build_nt, build_function_type_list): Likewise. cp: * error.c (cp_error_at, cp_warning_at, cp_pedwarn_at): Eliminate libiberty VA_ macros, always use stdarg. * rtti.c (create_pseudo_type_info): Likewise. * tree.c (build_min_nt, build_min): Likewise. From-SVN: r66919
2003-05-18 00:21:35 +02:00
va_end (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
exgettext: Handle gmsgid and cmsgid arguments specially, as gcc-internal-format and c-format. gcc/po/ * exgettext: Handle gmsgid and cmsgid arguments specially, as gcc-internal-format and c-format. Because of xgettext bug, invoke xgettext once with --language=c, once with --language=GCC-source and then merge together. Fail if xgettext is not 0.14.5 or later. gcc/ * intl.h (G_): New macro. * rtl-error.c (error_for_asm, warning_for_asm): Use gmsgid instead of msgid for argument name. * tree-ssa.c (warn_uninit): Likewise. * c-parser.c (c_parser_error): Likewise. * config/rs6000/rs6000-c.c (SYNTAX_ERROR): Likewise. * config/darwin-c.c (BAD): Likewise. * config/c4x/c4x-c.c (BAD): Likewise. * c-pragma.c (GCC_BAD, GCC_BAD2): Likewise. * c-errors.c (pedwarn_c99, pedwarn_c90): Likewise. * c-common.c (c_parse_error): Likewise. * diagnostic.c (diagnostic_set_info, verbatim, inform, warning, warning0, pedwarn, error, sorry, fatal_error, internal_error): Likewise. (fnotice): Use cmsgid instead of msgid for argument name. * gcov.c (fnotice): Likewise. * protoize.c (notice): Likewise. * final.c (output_operand_lossage): Likewise. * gcc.c (fatal, notice): Likewise. (error): Use gmsgid instead of msgid for argument name. * collect2.c (notice, fatal_perror, fatal): Use cmsgid instead of msgid for argument name. (error): Use gmsgid instead of msgid for argument name. * c-decl.c (locate_old_decl, implicit_decl_warning): Use G_() instead of N_(). * c-typeck.c (readonly_error, convert_for_assignment): Likewise. * tree-inline.c (inline_forbidden_p_1): Likewise. * ABOUT-GCC-NLS: Require gettext 0.14.5 or later. Mention the new conventions for marking translations. * doc/install.texi: Mention gettext 0.14.5 or later requirement. gcc/cp/ * error.c (locate_error): Use gmsgid instead of msgid for argument name. (cp_error_at, cp_warning_at, cp_pedwarn_at): Likewise. gcc/java/ * jv-scan.c (fatal_error, warning, warning0): Use gmsgid instead of msgid for argument name. * gjavah.c (error): Likewise. * java-tree.h (parse_error_context): Likewise. * parse.y (parse_error_context, parse_warning_context, issue_warning_error_from_context): Likewise. From-SVN: r100676
2005-06-06 21:31:40 +02:00
sorry (const char *gmsgid, ...)
{
diagnostic_info diagnostic;
builtins.c (validate_arglist): Eliminate libiberty VA_ macros, always use stdarg. gcc: * builtins.c (validate_arglist): Eliminate libiberty VA_ macros, always use stdarg. * c-errors.c (pedwarn_c99): Likewise. * c-format.c (status_warning): Likewise. * c-semantics.c (build_stmt): Likewise. * calls.c (emit_library_call, emit_library_call_value): Likewise. * collect2.c (notice, fatal_perror, fatal, error): Likewise. * cpperror.c (cpp_error, cpp_error_with_line): Likewise. * diagnostic.c (build_message_string, output_printf, output_verbatim, verbatim, inform, warning, pedwarn, error, sorry, fatal_error, internal_error, warning_with_decl, pedwarn_with_decl, error_with_decl, fnotice): Likewise. * dwarf2asm.c (dw2_asm_output_data, dw2_asm_output_delta, dw2_asm_output_offset, dw2_asm_output_pcrel, dw2_asm_output_addr, dw2_asm_output_addr_rtx, dw2_asm_output_nstring, dw2_asm_output_data_uleb128, dw2_asm_output_data_sleb128, dw2_asm_output_delta_uleb128, dw2_asm_output_delta_sleb128, dw2_asm_output_encoded_addr_rtx): Likewise. * emit-rtl.c (gen_rtx, gen_rtvec): Likewise. * errors.c (warning, error, fatal, internal_error): Likewise. * final.c (output_operand_lossage, asm_fprintf): Likewise. * fix-header.c (fatal): Likewise. * gcc.c (fatal, error, notice): Likewise. * gcov.c (fnotice): Likewise. * genattrtab.c (attr_rtx, attr_printf): Likewise. * gengtype.c (error_at_line, xasprintf, oprintf): Likewise. * gensupport.c (message_with_line): Likewise. * mips-tfile.c (fatal, error): Likewise. * protoize.c (notice): Likewise. * ra-debug.c (ra_debug_msg): Likewise. * read-rtl.c (fatal_with_file_and_line): Likewise. * rtl-error.c (error_for_asm, warning_for_asm): Likewise. * tree.c (build, build_nt, build_function_type_list): Likewise. cp: * error.c (cp_error_at, cp_warning_at, cp_pedwarn_at): Eliminate libiberty VA_ macros, always use stdarg. * rtti.c (create_pseudo_type_info): Likewise. * tree.c (build_min_nt, build_min): Likewise. From-SVN: r66919
2003-05-18 00:21:35 +02:00
va_list ap;
exgettext: Handle gmsgid and cmsgid arguments specially, as gcc-internal-format and c-format. gcc/po/ * exgettext: Handle gmsgid and cmsgid arguments specially, as gcc-internal-format and c-format. Because of xgettext bug, invoke xgettext once with --language=c, once with --language=GCC-source and then merge together. Fail if xgettext is not 0.14.5 or later. gcc/ * intl.h (G_): New macro. * rtl-error.c (error_for_asm, warning_for_asm): Use gmsgid instead of msgid for argument name. * tree-ssa.c (warn_uninit): Likewise. * c-parser.c (c_parser_error): Likewise. * config/rs6000/rs6000-c.c (SYNTAX_ERROR): Likewise. * config/darwin-c.c (BAD): Likewise. * config/c4x/c4x-c.c (BAD): Likewise. * c-pragma.c (GCC_BAD, GCC_BAD2): Likewise. * c-errors.c (pedwarn_c99, pedwarn_c90): Likewise. * c-common.c (c_parse_error): Likewise. * diagnostic.c (diagnostic_set_info, verbatim, inform, warning, warning0, pedwarn, error, sorry, fatal_error, internal_error): Likewise. (fnotice): Use cmsgid instead of msgid for argument name. * gcov.c (fnotice): Likewise. * protoize.c (notice): Likewise. * final.c (output_operand_lossage): Likewise. * gcc.c (fatal, notice): Likewise. (error): Use gmsgid instead of msgid for argument name. * collect2.c (notice, fatal_perror, fatal): Use cmsgid instead of msgid for argument name. (error): Use gmsgid instead of msgid for argument name. * c-decl.c (locate_old_decl, implicit_decl_warning): Use G_() instead of N_(). * c-typeck.c (readonly_error, convert_for_assignment): Likewise. * tree-inline.c (inline_forbidden_p_1): Likewise. * ABOUT-GCC-NLS: Require gettext 0.14.5 or later. Mention the new conventions for marking translations. * doc/install.texi: Mention gettext 0.14.5 or later requirement. gcc/cp/ * error.c (locate_error): Use gmsgid instead of msgid for argument name. (cp_error_at, cp_warning_at, cp_pedwarn_at): Likewise. gcc/java/ * jv-scan.c (fatal_error, warning, warning0): Use gmsgid instead of msgid for argument name. * gjavah.c (error): Likewise. * java-tree.h (parse_error_context): Likewise. * parse.y (parse_error_context, parse_warning_context, issue_warning_error_from_context): Likewise. From-SVN: r100676
2005-06-06 21:31:40 +02:00
va_start (ap, gmsgid);
diagnostic_set_info (&diagnostic, gmsgid, &ap, input_location, DK_SORRY);
diagnostic.c (diagnostic_for_decl): Take a diagnostic_context argument. * diagnostic.c (diagnostic_for_decl): Take a diagnostic_context argument. Restructure to be consistent with diagnostic_report_diagnostic. (diagnostic_count_diagnostic): Now static. Take a diagnostic_info argument, not just a diagnostic_t. Some code moved here from internal_error. Move a case label for clarity. (diagnostic_action_after_output): New function. Code moved here from internal_error and fatal_error. (bug_report_request): New #define so that this text appears in only one place. (diagnostic_report_diagnostic): Update to match changes to diagnostic_count_diagnostic. Call diagnostic_action_after_output. (diagnostic_set_info): Call gettext here. (pedwarn): Update comment. Don't call gettext here. (sorry): Use report_diagnostic. Don't call gettext here. (fatal_error): Remove final fnotice and exit, but call real_abort to prevent warnings about noreturn function returning. (internal_error): Likewise. Don't do ICE suppression here nor call context->internal_error. (warning_with_decl): Suppress for decls in system headers. Adjust call to diagnostic_for_decl. (pedwarn_with_decl): Likewise. (error_with_decl): Adjust call to diagnostic_for_decl. (error_recursion): Use bug_report_request. * diagnostic.h: Remove prototype of diagnostic_count_diagnostic. * objc/objc-act.c (error_with_ivar, warn_with_method): Don't call diagnostic_count_diagnostic. f: * bad.c: Don't call diagnostic_count_diagnostic. From-SVN: r66728
2003-05-12 20:32:18 +02:00
report_diagnostic (&diagnostic);
builtins.c (validate_arglist): Eliminate libiberty VA_ macros, always use stdarg. gcc: * builtins.c (validate_arglist): Eliminate libiberty VA_ macros, always use stdarg. * c-errors.c (pedwarn_c99): Likewise. * c-format.c (status_warning): Likewise. * c-semantics.c (build_stmt): Likewise. * calls.c (emit_library_call, emit_library_call_value): Likewise. * collect2.c (notice, fatal_perror, fatal, error): Likewise. * cpperror.c (cpp_error, cpp_error_with_line): Likewise. * diagnostic.c (build_message_string, output_printf, output_verbatim, verbatim, inform, warning, pedwarn, error, sorry, fatal_error, internal_error, warning_with_decl, pedwarn_with_decl, error_with_decl, fnotice): Likewise. * dwarf2asm.c (dw2_asm_output_data, dw2_asm_output_delta, dw2_asm_output_offset, dw2_asm_output_pcrel, dw2_asm_output_addr, dw2_asm_output_addr_rtx, dw2_asm_output_nstring, dw2_asm_output_data_uleb128, dw2_asm_output_data_sleb128, dw2_asm_output_delta_uleb128, dw2_asm_output_delta_sleb128, dw2_asm_output_encoded_addr_rtx): Likewise. * emit-rtl.c (gen_rtx, gen_rtvec): Likewise. * errors.c (warning, error, fatal, internal_error): Likewise. * final.c (output_operand_lossage, asm_fprintf): Likewise. * fix-header.c (fatal): Likewise. * gcc.c (fatal, error, notice): Likewise. * gcov.c (fnotice): Likewise. * genattrtab.c (attr_rtx, attr_printf): Likewise. * gengtype.c (error_at_line, xasprintf, oprintf): Likewise. * gensupport.c (message_with_line): Likewise. * mips-tfile.c (fatal, error): Likewise. * protoize.c (notice): Likewise. * ra-debug.c (ra_debug_msg): Likewise. * read-rtl.c (fatal_with_file_and_line): Likewise. * rtl-error.c (error_for_asm, warning_for_asm): Likewise. * tree.c (build, build_nt, build_function_type_list): Likewise. cp: * error.c (cp_error_at, cp_warning_at, cp_pedwarn_at): Eliminate libiberty VA_ macros, always use stdarg. * rtti.c (create_pseudo_type_info): Likewise. * tree.c (build_min_nt, build_min): Likewise. From-SVN: r66919
2003-05-18 00:21:35 +02:00
va_end (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
exgettext: Handle gmsgid and cmsgid arguments specially, as gcc-internal-format and c-format. gcc/po/ * exgettext: Handle gmsgid and cmsgid arguments specially, as gcc-internal-format and c-format. Because of xgettext bug, invoke xgettext once with --language=c, once with --language=GCC-source and then merge together. Fail if xgettext is not 0.14.5 or later. gcc/ * intl.h (G_): New macro. * rtl-error.c (error_for_asm, warning_for_asm): Use gmsgid instead of msgid for argument name. * tree-ssa.c (warn_uninit): Likewise. * c-parser.c (c_parser_error): Likewise. * config/rs6000/rs6000-c.c (SYNTAX_ERROR): Likewise. * config/darwin-c.c (BAD): Likewise. * config/c4x/c4x-c.c (BAD): Likewise. * c-pragma.c (GCC_BAD, GCC_BAD2): Likewise. * c-errors.c (pedwarn_c99, pedwarn_c90): Likewise. * c-common.c (c_parse_error): Likewise. * diagnostic.c (diagnostic_set_info, verbatim, inform, warning, warning0, pedwarn, error, sorry, fatal_error, internal_error): Likewise. (fnotice): Use cmsgid instead of msgid for argument name. * gcov.c (fnotice): Likewise. * protoize.c (notice): Likewise. * final.c (output_operand_lossage): Likewise. * gcc.c (fatal, notice): Likewise. (error): Use gmsgid instead of msgid for argument name. * collect2.c (notice, fatal_perror, fatal): Use cmsgid instead of msgid for argument name. (error): Use gmsgid instead of msgid for argument name. * c-decl.c (locate_old_decl, implicit_decl_warning): Use G_() instead of N_(). * c-typeck.c (readonly_error, convert_for_assignment): Likewise. * tree-inline.c (inline_forbidden_p_1): Likewise. * ABOUT-GCC-NLS: Require gettext 0.14.5 or later. Mention the new conventions for marking translations. * doc/install.texi: Mention gettext 0.14.5 or later requirement. gcc/cp/ * error.c (locate_error): Use gmsgid instead of msgid for argument name. (cp_error_at, cp_warning_at, cp_pedwarn_at): Likewise. gcc/java/ * jv-scan.c (fatal_error, warning, warning0): Use gmsgid instead of msgid for argument name. * gjavah.c (error): Likewise. * java-tree.h (parse_error_context): Likewise. * parse.y (parse_error_context, parse_warning_context, issue_warning_error_from_context): Likewise. From-SVN: r100676
2005-06-06 21:31:40 +02:00
fatal_error (const char *gmsgid, ...)
{
diagnostic_info diagnostic;
builtins.c (validate_arglist): Eliminate libiberty VA_ macros, always use stdarg. gcc: * builtins.c (validate_arglist): Eliminate libiberty VA_ macros, always use stdarg. * c-errors.c (pedwarn_c99): Likewise. * c-format.c (status_warning): Likewise. * c-semantics.c (build_stmt): Likewise. * calls.c (emit_library_call, emit_library_call_value): Likewise. * collect2.c (notice, fatal_perror, fatal, error): Likewise. * cpperror.c (cpp_error, cpp_error_with_line): Likewise. * diagnostic.c (build_message_string, output_printf, output_verbatim, verbatim, inform, warning, pedwarn, error, sorry, fatal_error, internal_error, warning_with_decl, pedwarn_with_decl, error_with_decl, fnotice): Likewise. * dwarf2asm.c (dw2_asm_output_data, dw2_asm_output_delta, dw2_asm_output_offset, dw2_asm_output_pcrel, dw2_asm_output_addr, dw2_asm_output_addr_rtx, dw2_asm_output_nstring, dw2_asm_output_data_uleb128, dw2_asm_output_data_sleb128, dw2_asm_output_delta_uleb128, dw2_asm_output_delta_sleb128, dw2_asm_output_encoded_addr_rtx): Likewise. * emit-rtl.c (gen_rtx, gen_rtvec): Likewise. * errors.c (warning, error, fatal, internal_error): Likewise. * final.c (output_operand_lossage, asm_fprintf): Likewise. * fix-header.c (fatal): Likewise. * gcc.c (fatal, error, notice): Likewise. * gcov.c (fnotice): Likewise. * genattrtab.c (attr_rtx, attr_printf): Likewise. * gengtype.c (error_at_line, xasprintf, oprintf): Likewise. * gensupport.c (message_with_line): Likewise. * mips-tfile.c (fatal, error): Likewise. * protoize.c (notice): Likewise. * ra-debug.c (ra_debug_msg): Likewise. * read-rtl.c (fatal_with_file_and_line): Likewise. * rtl-error.c (error_for_asm, warning_for_asm): Likewise. * tree.c (build, build_nt, build_function_type_list): Likewise. cp: * error.c (cp_error_at, cp_warning_at, cp_pedwarn_at): Eliminate libiberty VA_ macros, always use stdarg. * rtti.c (create_pseudo_type_info): Likewise. * tree.c (build_min_nt, build_min): Likewise. From-SVN: r66919
2003-05-18 00:21:35 +02:00
va_list ap;
exgettext: Handle gmsgid and cmsgid arguments specially, as gcc-internal-format and c-format. gcc/po/ * exgettext: Handle gmsgid and cmsgid arguments specially, as gcc-internal-format and c-format. Because of xgettext bug, invoke xgettext once with --language=c, once with --language=GCC-source and then merge together. Fail if xgettext is not 0.14.5 or later. gcc/ * intl.h (G_): New macro. * rtl-error.c (error_for_asm, warning_for_asm): Use gmsgid instead of msgid for argument name. * tree-ssa.c (warn_uninit): Likewise. * c-parser.c (c_parser_error): Likewise. * config/rs6000/rs6000-c.c (SYNTAX_ERROR): Likewise. * config/darwin-c.c (BAD): Likewise. * config/c4x/c4x-c.c (BAD): Likewise. * c-pragma.c (GCC_BAD, GCC_BAD2): Likewise. * c-errors.c (pedwarn_c99, pedwarn_c90): Likewise. * c-common.c (c_parse_error): Likewise. * diagnostic.c (diagnostic_set_info, verbatim, inform, warning, warning0, pedwarn, error, sorry, fatal_error, internal_error): Likewise. (fnotice): Use cmsgid instead of msgid for argument name. * gcov.c (fnotice): Likewise. * protoize.c (notice): Likewise. * final.c (output_operand_lossage): Likewise. * gcc.c (fatal, notice): Likewise. (error): Use gmsgid instead of msgid for argument name. * collect2.c (notice, fatal_perror, fatal): Use cmsgid instead of msgid for argument name. (error): Use gmsgid instead of msgid for argument name. * c-decl.c (locate_old_decl, implicit_decl_warning): Use G_() instead of N_(). * c-typeck.c (readonly_error, convert_for_assignment): Likewise. * tree-inline.c (inline_forbidden_p_1): Likewise. * ABOUT-GCC-NLS: Require gettext 0.14.5 or later. Mention the new conventions for marking translations. * doc/install.texi: Mention gettext 0.14.5 or later requirement. gcc/cp/ * error.c (locate_error): Use gmsgid instead of msgid for argument name. (cp_error_at, cp_warning_at, cp_pedwarn_at): Likewise. gcc/java/ * jv-scan.c (fatal_error, warning, warning0): Use gmsgid instead of msgid for argument name. * gjavah.c (error): Likewise. * java-tree.h (parse_error_context): Likewise. * parse.y (parse_error_context, parse_warning_context, issue_warning_error_from_context): Likewise. From-SVN: r100676
2005-06-06 21:31:40 +02:00
va_start (ap, gmsgid);
diagnostic_set_info (&diagnostic, gmsgid, &ap, input_location, DK_FATAL);
report_diagnostic (&diagnostic);
builtins.c (validate_arglist): Eliminate libiberty VA_ macros, always use stdarg. gcc: * builtins.c (validate_arglist): Eliminate libiberty VA_ macros, always use stdarg. * c-errors.c (pedwarn_c99): Likewise. * c-format.c (status_warning): Likewise. * c-semantics.c (build_stmt): Likewise. * calls.c (emit_library_call, emit_library_call_value): Likewise. * collect2.c (notice, fatal_perror, fatal, error): Likewise. * cpperror.c (cpp_error, cpp_error_with_line): Likewise. * diagnostic.c (build_message_string, output_printf, output_verbatim, verbatim, inform, warning, pedwarn, error, sorry, fatal_error, internal_error, warning_with_decl, pedwarn_with_decl, error_with_decl, fnotice): Likewise. * dwarf2asm.c (dw2_asm_output_data, dw2_asm_output_delta, dw2_asm_output_offset, dw2_asm_output_pcrel, dw2_asm_output_addr, dw2_asm_output_addr_rtx, dw2_asm_output_nstring, dw2_asm_output_data_uleb128, dw2_asm_output_data_sleb128, dw2_asm_output_delta_uleb128, dw2_asm_output_delta_sleb128, dw2_asm_output_encoded_addr_rtx): Likewise. * emit-rtl.c (gen_rtx, gen_rtvec): Likewise. * errors.c (warning, error, fatal, internal_error): Likewise. * final.c (output_operand_lossage, asm_fprintf): Likewise. * fix-header.c (fatal): Likewise. * gcc.c (fatal, error, notice): Likewise. * gcov.c (fnotice): Likewise. * genattrtab.c (attr_rtx, attr_printf): Likewise. * gengtype.c (error_at_line, xasprintf, oprintf): Likewise. * gensupport.c (message_with_line): Likewise. * mips-tfile.c (fatal, error): Likewise. * protoize.c (notice): Likewise. * ra-debug.c (ra_debug_msg): Likewise. * read-rtl.c (fatal_with_file_and_line): Likewise. * rtl-error.c (error_for_asm, warning_for_asm): Likewise. * tree.c (build, build_nt, build_function_type_list): Likewise. cp: * error.c (cp_error_at, cp_warning_at, cp_pedwarn_at): Eliminate libiberty VA_ macros, always use stdarg. * rtti.c (create_pseudo_type_info): Likewise. * tree.c (build_min_nt, build_min): Likewise. From-SVN: r66919
2003-05-18 00:21:35 +02:00
va_end (ap);
gcc_unreachable ();
}
/* 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
exgettext: Handle gmsgid and cmsgid arguments specially, as gcc-internal-format and c-format. gcc/po/ * exgettext: Handle gmsgid and cmsgid arguments specially, as gcc-internal-format and c-format. Because of xgettext bug, invoke xgettext once with --language=c, once with --language=GCC-source and then merge together. Fail if xgettext is not 0.14.5 or later. gcc/ * intl.h (G_): New macro. * rtl-error.c (error_for_asm, warning_for_asm): Use gmsgid instead of msgid for argument name. * tree-ssa.c (warn_uninit): Likewise. * c-parser.c (c_parser_error): Likewise. * config/rs6000/rs6000-c.c (SYNTAX_ERROR): Likewise. * config/darwin-c.c (BAD): Likewise. * config/c4x/c4x-c.c (BAD): Likewise. * c-pragma.c (GCC_BAD, GCC_BAD2): Likewise. * c-errors.c (pedwarn_c99, pedwarn_c90): Likewise. * c-common.c (c_parse_error): Likewise. * diagnostic.c (diagnostic_set_info, verbatim, inform, warning, warning0, pedwarn, error, sorry, fatal_error, internal_error): Likewise. (fnotice): Use cmsgid instead of msgid for argument name. * gcov.c (fnotice): Likewise. * protoize.c (notice): Likewise. * final.c (output_operand_lossage): Likewise. * gcc.c (fatal, notice): Likewise. (error): Use gmsgid instead of msgid for argument name. * collect2.c (notice, fatal_perror, fatal): Use cmsgid instead of msgid for argument name. (error): Use gmsgid instead of msgid for argument name. * c-decl.c (locate_old_decl, implicit_decl_warning): Use G_() instead of N_(). * c-typeck.c (readonly_error, convert_for_assignment): Likewise. * tree-inline.c (inline_forbidden_p_1): Likewise. * ABOUT-GCC-NLS: Require gettext 0.14.5 or later. Mention the new conventions for marking translations. * doc/install.texi: Mention gettext 0.14.5 or later requirement. gcc/cp/ * error.c (locate_error): Use gmsgid instead of msgid for argument name. (cp_error_at, cp_warning_at, cp_pedwarn_at): Likewise. gcc/java/ * jv-scan.c (fatal_error, warning, warning0): Use gmsgid instead of msgid for argument name. * gjavah.c (error): Likewise. * java-tree.h (parse_error_context): Likewise. * parse.y (parse_error_context, parse_warning_context, issue_warning_error_from_context): Likewise. From-SVN: r100676
2005-06-06 21:31:40 +02:00
internal_error (const char *gmsgid, ...)
{
diagnostic_info diagnostic;
builtins.c (validate_arglist): Eliminate libiberty VA_ macros, always use stdarg. gcc: * builtins.c (validate_arglist): Eliminate libiberty VA_ macros, always use stdarg. * c-errors.c (pedwarn_c99): Likewise. * c-format.c (status_warning): Likewise. * c-semantics.c (build_stmt): Likewise. * calls.c (emit_library_call, emit_library_call_value): Likewise. * collect2.c (notice, fatal_perror, fatal, error): Likewise. * cpperror.c (cpp_error, cpp_error_with_line): Likewise. * diagnostic.c (build_message_string, output_printf, output_verbatim, verbatim, inform, warning, pedwarn, error, sorry, fatal_error, internal_error, warning_with_decl, pedwarn_with_decl, error_with_decl, fnotice): Likewise. * dwarf2asm.c (dw2_asm_output_data, dw2_asm_output_delta, dw2_asm_output_offset, dw2_asm_output_pcrel, dw2_asm_output_addr, dw2_asm_output_addr_rtx, dw2_asm_output_nstring, dw2_asm_output_data_uleb128, dw2_asm_output_data_sleb128, dw2_asm_output_delta_uleb128, dw2_asm_output_delta_sleb128, dw2_asm_output_encoded_addr_rtx): Likewise. * emit-rtl.c (gen_rtx, gen_rtvec): Likewise. * errors.c (warning, error, fatal, internal_error): Likewise. * final.c (output_operand_lossage, asm_fprintf): Likewise. * fix-header.c (fatal): Likewise. * gcc.c (fatal, error, notice): Likewise. * gcov.c (fnotice): Likewise. * genattrtab.c (attr_rtx, attr_printf): Likewise. * gengtype.c (error_at_line, xasprintf, oprintf): Likewise. * gensupport.c (message_with_line): Likewise. * mips-tfile.c (fatal, error): Likewise. * protoize.c (notice): Likewise. * ra-debug.c (ra_debug_msg): Likewise. * read-rtl.c (fatal_with_file_and_line): Likewise. * rtl-error.c (error_for_asm, warning_for_asm): Likewise. * tree.c (build, build_nt, build_function_type_list): Likewise. cp: * error.c (cp_error_at, cp_warning_at, cp_pedwarn_at): Eliminate libiberty VA_ macros, always use stdarg. * rtti.c (create_pseudo_type_info): Likewise. * tree.c (build_min_nt, build_min): Likewise. From-SVN: r66919
2003-05-18 00:21:35 +02:00
va_list ap;
exgettext: Handle gmsgid and cmsgid arguments specially, as gcc-internal-format and c-format. gcc/po/ * exgettext: Handle gmsgid and cmsgid arguments specially, as gcc-internal-format and c-format. Because of xgettext bug, invoke xgettext once with --language=c, once with --language=GCC-source and then merge together. Fail if xgettext is not 0.14.5 or later. gcc/ * intl.h (G_): New macro. * rtl-error.c (error_for_asm, warning_for_asm): Use gmsgid instead of msgid for argument name. * tree-ssa.c (warn_uninit): Likewise. * c-parser.c (c_parser_error): Likewise. * config/rs6000/rs6000-c.c (SYNTAX_ERROR): Likewise. * config/darwin-c.c (BAD): Likewise. * config/c4x/c4x-c.c (BAD): Likewise. * c-pragma.c (GCC_BAD, GCC_BAD2): Likewise. * c-errors.c (pedwarn_c99, pedwarn_c90): Likewise. * c-common.c (c_parse_error): Likewise. * diagnostic.c (diagnostic_set_info, verbatim, inform, warning, warning0, pedwarn, error, sorry, fatal_error, internal_error): Likewise. (fnotice): Use cmsgid instead of msgid for argument name. * gcov.c (fnotice): Likewise. * protoize.c (notice): Likewise. * final.c (output_operand_lossage): Likewise. * gcc.c (fatal, notice): Likewise. (error): Use gmsgid instead of msgid for argument name. * collect2.c (notice, fatal_perror, fatal): Use cmsgid instead of msgid for argument name. (error): Use gmsgid instead of msgid for argument name. * c-decl.c (locate_old_decl, implicit_decl_warning): Use G_() instead of N_(). * c-typeck.c (readonly_error, convert_for_assignment): Likewise. * tree-inline.c (inline_forbidden_p_1): Likewise. * ABOUT-GCC-NLS: Require gettext 0.14.5 or later. Mention the new conventions for marking translations. * doc/install.texi: Mention gettext 0.14.5 or later requirement. gcc/cp/ * error.c (locate_error): Use gmsgid instead of msgid for argument name. (cp_error_at, cp_warning_at, cp_pedwarn_at): Likewise. gcc/java/ * jv-scan.c (fatal_error, warning, warning0): Use gmsgid instead of msgid for argument name. * gjavah.c (error): Likewise. * java-tree.h (parse_error_context): Likewise. * parse.y (parse_error_context, parse_warning_context, issue_warning_error_from_context): Likewise. From-SVN: r100676
2005-06-06 21:31:40 +02:00
va_start (ap, gmsgid);
diagnostic_set_info (&diagnostic, gmsgid, &ap, input_location, DK_ICE);
report_diagnostic (&diagnostic);
builtins.c (validate_arglist): Eliminate libiberty VA_ macros, always use stdarg. gcc: * builtins.c (validate_arglist): Eliminate libiberty VA_ macros, always use stdarg. * c-errors.c (pedwarn_c99): Likewise. * c-format.c (status_warning): Likewise. * c-semantics.c (build_stmt): Likewise. * calls.c (emit_library_call, emit_library_call_value): Likewise. * collect2.c (notice, fatal_perror, fatal, error): Likewise. * cpperror.c (cpp_error, cpp_error_with_line): Likewise. * diagnostic.c (build_message_string, output_printf, output_verbatim, verbatim, inform, warning, pedwarn, error, sorry, fatal_error, internal_error, warning_with_decl, pedwarn_with_decl, error_with_decl, fnotice): Likewise. * dwarf2asm.c (dw2_asm_output_data, dw2_asm_output_delta, dw2_asm_output_offset, dw2_asm_output_pcrel, dw2_asm_output_addr, dw2_asm_output_addr_rtx, dw2_asm_output_nstring, dw2_asm_output_data_uleb128, dw2_asm_output_data_sleb128, dw2_asm_output_delta_uleb128, dw2_asm_output_delta_sleb128, dw2_asm_output_encoded_addr_rtx): Likewise. * emit-rtl.c (gen_rtx, gen_rtvec): Likewise. * errors.c (warning, error, fatal, internal_error): Likewise. * final.c (output_operand_lossage, asm_fprintf): Likewise. * fix-header.c (fatal): Likewise. * gcc.c (fatal, error, notice): Likewise. * gcov.c (fnotice): Likewise. * genattrtab.c (attr_rtx, attr_printf): Likewise. * gengtype.c (error_at_line, xasprintf, oprintf): Likewise. * gensupport.c (message_with_line): Likewise. * mips-tfile.c (fatal, error): Likewise. * protoize.c (notice): Likewise. * ra-debug.c (ra_debug_msg): Likewise. * read-rtl.c (fatal_with_file_and_line): Likewise. * rtl-error.c (error_for_asm, warning_for_asm): Likewise. * tree.c (build, build_nt, build_function_type_list): Likewise. cp: * error.c (cp_error_at, cp_warning_at, cp_pedwarn_at): Eliminate libiberty VA_ macros, always use stdarg. * rtti.c (create_pseudo_type_info): Likewise. * tree.c (build_min_nt, build_min): Likewise. From-SVN: r66919
2003-05-18 00:21:35 +02:00
va_end (ap);
gcc_unreachable ();
}
/* 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
exgettext: Handle gmsgid and cmsgid arguments specially, as gcc-internal-format and c-format. gcc/po/ * exgettext: Handle gmsgid and cmsgid arguments specially, as gcc-internal-format and c-format. Because of xgettext bug, invoke xgettext once with --language=c, once with --language=GCC-source and then merge together. Fail if xgettext is not 0.14.5 or later. gcc/ * intl.h (G_): New macro. * rtl-error.c (error_for_asm, warning_for_asm): Use gmsgid instead of msgid for argument name. * tree-ssa.c (warn_uninit): Likewise. * c-parser.c (c_parser_error): Likewise. * config/rs6000/rs6000-c.c (SYNTAX_ERROR): Likewise. * config/darwin-c.c (BAD): Likewise. * config/c4x/c4x-c.c (BAD): Likewise. * c-pragma.c (GCC_BAD, GCC_BAD2): Likewise. * c-errors.c (pedwarn_c99, pedwarn_c90): Likewise. * c-common.c (c_parse_error): Likewise. * diagnostic.c (diagnostic_set_info, verbatim, inform, warning, warning0, pedwarn, error, sorry, fatal_error, internal_error): Likewise. (fnotice): Use cmsgid instead of msgid for argument name. * gcov.c (fnotice): Likewise. * protoize.c (notice): Likewise. * final.c (output_operand_lossage): Likewise. * gcc.c (fatal, notice): Likewise. (error): Use gmsgid instead of msgid for argument name. * collect2.c (notice, fatal_perror, fatal): Use cmsgid instead of msgid for argument name. (error): Use gmsgid instead of msgid for argument name. * c-decl.c (locate_old_decl, implicit_decl_warning): Use G_() instead of N_(). * c-typeck.c (readonly_error, convert_for_assignment): Likewise. * tree-inline.c (inline_forbidden_p_1): Likewise. * ABOUT-GCC-NLS: Require gettext 0.14.5 or later. Mention the new conventions for marking translations. * doc/install.texi: Mention gettext 0.14.5 or later requirement. gcc/cp/ * error.c (locate_error): Use gmsgid instead of msgid for argument name. (cp_error_at, cp_warning_at, cp_pedwarn_at): Likewise. gcc/java/ * jv-scan.c (fatal_error, warning, warning0): Use gmsgid instead of msgid for argument name. * gjavah.c (error): Likewise. * java-tree.h (parse_error_context): Likewise. * parse.y (parse_error_context, parse_warning_context, issue_warning_error_from_context): Likewise. From-SVN: r100676
2005-06-06 21:31:40 +02:00
fnotice (FILE *file, const char *cmsgid, ...)
{
builtins.c (validate_arglist): Eliminate libiberty VA_ macros, always use stdarg. gcc: * builtins.c (validate_arglist): Eliminate libiberty VA_ macros, always use stdarg. * c-errors.c (pedwarn_c99): Likewise. * c-format.c (status_warning): Likewise. * c-semantics.c (build_stmt): Likewise. * calls.c (emit_library_call, emit_library_call_value): Likewise. * collect2.c (notice, fatal_perror, fatal, error): Likewise. * cpperror.c (cpp_error, cpp_error_with_line): Likewise. * diagnostic.c (build_message_string, output_printf, output_verbatim, verbatim, inform, warning, pedwarn, error, sorry, fatal_error, internal_error, warning_with_decl, pedwarn_with_decl, error_with_decl, fnotice): Likewise. * dwarf2asm.c (dw2_asm_output_data, dw2_asm_output_delta, dw2_asm_output_offset, dw2_asm_output_pcrel, dw2_asm_output_addr, dw2_asm_output_addr_rtx, dw2_asm_output_nstring, dw2_asm_output_data_uleb128, dw2_asm_output_data_sleb128, dw2_asm_output_delta_uleb128, dw2_asm_output_delta_sleb128, dw2_asm_output_encoded_addr_rtx): Likewise. * emit-rtl.c (gen_rtx, gen_rtvec): Likewise. * errors.c (warning, error, fatal, internal_error): Likewise. * final.c (output_operand_lossage, asm_fprintf): Likewise. * fix-header.c (fatal): Likewise. * gcc.c (fatal, error, notice): Likewise. * gcov.c (fnotice): Likewise. * genattrtab.c (attr_rtx, attr_printf): Likewise. * gengtype.c (error_at_line, xasprintf, oprintf): Likewise. * gensupport.c (message_with_line): Likewise. * mips-tfile.c (fatal, error): Likewise. * protoize.c (notice): Likewise. * ra-debug.c (ra_debug_msg): Likewise. * read-rtl.c (fatal_with_file_and_line): Likewise. * rtl-error.c (error_for_asm, warning_for_asm): Likewise. * tree.c (build, build_nt, build_function_type_list): Likewise. cp: * error.c (cp_error_at, cp_warning_at, cp_pedwarn_at): Eliminate libiberty VA_ macros, always use stdarg. * rtti.c (create_pseudo_type_info): Likewise. * tree.c (build_min_nt, build_min): Likewise. From-SVN: r66919
2003-05-18 00:21:35 +02:00
va_list ap;
exgettext: Handle gmsgid and cmsgid arguments specially, as gcc-internal-format and c-format. gcc/po/ * exgettext: Handle gmsgid and cmsgid arguments specially, as gcc-internal-format and c-format. Because of xgettext bug, invoke xgettext once with --language=c, once with --language=GCC-source and then merge together. Fail if xgettext is not 0.14.5 or later. gcc/ * intl.h (G_): New macro. * rtl-error.c (error_for_asm, warning_for_asm): Use gmsgid instead of msgid for argument name. * tree-ssa.c (warn_uninit): Likewise. * c-parser.c (c_parser_error): Likewise. * config/rs6000/rs6000-c.c (SYNTAX_ERROR): Likewise. * config/darwin-c.c (BAD): Likewise. * config/c4x/c4x-c.c (BAD): Likewise. * c-pragma.c (GCC_BAD, GCC_BAD2): Likewise. * c-errors.c (pedwarn_c99, pedwarn_c90): Likewise. * c-common.c (c_parse_error): Likewise. * diagnostic.c (diagnostic_set_info, verbatim, inform, warning, warning0, pedwarn, error, sorry, fatal_error, internal_error): Likewise. (fnotice): Use cmsgid instead of msgid for argument name. * gcov.c (fnotice): Likewise. * protoize.c (notice): Likewise. * final.c (output_operand_lossage): Likewise. * gcc.c (fatal, notice): Likewise. (error): Use gmsgid instead of msgid for argument name. * collect2.c (notice, fatal_perror, fatal): Use cmsgid instead of msgid for argument name. (error): Use gmsgid instead of msgid for argument name. * c-decl.c (locate_old_decl, implicit_decl_warning): Use G_() instead of N_(). * c-typeck.c (readonly_error, convert_for_assignment): Likewise. * tree-inline.c (inline_forbidden_p_1): Likewise. * ABOUT-GCC-NLS: Require gettext 0.14.5 or later. Mention the new conventions for marking translations. * doc/install.texi: Mention gettext 0.14.5 or later requirement. gcc/cp/ * error.c (locate_error): Use gmsgid instead of msgid for argument name. (cp_error_at, cp_warning_at, cp_pedwarn_at): Likewise. gcc/java/ * jv-scan.c (fatal_error, warning, warning0): Use gmsgid instead of msgid for argument name. * gjavah.c (error): Likewise. * java-tree.h (parse_error_context): Likewise. * parse.y (parse_error_context, parse_warning_context, issue_warning_error_from_context): Likewise. From-SVN: r100676
2005-06-06 21:31:40 +02:00
va_start (ap, cmsgid);
vfprintf (file, _(cmsgid), ap);
builtins.c (validate_arglist): Eliminate libiberty VA_ macros, always use stdarg. gcc: * builtins.c (validate_arglist): Eliminate libiberty VA_ macros, always use stdarg. * c-errors.c (pedwarn_c99): Likewise. * c-format.c (status_warning): Likewise. * c-semantics.c (build_stmt): Likewise. * calls.c (emit_library_call, emit_library_call_value): Likewise. * collect2.c (notice, fatal_perror, fatal, error): Likewise. * cpperror.c (cpp_error, cpp_error_with_line): Likewise. * diagnostic.c (build_message_string, output_printf, output_verbatim, verbatim, inform, warning, pedwarn, error, sorry, fatal_error, internal_error, warning_with_decl, pedwarn_with_decl, error_with_decl, fnotice): Likewise. * dwarf2asm.c (dw2_asm_output_data, dw2_asm_output_delta, dw2_asm_output_offset, dw2_asm_output_pcrel, dw2_asm_output_addr, dw2_asm_output_addr_rtx, dw2_asm_output_nstring, dw2_asm_output_data_uleb128, dw2_asm_output_data_sleb128, dw2_asm_output_delta_uleb128, dw2_asm_output_delta_sleb128, dw2_asm_output_encoded_addr_rtx): Likewise. * emit-rtl.c (gen_rtx, gen_rtvec): Likewise. * errors.c (warning, error, fatal, internal_error): Likewise. * final.c (output_operand_lossage, asm_fprintf): Likewise. * fix-header.c (fatal): Likewise. * gcc.c (fatal, error, notice): Likewise. * gcov.c (fnotice): Likewise. * genattrtab.c (attr_rtx, attr_printf): Likewise. * gengtype.c (error_at_line, xasprintf, oprintf): Likewise. * gensupport.c (message_with_line): Likewise. * mips-tfile.c (fatal, error): Likewise. * protoize.c (notice): Likewise. * ra-debug.c (ra_debug_msg): Likewise. * read-rtl.c (fatal_with_file_and_line): Likewise. * rtl-error.c (error_for_asm, warning_for_asm): Likewise. * tree.c (build, build_nt, build_function_type_list): Likewise. cp: * error.c (cp_error_at, cp_warning_at, cp_pedwarn_at): Eliminate libiberty VA_ macros, always use stdarg. * rtti.c (create_pseudo_type_info): Likewise. * tree.c (build_min_nt, build_min): Likewise. From-SVN: r66919
2003-05-18 00:21:35 +02:00
va_end (ap);
}
/* 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 (diagnostic_context *context)
{
diagnostic_info diagnostic;
if (context->lock < 3)
Remove pedwarn_with_decl, warning_with_decl and error_with_decl from GCC. Remove pedwarn_with_decl, warning_with_decl and error_with_decl from GCC. * calls.c (try_to_integrate): Don't use xxx_with_decl. (expand_call): Likewise. * dwarfout.c (output_reg_number): Likewise. * expr.c (expand_expr): Likewise. * function.c (assign_temp): Likewise. (uninitialized_vars_warning): Likewise. (setjmp_args_warning): Likewise. (expand_function_end): Likewise. * stmt.c (fixup_gotos): Likewise. (warn_about_unused_variables): Likewise. (expand_end_bindings): Likewise. * stor-layout.c (layout_decl): Likewise. (place_field): Likewise. * toplev.c (check_global_declarations): Likewise. (rest_of_handle_inlining): Likewise. (default_tree_printer): New function. (general_init): Initialize diagnostic machinery before routing signals to the ICE machinery. Set default tree printer. * toplev.h (pedwarn_with_decl): Remove declaration. (warning_with_decl): Likewise. (error_with_decl): Likewise. (pedwarn): Remove attribute for the time being. * tree-inline.c (expand_call_inline): Don't use xxx_with_decl. * varasm.c (named_section): Likewise. (make_decl_rtl): Likewise. (assemble_variable): Likewise. (merge_weak): Likewise. (declare_weak): Likewise. * diagnostic.h: Move non-diagnostic stuff into pretty-print.h. * diagnostic.c: Move non-diagnostic stuff into pretty-print.c. (format_with_decl): Remove. (diagnostic_for_decl): Likewise. (pedwarn_with_decl): Likewise. (warning_with_decl): Likewise. (error_with_decl): Likewise. (diagnostic_initialize): Adjust. (diagnostic_count_diagnostic): Likewise. (announce_function): Likewise. (lhd_print_error_function): Likewise. (diagnostic_report_current_module): Likewise. (default_diagnostic_starter): Likewise. (diagnostic_report_diagnostic): Likewise. (default_diagnostic_finalizer): Likewise. (verbatim): Likewise. (error): Likewise. (warning): Likewise. * opts.c (common_handle_option): Likewise. * pretty-print.c: New file. * c-pretty-print.h (pp_base): Override. * c-pretty-print.c: Adjust use of macros throughout. (pp_buffer): New macro. (pp_newline): Likewise. * c-objc-common.c (c_tree_printer): Adjust prototype. Tidy. * Makefile.in (DIAGNOSTIC_H): New variable. (c-errors.o): Use it. (c-objc-common.o): Likewise. (c-common.o): Likewise. (c-opts.o): Likewise. (c-format.o): Likewise. (diagnostic.o): Likewise. (opts.o): Likewise. (toplev.o): Likewise. (rtl-error.o): Likewise. (dwarf2out.o): Likewise. (jump.o): Likewise. (pretty-print.o): New rule. cp/ * Make-lang.in (cp/error.o): Depend on DIAGNOSTIC_H. * error.c: Use the new pretty-printer fraamework. From-SVN: r69773
2003-07-25 11:52:32 +02:00
pp_flush (context->printer);
fnotice (stderr,
"Internal compiler error: Error reporting routines re-entered.\n");
/* Call diagnostic_action_after_output to get the "please submit a bug
report" message. It only looks at the kind field of diagnostic_info. */
diagnostic.kind = DK_ICE;
diagnostic_action_after_output (context, &diagnostic);
/* Do not use gcc_unreachable here; that goes through internal_error
and therefore would cause infinite recursion. */
real_abort ();
}
/* 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 (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 (void)
{
abort ();
}