]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
gcc/
authorgdr <gdr@138bc75d-0d04-0410-961f-82ee72b054a4>
Sun, 10 Jun 2001 13:48:04 +0000 (13:48 +0000)
committergdr <gdr@138bc75d-0d04-0410-961f-82ee72b054a4>
Sun, 10 Jun 2001 13:48:04 +0000 (13:48 +0000)
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

ch/

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

cp/

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

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@43140 138bc75d-0d04-0410-961f-82ee72b054a4

18 files changed:
gcc/ChangeLog
gcc/Makefile.in
gcc/c-parse.in
gcc/ch/ChangeLog
gcc/ch/Makefile.in
gcc/ch/actions.c
gcc/ch/decl.c
gcc/cp/ChangeLog
gcc/cp/Make-lang.in
gcc/cp/call.c
gcc/cp/repo.c
gcc/cp/typeck.c
gcc/cp/typeck2.c
gcc/diagnostic.c
gcc/diagnostic.h
gcc/dwarf2out.c
gcc/toplev.c
gcc/toplev.h

index 634634a91e324497f49a419ad7d81501350139fb..4efb3ba388bc083f3cd96604919f97efc5d1de9e 100644 (file)
@@ -1,3 +1,29 @@
+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
index c3ff71399946f62634cb8b567f2a329569e44d0f..a9af1e1cdf99ff6b83ea2c2bbd081ddb8854229a 100644 (file)
@@ -1133,7 +1133,8 @@ s-crt0:   $(CRT0_S) $(MCRT0_S) $(GCC_PASSES) $(CONFIG_H)
 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
@@ -1386,7 +1387,7 @@ sdbout.o : sdbout.c $(CONFIG_H) $(SYSTEM_H) $(TREE_H) $(RTL_H) flags.h except.h
 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) \
index bcbd15f8701e04e27bd4ac981b1c829faf7775fe..45b04dab71addd2759a38433339d81f7b1b54ff2 100644 (file)
@@ -51,6 +51,7 @@ end ifc
 #include "output.h"
 #include "toplev.h"
 #include "ggc.h"
+#include "diagnostic.h"  
   
 #ifdef MULTIBYTE_CHARS
 #include <locale.h>
index cc1358c0ce854313ac241e0e4c2476362020e03f..be600bd3da51a95ef1992f688e0aa7f49ce6387c 100644 (file)
@@ -1,3 +1,10 @@
+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.
index a15c1ce7506f10361ae153109b3f043196828036..deb26f3a9bd9be3a71cbe6c8507afbe18c1759b9 100644 (file)
@@ -269,12 +269,12 @@ $(srcdir)/hash.h:
 
 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 \
index 09c8a5a23f7d50c45ed3f4100393962cce7a9cbc..a0e50d68a5f834804df5f73af323555137aceabf 100644 (file)
@@ -32,6 +32,7 @@ Boston, MA 02111-1307, USA.  */
 #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 *));
index 6cdec6c9bee9e0860a9770305ac77391ae7186ec..a433fa7b79b7a9e885c05519fe7649144fdeb325 100644 (file)
@@ -191,6 +191,7 @@ Boston, MA 02111-1307, USA.  */
 #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)
index ad66b7ce93079ea22c5f4b575728ddbd4b6afa6a..f4527206cb708b86637616ee8a92c595f1455a98 100644 (file)
@@ -1,3 +1,21 @@
+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
index 84baffb4043b9b8b2a3dc25ca7ce1006e9891c60..9965c5e737e432f78bbf28563d9749874181dc7e 100644 (file)
@@ -245,10 +245,13 @@ cp/decl.o: cp/decl.c $(CXX_TREE_H) flags.h cp/lex.h cp/decl.h stack.h \
   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
