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]

Patch installed for missing specifiers in genautomata.c


Found these with aggressive format warnings checks enabled.

The code was passing names as the format string, causing fprintf to
needlessly scan them for specifiers.  Adding "%s" allows gcc to
optimize these cases in fputs.

Bootstrapped on sparc-sun-solaris2.7, the generated insn-attrtab.c
file was identical to that from an unpatched tree.

Installed as "obvious".


2003-05-20  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>

	* genautomata.c (output_description, output_automaton_units,
	output_state_arcs): Add missing specifiers.

diff -rup orig/egcc-CVS20030519/gcc/genautomata.c egcc-CVS20030519/gcc/genautomata.c
--- orig/egcc-CVS20030519/gcc/genautomata.c	2003-04-29 21:01:30.000000000 -0400
+++ egcc-CVS20030519/gcc/genautomata.c	2003-05-20 18:53:05.188607000 -0400
@@ -9359,7 +9359,7 @@ output_description ()
       if (decl->mode == dm_reserv)
 	{
           fprintf (output_description_file, "reservation ");
-          fprintf (output_description_file, DECL_RESERV (decl)->name);
+          fprintf (output_description_file, "%s", DECL_RESERV (decl)->name);
           fprintf (output_description_file, ": ");
           output_regexp (DECL_RESERV (decl)->regexp);
           fprintf (output_description_file, "\n");
@@ -9433,7 +9433,7 @@ output_automaton_units (automaton)
 	      curr_line_length += strlen (name) + 1;
 	      fprintf (output_description_file, " ");
 	    }
-	  fprintf (output_description_file, name);
+	  fprintf (output_description_file, "%s", name);
 	}
     }
   if (!there_is_an_automaton_unit)
@@ -9506,7 +9506,7 @@ output_state_arcs (state)
                   fprintf (output_description_file, ", ");
                 }
             }
-          fprintf (output_description_file, insn_name);
+          fprintf (output_description_file, "%s", insn_name);
           ainsn = ainsn->next_same_reservs_insn;
         }
       while (ainsn != NULL);


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