google / ngx_brotli

NGINX module for Brotli compression
BSD 2-Clause "Simplified" License
2.1k stars 216 forks source link

compiling with gcc 11.2.1 20210808 fails with “declared as a pointer → previously declared as a variable length array” #124

Closed dilyanpalauzov closed 2 years ago

dilyanpalauzov commented 3 years ago
make[1]: Entering directory '/src/http/nginx-1.20.1'
cc -c -pipe  -O -W -Wall -Wpointer-arith -Wno-unused-parameter -Werror -g -flto -pipe -O3 -Wno-deprecated-declarations  -I src/core -I src/event -I src/event/modules -I src/os/unix -I /usr/local/include/libxml2 -I /usr/local/include -I objs -I src/http -I src/http/modules -I src/http/v2 -I /git/ngx_brotli/deps/brotli/c/include \
        -o objs/addon/enc/encode.o \
        /git/ngx_brotli/deps/brotli/c/enc/encode.c
/git/ngx_brotli/deps/brotli/c/enc/encode.c:1473:20: error: argument 5 of type ‘const uint8_t *’ {aka ‘const unsigned char *’} declared as a pointer [-Werror=vla-parameter]
 1473 |     const uint8_t* input_buffer, size_t* encoded_size,
      |     ~~~~~~~~~~~~~~~^~~~~~~~~~~~
In file included from /git/ngx_brotli/deps/brotli/c/enc/encode.c:9:
/git/ngx_brotli/deps/brotli/c/include/brotli/encode.h:314:19: note: previously declared as a variable length array ‘const uint8_t[*encoded_size]’ {aka ‘const unsigned char[*encoded_size]’}
  314 |     const uint8_t input_buffer[BROTLI_ARRAY_PARAM(input_size)],
      |     ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/git/ngx_brotli/deps/brotli/c/enc/encode.c:1474:14: error: argument 7 of type ‘uint8_t *’ {aka ‘unsigned char *’} declared as a pointer [-Werror=vla-parameter]
 1474 |     uint8_t* encoded_buffer) {
      |     ~~~~~~~~~^~~~~~~~~~~~~~
In file included from /git/ngx_brotli/deps/brotli/c/enc/encode.c:9:
/git/ngx_brotli/deps/brotli/c/include/brotli/encode.h:316:13: note: previously declared as a variable length array ‘uint8_t[input_size]’ {aka ‘unsigned char[input_size]’}
  316 |     uint8_t encoded_buffer[BROTLI_ARRAY_PARAM(*encoded_size)]);
      |     ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
make[1]: *** [objs/Makefile:1551: objs/addon/enc/encode.o] Error 1
make[1]: Leaving directory '/src/http/nginx-1.20.1'
make: *** [Makefile:10: build] Error 2
dilyanpalauzov commented 3 years ago

See also https://github.com/google/brotli/issues/930 - brotli itself fails compiling with -flto -O3 -Wall -Werror

NoirPi commented 2 years ago

Theres a fix release: https://github.com/google/brotli/commit/4ec67035c0d97c270c1c73038cc66fc5fcdfc120