public inbox for passt-dev@passt.top
 help / color / mirror / code / Atom feed
From: David Gibson <david@gibson.dropbear.id.au>
To: Stefano Brivio <sbrivio@redhat.com>
Cc: passt-dev@passt.top
Subject: Re: [PATCH 0/3] RFC: Allow C11 extensions in the passt/pasta code
Date: Wed, 2 Aug 2023 14:47:07 +1000	[thread overview]
Message-ID: <ZMnfy8UO0KIfCLeG@zatzit> (raw)
In-Reply-To: <20230801101527.6cbdc8fa@elisabeth>

[-- Attachment #1: Type: text/plain, Size: 2350 bytes --]

On Tue, Aug 01, 2023 at 10:15:27AM +0200, Stefano Brivio wrote:
> On Tue,  1 Aug 2023 13:36:44 +1000
> David Gibson <david@gibson.dropbear.id.au> wrote:
> 
> > As discussed on our recent calls, the C11 standard introduces
> > anonymous structure and union members and static assertions, amongst
> > other things.  Both of these could be useful in a few places in
> > passt/pasta to make the code more readable and safer.
> > 
> > However, at the moment, the compiler flags we use only allow C99 code.
> > This series allows C11 code, and makes some fairly obvious cleanups by
> > using it.
> > 
> > It would be nice to get an opinion on this reasonably quickly, because
> > I have other patches in the works that will look different depending
> > on whether or not they can use C11 features.
> 
> ...then let me start with this one, as it's straightforward: I think
> anonymous unions and structures are great. :)
> 
> The series (especially 2/3) looks good to me, I'll push it in a bit.
> 
> We also need to check for issues with reasonably older gcc (perhaps
> those we have in the test/distro tests, at least) and clang versions,
> unless you already did that.

So I tried building with this series in some container images of old
debian versions.

In buster (Debian 10), it builds ok with both gcc 8sh and clang 7ish,
although the latter unsurprisingly gives warnings for the gcc specific
__attribute__((optimize("-fno-strict-aliasing"))) we have on the
siphash functions.

In stretch (Debian 9), it builds ok with gcc 6ish, though not with
clang-3.8ish.  However the latter doesn't appear to be because of the
C11 changes - it's complaining about initializers which only list some
of the structure fields.

In jessie (Debian 8) it doesn't build with gcc 4ish or clang-3.5ish,
but again it appears to be the incomplete initializers rather than the
C11 changes.


In short, it appears that before we hit compilers that won't cope with
the C11 changes, we hit compilers that object to incomplete
initializers that we're already using.  So.. I don't think there's any
reason not to apply the C11 changes.

-- 
David Gibson			| 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 --]

  reply	other threads:[~2023-08-02  4:47 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-01  3:36 [PATCH 0/3] RFC: Allow C11 extensions in the passt/pasta code David Gibson
2023-08-01  3:36 ` [PATCH 1/3] Allow C11 code, not just C99 code David Gibson
2023-08-01  3:36 ` [PATCH 2/3] Use C11 anonymous members to make poll refs less verbose to use David Gibson
2023-08-01  3:36 ` [PATCH 3/3] Use static assertion to verify that union epoll_ref is the right size David Gibson
2023-08-01  8:15 ` [PATCH 0/3] RFC: Allow C11 extensions in the passt/pasta code Stefano Brivio
2023-08-02  4:47   ` David Gibson [this message]
2023-08-02  8:19     ` Stefano Brivio
2023-08-04  7:03 ` Stefano Brivio

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZMnfy8UO0KIfCLeG@zatzit \
    --to=david@gibson.dropbear.id.au \
    --cc=passt-dev@passt.top \
    --cc=sbrivio@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).