+2001-06-10 Mark Mitchell <mark@codesourcery.com>
+ Gabriel Dos Reis <gdr@codesourcery.com>
+
+ * Makefile.in (c-parse.o): Depend on diagnostic.h
+ (dwarf2out.o): Likewise.
+
+ * dwarf2out.c: #include diagnostic.h
+
+ * toplev.h (warningcount, errorcount, sorrycount): Remove
+ declarations.
+
+ * toplev.c (warningcount, errorcount, sorrycount): Remove
+ definitions.
+
+ * diagnostic.h (struct output_buffer): Reorder fields.
+ (diagnostic_kind_count): New macro.
+ (errorcount, warningcount, sorrycount): Define as macros.
+ (diagnostic_report_warnings_p): New macro.
+ (output_state): Add diagnostic_count field.
+
+ * diagnostic.c (warningcount, errorcount, inhibit_warnings):
+ Remove tentative declaration.
+ (count_error): Use diagnostic_report_warnings_p.
+
+ * c-parse.in: #include diagnostic.h
+
2001-06-10 Stephane Carrez <Stephane.Carrez@worldnet.fr>
* config/m68hc11/m68hc11.md ("extendhisi2"): Fix constraints to
c-errors.o: c-errors.c $(CONFIG_H) $(SYSTEM_H) $(TREE_H) $(C_TREE_H) flags.h \
diagnostic.h $(TM_P_H)
c-parse.o : $(srcdir)/c-parse.c $(CONFIG_H) $(TREE_H) c-lex.h $(GGC_H) intl.h \
- $(C_TREE_H) input.h flags.h $(SYSTEM_H) toplev.h output.h cpplib.h
+ $(C_TREE_H) input.h flags.h $(SYSTEM_H) toplev.h output.h cpplib.h \
+ diagnostic.h
$(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) -c $(srcdir)/c-parse.c
$(srcdir)/c-parse.c: $(srcdir)/c-parse.y
dwarfout.o : dwarfout.c $(CONFIG_H) $(SYSTEM_H) $(TREE_H) $(RTL_H) dwarf.h \
flags.h insn-config.h reload.h output.h toplev.h dwarfout.h $(TM_P_H)
dwarf2out.o : dwarf2out.c $(CONFIG_H) $(SYSTEM_H) $(TREE_H) $(RTL_H) dwarf2.h \
- flags.h insn-config.h reload.h output.h \
+ flags.h insn-config.h reload.h output.h diagnostic.h \
hard-reg-set.h $(REGS_H) $(EXPR_H) toplev.h dwarf2out.h varray.h \
$(GGC_H) except.h dwarf2asm.h $(TM_P_H)
dwarf2asm.o : dwarf2asm.c $(CONFIG_H) $(SYSTEM_H) flags.h $(RTL_H) $(TREE_H) \
#include "output.h"
#include "toplev.h"
#include "ggc.h"
+#include "diagnostic.h"
#ifdef MULTIBYTE_CHARS
#include <locale.h>
+2001-06-10 Gabriel Dos Reis <gdr@codesourcery.com>
+
+ * decl.c: #include diagnostic.h
+ * actions.c: #include diagnostic.h
+ * Makefile.in (actions.o): Depend on diagnostic.h
+ (decl.o): Depend on diagnostic.h
+
2001-06-02 Joseph S. Myers <jsm28@cam.ac.uk>
* chill.texi: Move contents to just after title page.
actions.o : actions.c $(CONFIG_H) $(CHILL_TREE_H) actions.h $(RTL_H) \
lex.h $(srcdir)/../flags.h $(srcdir)/../input.h \
- $(EXPR_H) $(srcdir)/../system.h $(srcdir)/../toplev.h
+ $(EXPR_H) $(srcdir)/../system.h $(srcdir)/../toplev.h diagnostic.h
convert.o : convert.c $(CONFIG_H) $(CHILL_TREE_H) $(srcdir)/../flags.h \
$(srcdir)/../tree.h $(srcdir)/../system.h $(srcdir)/../toplev.h \
$(srcdir)/../convert.h
decl.o : decl.c $(CONFIG_H) $(CHILL_TREE_H) $(srcdir)/../flags.h lex.h \
- $(srcdir)/../system.h $(srcdir)/../toplev.h
+ $(srcdir)/../system.h $(srcdir)/../toplev.h diagnostic.h
except.o : except.c $(CONFIG_H) $(srcdir)/../tree.h $(RTL_H) $(CHILL_TREE_H) \
$(srcdir)/../system.h $(srcdir)/../toplev.h
expr.o : expr.c $(CONFIG_H) $(RTL_H) $(CHILL_TREE_H) $(srcdir)/../flags.h \
#include "obstack.h"
#include "assert.h"
#include "toplev.h"
+#include "diagnostic.h"
static int id_cmp PARAMS ((tree *, tree *));
static void warn_unhandled PARAMS ((const char *));
#include "input.h"
#include "rtl.h"
#include "toplev.h"
+#include "diagnostic.h"
#define IS_UNKNOWN_TYPE(type) (TYPE_SIZE(type)==0)
#define BUILTIN_NESTING_LEVEL (-1)
+2001-06-10 Mark Mitchell <mark@codesourcery.com>
+ Gabriel Dos Reis <gdr@codesourcery.com>
+
+ * Make-lang.in (cp/call.o): Depend on diagnostic.h
+ (cp/typeck.o): Depend on diagnostic.h
+ (cp/typeck2.o): Depend on diagnostic.h
+ (cp/repo.o): Depend on dignostic.h
+ * typeck.c: #include diagnostic.h
+ (convert_for_initialization): Remove extern declaration for
+ warningcount and errorcount.
+
+ * call.c: #include diagnostic.h
+ (convert_like_real): Remove extern declaration for warnincount and
+ errorcount.
+
+ * repo.c: #include diagnostic.h
+ * typeck2.c: #include diagnostic.h
+
2001-06-08 Nathan Sidwell <nathan@codesourcery.com>
* decl.c (duplicate_decls): Fix DECL_TEMPLATE_RESULT thinko
cp/operators.def $(TM_P_H)
cp/decl2.o: cp/decl2.c $(CXX_TREE_H) flags.h cp/lex.h cp/decl.h $(EXPR_H) \
output.h except.h toplev.h dwarf2out.h dwarfout.h $(GGC_H) $(RTL_H)
-cp/typeck2.o: cp/typeck2.c $(CXX_TREE_H) flags.h toplev.h output.h $(TM_P_H)
-cp/typeck.o: cp/typeck.c $(CXX_TREE_H) flags.h $(RTL_H) $(EXPR_H) toplev.h
+cp/typeck2.o: cp/typeck2.c $(CXX_TREE_H) flags.h toplev.h output.h $(TM_P_H) \
+ diagnostic.h
+cp/typeck.o: cp/typeck.c $(CXX_TREE_H) flags.h $(RTL_H) $(EXPR_H) toplev.h \
+ diagnostic.h
cp/class.o: cp/class.c $(CXX_TREE_H) flags.h toplev.h $(RTL_H)
-cp/call.o: cp/call.c $(CXX_TREE_H) flags.h toplev.h $(RTL_H) $(EXPR_H) $(GGC_H)
+cp/call.o: cp/call.c $(CXX_TREE_H) flags.h toplev.h $(RTL_H) $(EXPR_H) \
+ $(GGC_H) diagnostic.h
cp/friend.o: cp/friend.c $(CXX_TREE_H) flags.h $(RTL_H) toplev.h $(EXPR_H)
cp/init.o: cp/init.c $(CXX_TREE_H) flags.h $(RTL_H) $(EXPR_H) toplev.h \
$(GGC_H) except.h
$(GGC_H) $(RTL_H) except.h
cp/error.o: cp/error.c $(CXX_TREE_H) toplev.h diagnostic.h
cp/errfn.o: cp/errfn.c $(CXX_TREE_H) toplev.h
-cp/repo.o: cp/repo.c $(CXX_TREE_H) toplev.h $(GGC_H)
+cp/repo.o: cp/repo.c $(CXX_TREE_H) toplev.h $(GGC_H) diagnostic.h
cp/semantics.o: cp/semantics.c $(CXX_TREE_H) cp/lex.h except.h toplev.h \
flags.h $(GGC_H) output.h $(RTL_H) $(TIMEVAR_H) $(EXPR_H)
cp/dump.o: cp/dump.c $(CXX_TREE_H) c-dump.h
#include "toplev.h"
#include "expr.h"
#include "ggc.h"
+#include "diagnostic.h"
extern int inhibit_warnings;
int argnum;
int inner;
{
- extern int warningcount, errorcount;
int savew, savee;
tree totype = TREE_TYPE (convs);
#include "obstack.h"
#include "toplev.h"
#include "ggc.h"
+#include "diagnostic.h"
static tree repo_get_id PARAMS ((tree));
static char *extract_string PARAMS ((char **));
#include "flags.h"
#include "output.h"
#include "toplev.h"
+#include "diagnostic.h"
static tree convert_for_assignment PARAMS ((tree, tree, const char *, tree,
int));
if (codel == REFERENCE_TYPE)
{
/* This should eventually happen in convert_arguments. */
- extern int warningcount, errorcount;
int savew = 0, savee = 0;
if (fndecl)
#include "flags.h"
#include "toplev.h"
#include "output.h"
+#include "diagnostic.h"
static tree process_init_constructor PARAMS ((tree, tree, tree *));
static void error_recursion PARAMS ((void)) ATTRIBUTE_NORETURN;
extern int rtl_dump_and_exit;
-extern int inhibit_warnings;
extern int warnings_are_errors;
-extern int warningcount;
-extern int errorcount;
/* Front-end specific tree formatter, if non-NULL. */
printer_fn lang_printer = NULL;
count_error (warningp)
int warningp;
{
- if (warningp
- && (inhibit_warnings
- || (in_system_header && !warn_system_headers)))
+ if (warningp && !diagnostic_report_warnings_p ())
return 0;
if (warningp && !warnings_are_errors)
{
/* The prefix for each new line. */
const char *prefix;
+
/* The real upper bound of number of characters per line, taking into
account the case of a very very looong prefix. */
int maximum_length;
+
/* The ideal upper bound of number of characters per line, as suggested
by front-end. */
int ideal_maximum_length;
o DIAGNOSTICS_SHOW_PREFIX_EVERY_LINE: emit current PREFIX each time
a physical line is started. */
int prefixing_rule;
+
/* 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;
+
/* A pointer to the variable argument-list for formatting. */
va_list *format_args;
+
+ /* The number of times we have issued diagnostics. */
+ int diagnostic_count[DK_LAST_DIAGNOSTIC_KIND];
} output_state;
/* The output buffer datatype. This is best seen as an abstract datatype. */
/* Internal data. These fields should not be accessed directly by
front-ends. */
+ /* The current state of the buffer. */
+ output_state state;
+
/* Where to output formatted text. */
FILE* stream;
+
/* The obstack where the text is built up. */
struct obstack obstack;
+
/* The amount of characters output so far. */
int line_length;
- /* The current state of the buffer. */
- output_state state;
};
+#define output_buffer_state(BUFFER) (BUFFER)->state
#define output_buffer_attached_stream(BUFFER) (BUFFER)->stream
#define output_buffer_text_cursor(BUFFER) (BUFFER)->state.cursor
#define output_buffer_format_args(BUFFER) *((BUFFER)->state.format_args)
has been removed. */
extern output_buffer *diagnostic_buffer;
+#define diagnostic_kind_count(BUFFER, DK) \
+ (BUFFER)->state.diagnostic_count[(int) DK]
+
+/* The number of errors that have been issued so far. Ideally, these
+ would take an output_buffer as an argument. */
+#define errorcount diagnostic_kind_count (diagnostic_buffer, DK_ERROR)
+/* Similarly, but for warnings. */
+#define warningcount diagnostic_kind_count (diagnostic_buffer, DK_WARNING)
+/* Similarly, but for sorrys. */
+#define sorrycount diagnostic_kind_count (diagnostic_buffer, DK_SORRY)
+
+/* Returns non-zero if warnings should be emitted. */
+#define diagnostic_report_warnings_p() \
+ (!inhibit_warnings \
+ && !(in_system_header && !warn_system_headers))
+
+
/* Prototypes */
extern void set_diagnostic_context PARAMS ((diagnostic_context *,
const char *, va_list *,
#include "ggc.h"
#include "md5.h"
#include "tm_p.h"
+#include "diagnostic.h"
/* DWARF2 Abbreviation Glossary:
CFA = Canonical Frame Address
int optimize_size = 0;
-/* Number of error messages and warning messages so far. */
-
-int errorcount = 0;
-int warningcount = 0;
-int sorrycount = 0;
-
/* Nonzero if we should exit after parsing options. */
static int exit_after_options = 0;
PARAMS ((union tree_node *));
extern void note_outlining_of_inline_function
PARAMS ((union tree_node *));
-extern int errorcount;
-extern int warningcount;
-extern int sorrycount;
extern const char *progname;
extern const char *dump_base_name;