From 570e7b4454f2f879180ae3ca13dedd759aff5243 Mon Sep 17 00:00:00 2001 From: Laurent Vivier Date: Tue, 13 May 2025 11:40:59 +0200 Subject: dhcpv6: fix GCC error (unterminated-string-initialization) The string STR_NOTONLINK is intentionally not NUL-terminated. Ignore the GCC error using __attribute__((nonstring)). This error is reported by GCC 15.1.1 on Fedora 42. However, Clang 20.1.3 does not support __attribute__((nonstring)). Therefore, NOLINTNEXTLINE(clang-diagnostic-unknown-attributes) is also added to suppress Clang's unknown attribute warning. Signed-off-by: Laurent Vivier Signed-off-by: Stefano Brivio --- dhcpv6.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/dhcpv6.c b/dhcpv6.c index 373a988..ba16c66 100644 --- a/dhcpv6.c +++ b/dhcpv6.c @@ -144,7 +144,9 @@ struct opt_ia_addr { struct opt_status_code { struct opt_hdr hdr; uint16_t code; - char status_msg[sizeof(STR_NOTONLINK) - 1]; + /* "nonstring" is only supported since clang 23 */ + /* NOLINTNEXTLINE(clang-diagnostic-unknown-attributes) */ + __attribute__((nonstring)) char status_msg[sizeof(STR_NOTONLINK) - 1]; } __attribute__((packed)); /** -- cgit v1.2.3