diff options
author | Khem Raj <raj.khem@gmail.com> | 2016-01-13 23:16:24 -0800 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2016-01-22 23:42:54 +0000 |
commit | 2a18273fc74c6493e3d34499a8774e237772f109 (patch) | |
tree | cca06a52d1066eaf00bfe830e1fa58a72ca760a9 /meta/recipes-sato | |
parent | 41c85bcf121ecaeae8097c9874fda51d8a4f2b4a (diff) | |
download | openembedded-core-2a18273fc74c6493e3d34499a8774e237772f109.tar.gz openembedded-core-2a18273fc74c6493e3d34499a8774e237772f109.tar.bz2 openembedded-core-2a18273fc74c6493e3d34499a8774e237772f109.zip |
puzzles: Silence warning on arm with clang
Clang finds overflows when comparison is done between an unsigned char
and a integer constant. So explicitly typecast the constant before
comparison
Signed-off-by: Khem Raj <raj.khem@gmail.com>
Diffstat (limited to 'meta/recipes-sato')
-rw-r--r-- | meta/recipes-sato/puzzles/files/0001-palisade-Fix-warnings-with-clang-on-arm.patch | 72 | ||||
-rw-r--r-- | meta/recipes-sato/puzzles/puzzles_git.bb | 1 |
2 files changed, 73 insertions, 0 deletions
diff --git a/meta/recipes-sato/puzzles/files/0001-palisade-Fix-warnings-with-clang-on-arm.patch b/meta/recipes-sato/puzzles/files/0001-palisade-Fix-warnings-with-clang-on-arm.patch new file mode 100644 index 0000000000..5351f8eb4e --- /dev/null +++ b/meta/recipes-sato/puzzles/files/0001-palisade-Fix-warnings-with-clang-on-arm.patch @@ -0,0 +1,72 @@ +From 6d8326275802a2e6e61d3e99460af6891ae8362f Mon Sep 17 00:00:00 2001 +From: Khem Raj <raj.khem@gmail.com> +Date: Wed, 13 Jan 2016 23:10:19 -0800 +Subject: [puzzles][PATCH] palisade: Fix warnings with clang on arm + +ARM treats 'char' as unsigned char when 'char' is not qualified with +'signed' or 'unsigned' explicitly. + +This results in warnings e.g. + +palisade.c:531:22: error: comparison of constant -1 with expression of +type 'clue' (aka 'char') is always false +[-Werror,-Wtautological-constant-out-of-range-compare] + if (clues[i] == EMPTY) continue; + +Therefore, typcast the contant to char in such places to be explicit + +Signed-off-by: Khem Raj <raj.khem@gmail.com> +--- +Upstream-Status: Submitted + + palisade.c | 10 +++++----- + 1 file changed, 5 insertions(+), 5 deletions(-) + +diff --git a/palisade.c b/palisade.c +index 984e616..2b9c25c 100644 +--- a/palisade.c ++++ b/palisade.c +@@ -295,11 +295,11 @@ static void solver_connected_clues_versus_region_size(solver_ctx *ctx) + * If p = q = 3 then the region has size exactly 2. */ + + for (i = 0; i < wh; ++i) { +- if (ctx->clues[i] == EMPTY) continue; ++ if (ctx->clues[i] == (char)EMPTY) continue; + for (dir = 0; dir < 4; ++dir) { + int j = i + dx[dir] + w*dy[dir]; + if (disconnected(ctx, i, j, dir)) continue; +- if (ctx->clues[j] == EMPTY) continue; ++ if (ctx->clues[j] == (char)EMPTY) continue; + if ((8 - ctx->clues[i] - ctx->clues[j] > ctx->params->k) || + (ctx->clues[i] == 3 && ctx->clues[j] == 3 && + ctx->params->k != 2)) +@@ -317,7 +317,7 @@ static int solver_number_exhausted(solver_ctx *ctx) + int changed = FALSE; + + for (i = 0; i < wh; ++i) { +- if (ctx->clues[i] == EMPTY) continue; ++ if (ctx->clues[i] == (char)EMPTY) continue; + + if (bitcount[(ctx->borders[i] & BORDER_MASK)] == ctx->clues[i]) { + for (dir = 0; dir < 4; ++dir) { +@@ -528,7 +528,7 @@ static int is_solved(const game_params *params, clue *clues, + for (i = 0; i < wh; ++i) { + if (dsf[i] == UNVISITED) dfs_dsf(i, params->w, border, dsf, TRUE); + if (dsf_size(dsf, i) != k) goto error; +- if (clues[i] == EMPTY) continue; ++ if (clues[i] == (char)EMPTY) continue; + if (clues[i] != bitcount[border[i] & BORDER_MASK]) goto error; + } + +@@ -674,7 +674,7 @@ static char *new_game_desc(const game_params *params, random_state *rs, + p = numbers; + r = 0; + for (i = 0; i < wh; ++i) { +- if (numbers[i] != EMPTY) { ++ if (numbers[i] != (char)EMPTY) { + while (r) { + while (r > 26) { + *p++ = 'z'; +-- +2.7.0 + diff --git a/meta/recipes-sato/puzzles/puzzles_git.bb b/meta/recipes-sato/puzzles/puzzles_git.bb index 9c8170cbdb..dab5440d8f 100644 --- a/meta/recipes-sato/puzzles/puzzles_git.bb +++ b/meta/recipes-sato/puzzles/puzzles_git.bb @@ -13,6 +13,7 @@ SRC_URI = "git://git.tartarus.org/simon/puzzles.git \ file://fix-compiling-failure-with-option-g-O.patch \ file://0001-Use-labs-instead-of-abs.patch \ file://0001-rect-Fix-compiler-errors-about-uninitialized-use-of-.patch \ + file://0001-palisade-Fix-warnings-with-clang-on-arm.patch \ " SRCREV = "346584bf6e38232be8773c24fd7dedcbd7b3d9ed" PE = "1" |