On Mon, 18 May 2026 19:28:06 +0530
Anshu Kumari
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
--- 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;}
One minor detail, which I would usually fix up on merge, but in this case it's half of the patch...: our coding style always has code blocks separated by newlines and indented, that is, in this case: { static_assert(sizeof(s) <= IPPROTO_STRLEN, \ "Increase IPPROTO_STRLEN to contain " \ #s); \ return s; } and in these cases I would suggest to add (perhaps I mentioned it already?) something like "Based on a patch from ..." blah. Then before your Signed-off-by you can describe shortly what you changed in square brackets. Just grep for "Based on" in the git log, you'll find plenty of (rather consistent) examples. -- Stefano