On 5/18/26 15:58, Anshu Kumari wrote:
From: Jeskynar
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 Signed-off-by: Anshu Kumari
Fixes: 93c3e351f235 ("ip: Define a bound for the string returned by ipproto_name()")
Reviewed-by: Laurent Vivier
--- ip.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/ip.c b/ip.c index f2506bb..7b674e0 100644 --- a/ip.c +++ b/ip.c @@ -35,9 +35,9 @@ 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; + {static_assert(sizeof(s) <= IPPROTO_STRLEN, \ + "Increase IPPROTO_STRLEN to contain " #s); \ + return s;} case IPPROTO_ICMP: CASE("ICMP"); case IPPROTO_TCP: