Patch-Source: https://github.com/nginx/unit/commit/150378224f1d8b4e58765ce586c27f2fd36e47f0 From 150378224f1d8b4e58765ce586c27f2fd36e47f0 Mon Sep 17 00:00:00 2001 From: Andrew Clayton Date: Mon, 27 Jan 2025 16:14:43 +0000 Subject: [PATCH] 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: Link: Link: Cc: Alejandro Colomar Reviewed-by: Alejandro Colomar Signed-off-by: Andrew Clayton --- auto/cc/test | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/auto/cc/test b/auto/cc/test index ac4d5f337..a8c176b26 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 + NXT_CFLAGS="$NXT_CFLAGS -Wno-unterminated-string-initialization" + # Stop on warning. NXT_CFLAGS="$NXT_CFLAGS -Werror"