diff options
| author | Jeskynar <jeskynar@gmail.com> | 2026-05-18 19:28:06 +0530 |
|---|---|---|
| committer | Stefano Brivio <sbrivio@redhat.com> | 2026-05-26 12:25:14 +0200 |
| commit | 196a9e555ef3507430948ee4cc46ad574d643965 (patch) | |
| tree | 498ae088a2f54a2f580294ea19b0b8bb3ed1df90 | |
| parent | da0096964cb79752ef152f7d760b3f27997fc59d (diff) | |
| download | passt-196a9e555ef3507430948ee4cc46ad574d643965.tar passt-196a9e555ef3507430948ee4cc46ad574d643965.tar.gz passt-196a9e555ef3507430948ee4cc46ad574d643965.tar.bz2 passt-196a9e555ef3507430948ee4cc46ad574d643965.tar.lz passt-196a9e555ef3507430948ee4cc46ad574d643965.tar.xz passt-196a9e555ef3507430948ee4cc46ad574d643965.tar.zst passt-196a9e555ef3507430948ee4cc46ad574d643965.zip | |
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 <anskuma@redhat.com>
Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
Reviewed-by: Laurent Vivier <lvivier@redhat.com>
[sbrivio: Fixed coding style]
Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
| -rw-r--r-- | ip.c | 10 |
1 files changed, 6 insertions, 4 deletions
@@ -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: |
