* [PATCH] Avoid clang warnings in fwd.h
@ 2026-02-23 17:29 Peter Foley
2026-02-24 5:48 ` David Gibson
2026-03-03 19:11 ` Stefano Brivio
0 siblings, 2 replies; 6+ messages in thread
From: Peter Foley @ 2026-02-23 17:29 UTC (permalink / raw)
To: passt-dev; +Cc: Peter Foley
e.g.
./fwd.h:65:63: warning: '_Static_assert' with no message is a C23 extension [-Wc23-extensions]
65 | static_assert(sizeof(union fwd_listen_ref) == sizeof(uint32_t));
Signed-off-by: Peter Foley <pefoley@google.com>
---
fwd.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fwd.h b/fwd.h
index 1607011..7d299b6 100644
--- a/fwd.h
+++ b/fwd.h
@@ -62,7 +62,7 @@ union fwd_listen_ref {
};
uint32_t u32;
};
-static_assert(sizeof(union fwd_listen_ref) == sizeof(uint32_t));
+static_assert(sizeof(union fwd_listen_ref) == sizeof(uint32_t), "");
enum fwd_ports_mode {
FWD_UNSET = 0,
--
2.53.0.371.g1d285c8824-goog
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [PATCH] Avoid clang warnings in fwd.h
2026-02-23 17:29 [PATCH] Avoid clang warnings in fwd.h Peter Foley
@ 2026-02-24 5:48 ` David Gibson
2026-02-24 8:50 ` Stefano Brivio
2026-03-03 19:11 ` Stefano Brivio
1 sibling, 1 reply; 6+ messages in thread
From: David Gibson @ 2026-02-24 5:48 UTC (permalink / raw)
To: Peter Foley; +Cc: passt-dev
[-- Attachment #1: Type: text/plain, Size: 1087 bytes --]
On Mon, Feb 23, 2026 at 12:29:20PM -0500, Peter Foley wrote:
> e.g.
> ./fwd.h:65:63: warning: '_Static_assert' with no message is a C23 extension [-Wc23-extensions]
> 65 | static_assert(sizeof(union fwd_listen_ref) == sizeof(uint32_t));
>
> Signed-off-by: Peter Foley <pefoley@google.com>
> ---
> fwd.h | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fwd.h b/fwd.h
> index 1607011..7d299b6 100644
> --- a/fwd.h
> +++ b/fwd.h
> @@ -62,7 +62,7 @@ union fwd_listen_ref {
> };
> uint32_t u32;
> };
> -static_assert(sizeof(union fwd_listen_ref) == sizeof(uint32_t));
> +static_assert(sizeof(union fwd_listen_ref) == sizeof(uint32_t), "");
I'd prefer to see an actual message added here, rather than just
minimally suppressing the warning.
>
> enum fwd_ports_mode {
> FWD_UNSET = 0,
> --
> 2.53.0.371.g1d285c8824-goog
>
--
David Gibson (he or they) | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist, thank you, not the other way
| around.
http://www.ozlabs.org/~dgibson
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [PATCH] Avoid clang warnings in fwd.h
2026-02-24 5:48 ` David Gibson
@ 2026-02-24 8:50 ` Stefano Brivio
2026-03-02 4:34 ` David Gibson
0 siblings, 1 reply; 6+ messages in thread
From: Stefano Brivio @ 2026-02-24 8:50 UTC (permalink / raw)
To: David Gibson; +Cc: Peter Foley, passt-dev
On Tue, 24 Feb 2026 16:48:14 +1100
David Gibson <david@gibson.dropbear.id.au> wrote:
> On Mon, Feb 23, 2026 at 12:29:20PM -0500, Peter Foley wrote:
> > e.g.
> > ./fwd.h:65:63: warning: '_Static_assert' with no message is a C23 extension [-Wc23-extensions]
> > 65 | static_assert(sizeof(union fwd_listen_ref) == sizeof(uint32_t));
> >
> > Signed-off-by: Peter Foley <pefoley@google.com>
> > ---
> > fwd.h | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/fwd.h b/fwd.h
> > index 1607011..7d299b6 100644
> > --- a/fwd.h
> > +++ b/fwd.h
> > @@ -62,7 +62,7 @@ union fwd_listen_ref {
> > };
> > uint32_t u32;
> > };
> > -static_assert(sizeof(union fwd_listen_ref) == sizeof(uint32_t));
> > +static_assert(sizeof(union fwd_listen_ref) == sizeof(uint32_t), "");
>
> I'd prefer to see an actual message added here, rather than just
> minimally suppressing the warning.
Can you please suggest a message then? You added this static_assert()
in the first place.
--
Stefano
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [PATCH] Avoid clang warnings in fwd.h
2026-02-24 8:50 ` Stefano Brivio
@ 2026-03-02 4:34 ` David Gibson
0 siblings, 0 replies; 6+ messages in thread
From: David Gibson @ 2026-03-02 4:34 UTC (permalink / raw)
To: Stefano Brivio; +Cc: Peter Foley, passt-dev
[-- Attachment #1: Type: text/plain, Size: 1580 bytes --]
On Tue, Feb 24, 2026 at 09:50:56AM +0100, Stefano Brivio wrote:
> On Tue, 24 Feb 2026 16:48:14 +1100
> David Gibson <david@gibson.dropbear.id.au> wrote:
>
> > On Mon, Feb 23, 2026 at 12:29:20PM -0500, Peter Foley wrote:
> > > e.g.
> > > ./fwd.h:65:63: warning: '_Static_assert' with no message is a C23 extension [-Wc23-extensions]
> > > 65 | static_assert(sizeof(union fwd_listen_ref) == sizeof(uint32_t));
> > >
> > > Signed-off-by: Peter Foley <pefoley@google.com>
> > > ---
> > > fwd.h | 2 +-
> > > 1 file changed, 1 insertion(+), 1 deletion(-)
> > >
> > > diff --git a/fwd.h b/fwd.h
> > > index 1607011..7d299b6 100644
> > > --- a/fwd.h
> > > +++ b/fwd.h
> > > @@ -62,7 +62,7 @@ union fwd_listen_ref {
> > > };
> > > uint32_t u32;
> > > };
> > > -static_assert(sizeof(union fwd_listen_ref) == sizeof(uint32_t));
> > > +static_assert(sizeof(union fwd_listen_ref) == sizeof(uint32_t), "");
> >
> > I'd prefer to see an actual message added here, rather than just
> > minimally suppressing the warning.
>
> Can you please suggest a message then? You added this static_assert()
> in the first place.
Fair point.
I looked into this, and realised that I can make another cleanup in
the vicinity which changes the union into a struct and makes this
static_assert() redundant amongst some other improvements. Patch on
the list.
--
David Gibson (he or they) | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist, thank you, not the other way
| around.
http://www.ozlabs.org/~dgibson
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] Avoid clang warnings in fwd.h
2026-02-23 17:29 [PATCH] Avoid clang warnings in fwd.h Peter Foley
2026-02-24 5:48 ` David Gibson
@ 2026-03-03 19:11 ` Stefano Brivio
2026-03-04 19:14 ` Peter Foley
1 sibling, 1 reply; 6+ messages in thread
From: Stefano Brivio @ 2026-03-03 19:11 UTC (permalink / raw)
To: Peter Foley; +Cc: passt-dev
On Mon, 23 Feb 2026 12:29:20 -0500
Peter Foley <pefoley@google.com> wrote:
> e.g.
> ./fwd.h:65:63: warning: '_Static_assert' with no message is a C23 extension [-Wc23-extensions]
> 65 | static_assert(sizeof(union fwd_listen_ref) == sizeof(uint32_t));
>
> Signed-off-by: Peter Foley <pefoley@google.com>
> ---
> fwd.h | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fwd.h b/fwd.h
> index 1607011..7d299b6 100644
> --- a/fwd.h
> +++ b/fwd.h
> @@ -62,7 +62,7 @@ union fwd_listen_ref {
> };
> uint32_t u32;
> };
> -static_assert(sizeof(union fwd_listen_ref) == sizeof(uint32_t));
> +static_assert(sizeof(union fwd_listen_ref) == sizeof(uint32_t), "");
>
> enum fwd_ports_mode {
> FWD_UNSET = 0,
Peter, unless you see a problem with that, this patch would be
superseded by:
[PATCH 2/3] fwd, pif: Replace with pif_sock_l4() with pif_listen()
https://archives.passt.top/passt-dev/20260302043135.800803-3-david@gibson.dropbear.id.au/
as it avoids the need for this static_assert() altogether. So I would
drop this patch (carrying a Reported-by: tag) in favour of that one.
--
Stefano
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [PATCH] Avoid clang warnings in fwd.h
2026-03-03 19:11 ` Stefano Brivio
@ 2026-03-04 19:14 ` Peter Foley
0 siblings, 0 replies; 6+ messages in thread
From: Peter Foley @ 2026-03-04 19:14 UTC (permalink / raw)
To: Stefano Brivio; +Cc: passt-dev
[-- Attachment #1: Type: text/plain, Size: 632 bytes --]
On Tue, Mar 3, 2026 at 2:11 PM Stefano Brivio <sbrivio@redhat.com> wrote:
>
> Peter, unless you see a problem with that, this patch would be
> superseded by:
>
> [PATCH 2/3] fwd, pif: Replace with pif_sock_l4() with pif_listen()
>
> https://archives.passt.top/passt-dev/20260302043135.800803-3-david@gibson.dropbear.id.au/
>
> as it avoids the need for this static_assert() altogether. So I would
> drop this patch (carrying a Reported-by: tag) in favour of that one.
>
Sounds good, I'm mostly concerned with having a warning-free clang build.
The specific fix doesn't particularly matter.
Thanks,
Peter
[-- Attachment #2: Type: text/html, Size: 1147 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2026-03-04 19:14 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-02-23 17:29 [PATCH] Avoid clang warnings in fwd.h Peter Foley
2026-02-24 5:48 ` David Gibson
2026-02-24 8:50 ` Stefano Brivio
2026-03-02 4:34 ` David Gibson
2026-03-03 19:11 ` Stefano Brivio
2026-03-04 19:14 ` Peter Foley
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).