On 2026/05/10 11:36, Peter Hessler wrote:
> This is a build fix that only seems to happen on armv7, but it
> realistically should fail on all arches?
> 
>  -Werror=declaration-after-statement
> ./brotli/c/dec/decode.c:440:3: error: mixing declarations and code is
> incompatible with standards before C99 [-Werror,-Wdeclaration-after-statement]
>   440 |   BROTLI_HC_MARK_TABLE_FOR_FAST_LOAD(table);
>       |   ^
> ./brotli/c/dec/huffman.h:83:56: note: expanded from macro 
> 'BROTLI_HC_MARK_TABLE_FOR_FAST_LOAD'
>    83 | #define BROTLI_HC_MARK_TABLE_FOR_FAST_LOAD(H) uint32_t
> __fastload_##H = (*H)
>       |                                                        ^
> <scratch space>:106:1: note: expanded from here
>   106 | __fastload_table
>       | ^
> 1 error generated.

 29 #if ((defined(BROTLI_TARGET_ARMV7) || defined(BROTLI_TARGET_ARMV8_32)) &    
& \
 30   BROTLI_GNUC_HAS_ATTRIBUTE(aligned, 2, 7, 0))
 31 #define BROTLI_HUFFMAN_CODE_FAST_LOAD
 32 #endif
 33
 34 #if !defined(BROTLI_HUFFMAN_CODE_FAST_LOAD)
 35 /* Do not create this struct directly - use the ConstructHuffmanCode
 36  * constructor below! */
 37 typedef struct {
 38   uint8_t bits;    /* number of bits used for this symbol */
 39   uint16_t value;  /* symbol value or table offset */
...

> The build-system manually specifies -Werror=declaration-after-statement,
> but there is clearly statements before declarations in this code.  While
> this looks like vendor'd 3rd party code, it seems identical to our
> archivers/brotli port except for -Werror=declaration-after-statement.
> 
> So, just remove the Warning-Error.
> 
> OK?  Needs a REVISION bump?

I think I'd go with the fix that ghostscript are using, so it's easier
to remove when ghostscript is updated. But if you prefer yours then
please add an explanatory comment to the patch file.

https://bugs.ghostscript.com/show_bug.cgi?id=708831

they are trying to upstream it in
https://github.com/google/brotli/issues/1415

> 
> Index: print/ghostscript/gnu/patches/patch-configure
> ===================================================================
> RCS file: /cvs/ports/print/ghostscript/gnu/patches/patch-configure,v
> retrieving revision 1.12
> diff -u -p -u -p -r1.12 patch-configure
> --- print/ghostscript/gnu/patches/patch-configure     18 Mar 2026 16:43:26 
> -0000      1.12
> +++ print/ghostscript/gnu/patches/patch-configure     10 May 2026 09:24:33 
> -0000
> @@ -1,6 +1,15 @@
>  Index: configure
>  --- configure.orig
>  +++ configure
> +@@ -5629,7 +5629,7 @@ esac
> + if test x"$GCC" = x"yes"; then
> +     cflags_to_try="-Wall -Wstrict-prototypes -Wundef \
> + -Wmissing-declarations -Wmissing-prototypes -Wwrite-strings \
> +--fno-strict-aliasing -Werror=declaration-after-statement \
> ++-fno-strict-aliasing \
> + -fno-builtin -fno-common -Werror=return-type -Wno-unused-local-typedefs 
> $CFLAGS_LARGEFILE"
> +     optflags_to_try="$CC_OPT_FLAGS_TO_TRY"
> +     dbgflags_to_try="$CC_DBG_FLAGS_TO_TRY"
>  @@ -13441,8 +13441,8 @@ DLL_EXT=""
>   SO_LIB_VERSION_SEPARATOR="."
>   
> 
> 
> 
> -- 
> Right now I'm having amnesia and deja vu at the same time.
>               -- Steven Wright
> 

Reply via email to