This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [SPU/Build/Global] separate generror warning and gcc warning functions.


I am not sure who should review this, so I am adding Andrew for the
SPU parts, Paolo for the build machinery and two global maintainers.

Updated to recent revision, bootstrapped and regression tested on
x86_64-unknown-linux-gnu with
--enable-languages=all,ada

Cheers,

Manuel.

2008/8/22 Manuel López-Ibáñez <lopezibanez@gmail.com>:
> 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.
>
Index: gcc/genautomata.c
===================================================================
--- gcc/genautomata.c	(revision 146539)
+++ gcc/genautomata.c	(working copy)
@@ -2312,12 +2312,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;
@@ -2326,19 +2325,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
@@ -2400,20 +2397,20 @@ insert_bypass (struct bypass_decl *bypas
 	      {
 		if (!w_flag)
 		  error ("the same bypass `%s - %s' is already defined",
 			 bypass->out_insn_name, bypass->in_insn_name);
 		else
-		  warning (0, "the same bypass `%s - %s' is already defined",
+		  warning ("the same bypass `%s - %s' is already defined",
 			   bypass->out_insn_name, bypass->in_insn_name);
 	      }
 	    else if (!w_flag)
 	      error ("the same bypass `%s - %s' (guard %s) is already defined",
 		     bypass->out_insn_name, bypass->in_insn_name,
 		     bypass->bypass_guard_name);
 	    else
 	      warning
-		(0, "the same bypass `%s - %s' (guard %s) is already defined",
+		("the same bypass `%s - %s' (guard %s) is already defined",
 		 bypass->out_insn_name, bypass->in_insn_name,
 		 bypass->bypass_guard_name);
 	    return;
 	  }
 	if (curr->bypass_guard_name == NULL)
@@ -2463,11 +2460,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
@@ -2662,11 +2659,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);
 	}
     }
 }
 
@@ -2776,18 +2773,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
@@ -9232,22 +9229,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 146539)
+++ 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 146539)
+++ 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 146539)
+++ 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 146539)
+++ gcc/Makefile.in	(working copy)
@@ -2342,12 +2342,11 @@ omp-low.o : omp-low.c $(CONFIG_H) $(SYST
    $(CFGLOOP_H) 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) \
@@ -2409,11 +2408,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) \
@@ -2473,11 +2472,11 @@ passes.o : passes.c $(CONFIG_H) $(SYSTEM
    hosthooks.h $(CGRAPH_H) $(COVERAGE_H) $(TREE_PASS_H) $(TREE_DUMP_H) \
    $(GGC_H) $(INTEGRATE_H) $(CPPLIB_H) opts.h $(TREE_FLOW_H) $(TREE_INLINE_H) \
    gt-passes.h $(DF_H) $(PREDICT_H)
 
 plugin.o : plugin.c $(PLUGIN_H) $(CONFIG_H) $(SYSTEM_H) coretypes.h \
-   errors.h $(TOPLEV_H) $(TREE_H) $(TREE_PASS_H) intl.h
+   $(TOPLEV_H) $(TREE_H) $(TREE_PASS_H) intl.h
 
 plugin-version.o : plugin-version.c $(SYSTEM_H) gcc-plugin.h configargs.h
 	$(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) \
 	-DBASEVER=$(BASEVER_s) -DDATESTAMP=$(DATESTAMP_s) \
 	-DREVISION=$(REVISION_s) -DDEVPHASE=$(DEVPHASE_s) -c \
@@ -2922,11 +2921,11 @@ ira-build.o: ira-build.c $(CONFIG_H) $(S
    $(TARGET_H) $(RTL_H) $(REGS_H) hard-reg-set.h $(FLAGS_H) \
    insn-config.h $(RECOG_H) $(BASIC_BLOCK_H) $(TOPLEV_H) $(TM_P_H) \
    $(PARAMS_H) $(DF_H) sparseset.h $(IRA_INT_H)
 ira-costs.o: ira-costs.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
    $(TARGET_H) $(RTL_H) insn-config.h $(RECOG_H) \
-   $(REGS_H) hard-reg-set.h $(FLAGS_H) errors.h \
+   $(REGS_H) hard-reg-set.h $(FLAGS_H) \
    $(EXPR_H) $(BASIC_BLOCK_H) $(TM_P_H) \
    $(IRA_INT_H)
 ira-conflicts.o: ira-conflicts.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
    $(TARGET_H) $(RTL_H) $(REGS_H) hard-reg-set.h $(FLAGS_H) \
    insn-config.h $(RECOG_H) $(BASIC_BLOCK_H) $(TOPLEV_H) $(TM_P_H) $(PARAMS_H) \
Index: gcc/gimple.c
===================================================================
--- gcc/gimple.c	(revision 146539)
+++ 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/config/spu/spu-c.c
===================================================================
--- gcc/config/spu/spu-c.c	(revision 146539)
+++ 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 146539)
+++ gcc/config/spu/t-spu-elf	(working copy)
@@ -91,8 +91,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
 

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]