public inbox for passt-dev@passt.top
 help / color / mirror / code / Atom feed
From: Stefano Brivio <sbrivio@redhat.com>
To: David Gibson <david@gibson.dropbear.id.au>
Cc: Peter Foley <pefoley@google.com>, passt-dev@passt.top
Subject: Re: [PATCH] Add missing includes to headers
Date: Mon, 23 Feb 2026 17:32:01 +0100 (CET)	[thread overview]
Message-ID: <20260223173200.32bdaf93@elisabeth> (raw)
In-Reply-To: <aZvmrHATLCdVIARd@zatzit>

On Mon, 23 Feb 2026 16:33:32 +1100
David Gibson <david@gibson.dropbear.id.au> wrote:

> On Thu, Feb 19, 2026 at 01:44:54PM -0500, Peter Foley wrote:
> > Support build systems like bazel that check that headers are
> > self-contained.
> > 
> > Signed-off-by: Peter Foley <pefoley@google.com>  
> 
> There are kind of two schools of thoughts on headers.  One is that
> every header should #include anything it relies on.  The other is that
> headers should #include nothing, and .c files should includde
> everything they need in the right order.  The advantages of the second
> approach are that it makes it easier to keep #includes in .c files
> minimal, and makes circular dependencies more obvious and easier to
> dientanble.
> 
> We've kinda sorta been using approach two in passt, but not entirely,
> and honestly, it's not really working.

I would argue it *is* pretty much working, because it builds without
warnings against glibc and musl, with several versions of gcc and
Clang, on a large number of distributions and architectures, which is
what it needs to do.

There are currently two warnings with (unreleased) gcc 16-ish and
glibc, I still have to post patches for them, but they have nothing to
do with includes.

That being said, sure, it's not either approach and admittedly kind of
arbitrary and rather messy.

> So I'm happy to convert to the
> former approach.  However, if we're adding #includes in the headers so
> they're self contained, then we should be able to also *remove* a
> bunch of #includes from .c files (and other .h files) which were
> previously only there to satisfy the indirect dependencies.

Just for clarity, while I agree, this patch does *not* magically make
that Peter's job. :)

I'd say that making it build with Bazel is more useful at this stage so
I would happily accept this patch by itself (I just need to find a
moment to try out builds on musl and on a couple of distributions,
first).

The cleanup you propose can also be done independently at a later
point, also because I'm fairly sure there are a bunch of left-over
includes (also/mostly from myself) even before this change.

Note that this kind of cleanup would also take a bit of testing that
we currently can't automate, for example building against musl on
Alpine or Void Linux.

-- 
Stefano


      reply	other threads:[~2026-02-23 16:32 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-19 17:45 Peter Foley
2026-02-21 17:57 ` Stefano Brivio
     [not found]   ` <CAAAKUPN=GPDp84tQAv4Kpxs-AzKR44pDkWda-AbXWaUomYN5eg@mail.gmail.com>
     [not found]     ` <CAAAKUPMP8goRHqk0VDn6UDWmyyPXpzs37UuCLL8x7wDp10tY6A@mail.gmail.com>
2026-02-23 17:35       ` Stefano Brivio
     [not found]         ` <CAAAKUPMQZetb9RYoxaUZGyp7dWm8pifmvEfyV3M4Q6+j9jw89g@mail.gmail.com>
2026-02-23 18:11           ` [PATCH v2] " Peter Foley
2026-02-23 19:05           ` [PATCH] " Stefano Brivio
2026-02-23  5:33 ` David Gibson
2026-02-23 16:32   ` Stefano Brivio [this message]

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=20260223173200.32bdaf93@elisabeth \
    --to=sbrivio@redhat.com \
    --cc=david@gibson.dropbear.id.au \
    --cc=passt-dev@passt.top \
    --cc=pefoley@google.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).