public inbox for passt-dev@passt.top
 help / color / mirror / code / Atom feed
* [PATCH] ip: Wrap CASE macro body in braces for pre-C23 compatibility
@ 2026-05-18 13:58 Anshu Kumari
  2026-05-19  1:57 ` David Gibson
  2026-05-19  7:06 ` Laurent Vivier
  0 siblings, 2 replies; 3+ messages in thread
From: Anshu Kumari @ 2026-05-18 13:58 UTC (permalink / raw)
  To: anskuma, passt-dev, sbrivio; +Cc: david, jmaloy, lvivier, Jeskynar

From: Jeskynar <jeskynar@gmail.com>

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 <anskuma@redhat.com>
---
 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:
-- 
2.54.0


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-05-19  7:06 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-05-18 13:58 [PATCH] ip: Wrap CASE macro body in braces for pre-C23 compatibility Anshu Kumari
2026-05-19  1:57 ` David Gibson
2026-05-19  7:06 ` Laurent Vivier

Code repositories for project(s) associated with this public inbox

	https://passt.top/passt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for IMAP folder(s).