2000-04-22 07:49:16 -04:00
|
|
|
/* Various declarations for language-independent diagnostics subroutines.
|
2002-01-07 03:50:07 -05:00
|
|
|
Copyright (C) 2000, 2001, 2002 Free Software Foundation, Inc.
|
2000-04-22 07:49:16 -04:00
|
|
|
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 10:35:51 -04:00
|
|
|
This file is part of GCC.
|
2000-04-22 07:49:16 -04:00
|
|
|
|
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 10:35:51 -04:00
|
|
|
GCC is free software; you can redistribute it and/or modify it under
|
|
|
|
the terms of the GNU General Public License as published by the Free
|
|
|
|
Software Foundation; either version 2, or (at your option) any later
|
|
|
|
version.
|
2000-04-22 07:49:16 -04:00
|
|
|
|
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 10:35:51 -04: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.
|
2000-04-22 07:49:16 -04:00
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
Makefile.in, [...]: replace "GNU CC" with "GCC".
* Makefile.in, alias.c, basic-block.h, bb-reorder.c, bitmap.c,
bitmap.h, builtin-types.def, builtins.c, builtins.def,
c-aux-info.c, c-common.c, c-common.def, c-common.h,
c-convert.c, c-decl.c, c-dump.c, c-dump.h, c-errors.c,
c-format.c, c-lang.c, c-lex.c, c-lex.h, c-parse.in,
c-pragma.c, c-pragma.h, c-semantics.c, c-tree.h, c-typeck.c,
caller-save.c, calls.c, collect2.c, collect2.h, combine.c,
conditions.h, config.gcc, configure.frag, configure.in,
conflict.c, convert.c, convert.h, cppspec.c, crtstuff.c,
cse.c, cselib.c, cselib.h, dbxout.c, dbxout.h, defaults.h,
dependence.c, df.c, df.h, diagnostic.c, diagnostic.h,
doloop.c, dominance.c, dwarf.h, dwarf2.h, dwarf2asm.c,
dwarf2asm.h, dwarf2out.c, dwarf2out.h, dwarfout.c,
emit-rtl.c, errors.c, errors.h, except.c, except.h,
exgettext, explow.c, expmed.c, expr.c, expr.h, final.c,
fixproto, flags.h, flow.c, fold-const.c, fp-test.c,
function.c, function.h, gbl-ctors.h, gcc.c, gcc.h, gcc.hlp,
gccspec.c, gcov-io.h, gcse.c, genattr.c, genattrtab.c,
gencheck.c, gencodes.c, genconfig.c, genemit.c,
genextract.c, genflags.c, gengenrtl.c, genmultilib,
genopinit.c, genoutput.c, genpeep.c, genrecog.c,
gensupport.c, gensupport.h, ggc-callbacks.c, ggc-common.c,
ggc-none.c, ggc-page.c, ggc-simple.c, ggc.h, global.c,
graph.c, graph.h, gthr-aix.h, gthr-dce.h, gthr-posix.h,
gthr-rtems.h, gthr-single.h, gthr-solaris.h, gthr-vxworks.h,
gthr-win32.h, gthr.h, haifa-sched.c, halfpic.c, halfpic.h,
hard-reg-set.h, hwint.h, ifcvt.c, input.h, insn-addr.h,
integrate.c, integrate.h, jump.c, lcm.c, libgcc2.c,
libgcc2.h, lists.c, local-alloc.c, loop.c, loop.h,
machmode.def, machmode.h, main.c, mbchar.c, mbchar.h,
mips-tdump.c, mips-tfile.c, mklibgcc.in, mkmap-flat.awk,
mkmap-symver.awk, optabs.c, output.h, params.c, params.def,
params.h, predict.c, predict.def, predict.h, prefix.c,
prefix.h, print-rtl.c, print-tree.c, profile.c, protoize.c,
read-rtl.c, real.c, real.h, recog.c, recog.h, reg-stack.c,
regclass.c, regmove.c, regrename.c, regs.h, reload.c,
reload.h, reload1.c, reorg.c, resource.c, resource.h, rtl.c,
rtl.def, rtl.h, rtlanal.c, sbitmap.c, sbitmap.h,
sched-deps.c, sched-ebb.c, sched-int.h, sched-rgn.c,
sched-vis.c, sdbout.c, sdbout.h, sibcall.c, simplify-rtx.c,
ssa-ccp.c, ssa-dce.c, ssa.c, ssa.h, stmt.c, stor-layout.c,
stringpool.c, system.h, timevar.c, timevar.def, timevar.h,
tlink.c, toplev.c, toplev.h, tree.c, tree.def, tree.h,
tsystem.h, unroll.c, unwind-dw2-fde.c, unwind-dw2-fde.h,
unwind-dw2.c, unwind-pe.h, unwind-sjlj.c, unwind.h,
unwind.inc, varasm.c, varray.c, varray.h, xcoffout.c,
xcoffout.h: replace "GNU CC" with "GCC".
From-SVN: r45105
2001-08-22 10:35:51 -04:00
|
|
|
along with GCC; see the file COPYING. If not, write to the Free
|
|
|
|
Software Foundation, 59 Temple Place - Suite 330, Boston, MA
|
|
|
|
02111-1307, USA. */
|
2000-04-22 07:49:16 -04:00
|
|
|
|
2001-05-25 21:31:47 -04:00
|
|
|
#ifndef GCC_DIAGNOSTIC_H
|
|
|
|
#define GCC_DIAGNOSTIC_H
|
2000-04-22 07:49:16 -04:00
|
|
|
|
|
|
|
#include "obstack.h"
|
|
|
|
|
|
|
|
/* Forward declarations. */
|
|
|
|
typedef struct output_buffer output_buffer;
|
c-errors.c (pedwarn_c99): Adjust call to report_diagnostic.
* c-errors.c (pedwarn_c99): Adjust call to report_diagnostic.
* diagnostic.c (default_diagnostic_starter,
default_diagnostic_finalizer): New functions.
(diagnostic_for_asm, diagnostic_for_decl): Tweak.
(pedwarn, pedwarn_with_file_and_line, error,
error_with_file_and_line, fatal, warning,
warning_with_file_and_line): Adjust call to report_diagnostic.
(report_diagnostic): Rework.
(set_diagnostic_context): New function.
* diagnostic.h (struct diagnostic_context): New data structure.
(diagnostic_message, diagnostic_argument_list,
diagnostic_file_location, diagnostic_line_location,
diagnostic_is_warning, diagnostic_starter, diagnostic_finalizer,
diagnostic_finalizer, diagnostic_auxiliary_data): New macros.
(set_diagnostic_context): Declare.
(report_diagnostic): Change prototype.
From-SVN: r35817
2000-08-20 05:50:12 -04:00
|
|
|
typedef struct diagnostic_context diagnostic_context;
|
2000-08-21 06:14:18 -04:00
|
|
|
typedef void (*diagnostic_starter_fn) PARAMS ((output_buffer *,
|
|
|
|
diagnostic_context *));
|
|
|
|
typedef diagnostic_starter_fn diagnostic_finalizer_fn;
|
2000-04-22 07:49:16 -04:00
|
|
|
|
2001-05-01 04:19:45 -04:00
|
|
|
typedef enum
|
|
|
|
{
|
|
|
|
#define DEFINE_DIAGNOSTIC_KIND(K, M) K,
|
|
|
|
#include "diagnostic.def"
|
|
|
|
#undef DEFINE_DIAGNOSTIC_KIND
|
|
|
|
DK_LAST_DIAGNOSTIC_KIND
|
|
|
|
} diagnostic_t;
|
|
|
|
|
|
|
|
#define pedantic_error_kind() (flag_pedantic_errors ? DK_ERROR : DK_WARNING)
|
|
|
|
|
2001-06-26 03:53:50 -04:00
|
|
|
/* How often diagnostics are prefixed by their locations:
|
|
|
|
o DIAGNOSTICS_SHOW_PREFIX_NEVER: never - not yet supported;
|
|
|
|
o DIAGNOSTICS_SHOW_PREFIX_ONCE: emit only once;
|
|
|
|
o DIAGNOSTICS_SHOW_PREFIX_EVERY_LINE: emit each time a physical
|
|
|
|
line is started. */
|
|
|
|
typedef enum
|
|
|
|
{
|
|
|
|
DIAGNOSTICS_SHOW_PREFIX_ONCE = 0x0,
|
|
|
|
DIAGNOSTICS_SHOW_PREFIX_NEVER = 0x1,
|
|
|
|
DIAGNOSTICS_SHOW_PREFIX_EVERY_LINE = 0x2
|
|
|
|
} diagnostic_prefixing_rule_t;
|
2000-05-14 04:44:48 -04:00
|
|
|
|
2000-04-22 07:49:16 -04:00
|
|
|
/* The type of front-end specific hook that formats trees into an
|
2000-07-09 03:51:26 -04:00
|
|
|
output_buffer. A language specific printer returns a truth value if
|
2001-10-09 10:03:13 -04:00
|
|
|
everything goes well. */
|
2000-07-09 03:51:26 -04:00
|
|
|
typedef int (*printer_fn) PARAMS ((output_buffer *));
|
2000-04-22 07:49:16 -04:00
|
|
|
|
2000-12-01 14:31:01 -05:00
|
|
|
/* This data structure encapsulates an output_buffer's state. */
|
diagnostic.c (save_output_state): Remove.
2000-07-12 Gabriel Dos Reis <gdr@codesourcery.com>
* diagnostic.c (save_output_state): Remove.
(restore_output_state): Likewise.
(clear_text_info): New function.
(clear_diagnostic_info): Likewise.
(output_text_length, is_starting_newline, output_prefix,
line_wrap_cutoff, ideal_line_wrap_cutoff, prefix_was_emitted_for,
prefixing_policy, output_buffer_ptr_to_format_args): New macros
(set_real_maximum_length, output_set_maximum_length,
output_set_prefix, output_get_prefix, output_set_maximum_length,
output_destroy_prefix, init_output_buffer,
reshape_diagnostic_buffer, output_space_left, output_emit_prefix,
output_add_newline, output_add_character, output_add_space,
output_append_r, output_append, wrap_text, output_format,
output_do_printf, output_printf, output_do_verbatim,
output_verbatim, verbatim): Use them.
(output_clear): Split into cleat_text_info and
clear_diagnostic_info.
(struct output_state): Move to...
* diagnostic.h: ...Here
(struct output_buffer): Adjust.
From-SVN: r34975
2000-07-11 20:48:02 -04:00
|
|
|
typedef struct
|
2000-04-22 07:49:16 -04:00
|
|
|
{
|
2001-10-11 08:43:43 -04:00
|
|
|
/* The prefix for each new line. */
|
2000-06-06 16:11:40 -04:00
|
|
|
const char *prefix;
|
2001-06-10 09:48:04 -04:00
|
|
|
|
2000-04-22 07:49:16 -04:00
|
|
|
/* The real upper bound of number of characters per line, taking into
|
2000-12-01 14:31:01 -05:00
|
|
|
account the case of a very very looong prefix. */
|
2000-04-22 07:49:16 -04:00
|
|
|
int maximum_length;
|
2001-06-10 09:48:04 -04:00
|
|
|
|
2000-04-22 07:49:16 -04:00
|
|
|
/* The ideal upper bound of number of characters per line, as suggested
|
2001-10-09 10:03:13 -04:00
|
|
|
by front-end. */
|
2000-04-22 07:49:16 -04:00
|
|
|
int ideal_maximum_length;
|
2000-09-06 14:43:35 -04:00
|
|
|
|
|
|
|
/* Indentation count. */
|
|
|
|
int indent_skip;
|
|
|
|
|
2000-05-14 04:44:48 -04:00
|
|
|
/* Nonzero if current PREFIX was emitted at least once. */
|
2001-06-27 14:03:03 -04:00
|
|
|
bool emitted_prefix_p;
|
2000-08-21 06:14:18 -04:00
|
|
|
|
|
|
|
/* Nonzero means one should emit a newline before outputing anything. */
|
2001-06-27 14:03:03 -04:00
|
|
|
bool need_newline_p;
|
2000-08-21 06:14:18 -04:00
|
|
|
|
2001-06-26 03:53:50 -04:00
|
|
|
/* Current prefixing rule. */
|
|
|
|
diagnostic_prefixing_rule_t prefixing_rule;
|
2001-06-10 09:48:04 -04:00
|
|
|
|
2000-04-22 07:49:16 -04:00
|
|
|
/* The current char to output. Updated by front-end (*format_map) when
|
|
|
|
it is called to report front-end printer for a specified format. */
|
|
|
|
const char *cursor;
|
2001-06-10 09:48:04 -04:00
|
|
|
|
diagnostic.c (save_output_state): Remove.
2000-07-12 Gabriel Dos Reis <gdr@codesourcery.com>
* diagnostic.c (save_output_state): Remove.
(restore_output_state): Likewise.
(clear_text_info): New function.
(clear_diagnostic_info): Likewise.
(output_text_length, is_starting_newline, output_prefix,
line_wrap_cutoff, ideal_line_wrap_cutoff, prefix_was_emitted_for,
prefixing_policy, output_buffer_ptr_to_format_args): New macros
(set_real_maximum_length, output_set_maximum_length,
output_set_prefix, output_get_prefix, output_set_maximum_length,
output_destroy_prefix, init_output_buffer,
reshape_diagnostic_buffer, output_space_left, output_emit_prefix,
output_add_newline, output_add_character, output_add_space,
output_append_r, output_append, wrap_text, output_format,
output_do_printf, output_printf, output_do_verbatim,
output_verbatim, verbatim): Use them.
(output_clear): Split into cleat_text_info and
clear_diagnostic_info.
(struct output_state): Move to...
* diagnostic.h: ...Here
(struct output_buffer): Adjust.
From-SVN: r34975
2000-07-11 20:48:02 -04:00
|
|
|
/* A pointer to the variable argument-list for formatting. */
|
|
|
|
va_list *format_args;
|
2001-06-10 09:48:04 -04:00
|
|
|
|
|
|
|
/* The number of times we have issued diagnostics. */
|
|
|
|
int diagnostic_count[DK_LAST_DIAGNOSTIC_KIND];
|
diagnostic.c (save_output_state): Remove.
2000-07-12 Gabriel Dos Reis <gdr@codesourcery.com>
* diagnostic.c (save_output_state): Remove.
(restore_output_state): Likewise.
(clear_text_info): New function.
(clear_diagnostic_info): Likewise.
(output_text_length, is_starting_newline, output_prefix,
line_wrap_cutoff, ideal_line_wrap_cutoff, prefix_was_emitted_for,
prefixing_policy, output_buffer_ptr_to_format_args): New macros
(set_real_maximum_length, output_set_maximum_length,
output_set_prefix, output_get_prefix, output_set_maximum_length,
output_destroy_prefix, init_output_buffer,
reshape_diagnostic_buffer, output_space_left, output_emit_prefix,
output_add_newline, output_add_character, output_add_space,
output_append_r, output_append, wrap_text, output_format,
output_do_printf, output_printf, output_do_verbatim,
output_verbatim, verbatim): Use them.
(output_clear): Split into cleat_text_info and
clear_diagnostic_info.
(struct output_state): Move to...
* diagnostic.h: ...Here
(struct output_buffer): Adjust.
From-SVN: r34975
2000-07-11 20:48:02 -04:00
|
|
|
} output_state;
|
|
|
|
|
|
|
|
/* The output buffer datatype. This is best seen as an abstract datatype. */
|
|
|
|
struct output_buffer
|
|
|
|
{
|
|
|
|
/* Internal data. These fields should not be accessed directly by
|
|
|
|
front-ends. */
|
|
|
|
|
2001-06-10 09:48:04 -04:00
|
|
|
/* The current state of the buffer. */
|
|
|
|
output_state state;
|
|
|
|
|
2001-02-23 12:28:25 -05:00
|
|
|
/* Where to output formatted text. */
|
|
|
|
FILE* stream;
|
2001-06-10 09:48:04 -04:00
|
|
|
|
diagnostic.c (save_output_state): Remove.
2000-07-12 Gabriel Dos Reis <gdr@codesourcery.com>
* diagnostic.c (save_output_state): Remove.
(restore_output_state): Likewise.
(clear_text_info): New function.
(clear_diagnostic_info): Likewise.
(output_text_length, is_starting_newline, output_prefix,
line_wrap_cutoff, ideal_line_wrap_cutoff, prefix_was_emitted_for,
prefixing_policy, output_buffer_ptr_to_format_args): New macros
(set_real_maximum_length, output_set_maximum_length,
output_set_prefix, output_get_prefix, output_set_maximum_length,
output_destroy_prefix, init_output_buffer,
reshape_diagnostic_buffer, output_space_left, output_emit_prefix,
output_add_newline, output_add_character, output_add_space,
output_append_r, output_append, wrap_text, output_format,
output_do_printf, output_printf, output_do_verbatim,
output_verbatim, verbatim): Use them.
(output_clear): Split into cleat_text_info and
clear_diagnostic_info.
(struct output_state): Move to...
* diagnostic.h: ...Here
(struct output_buffer): Adjust.
From-SVN: r34975
2000-07-11 20:48:02 -04:00
|
|
|
/* The obstack where the text is built up. */
|
|
|
|
struct obstack obstack;
|
2001-06-10 09:48:04 -04:00
|
|
|
|
diagnostic.c (save_output_state): Remove.
2000-07-12 Gabriel Dos Reis <gdr@codesourcery.com>
* diagnostic.c (save_output_state): Remove.
(restore_output_state): Likewise.
(clear_text_info): New function.
(clear_diagnostic_info): Likewise.
(output_text_length, is_starting_newline, output_prefix,
line_wrap_cutoff, ideal_line_wrap_cutoff, prefix_was_emitted_for,
prefixing_policy, output_buffer_ptr_to_format_args): New macros
(set_real_maximum_length, output_set_maximum_length,
output_set_prefix, output_get_prefix, output_set_maximum_length,
output_destroy_prefix, init_output_buffer,
reshape_diagnostic_buffer, output_space_left, output_emit_prefix,
output_add_newline, output_add_character, output_add_space,
output_append_r, output_append, wrap_text, output_format,
output_do_printf, output_printf, output_do_verbatim,
output_verbatim, verbatim): Use them.
(output_clear): Split into cleat_text_info and
clear_diagnostic_info.
(struct output_state): Move to...
* diagnostic.h: ...Here
(struct output_buffer): Adjust.
From-SVN: r34975
2000-07-11 20:48:02 -04:00
|
|
|
/* The amount of characters output so far. */
|
|
|
|
int line_length;
|
2001-06-26 01:42:06 -04:00
|
|
|
|
|
|
|
/* This must be large enough to hold any printed integer or
|
|
|
|
floating-point value. */
|
|
|
|
char digit_buffer[128];
|
2001-06-26 15:18:37 -04:00
|
|
|
|
|
|
|
/* If non-NULL, this function formats data in the BUFFER. When called,
|
|
|
|
output_buffer_text_cursor (BUFFER) points to a format code.
|
|
|
|
FORMAT_DECODER should call output_add_string (and related functions)
|
|
|
|
to add data to the BUFFER. FORMAT_DECODER can read arguments from
|
|
|
|
output_buffer_format_args (BUFFER) using VA_ARG. If the BUFFER needs
|
|
|
|
additional characters from the format string, it should advance
|
|
|
|
the output_buffer_text_cursor (BUFFER) as it goes. When FORMAT_DECODER
|
|
|
|
returns, output_buffer_text_cursor (BUFFER) should point to the last
|
|
|
|
character processed. */
|
|
|
|
|
|
|
|
printer_fn format_decoder;
|
2000-04-22 07:49:16 -04:00
|
|
|
};
|
|
|
|
|
2001-06-27 14:03:03 -04:00
|
|
|
/* Current state of the diagnostic_context' output_buffer. This macro
|
|
|
|
accepts both `diagnostic_context *' and `output_buffer *'. */
|
2002-01-07 03:50:07 -05:00
|
|
|
#define output_buffer_state(BUFFER) ((output_buffer *)(BUFFER))->state
|
2001-06-27 14:03:03 -04:00
|
|
|
|
|
|
|
/* The stream attached to the output_buffer, where the formatted
|
|
|
|
diagnostics will ultimately go. Works only on `output_buffer *'. */
|
2001-02-23 12:28:25 -05:00
|
|
|
#define output_buffer_attached_stream(BUFFER) (BUFFER)->stream
|
2001-06-27 14:03:03 -04:00
|
|
|
|
|
|
|
/* This points to the beginning of the rest of the diagnostic message
|
|
|
|
to be formatted. Accepts only `output_buffer *'s. */
|
diagnostic.c (save_output_state): Remove.
2000-07-12 Gabriel Dos Reis <gdr@codesourcery.com>
* diagnostic.c (save_output_state): Remove.
(restore_output_state): Likewise.
(clear_text_info): New function.
(clear_diagnostic_info): Likewise.
(output_text_length, is_starting_newline, output_prefix,
line_wrap_cutoff, ideal_line_wrap_cutoff, prefix_was_emitted_for,
prefixing_policy, output_buffer_ptr_to_format_args): New macros
(set_real_maximum_length, output_set_maximum_length,
output_set_prefix, output_get_prefix, output_set_maximum_length,
output_destroy_prefix, init_output_buffer,
reshape_diagnostic_buffer, output_space_left, output_emit_prefix,
output_add_newline, output_add_character, output_add_space,
output_append_r, output_append, wrap_text, output_format,
output_do_printf, output_printf, output_do_verbatim,
output_verbatim, verbatim): Use them.
(output_clear): Split into cleat_text_info and
clear_diagnostic_info.
(struct output_state): Move to...
* diagnostic.h: ...Here
(struct output_buffer): Adjust.
From-SVN: r34975
2000-07-11 20:48:02 -04:00
|
|
|
#define output_buffer_text_cursor(BUFFER) (BUFFER)->state.cursor
|
2001-06-27 14:03:03 -04:00
|
|
|
|
|
|
|
/* The rest of the `variable argument list' not yet processed.
|
|
|
|
This macro works on both `output_state *' and `output_buffer *'. */
|
|
|
|
#define output_buffer_format_args(BUFFER) \
|
2002-01-07 03:50:07 -05:00
|
|
|
*(((output_state *)(BUFFER))->format_args)
|
2001-06-27 14:03:03 -04:00
|
|
|
|
|
|
|
/* In line-wrapping mode, whether we should start a new line. */
|
2000-08-21 06:14:18 -04:00
|
|
|
#define output_needs_newline(BUFFER) (BUFFER)->state.need_newline_p
|
2001-06-27 14:03:03 -04:00
|
|
|
|
|
|
|
/* The amount of whitespace to be emitted when starting a new line. */
|
2000-09-06 14:43:35 -04:00
|
|
|
#define output_indentation(BUFFER) (BUFFER)->state.indent_skip
|
2001-06-27 14:03:03 -04:00
|
|
|
|
|
|
|
/* A pointer to the formatted diagonstic message. */
|
2000-09-28 08:50:37 -04:00
|
|
|
#define output_message_text(BUFFER) \
|
|
|
|
((const char *) obstack_base (&(BUFFER)->obstack))
|
diagnostic.c (save_output_state): Remove.
2000-07-12 Gabriel Dos Reis <gdr@codesourcery.com>
* diagnostic.c (save_output_state): Remove.
(restore_output_state): Likewise.
(clear_text_info): New function.
(clear_diagnostic_info): Likewise.
(output_text_length, is_starting_newline, output_prefix,
line_wrap_cutoff, ideal_line_wrap_cutoff, prefix_was_emitted_for,
prefixing_policy, output_buffer_ptr_to_format_args): New macros
(set_real_maximum_length, output_set_maximum_length,
output_set_prefix, output_get_prefix, output_set_maximum_length,
output_destroy_prefix, init_output_buffer,
reshape_diagnostic_buffer, output_space_left, output_emit_prefix,
output_add_newline, output_add_character, output_add_space,
output_append_r, output_append, wrap_text, output_format,
output_do_printf, output_printf, output_do_verbatim,
output_verbatim, verbatim): Use them.
(output_clear): Split into cleat_text_info and
clear_diagnostic_info.
(struct output_state): Move to...
* diagnostic.h: ...Here
(struct output_buffer): Adjust.
From-SVN: r34975
2000-07-11 20:48:02 -04:00
|
|
|
|
2000-12-01 14:31:01 -05:00
|
|
|
/* This data structure bundles altogether any information relevant to
|
c-errors.c (pedwarn_c99): Adjust call to report_diagnostic.
* c-errors.c (pedwarn_c99): Adjust call to report_diagnostic.
* diagnostic.c (default_diagnostic_starter,
default_diagnostic_finalizer): New functions.
(diagnostic_for_asm, diagnostic_for_decl): Tweak.
(pedwarn, pedwarn_with_file_and_line, error,
error_with_file_and_line, fatal, warning,
warning_with_file_and_line): Adjust call to report_diagnostic.
(report_diagnostic): Rework.
(set_diagnostic_context): New function.
* diagnostic.h (struct diagnostic_context): New data structure.
(diagnostic_message, diagnostic_argument_list,
diagnostic_file_location, diagnostic_line_location,
diagnostic_is_warning, diagnostic_starter, diagnostic_finalizer,
diagnostic_finalizer, diagnostic_auxiliary_data): New macros.
(set_diagnostic_context): Declare.
(report_diagnostic): Change prototype.
From-SVN: r35817
2000-08-20 05:50:12 -04:00
|
|
|
the context of a diagnostic message. */
|
|
|
|
struct diagnostic_context
|
|
|
|
{
|
2001-06-26 10:06:07 -04:00
|
|
|
/* Where most of the diagnostic formatting work is done. In Object
|
|
|
|
Oriented terms, we'll say that diagnostic_context is a sub-class of
|
|
|
|
output_buffer. */
|
|
|
|
output_buffer buffer;
|
|
|
|
|
c-errors.c (pedwarn_c99): Adjust call to report_diagnostic.
* c-errors.c (pedwarn_c99): Adjust call to report_diagnostic.
* diagnostic.c (default_diagnostic_starter,
default_diagnostic_finalizer): New functions.
(diagnostic_for_asm, diagnostic_for_decl): Tweak.
(pedwarn, pedwarn_with_file_and_line, error,
error_with_file_and_line, fatal, warning,
warning_with_file_and_line): Adjust call to report_diagnostic.
(report_diagnostic): Rework.
(set_diagnostic_context): New function.
* diagnostic.h (struct diagnostic_context): New data structure.
(diagnostic_message, diagnostic_argument_list,
diagnostic_file_location, diagnostic_line_location,
diagnostic_is_warning, diagnostic_starter, diagnostic_finalizer,
diagnostic_finalizer, diagnostic_auxiliary_data): New macros.
(set_diagnostic_context): Declare.
(report_diagnostic): Change prototype.
From-SVN: r35817
2000-08-20 05:50:12 -04:00
|
|
|
/* The diagnostic message to output. */
|
|
|
|
const char *message;
|
|
|
|
|
|
|
|
/* A pointer to a variable list of the arguments necessary for the
|
2000-12-01 14:31:01 -05:00
|
|
|
purpose of message formatting. */
|
c-errors.c (pedwarn_c99): Adjust call to report_diagnostic.
* c-errors.c (pedwarn_c99): Adjust call to report_diagnostic.
* diagnostic.c (default_diagnostic_starter,
default_diagnostic_finalizer): New functions.
(diagnostic_for_asm, diagnostic_for_decl): Tweak.
(pedwarn, pedwarn_with_file_and_line, error,
error_with_file_and_line, fatal, warning,
warning_with_file_and_line): Adjust call to report_diagnostic.
(report_diagnostic): Rework.
(set_diagnostic_context): New function.
* diagnostic.h (struct diagnostic_context): New data structure.
(diagnostic_message, diagnostic_argument_list,
diagnostic_file_location, diagnostic_line_location,
diagnostic_is_warning, diagnostic_starter, diagnostic_finalizer,
diagnostic_finalizer, diagnostic_auxiliary_data): New macros.
(set_diagnostic_context): Declare.
(report_diagnostic): Change prototype.
From-SVN: r35817
2000-08-20 05:50:12 -04:00
|
|
|
va_list *args_ptr;
|
|
|
|
|
|
|
|
/* The name of the source file involved in the diiagnostic. */
|
|
|
|
const char *file;
|
|
|
|
|
|
|
|
/* The line-location in the source file. */
|
|
|
|
int line;
|
|
|
|
|
2000-12-01 14:31:01 -05:00
|
|
|
/* Is this message a warning? */
|
c-errors.c (pedwarn_c99): Adjust call to report_diagnostic.
* c-errors.c (pedwarn_c99): Adjust call to report_diagnostic.
* diagnostic.c (default_diagnostic_starter,
default_diagnostic_finalizer): New functions.
(diagnostic_for_asm, diagnostic_for_decl): Tweak.
(pedwarn, pedwarn_with_file_and_line, error,
error_with_file_and_line, fatal, warning,
warning_with_file_and_line): Adjust call to report_diagnostic.
(report_diagnostic): Rework.
(set_diagnostic_context): New function.
* diagnostic.h (struct diagnostic_context): New data structure.
(diagnostic_message, diagnostic_argument_list,
diagnostic_file_location, diagnostic_line_location,
diagnostic_is_warning, diagnostic_starter, diagnostic_finalizer,
diagnostic_finalizer, diagnostic_auxiliary_data): New macros.
(set_diagnostic_context): Declare.
(report_diagnostic): Change prototype.
From-SVN: r35817
2000-08-20 05:50:12 -04:00
|
|
|
int warn;
|
|
|
|
|
|
|
|
/* This function is called before any message is printed out. It is
|
2000-12-01 14:31:01 -05:00
|
|
|
responsible for preparing message prefix and such. For example, it
|
c-errors.c (pedwarn_c99): Adjust call to report_diagnostic.
* c-errors.c (pedwarn_c99): Adjust call to report_diagnostic.
* diagnostic.c (default_diagnostic_starter,
default_diagnostic_finalizer): New functions.
(diagnostic_for_asm, diagnostic_for_decl): Tweak.
(pedwarn, pedwarn_with_file_and_line, error,
error_with_file_and_line, fatal, warning,
warning_with_file_and_line): Adjust call to report_diagnostic.
(report_diagnostic): Rework.
(set_diagnostic_context): New function.
* diagnostic.h (struct diagnostic_context): New data structure.
(diagnostic_message, diagnostic_argument_list,
diagnostic_file_location, diagnostic_line_location,
diagnostic_is_warning, diagnostic_starter, diagnostic_finalizer,
diagnostic_finalizer, diagnostic_auxiliary_data): New macros.
(set_diagnostic_context): Declare.
(report_diagnostic): Change prototype.
From-SVN: r35817
2000-08-20 05:50:12 -04:00
|
|
|
might say:
|
|
|
|
In file included from "/usr/local/include/curses.h:5:
|
|
|
|
from "/home/gdr/src/nifty_printer.h:56:
|
|
|
|
...
|
|
|
|
*/
|
|
|
|
void (*begin_diagnostic) PARAMS ((output_buffer *, diagnostic_context *));
|
|
|
|
|
2001-10-11 08:43:43 -04:00
|
|
|
/* This function is called after the diagnostic message is printed. */
|
c-errors.c (pedwarn_c99): Adjust call to report_diagnostic.
* c-errors.c (pedwarn_c99): Adjust call to report_diagnostic.
* diagnostic.c (default_diagnostic_starter,
default_diagnostic_finalizer): New functions.
(diagnostic_for_asm, diagnostic_for_decl): Tweak.
(pedwarn, pedwarn_with_file_and_line, error,
error_with_file_and_line, fatal, warning,
warning_with_file_and_line): Adjust call to report_diagnostic.
(report_diagnostic): Rework.
(set_diagnostic_context): New function.
* diagnostic.h (struct diagnostic_context): New data structure.
(diagnostic_message, diagnostic_argument_list,
diagnostic_file_location, diagnostic_line_location,
diagnostic_is_warning, diagnostic_starter, diagnostic_finalizer,
diagnostic_finalizer, diagnostic_auxiliary_data): New macros.
(set_diagnostic_context): Declare.
(report_diagnostic): Change prototype.
From-SVN: r35817
2000-08-20 05:50:12 -04:00
|
|
|
void (*end_diagnostic) PARAMS ((output_buffer *, diagnostic_context *));
|
|
|
|
|
|
|
|
/* Hook for front-end extensions. */
|
|
|
|
void *x_data;
|
|
|
|
};
|
|
|
|
|
2001-06-27 14:03:03 -04:00
|
|
|
/* The diagnostic message being formatted. */
|
c-errors.c (pedwarn_c99): Adjust call to report_diagnostic.
* c-errors.c (pedwarn_c99): Adjust call to report_diagnostic.
* diagnostic.c (default_diagnostic_starter,
default_diagnostic_finalizer): New functions.
(diagnostic_for_asm, diagnostic_for_decl): Tweak.
(pedwarn, pedwarn_with_file_and_line, error,
error_with_file_and_line, fatal, warning,
warning_with_file_and_line): Adjust call to report_diagnostic.
(report_diagnostic): Rework.
(set_diagnostic_context): New function.
* diagnostic.h (struct diagnostic_context): New data structure.
(diagnostic_message, diagnostic_argument_list,
diagnostic_file_location, diagnostic_line_location,
diagnostic_is_warning, diagnostic_starter, diagnostic_finalizer,
diagnostic_finalizer, diagnostic_auxiliary_data): New macros.
(set_diagnostic_context): Declare.
(report_diagnostic): Change prototype.
From-SVN: r35817
2000-08-20 05:50:12 -04:00
|
|
|
#define diagnostic_message(DC) (DC)->message
|
2001-06-27 14:03:03 -04:00
|
|
|
|
|
|
|
/* A pointer to the variable argument list used in a call
|
|
|
|
to a diagonstic routine. */
|
c-errors.c (pedwarn_c99): Adjust call to report_diagnostic.
* c-errors.c (pedwarn_c99): Adjust call to report_diagnostic.
* diagnostic.c (default_diagnostic_starter,
default_diagnostic_finalizer): New functions.
(diagnostic_for_asm, diagnostic_for_decl): Tweak.
(pedwarn, pedwarn_with_file_and_line, error,
error_with_file_and_line, fatal, warning,
warning_with_file_and_line): Adjust call to report_diagnostic.
(report_diagnostic): Rework.
(set_diagnostic_context): New function.
* diagnostic.h (struct diagnostic_context): New data structure.
(diagnostic_message, diagnostic_argument_list,
diagnostic_file_location, diagnostic_line_location,
diagnostic_is_warning, diagnostic_starter, diagnostic_finalizer,
diagnostic_finalizer, diagnostic_auxiliary_data): New macros.
(set_diagnostic_context): Declare.
(report_diagnostic): Change prototype.
From-SVN: r35817
2000-08-20 05:50:12 -04:00
|
|
|
#define diagnostic_argument_list(DC) (DC)->args_ptr
|
2001-06-27 14:03:03 -04:00
|
|
|
|
|
|
|
/* The program file to which the diagnostic is referring to. */
|
c-errors.c (pedwarn_c99): Adjust call to report_diagnostic.
* c-errors.c (pedwarn_c99): Adjust call to report_diagnostic.
* diagnostic.c (default_diagnostic_starter,
default_diagnostic_finalizer): New functions.
(diagnostic_for_asm, diagnostic_for_decl): Tweak.
(pedwarn, pedwarn_with_file_and_line, error,
error_with_file_and_line, fatal, warning,
warning_with_file_and_line): Adjust call to report_diagnostic.
(report_diagnostic): Rework.
(set_diagnostic_context): New function.
* diagnostic.h (struct diagnostic_context): New data structure.
(diagnostic_message, diagnostic_argument_list,
diagnostic_file_location, diagnostic_line_location,
diagnostic_is_warning, diagnostic_starter, diagnostic_finalizer,
diagnostic_finalizer, diagnostic_auxiliary_data): New macros.
(set_diagnostic_context): Declare.
(report_diagnostic): Change prototype.
From-SVN: r35817
2000-08-20 05:50:12 -04:00
|
|
|
#define diagnostic_file_location(DC) (DC)->file
|
2001-06-27 14:03:03 -04:00
|
|
|
|
|
|
|
/* The program source line referred to in the diagnostic message. */
|
c-errors.c (pedwarn_c99): Adjust call to report_diagnostic.
* c-errors.c (pedwarn_c99): Adjust call to report_diagnostic.
* diagnostic.c (default_diagnostic_starter,
default_diagnostic_finalizer): New functions.
(diagnostic_for_asm, diagnostic_for_decl): Tweak.
(pedwarn, pedwarn_with_file_and_line, error,
error_with_file_and_line, fatal, warning,
warning_with_file_and_line): Adjust call to report_diagnostic.
(report_diagnostic): Rework.
(set_diagnostic_context): New function.
* diagnostic.h (struct diagnostic_context): New data structure.
(diagnostic_message, diagnostic_argument_list,
diagnostic_file_location, diagnostic_line_location,
diagnostic_is_warning, diagnostic_starter, diagnostic_finalizer,
diagnostic_finalizer, diagnostic_auxiliary_data): New macros.
(set_diagnostic_context): Declare.
(report_diagnostic): Change prototype.
From-SVN: r35817
2000-08-20 05:50:12 -04:00
|
|
|
#define diagnostic_line_location(DC) (DC)->line
|
2001-06-27 14:03:03 -04:00
|
|
|
|
|
|
|
/* Tell whether the diagnostic message is to be treated as a warning. */
|
c-errors.c (pedwarn_c99): Adjust call to report_diagnostic.
* c-errors.c (pedwarn_c99): Adjust call to report_diagnostic.
* diagnostic.c (default_diagnostic_starter,
default_diagnostic_finalizer): New functions.
(diagnostic_for_asm, diagnostic_for_decl): Tweak.
(pedwarn, pedwarn_with_file_and_line, error,
error_with_file_and_line, fatal, warning,
warning_with_file_and_line): Adjust call to report_diagnostic.
(report_diagnostic): Rework.
(set_diagnostic_context): New function.
* diagnostic.h (struct diagnostic_context): New data structure.
(diagnostic_message, diagnostic_argument_list,
diagnostic_file_location, diagnostic_line_location,
diagnostic_is_warning, diagnostic_starter, diagnostic_finalizer,
diagnostic_finalizer, diagnostic_auxiliary_data): New macros.
(set_diagnostic_context): Declare.
(report_diagnostic): Change prototype.
From-SVN: r35817
2000-08-20 05:50:12 -04:00
|
|
|
#define diagnostic_is_warning(DC) (DC)->warn
|
2001-06-27 14:03:03 -04:00
|
|
|
|
|
|
|
/* Client supplied function to announce a diagnostic. */
|
c-errors.c (pedwarn_c99): Adjust call to report_diagnostic.
* c-errors.c (pedwarn_c99): Adjust call to report_diagnostic.
* diagnostic.c (default_diagnostic_starter,
default_diagnostic_finalizer): New functions.
(diagnostic_for_asm, diagnostic_for_decl): Tweak.
(pedwarn, pedwarn_with_file_and_line, error,
error_with_file_and_line, fatal, warning,
warning_with_file_and_line): Adjust call to report_diagnostic.
(report_diagnostic): Rework.
(set_diagnostic_context): New function.
* diagnostic.h (struct diagnostic_context): New data structure.
(diagnostic_message, diagnostic_argument_list,
diagnostic_file_location, diagnostic_line_location,
diagnostic_is_warning, diagnostic_starter, diagnostic_finalizer,
diagnostic_finalizer, diagnostic_auxiliary_data): New macros.
(set_diagnostic_context): Declare.
(report_diagnostic): Change prototype.
From-SVN: r35817
2000-08-20 05:50:12 -04:00
|
|
|
#define diagnostic_starter(DC) (DC)->begin_diagnostic
|
2001-06-27 14:03:03 -04:00
|
|
|
|
|
|
|
/* Client supplied function called after a diagnostic message is
|
|
|
|
displayed. */
|
c-errors.c (pedwarn_c99): Adjust call to report_diagnostic.
* c-errors.c (pedwarn_c99): Adjust call to report_diagnostic.
* diagnostic.c (default_diagnostic_starter,
default_diagnostic_finalizer): New functions.
(diagnostic_for_asm, diagnostic_for_decl): Tweak.
(pedwarn, pedwarn_with_file_and_line, error,
error_with_file_and_line, fatal, warning,
warning_with_file_and_line): Adjust call to report_diagnostic.
(report_diagnostic): Rework.
(set_diagnostic_context): New function.
* diagnostic.h (struct diagnostic_context): New data structure.
(diagnostic_message, diagnostic_argument_list,
diagnostic_file_location, diagnostic_line_location,
diagnostic_is_warning, diagnostic_starter, diagnostic_finalizer,
diagnostic_finalizer, diagnostic_auxiliary_data): New macros.
(set_diagnostic_context): Declare.
(report_diagnostic): Change prototype.
From-SVN: r35817
2000-08-20 05:50:12 -04:00
|
|
|
#define diagnostic_finalizer(DC) (DC)->end_diagnostic
|
2001-06-27 14:03:03 -04:00
|
|
|
|
ChangeLog.0, [...]: Fix spelling errors.
* ChangeLog.0, ChangeLog.1, ChangeLog.2, ChangeLog.3, ChangeLog.4,
ChangeLog.5, ChangeLog, ChangeLog.lib, FSFChangeLog.10, ONEWS,
c-common.c, caller-save.c, cfg.c, cfgcleanup.c, cfgrtl.c,
collect2.c, df.h, diagnostic.h, final.c, gcse.c, gthr.h,
haifa-sched.c, jump.c, local-alloc.c, profile.c, protoize.c,
regmove.c, reload1.c, rtlanal.c, sched-vis.c, ssa.c, stmt.c,
system.h, toplev.c: Fix spelling errors.
From-SVN: r46580
2001-10-28 07:42:06 -05:00
|
|
|
/* Extension hook for client. */
|
c-errors.c (pedwarn_c99): Adjust call to report_diagnostic.
* c-errors.c (pedwarn_c99): Adjust call to report_diagnostic.
* diagnostic.c (default_diagnostic_starter,
default_diagnostic_finalizer): New functions.
(diagnostic_for_asm, diagnostic_for_decl): Tweak.
(pedwarn, pedwarn_with_file_and_line, error,
error_with_file_and_line, fatal, warning,
warning_with_file_and_line): Adjust call to report_diagnostic.
(report_diagnostic): Rework.
(set_diagnostic_context): New function.
* diagnostic.h (struct diagnostic_context): New data structure.
(diagnostic_message, diagnostic_argument_list,
diagnostic_file_location, diagnostic_line_location,
diagnostic_is_warning, diagnostic_starter, diagnostic_finalizer,
diagnostic_finalizer, diagnostic_auxiliary_data): New macros.
(set_diagnostic_context): Declare.
(report_diagnostic): Change prototype.
From-SVN: r35817
2000-08-20 05:50:12 -04:00
|
|
|
#define diagnostic_auxiliary_data(DC) (DC)->x_data
|
2001-06-27 14:03:03 -04:00
|
|
|
|
|
|
|
/* Client supplied function used to decode formats. Can operate on both
|
|
|
|
`output_buffer *' and `diagnostic_context *'. */
|
2001-08-08 04:10:58 -04:00
|
|
|
#define diagnostic_format_decoder(DC) ((output_buffer *)(DC))->format_decoder
|
2001-06-27 14:03:03 -04:00
|
|
|
|
|
|
|
/* Prefixing rule used in formatting a diagnostic message. Accepts both
|
|
|
|
`output_buffer *' and `diagnostic_context *'. */
|
|
|
|
#define diagnostic_prefixing_rule(DC) \
|
2001-08-08 04:10:58 -04:00
|
|
|
((output_buffer *)(DC))->state.prefixing_rule
|
c-errors.c (pedwarn_c99): Adjust call to report_diagnostic.
* c-errors.c (pedwarn_c99): Adjust call to report_diagnostic.
* diagnostic.c (default_diagnostic_starter,
default_diagnostic_finalizer): New functions.
(diagnostic_for_asm, diagnostic_for_decl): Tweak.
(pedwarn, pedwarn_with_file_and_line, error,
error_with_file_and_line, fatal, warning,
warning_with_file_and_line): Adjust call to report_diagnostic.
(report_diagnostic): Rework.
(set_diagnostic_context): New function.
* diagnostic.h (struct diagnostic_context): New data structure.
(diagnostic_message, diagnostic_argument_list,
diagnostic_file_location, diagnostic_line_location,
diagnostic_is_warning, diagnostic_starter, diagnostic_finalizer,
diagnostic_finalizer, diagnostic_auxiliary_data): New macros.
(set_diagnostic_context): Declare.
(report_diagnostic): Change prototype.
From-SVN: r35817
2000-08-20 05:50:12 -04:00
|
|
|
|
2001-06-26 15:18:37 -04:00
|
|
|
/* Maximum characters per line in automatic line wrapping mode.
|
2001-10-09 10:03:13 -04:00
|
|
|
Zero means don't wrap lines. */
|
2001-06-27 14:03:03 -04:00
|
|
|
#define diagnostic_line_cutoff(DC) \
|
2001-08-08 04:10:58 -04:00
|
|
|
((output_buffer *)(DC))->state.ideal_maximum_length
|
2000-06-06 16:11:40 -04:00
|
|
|
|
2001-06-27 14:03:03 -04:00
|
|
|
/* This diagnostic context is used by front-ends that directly output
|
2000-06-06 16:11:40 -04:00
|
|
|
diagnostic messages without going through `error', `warning',
|
2001-06-27 14:03:03 -04:00
|
|
|
and similar functions. */
|
2001-06-26 10:06:07 -04:00
|
|
|
extern diagnostic_context *global_dc;
|
2000-06-06 16:11:40 -04:00
|
|
|
|
2001-06-27 14:03:03 -04:00
|
|
|
/* This will be removed shortly. */
|
|
|
|
extern output_buffer *diagnostic_buffer;
|
|
|
|
|
|
|
|
/* The total count of a KIND of diagnostics meitted so far. */
|
|
|
|
#define diagnostic_kind_count(DC, DK) \
|
2001-08-08 04:10:58 -04:00
|
|
|
((output_buffer *)(DC))->state.diagnostic_count[(int) (DK)]
|
2001-06-10 09:48:04 -04:00
|
|
|
|
|
|
|
/* The number of errors that have been issued so far. Ideally, these
|
|
|
|
would take an output_buffer as an argument. */
|
2001-06-27 14:03:03 -04:00
|
|
|
#define errorcount diagnostic_kind_count (global_dc, DK_ERROR)
|
2001-06-10 09:48:04 -04:00
|
|
|
/* Similarly, but for warnings. */
|
2001-06-27 14:03:03 -04:00
|
|
|
#define warningcount diagnostic_kind_count (global_dc, DK_WARNING)
|
2001-06-10 09:48:04 -04:00
|
|
|
/* Similarly, but for sorrys. */
|
2001-06-27 14:03:03 -04:00
|
|
|
#define sorrycount diagnostic_kind_count (global_dc, DK_SORRY)
|
2001-06-10 09:48:04 -04:00
|
|
|
|
|
|
|
/* Returns non-zero if warnings should be emitted. */
|
|
|
|
#define diagnostic_report_warnings_p() \
|
|
|
|
(!inhibit_warnings \
|
|
|
|
&& !(in_system_header && !warn_system_headers))
|
|
|
|
|
|
|
|
|
2000-04-22 07:49:16 -04:00
|
|
|
/* Prototypes */
|
2001-02-02 20:03:35 -05:00
|
|
|
extern void set_diagnostic_context PARAMS ((diagnostic_context *,
|
|
|
|
const char *, va_list *,
|
|
|
|
const char *, int, int));
|
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 17:44:12 -05:00
|
|
|
extern void set_internal_error_function PARAMS ((void (*)
|
2001-02-02 20:03:35 -05:00
|
|
|
PARAMS ((const char *,
|
|
|
|
va_list *))));
|
|
|
|
extern void report_diagnostic PARAMS ((diagnostic_context *));
|
2001-06-26 15:18:37 -04:00
|
|
|
extern void diagnostic_initialize PARAMS ((diagnostic_context *));
|
2001-02-02 20:03:35 -05:00
|
|
|
extern void init_output_buffer PARAMS ((output_buffer *,
|
|
|
|
const char *, int));
|
|
|
|
extern void flush_diagnostic_buffer PARAMS ((void));
|
|
|
|
extern void output_clear PARAMS ((output_buffer *));
|
|
|
|
extern const char *output_get_prefix PARAMS ((const output_buffer *));
|
|
|
|
extern const char *output_last_position PARAMS ((const output_buffer *));
|
|
|
|
extern void output_set_prefix PARAMS ((output_buffer *,
|
|
|
|
const char *));
|
|
|
|
extern void output_destroy_prefix PARAMS ((output_buffer *));
|
2001-06-26 15:18:37 -04:00
|
|
|
extern void output_set_maximum_length PARAMS ((output_buffer *, int));
|
2001-02-02 20:03:35 -05:00
|
|
|
extern void output_emit_prefix PARAMS ((output_buffer *));
|
|
|
|
extern void output_add_newline PARAMS ((output_buffer *));
|
|
|
|
extern void output_add_space PARAMS ((output_buffer *));
|
|
|
|
extern int output_space_left PARAMS ((const output_buffer *));
|
|
|
|
extern void output_append PARAMS ((output_buffer *, const char *,
|
|
|
|
const char *));
|
|
|
|
extern void output_add_character PARAMS ((output_buffer *, int));
|
|
|
|
extern void output_decimal PARAMS ((output_buffer *, int));
|
|
|
|
extern void output_add_string PARAMS ((output_buffer *,
|
|
|
|
const char *));
|
|
|
|
extern const char *output_finalize_message PARAMS ((output_buffer *));
|
|
|
|
extern void output_clear_message_text PARAMS ((output_buffer *));
|
|
|
|
extern void output_printf PARAMS ((output_buffer *, const char *,
|
|
|
|
...)) ATTRIBUTE_PRINTF_2;
|
|
|
|
extern int output_is_line_wrapping PARAMS ((output_buffer *));
|
|
|
|
extern void output_verbatim PARAMS ((output_buffer *, const char *,
|
|
|
|
...)) ATTRIBUTE_PRINTF_2;
|
|
|
|
extern void verbatim PARAMS ((const char *, ...))
|
|
|
|
ATTRIBUTE_PRINTF_1;
|
|
|
|
extern char *context_as_prefix PARAMS ((const char *, int, int));
|
|
|
|
extern char *file_name_as_prefix PARAMS ((const char *));
|
|
|
|
extern int error_module_changed PARAMS ((void));
|
|
|
|
extern void record_last_error_module PARAMS ((void));
|
|
|
|
extern int error_function_changed PARAMS ((void));
|
|
|
|
extern void record_last_error_function PARAMS ((void));
|
|
|
|
extern void report_problematic_module PARAMS ((output_buffer *));
|
2000-04-22 07:49:16 -04:00
|
|
|
|
2001-06-28 08:26:38 -04:00
|
|
|
/* Called by report_error_function to print out function name.
|
|
|
|
* Default may be overridden by language front-ends. */
|
|
|
|
extern void (*print_error_function) PARAMS ((diagnostic_context *,
|
|
|
|
const char *));
|
|
|
|
|
|
|
|
extern void default_print_error_function PARAMS ((diagnostic_context *,
|
|
|
|
const char *));
|
|
|
|
|
2001-05-25 21:31:47 -04:00
|
|
|
#endif /* ! GCC_DIAGNOSTIC_H */
|