public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [RF SPU testing] separate errors.c and diagnostic.c functions (try2)
@ 2008-08-22 22:35 Manuel López-Ibáñez
  2008-08-25  8:59 ` Manuel López-Ibáñez
  0 siblings, 1 reply; 5+ messages in thread
From: Manuel López-Ibáñez @ 2008-08-22 22:35 UTC (permalink / raw)
  To: Gcc Patch List

[-- Attachment #1: Type: text/plain, Size: 1460 bytes --]

The files errors.c and errors.h define and declare some diagnostics
functions that are used by the gen* programs. On the other hand,
toplev.h and diagnostic.c declare and define different diagnostics
functions used by the rest of the compiler.

We have been trying to keep the declarations of error, warning, etc.
found in errrors.h and toplev.h compatible. However, this has no
future at all. They do not need to be compatible since they are not
(or should not be) used in the same places. Moreover, being compatible
has allowed errors.h to sneak into some compiler files where it does
not belong. (I would prefer if errors.h and errors.c would rather be
called generrors.h and generrors.c)

This version should work in SPU, although I cannot test it so testing
in that (and any other target) is appreciated.


Bootstrapped and regression tested on x86_64-unknown-linux-gnu with
--enable-languages=all,ada

OK for trunk?

2008-08-22  Manuel Lopez-Ibanez  <manu@gcc.gnu.org>

	* Makefile.in: Update dependencies.
	* errors.c (warning): Remove unused parameter 'opt'. Returns
	'void'.
	* errors.h: Remove bogus comment about compatibility.
	(warning): Update declaration.
	* genautomata.c: Update all calls to warning.
	* gimple.c: Do not include errors.h. Include toplev.h.
	* tree-ssa-structalias.c: Do not include errors.h.
	* omega.c: Likewise.
	* tree-ssa-reassoc.c: Likewise.
	* config/spu/spu-c.c: Likewise.
	* config/spu/t-spu-elf: Update dependencies.

[-- Attachment #2: fix-generrors.diff --]
[-- Type: text/plain, Size: 13155 bytes --]

Index: gcc/genautomata.c
===================================================================
--- gcc/genautomata.c	(revision 139406)
+++ gcc/genautomata.c	(working copy)
@@ -2305,12 +2305,11 @@ add_presence_absence (unit_set_el_t dest
 			  error ("unit `%s' excludes and requires presence of `%s'",
 				 dst->unit_decl->name, unit->name);
 			  no_error_flag = 0;
 			}
 		      else
