From 7d7ff5f881e99ae803d0b48b6e289fd29dcb4fe4 Mon Sep 17 00:00:00 2001 From: "Benjamin A. Beasley" Date: Tue, 26 Oct 2021 08:50:09 -0400 Subject: [PATCH] Apply a patch for warnings in stb_herringbone_wang_tile --- 1236.patch | 37 +++++++++++++++++++++++++++++++++++++ stb.spec | 9 +++++++++ 2 files changed, 46 insertions(+) create mode 100644 1236.patch diff --git a/1236.patch b/1236.patch new file mode 100644 index 0000000..37cc507 --- /dev/null +++ b/1236.patch @@ -0,0 +1,37 @@ +From 5cf3af3181f7a0fb8d59ca5fe8daa011c1918d19 Mon Sep 17 00:00:00 2001 +From: Ryan Wiedemann +Date: Mon, 25 Oct 2021 22:11:48 -0600 +Subject: [PATCH] Predeclare stbhw__process struct to fix warnings + +A subset of the warnings as produced by `clang`. +``` +./../stb_herringbone_wang_tile.h:369:41: warning: declaration of 'struct stbhw__process' will not be visible outside of this function [-Wvisibility] +typedef void stbhw__process_rect(struct stbhw__process *p, int xpos, int ypos, + ^ +./../stb_herringbone_wang_tile.h:401:43: warning: incompatible pointer types passing 'stbhw__process *' (aka 'struct stbhw__process *') to parameter of type 'struct stbhw__process *' [-Wincompatible-pointer-types] + p->process_h_rect(p, xpos, ypos, a,b,c,d,e,f); + ^ +./../stb_herringbone_wang_tile.h:425:43: warning: incompatible pointer types passing 'stbhw__process *' (aka 'struct stbhw__process *') to parameter of type 'struct stbhw__process *' [-Wincompatible-pointer-types] + p->process_v_rect(p, xpos, ypos, a,b,c,d,e,f); + ^ +./../stb_herringbone_wang_tile.h:929:21: warning: incompatible pointer types assigning to 'stbhw__process_rect *' (aka 'void (*)(struct stbhw__process *, int, int, int, int, int, int, int, int)') from 'void (stbhw__process *, int, int, int, int, int, int, int, int)' (aka 'void (struct stbhw__process *, int, int, int, int, int, int, int, int)') [-Wincompatible-pointer-types] + p.process_h_rect = stbhw__parse_h_rect; + ^ ~~~~~~~~~~~~~~~~~~~ +``` +--- + stb_herringbone_wang_tile.h | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/stb_herringbone_wang_tile.h b/stb_herringbone_wang_tile.h +index 5517941f7a..92c238bb24 100644 +--- a/stb_herringbone_wang_tile.h ++++ b/stb_herringbone_wang_tile.h +@@ -366,6 +366,8 @@ STBHW_EXTERN const char *stbhw_get_last_error(void) + // need to try to do more sophisticated parsing of edge color + // markup or something. + ++struct stbhw__process; ++ + typedef void stbhw__process_rect(struct stbhw__process *p, int xpos, int ypos, + int a, int b, int c, int d, int e, int f); + diff --git a/stb.spec b/stb.spec index 9099076..0ff1dbc 100644 --- a/stb.spec +++ b/stb.spec @@ -80,6 +80,15 @@ Patch4: %{forgeurl}/pull/1204.patch # https://github.com/nothings/stb/pull/1223 Patch5: %{forgeurl}/pull/1223.patch +# Forward declare stbhw__process struct to fix warnings +# https://github.com/nothings/stb/pull/1225 +# +# We don’t see these warnings in the “compile tests”, but we can reproduce them +# by manually compiling tests/herringbone_map.c; a real user of the +# stb_herringbone_wang_tile library would encounter them; and inspection of the +# patch shows it to be correct. +Patch6: %{forgeurl}/pull/1236.patch + %global stb_c_lexer_version 0.12 %global stb_connected_components_version 0.96 %global stb_divide_version 0.94