From 196a9e555ef3507430948ee4cc46ad574d643965 Mon Sep 17 00:00:00 2001 From: Jeskynar Date: Mon, 18 May 2026 19:28:06 +0530 Subject: ip: Wrap CASE macro body in braces for pre-C23 compatibility Compiling on RHEL8 (gcc-8.5) gives an error in ip.c. ip.c:88:3: error: a label can only be part of a statement and a declaration is not a statement due to the use of static_assert. The fix is to surround it with {}. Link: https://bugs.passt.top/show_bug.cgi?id=201 Fixes: 93c3e351f235 ("ip: Define a bound for the string returned by ipproto_name()") Signed-off-by: Anshu Kumari Reviewed-by: David Gibson Reviewed-by: Laurent Vivier [sbrivio: Fixed coding style] Signed-off-by: Stefano Brivio --- ip.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/ip.c b/ip.c index f2506bb..7238700 100644 --- a/ip.c +++ b/ip.c @@ -34,10 +34,12 @@ const char *ipproto_name(uint8_t proto) { switch (proto) { -#define CASE(s) \ - static_assert(sizeof(s) <= IPPROTO_STRLEN, \ - "Increase IPPROTO_STRLEN to contain " #s); \ - return s; +#define CASE(s) \ + { \ + static_assert(sizeof(s) <= IPPROTO_STRLEN, \ + "Increase IPPROTO_STRLEN to contain " #s); \ + return s; \ + } case IPPROTO_ICMP: CASE("ICMP"); case IPPROTO_TCP: -- cgit v1.2.3