]> git.ipfire.org Git - thirdparty/gnulib.git/commitdiff
diffseq: port to GCC 7 with --enable-gcc-warnings
authorPaul Eggert <eggert@cs.ucla.edu>
Sat, 17 Jun 2017 19:16:27 +0000 (12:16 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Sat, 17 Jun 2017 19:17:00 +0000 (12:17 -0700)
* lib/diffseq.h (diag): Use an if, not an ifdef, for most of the
heuristic check.  This way, GCC 7 with --enable-gcc-warnings does
not complain about big_snake being defined but not used.

ChangeLog
lib/diffseq.h

index 2e332a41384417947ceb5eaf77d344052516a657..55bc3c53c035b49a60aafd0ce6a737977b56b7fe 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2017-06-17  Paul Eggert  <eggert@cs.ucla.edu>
+
+       diffseq: port to GCC 7 with --enable-gcc-warnings
+       * lib/diffseq.h (diag): Use an if, not an ifdef, for most of the
+       heuristic check.  This way, GCC 7 with --enable-gcc-warnings does
+       not complain about big_snake being defined but not used.
+
 2017-06-15  Bruno Haible  <bruno@clisp.org>
 
        gettext-h: Update theoretical condition for use of variable size arrays.
index d7a374357c7bd4533fc807966fb392b449b2d52c..a3cf140990ba6ed546ed2de8ab35ddfebb395e49 100644 (file)
@@ -279,6 +279,11 @@ diag (OFFSET xoff, OFFSET xlim, OFFSET yoff, OFFSET ylim, bool find_minimal,
         continue;
 
 #ifdef USE_HEURISTIC
+      bool heuristic = ctxt->heuristic;
+#else
+      bool heuristic = false;
+#endif
+
       /* Heuristic: check occasionally for a diagonal that has made lots
          of progress compared with the edit distance.  If we have any
          such, find the one that has made the most progress and return it
@@ -287,7 +292,7 @@ diag (OFFSET xoff, OFFSET xlim, OFFSET yoff, OFFSET ylim, bool find_minimal,
          With this heuristic, for vectors with a constant small density
          of changes, the algorithm is linear in the vector size.  */
 
-      if (200 < c && big_snake && ctxt->heuristic)
+      if (200 < c && big_snake && heuristic)
         {
           {
             OFFSET best = 0;
@@ -367,7 +372,6 @@ diag (OFFSET xoff, OFFSET xlim, OFFSET yoff, OFFSET ylim, bool find_minimal,
               }
           }
         }
-#endif /* USE_HEURISTIC */
 
       /* Heuristic: if we've gone well beyond the call of duty, give up
          and report halfway between our best results so far.  */