Hello, I got a minor warning when compiling gettext, which uses the 'diffseq' module without USE_HEURISTIC set.
diffseq.h: In function 'diag': diffseq.h:189:12: warning: variable 'big_snake' set but not used [-Wunused-but-set-variable] bool big_snake = false; ^ Here is a patch.
>From 64d214551eb102e5acb9c971505c8b167b0d5b62 Mon Sep 17 00:00:00 2001 From: Daiki Ueno <u...@gnu.org> Date: Wed, 10 Dec 2014 12:38:37 +0900 Subject: [PATCH] diffseq: avoid compiler warning when !USE_HEURISTIC * lib/diffseq.h (diag) [!USE_HEURISTIC]: Don't set the locale variable 'big_snake'. --- ChangeLog | 6 ++++++ lib/diffseq.h | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/ChangeLog b/ChangeLog index 5fac19d..3f3eceb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2014-12-10 Daiki Ueno <u...@gnu.org> + + diffseq: avoid compiler warning when !USE_HEURISTIC + * lib/diffseq.h (diag) [!USE_HEURISTIC]: Don't set the locale + variable 'big_snake'. + 2014-12-09 Paul Eggert <egg...@cs.ucla.edu> posixtm: avoid compiler warning in a better way diff --git a/lib/diffseq.h b/lib/diffseq.h index 1974c36..eec5b39 100644 --- a/lib/diffseq.h +++ b/lib/diffseq.h @@ -186,7 +186,9 @@ diag (OFFSET xoff, OFFSET xlim, OFFSET yoff, OFFSET ylim, for (c = 1;; ++c) { OFFSET d; /* Active diagonal. */ +#ifdef USE_HEURISTIC bool big_snake = false; +#endif /* Extend the top-down search by an edit step in each diagonal. */ if (fmin > dmin) @@ -209,8 +211,10 @@ diag (OFFSET xoff, OFFSET xlim, OFFSET yoff, OFFSET ylim, x < xlim && y < ylim && XREF_YREF_EQUAL (x, y); x++, y++) continue; +#ifdef USE_HEURISTIC if (x - x0 > SNAKE_LIMIT) big_snake = true; +#endif fd[d] = x; if (odd && bmin <= d && d <= bmax && bd[d] <= x) { @@ -241,8 +245,10 @@ diag (OFFSET xoff, OFFSET xlim, OFFSET yoff, OFFSET ylim, xoff < x && yoff < y && XREF_YREF_EQUAL (x - 1, y - 1); x--, y--) continue; +#ifdef USE_HEURISTIC if (x0 - x > SNAKE_LIMIT) big_snake = true; +#endif bd[d] = x; if (!odd && fmin <= d && d <= fmax && x <= fd[d]) { -- 2.1.0
Regards, -- Daiki Ueno