blob: 143e898a513832875668df5f05a86cb9c90f38af [file] [log] [blame]
Andrew Geissler82c905d2020-04-13 13:39:40 -05001From 453587d714473b806473b309727f865b673cbc06 Mon Sep 17 00:00:00 2001
Patrick Williamsd8c66bc2016-06-20 12:57:21 -05002From: Khem Raj <raj.khem@gmail.com>
3Date: Wed, 13 Jan 2016 23:10:19 -0800
Andrew Geissler82c905d2020-04-13 13:39:40 -05004Subject: [PATCH] palisade: Fix warnings with clang on arm
Patrick Williamsd8c66bc2016-06-20 12:57:21 -05005
6ARM treats 'char' as unsigned char when 'char' is not qualified with
7'signed' or 'unsigned' explicitly.
8
9This results in warnings e.g.
10
11palisade.c:531:22: error: comparison of constant -1 with expression of
12type 'clue' (aka 'char') is always false
13[-Werror,-Wtautological-constant-out-of-range-compare]
14 if (clues[i] == EMPTY) continue;
15
16Therefore, typcast the contant to char in such places to be explicit
17
18Signed-off-by: Khem Raj <raj.khem@gmail.com>
Patrick Williamsd8c66bc2016-06-20 12:57:21 -050019Upstream-Status: Submitted
Andrew Geissler82c905d2020-04-13 13:39:40 -050020---
Patrick Williamsd8c66bc2016-06-20 12:57:21 -050021 palisade.c | 10 +++++-----
22 1 file changed, 5 insertions(+), 5 deletions(-)
23
24diff --git a/palisade.c b/palisade.c
Andrew Geissler82c905d2020-04-13 13:39:40 -050025index 6ffbf2d..8b54d42 100644
Patrick Williamsd8c66bc2016-06-20 12:57:21 -050026--- a/palisade.c
27+++ b/palisade.c
Andrew Geissler82c905d2020-04-13 13:39:40 -050028@@ -304,11 +304,11 @@ static void solver_connected_clues_versus_region_size(solver_ctx *ctx)
Patrick Williamsd8c66bc2016-06-20 12:57:21 -050029 * If p = q = 3 then the region has size exactly 2. */
30
31 for (i = 0; i < wh; ++i) {
32- if (ctx->clues[i] == EMPTY) continue;
33+ if (ctx->clues[i] == (char)EMPTY) continue;
34 for (dir = 0; dir < 4; ++dir) {
35 int j = i + dx[dir] + w*dy[dir];
36 if (disconnected(ctx, i, j, dir)) continue;
37- if (ctx->clues[j] == EMPTY) continue;
38+ if (ctx->clues[j] == (char)EMPTY) continue;
39 if ((8 - ctx->clues[i] - ctx->clues[j] > ctx->params->k) ||
40 (ctx->clues[i] == 3 && ctx->clues[j] == 3 &&
41 ctx->params->k != 2))
Andrew Geissler82c905d2020-04-13 13:39:40 -050042@@ -326,7 +326,7 @@ static bool solver_number_exhausted(solver_ctx *ctx)
43 bool changed = false;
Patrick Williamsd8c66bc2016-06-20 12:57:21 -050044
45 for (i = 0; i < wh; ++i) {
46- if (ctx->clues[i] == EMPTY) continue;
47+ if (ctx->clues[i] == (char)EMPTY) continue;
48
49 if (bitcount[(ctx->borders[i] & BORDER_MASK)] == ctx->clues[i]) {
50 for (dir = 0; dir < 4; ++dir) {
Andrew Geissler82c905d2020-04-13 13:39:40 -050051@@ -538,7 +538,7 @@ static bool is_solved(const game_params *params, clue *clues,
Patrick Williamsd8c66bc2016-06-20 12:57:21 -050052 for (i = 0; i < wh; ++i) {
Andrew Geissler82c905d2020-04-13 13:39:40 -050053 if (dsf[i] == UNVISITED) dfs_dsf(i, params->w, border, dsf, true);
Patrick Williamsd8c66bc2016-06-20 12:57:21 -050054 if (dsf_size(dsf, i) != k) goto error;
55- if (clues[i] == EMPTY) continue;
56+ if (clues[i] == (char)EMPTY) continue;
57 if (clues[i] != bitcount[border[i] & BORDER_MASK]) goto error;
58 }
59
Andrew Geissler82c905d2020-04-13 13:39:40 -050060@@ -685,7 +685,7 @@ static char *new_game_desc(const game_params *params, random_state *rs,
Patrick Williamsd8c66bc2016-06-20 12:57:21 -050061 p = numbers;
62 r = 0;
63 for (i = 0; i < wh; ++i) {
64- if (numbers[i] != EMPTY) {
65+ if (numbers[i] != (char)EMPTY) {
66 while (r) {
67 while (r > 26) {
68 *p++ = 'z';