New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
lib: silence clang/gcc -Wvla warnings in brotli headers #10738
Conversation
5247cdd
to
2d2bd88
Compare
Upstream solution works for all build methods, not just GNU Make. Ref: curl/curl#10738
2d2bd88
to
c0e7597
Compare
brotli v1.0.0 throughout current latest v1.0.9 and latest master [1] trigger this warning. llvm/clang: ``` In file included from ./curl/lib/content_encoding.c:36: ./brotli/x64-ucrt/usr/include/brotli/decode.h:204:34: warning: variable length array used [-Wvla] const uint8_t encoded_buffer[BROTLI_ARRAY_PARAM(encoded_size)], ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ./brotli/x64-ucrt/usr/include/brotli/port.h:253:34: note: expanded from macro 'BROTLI_ARRAY_PARAM' ^~~~~~ In file included from ./curl/lib/content_encoding.c:36: ./brotli/x64-ucrt/usr/include/brotli/decode.h:206:48: warning: variable length array used [-Wvla] uint8_t decoded_buffer[BROTLI_ARRAY_PARAM(*decoded_size)]); ~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~ ./brotli/x64-ucrt/usr/include/brotli/port.h:253:35: note: expanded from macro 'BROTLI_ARRAY_PARAM' ~^~~~~ ``` gcc: ``` In file included from ./curl/lib/content_encoding.c:36: ./brotli/x64-ucrt/usr/include/brotli/decode.h:204:5: warning: ISO C90 forbids variable length array 'encoded_buffer' [-Wvla] 204 | const uint8_t encoded_buffer[BROTLI_ARRAY_PARAM(encoded_size)], | ^~~~~ ./brotli/x64-ucrt/usr/include/brotli/decode.h:206:5: warning: ISO C90 forbids variable length array 'decoded_buffer' [-Wvla] 206 | uint8_t decoded_buffer[BROTLI_ARRAY_PARAM(*decoded_size)]); | ^~~~~~~ ``` [1] google/brotli@ed1995b Closes #xxxxx
c0e7597
to
bd7bc96
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe we generally avoid this warning in configure builds thanks to the convert -I options to -isystem
macro.
Aha, that's why it never appeared there, neat. This can work with GNU Make, but not sure how teach it to CMake. |
By giving the |
@MarcelRaad: Thank you, noted the trick! [ But.. I'd prefer to do this in the source. It's easier than syncing behaviour between build systems. Unless there is an objection! ] |
brotli v1.0.0 throughout current latest v1.0.9 and latest master 1 trigger this warning.
llvm/clang:
gcc:
Closes #10738
Footnotes
https://github.com/google/brotli/commit/ed1995b6bda19244070ab5d331111f16f67c8054↩