Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame^] | 1 | From 453587d714473b806473b309727f865b673cbc06 Mon Sep 17 00:00:00 2001 |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 2 | From: Khem Raj <raj.khem@gmail.com> |
| 3 | Date: Wed, 13 Jan 2016 23:10:19 -0800 |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame^] | 4 | Subject: [PATCH] palisade: Fix warnings with clang on arm |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 5 | |
| 6 | ARM treats 'char' as unsigned char when 'char' is not qualified with |
| 7 | 'signed' or 'unsigned' explicitly. |
| 8 | |
| 9 | This results in warnings e.g. |
| 10 | |
| 11 | palisade.c:531:22: error: comparison of constant -1 with expression of |
| 12 | type 'clue' (aka 'char') is always false |
| 13 | [-Werror,-Wtautological-constant-out-of-range-compare] |
| 14 | if (clues[i] == EMPTY) continue; |
| 15 | |
| 16 | Therefore, typcast the contant to char in such places to be explicit |
| 17 | |
| 18 | Signed-off-by: Khem Raj <raj.khem@gmail.com> |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 19 | Upstream-Status: Submitted |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame^] | 20 | --- |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 21 | palisade.c | 10 +++++----- |
| 22 | 1 file changed, 5 insertions(+), 5 deletions(-) |
| 23 | |
| 24 | diff --git a/palisade.c b/palisade.c |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame^] | 25 | index 6ffbf2d..8b54d42 100644 |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 26 | --- a/palisade.c |
| 27 | +++ b/palisade.c |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame^] | 28 | @@ -304,11 +304,11 @@ static void solver_connected_clues_versus_region_size(solver_ctx *ctx) |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 29 | * 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 Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame^] | 42 | @@ -326,7 +326,7 @@ static bool solver_number_exhausted(solver_ctx *ctx) |
| 43 | bool changed = false; |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 44 | |
| 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 Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame^] | 51 | @@ -538,7 +538,7 @@ static bool is_solved(const game_params *params, clue *clues, |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 52 | for (i = 0; i < wh; ++i) { |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame^] | 53 | if (dsf[i] == UNVISITED) dfs_dsf(i, params->w, border, dsf, true); |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 54 | 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 Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame^] | 60 | @@ -685,7 +685,7 @@ static char *new_game_desc(const game_params *params, random_state *rs, |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 61 | 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'; |