diff options
| author | Andrew Clayton <a.clayton@nginx.com> | 2025-01-27 16:14:43 +0000 |
|---|---|---|
| committer | Andrew Clayton <a.clayton@nginx.com> | 2025-02-03 18:51:59 +0000 |
| commit | 150378224f1d8b4e58765ce586c27f2fd36e47f0 (patch) | |
| tree | 0cc1f053d66a26ccbc384fe573976e7c4780cedd | |
| parent | 7b7b29fcfe077e577cf088414cff0128bfb0c1bf (diff) | |
| download | unit-150378224f1d8b4e58765ce586c27f2fd36e47f0.tar.gz unit-150378224f1d8b4e58765ce586c27f2fd36e47f0.tar.bz2 | |
Fix build with GCC 15
The upcoming GCC 15 release introduces a new compiler warning,
Wunterminated-string-initialization.
This is intended to catch things like
static const u_char hex[16] = "0123456789ABCDEF";
Where we are creating a character array from a string literal, but the
specified size is not enough for the terminating NUL byte.
In the above example that is intended as it is used as a lookup table
and only the individual indices are accessed.
As it happens, Unit uses the above idiom in a few places, triggering
this warning (which we treat as an error by default).
While I don't like disabling compiler warnings, lets just disable this
one temporarily, as there is a patch in the works to make the
"nonstring" variable attribute quell this warning.
We just disable this on GCC as this isn't in Clang and we don't need to
worry about older compilers as GCC silently ignores unknown -Wno-*
options.
Link: <https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=44c9403ed1833ae71a59e84f9e37af3182be0df5>
Link: <https://gcc.gnu.org/onlinedocs/gcc-14.2.0/gcc/Common-Variable-Attributes.html>
Link: <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117178#c21>
Cc: Alejandro Colomar <alx@kernel.org>
Reviewed-by: Alejandro Colomar <alx@kernel.org>
Signed-off-by: Andrew Clayton <a.clayton@nginx.com>
| -rw-r--r-- | auto/cc/test | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/auto/cc/test b/auto/cc/test index ac4d5f33..a8c176b2 100644 --- a/auto/cc/test +++ b/auto/cc/test @@ -93,6 +93,10 @@ case $NXT_CC_NAME in NXT_CFLAGS="$NXT_CFLAGS -Wmissing-prototypes" + # Disable Wunterminated-string-initialization temporarily. + # See <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117178#c21> + NXT_CFLAGS="$NXT_CFLAGS -Wno-unterminated-string-initialization" + # Stop on warning. NXT_CFLAGS="$NXT_CFLAGS -Werror" |