-			warning
-			  (0, "unit `%s' excludes and requires presence of `%s'",
+			warning ("unit `%s' excludes and requires presence of `%s'",
 			   dst->unit_decl->name, unit->name);
 		    }
 		}
 	    else if (pat->units_num == 1)
 	      for (curr_pat_el = dst->unit_decl->presence_list;
@@ -2319,19 +2318,17 @@ add_presence_absence (unit_set_el_t dest
 		if (curr_pat_el->units_num == 1
 		    && unit == curr_pat_el->unit_decls [0])
 		  {
 		    if (!w_flag)
 		      {
-			error
-			  ("unit `%s' requires absence and presence of `%s'",
-			   dst->unit_decl->name, unit->name);
+			error ("unit `%s' requires absence and presence of `%s'",
+			       dst->unit_decl->name, unit->name);
 			no_error_flag = 0;
 		      }
 		    else
-		      warning
-			(0, "unit `%s' requires absence and presence of `%s'",
-			 dst->unit_decl->name, unit->name);
+		      warning ("unit `%s' requires absence and presence of `%s'",
+			       dst->unit_decl->name, unit->name);
 		  }
 	    if (no_error_flag)
 	      {
 		for (prev_el = (presence_p
 				? (final_p
@@ -2408,11 +2405,11 @@ process_decls (void)
 	    {
 	      if (!w_flag)
 		error ("repeated declaration of automaton `%s'",
 		       DECL_AUTOMATON (decl)->name);
 	      else
-		warning (0, "repeated declaration of automaton `%s'",
+		warning ("repeated declaration of automaton `%s'",
 			 DECL_AUTOMATON (decl)->name);
 	    }
 	}
     }
   /* Checking undeclared automata, repeated declarations (except for
@@ -2520,19 +2517,17 @@ process_decls (void)
 	      if (bypass != NULL)
 		{
 		  if (DECL_BYPASS (decl)->latency == bypass->latency)
 		    {
 		      if (!w_flag)
-			error
-			  ("the same bypass `%s - %s' is already defined",
-			   DECL_BYPASS (decl)->out_insn_name,
-			   DECL_BYPASS (decl)->in_insn_name);
+			error ("the same bypass `%s - %s' is already defined",
+			       DECL_BYPASS (decl)->out_insn_name,
+			       DECL_BYPASS (decl)->in_insn_name);
 		      else
-			warning
-			  (0, "the same bypass `%s - %s' is already defined",
-			   DECL_BYPASS (decl)->out_insn_name,
-			   DECL_BYPASS (decl)->in_insn_name);
+			warning ("the same bypass `%s - %s' is already defined",
+				 DECL_BYPASS (decl)->out_insn_name,
+				 DECL_BYPASS (decl)->in_insn_name);
 		    }
 		  else
 		    error ("bypass `%s - %s' is already defined",
 			   DECL_BYPASS (decl)->out_insn_name,
 			   DECL_BYPASS (decl)->in_insn_name);
@@ -2636,11 +2631,11 @@ check_automaton_usage (void)
 	  && !DECL_AUTOMATON (decl)->automaton_is_used)
 	{
 	  if (!w_flag)
 	    error ("automaton `%s' is not used", DECL_AUTOMATON (decl)->name);
 	  else
-	    warning (0, "automaton `%s' is not used",
+	    warning ("automaton `%s' is not used",
 		     DECL_AUTOMATON (decl)->name);
 	}
     }
 }
 
@@ -2750,18 +2745,18 @@ check_usage (void)
       if (decl->mode == dm_unit && !DECL_UNIT (decl)->unit_is_used)
 	{
 	  if (!w_flag)
 	    error ("unit `%s' is not used", DECL_UNIT (decl)->name);
 	  else
-	    warning (0, "unit `%s' is not used", DECL_UNIT (decl)->name);
+	    warning ("unit `%s' is not used", DECL_UNIT (decl)->name);
 	}
       else if (decl->mode == dm_reserv && !DECL_RESERV (decl)->reserv_is_used)
 	{
 	  if (!w_flag)
 	    error ("reservation `%s' is not used", DECL_RESERV (decl)->name);
 	  else
-	    warning (0, "reservation `%s' is not used", DECL_RESERV (decl)->name);
+	    warning ("reservation `%s' is not used", DECL_RESERV (decl)->name);
 	}
     }
 }
 
 /* The following variable value is number of reservation being
@@ -9005,22 +9000,21 @@ check_automata_insn_issues (void)
 		  if (!w_flag)
 		    error ("Automaton `%s': Insn `%s' will never be issued",
 			   automaton->corresponding_automaton_decl->name,
 			   reserv_ainsn->insn_reserv_decl->name);
 		  else
-		    warning
-		      (0, "Automaton `%s': Insn `%s' will never be issued",
-		       automaton->corresponding_automaton_decl->name,
-		       reserv_ainsn->insn_reserv_decl->name);
+		    warning ("Automaton `%s': Insn `%s' will never be issued",
+			     automaton->corresponding_automaton_decl->name,
+			     reserv_ainsn->insn_reserv_decl->name);
 		}
 	      else
 		{
 		  if (!w_flag)
 		    error ("Insn `%s' will never be issued",
 			   reserv_ainsn->insn_reserv_decl->name);
 		  else
-		    warning (0, "Insn `%s' will never be issued",
+		    warning ("Insn `%s' will never be issued",
 			     reserv_ainsn->insn_reserv_decl->name);
 		}
 	  }
     }
 }
Index: gcc/errors.c
===================================================================
--- gcc/errors.c	(revision 139406)
+++ gcc/errors.c	(working copy)
@@ -38,21 +38,20 @@ const char *progname;
 
 int have_error = 0;
 
 /* Print a warning message - output produced, but there may be problems.  */
 
-bool
-warning (int opt ATTRIBUTE_UNUSED, const char *format, ...)
+void
+warning (const char *format, ...)
 {
   va_list ap;
 
   va_start (ap, format);
   fprintf (stderr, "%s: warning: ", progname);
   vfprintf (stderr, format, ap);
   va_end (ap);
   fputc('\n', stderr);
-  return true;
 }
 
 
 /* Print an error message - we keep going but the output is unusable.  */
 
Index: gcc/errors.h
===================================================================
--- gcc/errors.h	(revision 139406)
+++ gcc/errors.h	(working copy)
@@ -27,15 +27,11 @@ along with GCC; see the file COPYING3.  
    GCC does not know about.  */
 
 #ifndef GCC_ERRORS_H
 #define GCC_ERRORS_H
 
-/* The first parameter is for compatibility with the non-generator
-   version of warning().  For those, you'd pass an OPT_W* value from
-   options.h, but in generator programs it has no effect, so it's OK
-   to just pass zero for calls from generator-only files.  */
-extern bool warning (int, const char *, ...) ATTRIBUTE_PRINTF_2 ATTRIBUTE_COLD;
+extern void warning (const char *, ...) ATTRIBUTE_PRINTF_1 ATTRIBUTE_COLD;
 extern void error (const char *, ...) ATTRIBUTE_PRINTF_1 ATTRIBUTE_COLD;
 extern void fatal (const char *, ...) ATTRIBUTE_NORETURN ATTRIBUTE_PRINTF_1 ATTRIBUTE_COLD;
 extern void internal_error (const char *, ...) ATTRIBUTE_NORETURN ATTRIBUTE_PRINTF_1 ATTRIBUTE_COLD;
 extern const char *trim_filename (const char *);
 
Index: gcc/omega.c
===================================================================
--- gcc/omega.c	(revision 139406)
+++ gcc/omega.c	(working copy)
@@ -33,11 +33,10 @@ along with GCC; see the file COPYING3.  
 
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
 #include "tm.h"
-#include "errors.h"
 #include "ggc.h"
 #include "tree.h"
 #include "diagnostic.h"
 #include "varray.h"
 #include "tree-pass.h"
Index: gcc/Makefile.in
===================================================================
--- gcc/Makefile.in	(revision 139406)
+++ gcc/Makefile.in	(working copy)
@@ -2041,11 +2041,11 @@ stor-layout.o : stor-layout.c $(CONFIG_H
    $(TREE_H) $(PARAMS_H) $(FLAGS_H) $(FUNCTION_H) $(EXPR_H) output.h $(RTL_H) \
    $(GGC_H) $(TM_P_H) $(TARGET_H) langhooks.h $(REGS_H) gt-stor-layout.h \
    $(TOPLEV_H)
 tree-ssa-structalias.o: tree-ssa-structalias.c tree-ssa-structalias.h \
    $(SYSTEM_H) $(CONFIG_H) coretypes.h $(TM_H) $(GGC_H) $(OBSTACK_H) $(BITMAP_H) \
-   $(FLAGS_H) $(RTL_H) $(TM_P_H) hard-reg-set.h $(BASIC_BLOCK_H) output.h errors.h \
+   $(FLAGS_H) $(RTL_H) $(TM_P_H) hard-reg-set.h $(BASIC_BLOCK_H) output.h \
    $(DIAGNOSTIC_H) $(TREE_H) $(C_COMMON_H) $(TREE_FLOW_H) $(TREE_INLINE_H) varray.h \
    $(C_TREE_H) $(GIMPLE_H) $(HASHTAB_H) $(FUNCTION_H) $(CGRAPH_H) tree-pass.h \
    $(TIMEVAR_H) alloc-pool.h $(SPLAY_TREE_H) $(PARAMS_H) gt-tree-ssa-structalias.h \
    $(CGRAPH_H) $(ALIAS_H) pointer-set.h
 tree-ssa.o : tree-ssa.c $(TREE_FLOW_H) $(CONFIG_H) $(SYSTEM_H) \
@@ -2273,11 +2273,11 @@ tree-ssa-alias.o : tree-ssa-alias.c $(TR
    $(FUNCTION_H) $(TIMEVAR_H) convert.h $(TM_H) coretypes.h langhooks.h \
    $(TREE_DUMP_H) tree-pass.h $(PARAMS_H) $(BASIC_BLOCK_H) $(DIAGNOSTIC_H) \
    hard-reg-set.h $(GIMPLE_H) vec.h tree-ssa-structalias.h \
    $(IPA_TYPE_ESCAPE_H) vecprim.h pointer-set.h alloc-pool.h
 tree-ssa-reassoc.o : tree-ssa-reassoc.c $(TREE_FLOW_H) $(CONFIG_H) \
-   $(SYSTEM_H) $(TREE_H) $(GGC_H) $(DIAGNOSTIC_H) errors.h $(TIMEVAR_H) \
+   $(SYSTEM_H) $(TREE_H) $(GGC_H) $(DIAGNOSTIC_H) $(TIMEVAR_H) \
    $(TM_H) coretypes.h $(TREE_DUMP_H) tree-pass.h $(FLAGS_H) tree-iterator.h\
    $(BASIC_BLOCK_H) $(GIMPLE_H) $(TREE_INLINE_H) vec.h langhooks.h \
    alloc-pool.h pointer-set.h $(CFGLOOP_H)
 tree-optimize.o : tree-optimize.c $(TREE_FLOW_H) $(CONFIG_H) $(SYSTEM_H) \
    $(RTL_H) $(TREE_H) $(TM_P_H) hard-reg-set.h $(EXPR_H) $(GGC_H) output.h \
@@ -2311,11 +2311,11 @@ omp-low.o : omp-low.c $(CONFIG_H) $(SYST
    tree-iterator.h
 tree-browser.o : tree-browser.c tree-browser.def $(CONFIG_H) $(SYSTEM_H) \
    $(TREE_H) $(TREE_INLINE_H) $(DIAGNOSTIC_H) $(HASHTAB_H) \
    $(TM_H) coretypes.h
 omega.o : omega.c omega.h $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
-   errors.h $(GGC_H) $(TREE_H) $(DIAGNOSTIC_H) varray.h tree-pass.h  $(PARAMS_H)
+   $(GGC_H) $(TREE_H) $(DIAGNOSTIC_H) varray.h tree-pass.h  $(PARAMS_H)
 tree-chrec.o: tree-chrec.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
    $(GGC_H) $(TREE_H) $(REAL_H) $(SCEV_H) tree-pass.h $(PARAMS_H) \
    $(DIAGNOSTIC_H) $(CFGLOOP_H) $(TREE_FLOW_H)
 tree-scalar-evolution.o: tree-scalar-evolution.c $(CONFIG_H) $(SYSTEM_H) \
    coretypes.h $(TM_H) $(GGC_H) $(TREE_H) $(REAL_H) $(RTL_H) \
@@ -2365,11 +2365,11 @@ tree-stdarg.o: tree-stdarg.c $(CONFIG_H)
    tree-stdarg.h $(TARGET_H) langhooks.h
 tree-object-size.o: tree-object-size.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
    $(TM_H) $(TREE_H) $(TOPLEV_H) $(DIAGNOSTIC_H) $(TREE_FLOW_H) tree-pass.h \
    tree-ssa-propagate.h
 gimple.o : gimple.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TREE_H) \
-   $(GGC_H) $(GIMPLE_H) $(GIMPLE_H) $(DIAGNOSTIC_H) gt-gimple.h \
+   $(GGC_H) $(GIMPLE_H) $(TOPLEV_H) $(DIAGNOSTIC_H) gt-gimple.h \
    $(TREE_FLOW_H) value-prof.h $(FLAGS_H)
 gimple-pretty-print.o : gimple-pretty-print.c $(CONFIG_H) $(SYSTEM_H) \
    $(TREE_H) $(DIAGNOSTIC_H) $(REAL_H) $(HASHTAB_H) $(TREE_FLOW_H) \
    $(TM_H) coretypes.h tree-pass.h $(GIMPLE_H) value-prof.h
 tree-mudflap.o : $(CONFIG_H) $(SYSTEM_H) $(TREE_H) $(TREE_INLINE_H) \
Index: gcc/gimple.c
===================================================================
--- gcc/gimple.c	(revision 139406)
+++ gcc/gimple.c	(working copy)
@@ -23,14 +23,14 @@ along with GCC; see the file COPYING3.  
 #include "system.h"
 #include "coretypes.h"
 #include "tm.h"
 #include "tree.h"
 #include "ggc.h"
-#include "errors.h"
 #include "hard-reg-set.h"
 #include "basic-block.h"
 #include "gimple.h"
+#include "toplev.h"
 #include "diagnostic.h"
 #include "tree-flow.h"
 #include "value-prof.h"
 #include "flags.h"
 
Index: gcc/tree-ssa-structalias.c
===================================================================
--- gcc/tree-ssa-structalias.c	(revision 139406)
+++ gcc/tree-ssa-structalias.c	(working copy)
@@ -29,11 +29,10 @@
 #include "rtl.h"
 #include "tm_p.h"
 #include "hard-reg-set.h"
 #include "basic-block.h"
 #include "output.h"
-#include "errors.h"
 #include "diagnostic.h"
 #include "tree.h"
 #include "c-common.h"
 #include "tree-flow.h"
 #include "tree-inline.h"
Index: gcc/tree-ssa-reassoc.c
===================================================================
--- gcc/tree-ssa-reassoc.c	(revision 139406)
+++ gcc/tree-ssa-reassoc.c	(working copy)
@@ -20,11 +20,10 @@ along with GCC; see the file COPYING3.  
 
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
 #include "tm.h"
-#include "errors.h"
 #include "ggc.h"
 #include "tree.h"
 #include "basic-block.h"
 #include "diagnostic.h"
 #include "tree-inline.h"
Index: gcc/config/spu/spu-c.c
===================================================================
--- gcc/config/spu/spu-c.c	(revision 139406)
+++ gcc/config/spu/spu-c.c	(working copy)
@@ -23,11 +23,10 @@
 #include "c-tree.h"
 #include "c-pragma.h"
 #include "function.h"
 #include "rtl.h"
 #include "expr.h"
-#include "errors.h"
 #include "tm_p.h"
 #include "langhooks.h"
 #include "insn-config.h"
 #include "insn-codes.h"
 #include "recog.h"
Index: gcc/config/spu/t-spu-elf
===================================================================
--- gcc/config/spu/t-spu-elf	(revision 139406)
+++ gcc/config/spu/t-spu-elf	(working copy)
@@ -83,8 +83,8 @@ spu.o: $(CONFIG_H) $(SYSTEM_H) coretypes
 spu-c.o: $(srcdir)/config/spu/spu-c.c \
     $(srcdir)/config/spu/spu-protos.h \
     $(srcdir)/config/spu/spu-builtins.h \
     $(srcdir)/config/spu/spu-builtins.def \
     $(CONFIG_H) $(SYSTEM_H) $(TREE_H) $(CPPLIB_H) \
-    $(TM_P_H) c-pragma.h errors.h coretypes.h $(TM_H) insn-codes.h
+    $(TM_P_H) c-pragma.h coretypes.h $(TM_H) insn-codes.h
 	$(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $(srcdir)/config/spu/spu-c.c
 

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2008-08-26  6:47 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-08-22 22:35 [RF SPU testing] separate errors.c and diagnostic.c functions (try2) Manuel López-Ibáñez
2008-08-25  8:59 ` Manuel López-Ibáñez
2008-08-25 11:12   ` Revital1 Eres
2008-08-25 12:35     ` Manuel López-Ibáñez
2008-08-26  7:57       ` Revital1 Eres

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).