From: "SZEDER Gábor" <szeder.dev@gmail.com>
To: phillip.wood@dunelm.org.uk
Cc: Patrick Steinhardt <ps@pks.im>, git@vger.kernel.org
Subject: Re: [PATCH 7/8] meson: compile compatibility sources separately
Date: Thu, 12 Mar 2026 00:27:49 +0100 [thread overview]
Message-ID: <abH6dayn5tJBMY9p@szeder.dev> (raw)
In-Reply-To: <debb89c9-2fab-4922-af1a-6048094baf9f@gmail.com>
On Wed, Mar 11, 2026 at 02:56:24PM +0000, Phillip Wood wrote:
> On 11/03/2026 14:32, Phillip Wood wrote:
> > On 10/03/2026 17:52, Patrick Steinhardt wrote:
> > > In the next commit we're about to introduce a precompiled header for
> > > "git-compat-util.h". The consequence of this change is that we'll
> > > implicitly include that header for every compilation unit that uses the
> > > precompiled headers.
> >
> > Is that a meson thing? I know it defines precompiled headers on a per-
> > target basis but does it somehow force each source file to include the
> > precompiled header? Looking at the gcc documentation it seems like the
> > precompiled header is only included where the original header is
> > included.
>
> Answering my own question the precompiled header is included via "-include"
> on the commandline. This is necessary in the general case because a
> precompiled header cannot be used once the first C token is seen.
>
> As an aside in git we could probably get away without using "-include"
> because if we include "git-compat-util.h" it is always the first thing we
> do, or we inculde another file like "builtin.h" which immediately includes
> "git-compat-util.h" and so it is included before the first C token is seen.
I couldn't find this in the GCC docs, but Make's documentation states
that "you cannot include a precompiled header from inside another
header." [1]
The strace of compiling a 'builtin/*.c' source file seems to confirm
it, the compiler (gcc-12) does look for 'builtin.h.gch', but doesn't
look for 'git-compat-util.h.gch':
592662 newfstatat(AT_FDCWD, "builtin/builtin.h.gch", 0x7fff2066e610, 0) = -1 ENOENT (No such file or directory)
592662 openat(AT_FDCWD, "builtin/builtin.h", O_RDONLY|O_NOCTTY) = -1 ENOENT (No such file or directory)
592662 newfstatat(AT_FDCWD, "./builtin.h.gch", 0x7fff2066e610, 0) = -1 ENOENT (No such file or directory)
592662 openat(AT_FDCWD, "./builtin.h", O_RDONLY|O_NOCTTY) = 4
592662 newfstatat(4, "", {st_mode=S_IFREG|0664, st_size=17968, ...}, AT_EMPTY_PATH) = 0
592662 read(4, "#ifndef BUILTIN_H\n#define BUILTI"..., 17968) = 17968
592662 close(4) = 0
592662 openat(AT_FDCWD, "./git-compat-util.h", O_RDONLY|O_NOCTTY) = 4
[1] Second bullet point at:
https://gcc.gnu.org/onlinedocs/gcc/Precompiled-Headers.html
next prev parent reply other threads:[~2026-03-11 23:28 UTC|newest]
Thread overview: 49+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-10 17:52 [PATCH 0/8] Some build system improvements Patrick Steinhardt
2026-03-10 17:52 ` [PATCH 1/8] Introduce new "tools/" directory Patrick Steinhardt
2026-03-10 17:52 ` [PATCH 2/8] contrib: move "coccinelle/" directory into "tools/" Patrick Steinhardt
2026-03-10 17:52 ` [PATCH 3/8] contrib: move "coverage-diff.sh" script " Patrick Steinhardt
2026-03-10 17:52 ` [PATCH 4/8] contrib: move "update-unicode.sh" " Patrick Steinhardt
2026-03-10 17:52 ` [PATCH 5/8] builds: move build scripts " Patrick Steinhardt
2026-03-10 17:52 ` [PATCH 6/8] git-compat-util.h: move warning infra to prepare for PCHs Patrick Steinhardt
2026-03-10 17:52 ` [PATCH 7/8] meson: compile compatibility sources separately Patrick Steinhardt
2026-03-11 14:32 ` Phillip Wood
2026-03-11 14:56 ` Phillip Wood
2026-03-11 23:27 ` SZEDER Gábor [this message]
2026-03-12 6:21 ` Patrick Steinhardt
2026-03-13 10:33 ` Phillip Wood
2026-03-16 8:09 ` Patrick Steinhardt
2026-03-12 6:22 ` Patrick Steinhardt
2026-03-13 10:33 ` Phillip Wood
2026-03-16 8:09 ` Patrick Steinhardt
2026-03-16 10:52 ` Phillip Wood
2026-03-17 15:38 ` Kristoffer Haugsbakk
2026-03-19 5:32 ` Patrick Steinhardt
2026-03-10 17:52 ` [PATCH 8/8] meson: precompile "git-compat-util.h" Patrick Steinhardt
2026-03-11 14:32 ` Phillip Wood
2026-03-12 6:21 ` Patrick Steinhardt
2026-03-10 18:23 ` [PATCH 0/8] Some build system improvements Junio C Hamano
2026-03-11 7:32 ` Patrick Steinhardt
2026-03-13 22:21 ` Junio C Hamano
2026-03-16 8:09 ` Patrick Steinhardt
2026-03-16 10:07 ` [PATCH v2 " Patrick Steinhardt
2026-03-16 10:07 ` [PATCH v2 1/8] Introduce new "tools/" directory Patrick Steinhardt
2026-03-16 10:07 ` [PATCH v2 2/8] contrib: move "coccinelle/" directory into "tools/" Patrick Steinhardt
2026-03-16 10:07 ` [PATCH v2 3/8] contrib: move "coverage-diff.sh" script " Patrick Steinhardt
2026-03-16 10:07 ` [PATCH v2 4/8] contrib: move "update-unicode.sh" " Patrick Steinhardt
2026-03-16 10:08 ` [PATCH v2 5/8] builds: move build scripts " Patrick Steinhardt
2026-03-16 10:08 ` [PATCH v2 6/8] git-compat-util.h: move warning infra to prepare for PCHs Patrick Steinhardt
2026-03-16 10:08 ` [PATCH v2 7/8] meson: compile compatibility sources separately Patrick Steinhardt
2026-03-16 10:08 ` [PATCH v2 8/8] meson: precompile "git-compat-util.h" Patrick Steinhardt
2026-03-16 10:54 ` [PATCH v2 0/8] Some build system improvements Phillip Wood
2026-03-19 5:33 ` [PATCH v3 " Patrick Steinhardt
2026-03-19 5:33 ` [PATCH v3 1/8] Introduce new "tools/" directory Patrick Steinhardt
2026-03-19 5:33 ` [PATCH v3 2/8] contrib: move "coccinelle/" directory into "tools/" Patrick Steinhardt
2026-03-19 5:33 ` [PATCH v3 3/8] contrib: move "coverage-diff.sh" script " Patrick Steinhardt
2026-03-20 12:15 ` Toon Claes
2026-03-19 5:33 ` [PATCH v3 4/8] contrib: move "update-unicode.sh" " Patrick Steinhardt
2026-03-19 5:33 ` [PATCH v3 5/8] builds: move build scripts " Patrick Steinhardt
2026-03-19 5:33 ` [PATCH v3 6/8] git-compat-util.h: move warning infra to prepare for PCHs Patrick Steinhardt
2026-03-20 12:34 ` Toon Claes
2026-03-19 5:33 ` [PATCH v3 7/8] meson: compile compatibility sources separately Patrick Steinhardt
2026-03-19 5:33 ` [PATCH v3 8/8] meson: precompile "git-compat-util.h" Patrick Steinhardt
2026-03-20 12:37 ` Toon Claes
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=abH6dayn5tJBMY9p@szeder.dev \
--to=szeder.dev@gmail.com \
--cc=git@vger.kernel.org \
--cc=phillip.wood@dunelm.org.uk \
--cc=ps@pks.im \
/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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox