diff options
Diffstat (limited to 'meta/recipes-sato/puzzles')
8 files changed, 9 insertions, 337 deletions
diff --git a/meta/recipes-sato/puzzles/files/0001-Use-Wno-error-format-overflow-if-the-compiler-suppor.patch b/meta/recipes-sato/puzzles/files/0001-Use-Wno-error-format-overflow-if-the-compiler-suppor.patch deleted file mode 100644 index d40a3b1ef9..0000000000 --- a/meta/recipes-sato/puzzles/files/0001-Use-Wno-error-format-overflow-if-the-compiler-suppor.patch +++ /dev/null | |||
@@ -1,32 +0,0 @@ | |||
1 | From 337799e40350b3db2441cc98f65ec36a74dfb356 Mon Sep 17 00:00:00 2001 | ||
2 | From: Khem Raj <raj.khem@gmail.com> | ||
3 | Date: Fri, 21 Apr 2017 12:18:08 -0700 | ||
4 | Subject: [PATCH] Use -Wno-error=format-overflow= if the compiler supports it | ||
5 | |||
6 | we need this warning to be suppressed with gcc7+ | ||
7 | however older compilers dont support it so we need | ||
8 | a way to disble it only if compiler supports it | ||
9 | |||
10 | Upstream-Status: Pending | ||
11 | |||
12 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
13 | --- | ||
14 | configure.ac | 2 +- | ||
15 | 1 file changed, 1 insertion(+), 1 deletion(-) | ||
16 | |||
17 | diff --git a/configure.ac b/configure.ac | ||
18 | index 3a38c95..bb9035e 100644 | ||
19 | --- a/configure.ac | ||
20 | +++ b/configure.ac | ||
21 | @@ -42,7 +42,7 @@ fi | ||
22 | if test "x$GCC" = "xyes"; then | ||
23 | AC_MSG_CHECKING([for usable gcc warning flags]) | ||
24 | gccwarningflags= | ||
25 | - for flag in -Wall -Werror -std=c89 -pedantic; do | ||
26 | + for flag in -Wall -Werror -std=c89 -pedantic -Wno-error=format-overflow=; do | ||
27 | ac_save_CFLAGS="$CFLAGS" | ||
28 | ac_save_LIBS="$LIBS" | ||
29 | CFLAGS="$CFLAGS$gccwarningflags $flag $GTK_CFLAGS" | ||
30 | -- | ||
31 | 2.12.2 | ||
32 | |||
diff --git a/meta/recipes-sato/puzzles/files/0001-malloc-Check-for-excessive-values-to-malloc.patch b/meta/recipes-sato/puzzles/files/0001-malloc-Check-for-excessive-values-to-malloc.patch deleted file mode 100644 index 66af6afa2f..0000000000 --- a/meta/recipes-sato/puzzles/files/0001-malloc-Check-for-excessive-values-to-malloc.patch +++ /dev/null | |||
@@ -1,49 +0,0 @@ | |||
1 | From 1c01a5bc9ac7f8aaa484b1a8e0e74aa5f8899d0e Mon Sep 17 00:00:00 2001 | ||
2 | From: Khem Raj <raj.khem@gmail.com> | ||
3 | Date: Sun, 8 Nov 2020 11:17:59 -0800 | ||
4 | Subject: [PATCH] malloc: Check for excessive values to malloc | ||
5 | |||
6 | with whole program optimizers like lto smalloc() | ||
7 | is inlined the excessive constant argument is propagated to | ||
8 | malloc() and ultimately triggers the warning. | ||
9 | |||
10 | malloc.c:15:9: error: argument 1 range [18446744065119617024, 18446744073709551580] exceeds maximum object size 9223372036854775807 [-Werror=alloc-size-larger-than=] | ||
11 | |||
12 | therefore add a check before excessive constant argument before calling | ||
13 | malloc | ||
14 | |||
15 | Note that this will not happen with normal compile since they happen to | ||
16 | be in different translation units and compiler can not semantically | ||
17 | analyze as much | ||
18 | |||
19 | Upstream-Status: Pending | ||
20 | |||
21 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
22 | --- | ||
23 | malloc.c | 3 +++ | ||
24 | 1 file changed, 3 insertions(+) | ||
25 | |||
26 | diff --git a/malloc.c b/malloc.c | ||
27 | index a7fa7c5..520377c 100644 | ||
28 | --- a/malloc.c | ||
29 | +++ b/malloc.c | ||
30 | @@ -2,6 +2,7 @@ | ||
31 | * malloc.c: safe wrappers around malloc, realloc, free, strdup | ||
32 | */ | ||
33 | |||
34 | +#include <stdint.h> | ||
35 | #include <stdlib.h> | ||
36 | #include <string.h> | ||
37 | #include "puzzles.h" | ||
38 | @@ -12,6 +13,8 @@ | ||
39 | */ | ||
40 | void *smalloc(size_t size) { | ||
41 | void *p; | ||
42 | + if (size > PTRDIFF_MAX) | ||
43 | + fatal("exceeds maximum object size"); | ||
44 | p = malloc(size); | ||
45 | if (!p) | ||
46 | fatal("out of memory"); | ||
47 | -- | ||
48 | 2.29.2 | ||
49 | |||
diff --git a/meta/recipes-sato/puzzles/files/0001-map-Fix-stringop-overflow-warning.patch b/meta/recipes-sato/puzzles/files/0001-map-Fix-stringop-overflow-warning.patch deleted file mode 100644 index a02d8732ab..0000000000 --- a/meta/recipes-sato/puzzles/files/0001-map-Fix-stringop-overflow-warning.patch +++ /dev/null | |||
@@ -1,42 +0,0 @@ | |||
1 | From 3d78d4cffcdc1242892b6c21c26d1c96938c48d1 Mon Sep 17 00:00:00 2001 | ||
2 | From: Khem Raj <raj.khem@gmail.com> | ||
3 | Date: Sat, 27 Feb 2021 10:02:43 -0800 | ||
4 | Subject: [PATCH] map: Fix stringop-overflow warning | ||
5 | |||
6 | Fixes | ||
7 | |||
8 | ../git/map.c: In function 'new_game_desc': | ||
9 | ../git/map.c:1663:23: error: writing 1 byte into a region of size 0 [-Werror=stringop-overflow=] | ||
10 | 1663 | ret[retlen++] = ','; | ||
11 | | ~~~~~~~~~~~~~~^~~~~ | ||
12 | ../git/./map.c: In function 'new_game_desc': | ||
13 | ../git/./map.c:1663:23: error: writing 1 byte into a region of size 0 [-Werror=stringop-overflow=] | ||
14 | 1663 | ret[retlen++] = ','; | ||
15 | | ~~~~~~~~~~~~~~^~~~~ | ||
16 | |||
17 | Upstream-Status: Pending | ||
18 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
19 | --- | ||
20 | map.c | 6 ++++-- | ||
21 | 1 file changed, 4 insertions(+), 2 deletions(-) | ||
22 | |||
23 | diff --git a/map.c b/map.c | ||
24 | index 412305c..fa0c493 100644 | ||
25 | --- a/map.c | ||
26 | +++ b/map.c | ||
27 | @@ -1659,8 +1659,10 @@ static char *new_game_desc(const game_params *params, random_state *rs, | ||
28 | } | ||
29 | } | ||
30 | |||
31 | - ret[retlen++] = 'a'-1 + run; | ||
32 | - ret[retlen++] = ','; | ||
33 | + if(ret != NULL) { | ||
34 | + ret[retlen++] = 'a'-1 + run; | ||
35 | + ret[retlen++] = ','; | ||
36 | + } | ||
37 | |||
38 | run = 0; | ||
39 | for (i = 0; i < n; i++) { | ||
40 | -- | ||
41 | 2.30.1 | ||
42 | |||
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 deleted file mode 100644 index 143e898a51..0000000000 --- a/meta/recipes-sato/puzzles/files/0001-palisade-Fix-warnings-with-clang-on-arm.patch +++ /dev/null | |||
@@ -1,68 +0,0 @@ | |||
1 | From 453587d714473b806473b309727f865b673cbc06 Mon Sep 17 00:00:00 2001 | ||
2 | From: Khem Raj <raj.khem@gmail.com> | ||
3 | Date: Wed, 13 Jan 2016 23:10:19 -0800 | ||
4 | Subject: [PATCH] palisade: Fix warnings with clang on arm | ||
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> | ||
19 | Upstream-Status: Submitted | ||
20 | --- | ||
21 | palisade.c | 10 +++++----- | ||
22 | 1 file changed, 5 insertions(+), 5 deletions(-) | ||
23 | |||
24 | diff --git a/palisade.c b/palisade.c | ||
25 | index 6ffbf2d..8b54d42 100644 | ||
26 | --- a/palisade.c | ||
27 | +++ b/palisade.c | ||
28 | @@ -304,11 +304,11 @@ static void solver_connected_clues_versus_region_size(solver_ctx *ctx) | ||
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)) | ||
42 | @@ -326,7 +326,7 @@ static bool solver_number_exhausted(solver_ctx *ctx) | ||
43 | bool changed = false; | ||
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) { | ||
51 | @@ -538,7 +538,7 @@ static bool is_solved(const game_params *params, clue *clues, | ||
52 | for (i = 0; i < wh; ++i) { | ||
53 | if (dsf[i] == UNVISITED) dfs_dsf(i, params->w, border, dsf, true); | ||
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 | |||
60 | @@ -685,7 +685,7 @@ static char *new_game_desc(const game_params *params, random_state *rs, | ||
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'; | ||
diff --git a/meta/recipes-sato/puzzles/files/0001-pattern.c-Change-string-lenght-parameter-to-be-size_.patch b/meta/recipes-sato/puzzles/files/0001-pattern.c-Change-string-lenght-parameter-to-be-size_.patch deleted file mode 100644 index 7ca582fe5d..0000000000 --- a/meta/recipes-sato/puzzles/files/0001-pattern.c-Change-string-lenght-parameter-to-be-size_.patch +++ /dev/null | |||
@@ -1,34 +0,0 @@ | |||
1 | From 3af5a1e579e3324a13ba1f892c7befb3ab32d899 Mon Sep 17 00:00:00 2001 | ||
2 | From: Khem Raj <raj.khem@gmail.com> | ||
3 | Date: Thu, 7 Mar 2019 21:56:57 -0800 | ||
4 | Subject: [PATCH] pattern.c: Change string lenght parameter to be size_t in | ||
5 | do_row() | ||
6 | |||
7 | This fixes below error on some architectures e.g. RISC-V | ||
8 | |||
9 | pattern.c:455:9: error: 'memset' specified size between 18446744071562067968 and 18446744073709551615 exceeds maximum object size 9223372036854775807 [-Werror=stringop-overflow=] 455 | memset(deduced, DOT, (size_t)len); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
10 | |||
11 | Upstream-Status: Pending | ||
12 | |||
13 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
14 | |||
15 | --- | ||
16 | pattern.c | 2 +- | ||
17 | 1 file changed, 1 insertion(+), 1 deletion(-) | ||
18 | |||
19 | diff --git a/pattern.c b/pattern.c | ||
20 | index ffadd3f..4e5f187 100644 | ||
21 | --- a/pattern.c | ||
22 | +++ b/pattern.c | ||
23 | @@ -428,7 +428,7 @@ static bool do_row(unsigned char *known, unsigned char *deduced, | ||
24 | unsigned char *row, | ||
25 | unsigned char *minpos_done, unsigned char *maxpos_done, | ||
26 | unsigned char *minpos_ok, unsigned char *maxpos_ok, | ||
27 | - unsigned char *start, int len, int step, int *data, | ||
28 | + unsigned char *start, size_t len, int step, int *data, | ||
29 | unsigned int *changed | ||
30 | #ifdef STANDALONE_SOLVER | ||
31 | , const char *rowcol, int index, int cluewid | ||
32 | -- | ||
33 | 2.17.1 | ||
34 | |||
diff --git a/meta/recipes-sato/puzzles/files/fix-compiling-failure-with-option-g-O.patch b/meta/recipes-sato/puzzles/files/fix-compiling-failure-with-option-g-O.patch deleted file mode 100644 index 28040523d4..0000000000 --- a/meta/recipes-sato/puzzles/files/fix-compiling-failure-with-option-g-O.patch +++ /dev/null | |||
@@ -1,44 +0,0 @@ | |||
1 | From 876c6ff1e20f51b0921acda99861f476b6423f26 Mon Sep 17 00:00:00 2001 | ||
2 | From: Hongxu Jia <hongxu.jia@windriver.com> | ||
3 | Date: Mon, 11 Aug 2014 12:39:53 +0800 | ||
4 | Subject: [PATCH] gtk.c: fix compiling failure with option -g -O | ||
5 | |||
6 | There were compiling failure with option -g -O | ||
7 | ... | ||
8 | ././gtk.c: In function 'configure_area': | ||
9 | ././gtk.c:397:2: error: 'cr' may be used uninitialized in this function [-Werror=maybe-uninitialized] | ||
10 | cairo_set_source_rgb(cr, | ||
11 | ^ | ||
12 | ././gtk.c:384:14: note: 'cr' was declared here | ||
13 | cairo_t *cr; | ||
14 | ^ | ||
15 | ././gtk.c: In function 'main': | ||
16 | ././gtk.c:2911:6: error: 'error' may be used uninitialized in this function [-Werror=maybe-uninitialized] | ||
17 | fprintf(stderr, "%s: %s\n", pname, error); | ||
18 | ^ | ||
19 | cc1: all warnings being treated as errors | ||
20 | ... | ||
21 | |||
22 | Initialized pointer 'cr' and 'error' with NULL | ||
23 | |||
24 | Upstream-Status: Pending | ||
25 | |||
26 | Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com> | ||
27 | |||
28 | --- | ||
29 | gtk.c | 2 +- | ||
30 | 1 file changed, 1 insertion(+), 1 deletion(-) | ||
31 | |||
32 | diff --git a/gtk.c b/gtk.c | ||
33 | index 4565836..5e83b48 100644 | ||
34 | --- a/gtk.c | ||
35 | +++ b/gtk.c | ||
36 | @@ -2944,7 +2944,7 @@ static void list_presets_from_menu(struct preset_menu *menu) | ||
37 | int main(int argc, char **argv) | ||
38 | { | ||
39 | char *pname = argv[0]; | ||
40 | - char *error; | ||
41 | + char *error = NULL; | ||
42 | int ngenerate = 0, px = 1, py = 1; | ||
43 | bool print = false; | ||
44 | bool time_generation = false, test_solve = false, list_presets = false; | ||
diff --git a/meta/recipes-sato/puzzles/files/fix-ki-uninitialized.patch b/meta/recipes-sato/puzzles/files/fix-ki-uninitialized.patch deleted file mode 100644 index 7218d620ec..0000000000 --- a/meta/recipes-sato/puzzles/files/fix-ki-uninitialized.patch +++ /dev/null | |||
@@ -1,25 +0,0 @@ | |||
1 | puzzles: avoid compiler unitialized variable error | ||
2 | |||
3 | The compiler does not realize that we must go through the while() | ||
4 | loop at least once, so we replace it with a for() loop. | ||
5 | |||
6 | Upstream-Status: Pending | ||
7 | |||
8 | Signed-off-by: Joe Slater <joe.slater@windriver.com> | ||
9 | |||
10 | --- a/tree234.c | ||
11 | +++ b/tree234.c | ||
12 | @@ -326,8 +326,11 @@ static void *add234_internal(tree234 *t, | ||
13 | return orig_e; | ||
14 | } | ||
15 | |||
16 | - n = t->root; | ||
17 | - while (n) { | ||
18 | + /* | ||
19 | + * We know t->root is not NULL. The logic | ||
20 | + * to break out of this is at the end of the loop. | ||
21 | + */ | ||
22 | + for (n = t->root;;) { | ||
23 | LOG((" node %p: %p/%d \"%s\" %p/%d \"%s\" %p/%d \"%s\" %p/%d\n", | ||
24 | n, | ||
25 | n->kids[0], n->counts[0], n->elems[0], | ||
diff --git a/meta/recipes-sato/puzzles/puzzles_git.bb b/meta/recipes-sato/puzzles/puzzles_git.bb index 16a08585cc..e9403ee130 100644 --- a/meta/recipes-sato/puzzles/puzzles_git.bb +++ b/meta/recipes-sato/puzzles/puzzles_git.bb | |||
@@ -2,49 +2,28 @@ SUMMARY = "Simon Tatham's Portable Puzzle Collection" | |||
2 | DESCRIPTION = "Collection of small computer programs which implement one-player puzzle games." | 2 | DESCRIPTION = "Collection of small computer programs which implement one-player puzzle games." |
3 | HOMEPAGE = "http://www.chiark.greenend.org.uk/~sgtatham/puzzles/" | 3 | HOMEPAGE = "http://www.chiark.greenend.org.uk/~sgtatham/puzzles/" |
4 | LICENSE = "MIT" | 4 | LICENSE = "MIT" |
5 | LIC_FILES_CHKSUM = "file://LICENCE;md5=6099f4981f9461d7f411091e69a7f07a" | 5 | LIC_FILES_CHKSUM = "file://LICENCE;md5=191542b32377bde254e9799e0a46f18b" |
6 | 6 | ||
7 | DEPENDS = "libxt" | 7 | # gtk support includes a bunch of x11 headers |
8 | |||
9 | # The libxt requires x11 in DISTRO_FEATURES | ||
10 | REQUIRED_DISTRO_FEATURES = "x11" | 8 | REQUIRED_DISTRO_FEATURES = "x11" |
11 | 9 | ||
12 | SRC_URI = "git://git.tartarus.org/simon/puzzles.git \ | 10 | SRC_URI = "git://git.tartarus.org/simon/puzzles.git;branch=main;protocol=https" |
13 | file://fix-compiling-failure-with-option-g-O.patch \ | ||
14 | file://0001-palisade-Fix-warnings-with-clang-on-arm.patch \ | ||
15 | file://0001-Use-Wno-error-format-overflow-if-the-compiler-suppor.patch \ | ||
16 | file://0001-pattern.c-Change-string-lenght-parameter-to-be-size_.patch \ | ||
17 | file://fix-ki-uninitialized.patch \ | ||
18 | file://0001-malloc-Check-for-excessive-values-to-malloc.patch \ | ||
19 | file://0001-map-Fix-stringop-overflow-warning.patch \ | ||
20 | " | ||
21 | 11 | ||
22 | UPSTREAM_CHECK_COMMITS = "1" | 12 | UPSTREAM_CHECK_COMMITS = "1" |
23 | SRCREV = "84cb4c6701e027090ff3fd955ce08065e20121b2" | 13 | SRCREV = "80aac3104096aee4057b675c53ece8e60793aa90" |
24 | PE = "2" | 14 | PE = "2" |
25 | PV = "0.0+git${SRCPV}" | 15 | PV = "0.0+git" |
26 | 16 | ||
27 | S = "${WORKDIR}/git" | 17 | S = "${WORKDIR}/git" |
28 | 18 | ||
29 | inherit autotools features_check pkgconfig | 19 | inherit cmake features_check pkgconfig |
30 | |||
31 | PACKAGECONFIG ??= "gtk3" | ||
32 | PACKAGECONFIG[gtk2] = "--with-gtk=2,,gtk+," | ||
33 | PACKAGECONFIG[gtk3] = "--with-gtk=3,,gtk+3," | ||
34 | |||
35 | CFLAGS_append = " -Wno-deprecated-declarations" | ||
36 | |||
37 | ASNEEDED = "" | ||
38 | 20 | ||
39 | do_configure_prepend () { | 21 | DEPENDS += "gtk+3" |
40 | cd ${S} | ||
41 | ./mkfiles.pl | ||
42 | cd ${B} | ||
43 | } | ||
44 | 22 | ||
45 | do_install_append () { | 23 | do_install:append () { |
46 | # net conflicts with Samba, so rename it | 24 | # net conflicts with Samba, so rename it |
47 | mv ${D}${bindir}/net ${D}${bindir}/puzzles-net | 25 | mv ${D}${bindir}/net ${D}${bindir}/puzzles-net |
26 | rm ${D}/${datadir}/applications/net.desktop | ||
48 | 27 | ||
49 | # Create desktop shortcuts | 28 | # Create desktop shortcuts |
50 | install -d ${D}/${datadir}/applications/ | 29 | install -d ${D}/${datadir}/applications/ |
@@ -68,16 +47,3 @@ STOP | |||
68 | done | 47 | done |
69 | } | 48 | } |
70 | 49 | ||
71 | PACKAGES += "${PN}-extra" | ||
72 | |||
73 | FILES_${PN} = "" | ||
74 | FILES_${PN}-extra = "${prefix}/bin ${datadir}/applications" | ||
75 | |||
76 | python __anonymous () { | ||
77 | var = d.expand("FILES_${PN}") | ||
78 | data = d.getVar(var, False) | ||
79 | for name in ("bridges", "fifteen", "inertia", "map", "samegame", "slant"): | ||
80 | data = data + " ${bindir}/%s" % name | ||
81 | data = data + " ${datadir}/applications/%s.desktop" % name | ||
82 | d.setVar(var, data) | ||
83 | } | ||