@@ -269,7 +272,7 @@ cp/pt.o: cp/pt.c $(CXX_TREE_H) cp/decl.h cp/parse.h cp/lex.h toplev.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
index f09659acbcc3bf57d6b933c967fcad427874d086..e7b6bbd824b4f5f0c6a30b3c4b79b4e17bc58972 100644 (file)
@@ -34,6 +34,7 @@ Boston, MA 02111-1307, USA.  */
 #include "toplev.h"
 #include "expr.h"
 #include "ggc.h"
+#include "diagnostic.h"
 
 extern int inhibit_warnings;
 
@@ -3716,7 +3717,6 @@ convert_like_real (convs, expr, fn, argnum, inner)
      int argnum;
      int inner;
 {
-  extern int warningcount, errorcount;
   int savew, savee;
 
   tree totype = TREE_TYPE (convs);
index f2f95919d56ee0088fa1088d13edcbf151f6c1bc..74c5ee86b128dc15e47cfe09a076e853550fc3e5 100644 (file)
@@ -33,6 +33,7 @@ Boston, MA 02111-1307, USA.  */
 #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 **));
index 01805c664faac8864ff10757f8c2209aa7a76d5b..3c2ea8d9666846ff5dc3e24d2f4c6399e27820a7 100644 (file)
@@ -40,6 +40,7 @@ Boston, MA 02111-1307, USA.  */
 #include "flags.h"
 #include "output.h"
 #include "toplev.h"
+#include "diagnostic.h"
 
 static tree convert_for_assignment PARAMS ((tree, tree, const char *, tree,
                                          int));
@@ -6431,7 +6432,6 @@ convert_for_initialization (exp, type, rhs, flags, errtype, fndecl, parmnum)
   if (codel == REFERENCE_TYPE)
     {
       /* This should eventually happen in convert_arguments.  */
-      extern int warningcount, errorcount;
       int savew = 0, savee = 0;
 
       if (fndecl)
index 959d979872d32cbf687e8655f07683cba759c7df..09621d4cb5721e259e351d84bd533a2870456e1d 100644 (file)
@@ -38,6 +38,7 @@ Boston, MA 02111-1307, USA.  */
 #include "flags.h"
 #include "toplev.h"
 #include "output.h"
+#include "diagnostic.h"
 
 static tree process_init_constructor PARAMS ((tree, tree, tree *));
 
index eb0e5214fa57ce999b352d19b994a14921466f1c..bb75846c99b1fa8cabb55716f4557dad8c3a0bba 100644 (file)
@@ -103,10 +103,7 @@ static void default_diagnostic_finalizer PARAMS ((output_buffer *,
 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;
@@ -1049,9 +1046,7 @@ int
 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)
index 9d017584aaff35d7cba83f00639fb031ce91ef5d..02029ea59c7e0054a5eff807acf8202c3457473f 100644 (file)
@@ -55,9 +55,11 @@ typedef struct
 {
   /* 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;
@@ -77,11 +79,16 @@ typedef struct
      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.  */
@@ -90,16 +97,20 @@ struct output_buffer
   /* 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)
@@ -178,6 +189,23 @@ extern int diagnostic_message_length_per_line;
    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 *,
index 5d561840e6a1255eab896c7a95f16b46aa6ca1d7..5257b9146198c6f0e19a43393d08a3c7c75ccc8b 100644 (file)
@@ -56,6 +56,7 @@ Boston, MA 02111-1307, USA.  */
 #include "ggc.h"
 #include "md5.h"
 #include "tm_p.h"
+#include "diagnostic.h"
 
 /* DWARF2 Abbreviation Glossary:
    CFA = Canonical Frame Address
index 2f803aa44bb5ced4e352d55049dd12fa684079be..16a1de5f45ca7e2d2047f66e594caf058a55ddb6 100644 (file)
@@ -379,12 +379,6 @@ int optimize = 0;
 
 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;
 
index 8d0d2a6de023deb34a55aa46f43606c0e5cd425a..ca09e0ef2e87aab811337ead110676fc1c4ffc7b 100644 (file)
@@ -132,9 +132,6 @@ extern void note_deferral_of_defined_inline_function
                                        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;