aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Tatham <anakin@pobox.com>2023-02-18 07:06:27 +0000
committerSimon Tatham <anakin@pobox.com>2023-02-18 08:55:13 +0000
commitdbced097ac16973f648ad2f024cc2302fa187578 (patch)
tree9efddfcddbaa0a5a9c9516b82d9e044c35041783
parent615a337e426c0dc598b0bcdd9aec6bcbc4c50d2c (diff)
downloadpuzzles-dbced097ac16973f648ad2f024cc2302fa187578.zip
puzzles-dbced097ac16973f648ad2f024cc2302fa187578.tar.gz
puzzles-dbced097ac16973f648ad2f024cc2302fa187578.tar.bz2
puzzles-dbced097ac16973f648ad2f024cc2302fa187578.tar.xz
Fix unused variable warnings from clang.
If you enable -DSTRICT=ON in cmake and also build with clang, it reports a couple of variables set but not otherwise used. One was genuinely unused ('loop_found' in loop_deductions in Loopy); the other is used by debug statements that are usually but not always compiled out.
-rw-r--r--lightup.c2
-rw-r--r--loopy.c3
2 files changed, 3 insertions, 2 deletions
diff --git a/lightup.c b/lightup.c
index 854d28a..3db47f7 100644
--- a/lightup.c
+++ b/lightup.c
@@ -416,6 +416,8 @@ static void debug_state(game_state *state)
int x, y;
char c = '?';
+ (void)c; /* placate -Wunused-but-set-variable if debug() does nothing */
+
for (y = 0; y < state->h; y++) {
for (x = 0; x < state->w; x++) {
c = '.';
diff --git a/loopy.c b/loopy.c
index 18da2e8..3545976 100644
--- a/loopy.c
+++ b/loopy.c
@@ -2713,7 +2713,6 @@ static int loop_deductions(solver_state *sstate)
game_state *state = sstate->state;
grid *g = state->game_grid;
int shortest_chainlen = g->num_dots;
- bool loop_found = false;
int dots_connected;
bool progress = false;
int i;
@@ -2726,7 +2725,7 @@ static int loop_deductions(solver_state *sstate)
*/
for (i = 0; i < g->num_edges; i++) {
if (state->lines[i] == LINE_YES) {
- loop_found |= merge_dots(sstate, i);
+ merge_dots(sstate, i);
edgecount++;
}
}