address unused variables

Akim Demaille <[email protected]> Sun, 31 Jul 2022 09:35:59 +0200
Newsgroups gmane.comp.parsers.bison.patches
Message-ID <[email protected]>
commit cb679b2a098dc3642be4c4ee14b843bd3d4ab8a7
Author: Akim Demaille <[email protected]>
Date:   Sun Jul 31 09:13:48 2022 +0200

    address unused variables
   =20
    Reported by recent versions of clang.
   =20
    * src/counterexample.c (search_state_prepend): Use complexity_cost.
    * src/print.c: Remove useless variable.

diff --git a/src/counterexample.c b/src/counterexample.c
index 2195b6ef..6ce72c9a 100644
--- a/src/counterexample.c
+++ b/src/counterexample.c
@@ -890,11 +890,11 @@ search_state_prepend (search_state *ss, =
symbol_number sym, bitset guide)
       gl_list_free (prev);
       return;
     }
+
   // The parse state heads are either both production items or both
   // transition items. So all prepend options will either be
   // reverse transitions or reverse productions
-  int complexity_cost =3D prod1 ? PRODUCTION_COST : UNSHIFT_COST;
-  complexity_cost *=3D 2;
+  const int complexity_cost =3D 2 * (prod1 ? PRODUCTION_COST : =
UNSHIFT_COST);
=20
   parse_state_list prev1 =3D parser_prepend (ss->states[0]);
   parse_state_list prev2 =3D parser_prepend (ss->states[1]);
@@ -926,11 +926,7 @@ search_state_prepend (search_state *ss, =
symbol_number sym, bitset guide)
           if (psi1->state !=3D psi2->state)
             continue;
=20
-          int complexity =3D ss->complexity;
-          if (prod1)
-            complexity +=3D PRODUCTION_COST * 2;
-          else
-            complexity +=3D UNSHIFT_COST * 2;
+          int complexity =3D ss->complexity + complexity_cost;
           // penalty for not being along the guide path
           if (!guided1 || !guided2)
             complexity +=3D EXTENDED_COST;
diff --git a/src/print.c b/src/print.c
index 6e75e3d9..b7e2ebed 100644
--- a/src/print.c
+++ b/src/print.c
@@ -419,11 +419,9 @@ print_nonterminal_symbols (FILE *out)
             break;
         }
=20
-      int column =3D 4 + mbswidth (tag, 0);
       fprintf (out, "%4s%s", "", tag);
       if (sym->content->type_name)
-        column +=3D fprintf (out, " <%s>",
-                           sym->content->type_name);
+        fprintf (out, " <%s>", sym->content->type_name);
       fprintf (out, " (%d)\n", i);
=20
       if (on_left)