This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Patch for genautomata warnings from insn-attrtab.c
- From: "Kaveh R. Ghazi" <ghazi at caip dot rutgers dot edu>
- To: gcc-patches at gcc dot gnu dot org, vmakarov at redhat dot com
- Date: Mon, 19 Aug 2002 12:07:58 -0400 (EDT)
- Subject: Patch for genautomata warnings from insn-attrtab.c
I'm getting these warnings from insn-attrtab.c on mips-sgi-irix6.2:
> insn-attrtab.c:9718: warning: `res' might be used uninitialized in this function
> insn-attrtab.c:9676: warning: `translate_0' defined but not used
> insn-attrtab.c:9680: warning: `transitions_0' defined but not used
> insn-attrtab.c:9693: warning: `min_issue_delay_0' defined but not used
The first one comes from this function in the attrtab output file:
> static int
> internal_min_issue_delay (insn_code, chip)
> int insn_code;
> struct DFA_chip *chip ATTRIBUTE_UNUSED;
> {
> int temp ATTRIBUTE_UNUSED;
> int res;
>
> switch (insn_code)
> {
> case 0: /* $advance_cycle */
> break;
>
>
> default:
> res = -1;
> break;
> }
> return res;
> }
I don't know how to make it avoid outputting case 0, so an easy way to
fix it is to always initialize `res' to -1. The other warnings I
fixed by adding ATTRIBUTE_UNUSED.
Tested by rebuilding insn-attrtab.o in stage3. Full bootstrap underway.
Assuming it completes, ok to install?
Thanks,
--Kaveh
2002-08-19 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* genautomata.c (output_translate_vect, output_state_ainsn_table,
output_min_issue_delay_table): Mark variable with ATTRIBUTE_UNUSED
in output file.
(output_internal_min_issue_delay_func): Initialize variable in
output file.
diff -rup orig/egcc-CVS20020818/gcc/genautomata.c egcc-CVS20020818/gcc/genautomata.c
--- orig/egcc-CVS20020818/gcc/genautomata.c 2002-08-19 11:53:05.352539419 -0400
+++ egcc-CVS20020818/gcc/genautomata.c 2002-08-19 11:52:48.411510444 -0400
@@ -7278,7 +7278,7 @@ output_translate_vect (automaton)
output_range_type (output_file, 0, automaton->insn_equiv_classes_num);
fprintf (output_file, " ");
output_translate_vect_name (output_file, automaton);
- fprintf (output_file, "[] = {\n");
+ fprintf (output_file, "[] ATTRIBUTE_UNUSED = {\n");
output_vect (VLA_HWINT_BEGIN (translate_vect),
VLA_HWINT_LENGTH (translate_vect));
fprintf (output_file, "};\n\n");
@@ -7349,7 +7349,7 @@ output_state_ainsn_table (tab, table_nam
tab->max_comb_vect_el_value);
fprintf (output_file, " ");
(*output_full_vect_name_func) (output_file, tab->automaton);
- fprintf (output_file, "[] = {\n");
+ fprintf (output_file, "[] ATTRIBUTE_UNUSED = {\n");
output_vect (VLA_HWINT_BEGIN (tab->full_vect),
VLA_HWINT_LENGTH (tab->full_vect));
fprintf (output_file, "};\n\n");
@@ -7362,7 +7362,7 @@ output_state_ainsn_table (tab, table_nam
tab->max_comb_vect_el_value);
fprintf (output_file, " ");
(*output_comb_vect_name_func) (output_file, tab->automaton);
- fprintf (output_file, "[] = {\n");
+ fprintf (output_file, "[] ATTRIBUTE_UNUSED = {\n");
output_vect (VLA_HWINT_BEGIN (tab->comb_vect),
VLA_HWINT_LENGTH (tab->comb_vect));
fprintf (output_file, "};\n\n");
@@ -7779,7 +7779,7 @@ output_min_issue_delay_table (automaton)
output_range_type (output_file, 0, automaton->max_min_delay);
fprintf (output_file, " ");
output_min_issue_delay_vect_name (output_file, automaton);
- fprintf (output_file, "[] = {\n");
+ fprintf (output_file, "[] ATTRIBUTE_UNUSED = {\n");
/* Compress the vector */
if (automaton->max_min_delay < 2)
automaton->min_issue_delay_table_compression_factor = 8;
@@ -8091,7 +8091,7 @@ output_internal_min_issue_delay_func ()
INTERNAL_MIN_ISSUE_DELAY_FUNC_NAME, INTERNAL_INSN_CODE_NAME,
CHIP_PARAMETER_NAME, INTERNAL_INSN_CODE_NAME, CHIP_NAME,
CHIP_PARAMETER_NAME);
- fprintf (output_file, "{\n int %s ATTRIBUTE_UNUSED;\n int %s;\n",
+ fprintf (output_file, "{\n int %s ATTRIBUTE_UNUSED;\n int %s = -1;\n",
TEMPORARY_VARIABLE_NAME, RESULT_VARIABLE_NAME);
fprintf (output_file, "\n switch (%s)\n {\n", INTERNAL_INSN_CODE_NAME);
output_insn_code_cases (output_automata_list_min_issue_delay_code);