From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: passt.top; dmarc=none (p=none dis=none) header.from=gibson.dropbear.id.au Authentication-Results: passt.top; dkim=pass (2048-bit key; secure) header.d=gibson.dropbear.id.au header.i=@gibson.dropbear.id.au header.a=rsa-sha256 header.s=202602 header.b=HSsz04zS; dkim-atps=neutral Received: from mail.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3]) by passt.top (Postfix) with ESMTPS id 8DBE95A0269 for ; Tue, 24 Feb 2026 06:44:51 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gibson.dropbear.id.au; s=202602; t=1771911887; bh=4MM9oARcGmUG+TBGmqMu3IUWojMgCzsgYF8LNMWe+Wk=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=HSsz04zS+LJshsKlzQrsURG1qkxl8MBsCQa5TI4w00lFFWpwuJJMvX0hJKiP8/lwx BZojUBzIaZjxaOCsewWNoNszcme5ocFrBsFfWoXddJqEueXJb+RuGTZaiDy+sb7w9B IBihIrf21ZYDHUFYMWfUWdhnX8ppD5HPrnacmwEZFy1D7+c32SZS/RjOJS1uS/pZFt /7xIgpXQjDRz744eFlv6On4QoBtsSQpV55avELLsFkgNSUmoNbNkieC/LGIHXdimAl WEdDvu3uOiYLwlv95p3VrRYCMK31X5VZFzLQt72xohJvJXaxGCgtUbXXgtY3+j3QAs 88o45Z9s2Ipxg== Received: by gandalf.ozlabs.org (Postfix, from userid 1007) id 4fKmrb3p5jz4wBF; Tue, 24 Feb 2026 16:44:47 +1100 (AEDT) Date: Tue, 24 Feb 2026 16:37:59 +1100 From: David Gibson To: Stefano Brivio Subject: Re: [PATCH] Add missing includes to headers Message-ID: References: <20260219184454.1501389-1-pefoley@google.com> <20260223173200.32bdaf93@elisabeth> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="TglgT8SjC37MD4fY" Content-Disposition: inline In-Reply-To: <20260223173200.32bdaf93@elisabeth> Message-ID-Hash: UWCLBCBBBKTJNOFQJWYB4EWGNHK2X3L4 X-Message-ID-Hash: UWCLBCBBBKTJNOFQJWYB4EWGNHK2X3L4 X-MailFrom: dgibson@gandalf.ozlabs.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Peter Foley , passt-dev@passt.top X-Mailman-Version: 3.3.8 Precedence: list List-Id: Development discussion and patches for passt Archived-At: Archived-At: List-Archive: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: --TglgT8SjC37MD4fY Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Feb 23, 2026 at 05:32:01PM +0100, Stefano Brivio wrote: > On Mon, 23 Feb 2026 16:33:32 +1100 > David Gibson wrote: >=20 > > 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. > > >=20 > > > Signed-off-by: Peter Foley =20 > >=20 > > 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. > >=20 > > We've kinda sorta been using approach two in passt, but not entirely, > > and honestly, it's not really working. >=20 > 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. Ok, let me qualify that. I mean that I frequently hit minor irritations related to not-self-contained headers, and I'm not really feeling the benefits of the approach.. That is to say, I don't feel like the no-indirect-includes approach is working in the sense of providing benefits to outweigh going the other direction. > 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. >=20 > That being said, sure, it's not either approach and admittedly kind of > arbitrary and rather messy. Right. > > 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. >=20 > Just for clarity, while I agree, this patch does *not* magically make > that Peter's job. :) Heh, fair enough. > 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). Also fair enough. > 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. >=20 > 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. >=20 > --=20 > Stefano >=20 --=20 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 --TglgT8SjC37MD4fY Content-Type: application/pgp-signature; name=signature.asc -----BEGIN PGP SIGNATURE----- iQIzBAEBCgAdFiEEO+dNsU4E3yXUXRK2zQJF27ox2GcFAmmdOSQACgkQzQJF27ox 2Gd1RA//e9VbTHVg61Rq3LyChk4PVQ1QoeV1RFrfUy94+4T06IQva4vXaPGEU4Kw kaM9G0Gsj5to6tS+kcgehkhE84YqWBhKJSneXeED85KJVDzM+GaD/cF2zXXCp6tZ fOIS/sAzOZXNYbRksAdy0jEno/d0l13fyvbgteoWf8rmY7eRTSvgD/8bHZtpDfHY SiScNlIOx8GRSMAxLRr+Q9bgrz6nuk5E/Mwv8xkZbnBFeLwtKO7bSmtzLCyqkbiu xusGOGhRNRYWETa6Fg7QcbccnDZJWjJuLXgwSvhpUR3LrhXGPBfJsQVb+skaZZBP ZhsCzRtxiB/iarHOzHMTvdJ63OJIHuzxFXLEbXbFBWiI5E/Z6HiQdzoJazKdnVcN W4CBZ3i8dl5uzfKu+yuOdurs/M/Qe6xNQyEBCz2DYA2c5f6LAwfzElFCfMF/n/1S lDugE10i0pwWBaGgMfItkrMS/mg5kPgp4kzezG0nY+h/pkIgl9qJ+PfeFxtApVgU F+laiRyoQZdN2LdpCuQopBgwufVnfG1h4ImNrrba2WHB5sC9baKYJZ611nx01+1k CkzkW7k8wk6aR5leZjIo4IZO1uccBZy6swK531uRiH3nUJxFKJ8SLLKyOGAFxxYy R1dKXB857oH68HfIb//V1Bw/vmZWUTYvN6vmLae5jcaYP9rvLOk= =/nDg -----END PGP SIGNATURE----- --TglgT8SjC37MD4fY--