git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 7/8] meson: compile compatibility sources separately

From
Patrick Steinhardt <ps@pks.im>
Date
Mar 12, 2026, 06:22 UTC
Message-ID
<abJbir7NocxmBuAo@pks.im>
In-Reply-To
<debb89c9-2fab-4922-af1a-6048094baf9f@gmail.com>
On Wed, Mar 11, 2026 at 02:56:24PM +0000, Phillip Wood wrote:
Show 25 quoted lines
> 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.
> However meson cannot rely on that.
> 
> I notice the reftable sources don't seem to include "git-compat-util.h", do
> they need special handling here as well?

I don't see a strong reason to do so. The reason why we need to be careful with "compat/" is that we redefine a bunch of standard symbols there, and that requires us to play a couple of tricks with preprocessor macros (see e.g. "compat/fopen.c").

We don't do anything like that in the reftable library, and we already include "compat/posix.h". So in practice, it shouldn't have much of a consueqence if we start to include "git-compat-util.h" implicitly over there.

But if it ever does we can treat it the same as the compat library.
Patrick
Previous: SZEDER GáborNext: Phillip Wood
Message 16 of 53 in “Some build system improvements”
  1. 0/8 Some build system improvementsPatrick Steinhardt, Mar 10, 2026
  2. 1/8 Introduce new "tools/" directoryPatrick Steinhardt, Mar 10, 2026
  3. 2/8 contrib: move "coccinelle/" directory into "tools/"Patrick Steinhardt, Mar 10, 2026
  4. 3/8 contrib: move "coverage-diff.sh" script into "tools/"Patrick Steinhardt, Mar 10, 2026
  5. 4/8 contrib: move "update-unicode.sh" script into "tools/"Patrick Steinhardt, Mar 10, 2026
  6. 5/8 builds: move build scripts into "tools/"Patrick Steinhardt, Mar 10, 2026
  7. 6/8 git-compat-util.h: move warning infra to prepare for PCHsPatrick Steinhardt, Mar 10, 2026
  8. 7/8 meson: compile compatibility sources separatelyPatrick Steinhardt, Mar 10, 2026
  9. Phillip WoodMar 11, 2026
  10. Phillip WoodMar 11, 2026
  11. SZEDER GáborMar 11, 2026
  12. Patrick SteinhardtMar 12, 2026
  13. Phillip WoodMar 13, 2026
  14. Patrick SteinhardtMar 16, 2026
  15. SZEDER GáborApr 10, 2026
  16. Patrick SteinhardtMar 12, 2026
  17. Phillip WoodMar 13, 2026
  18. Patrick SteinhardtMar 16, 2026
  19. Phillip WoodMar 16, 2026
  20. Kristoffer HaugsbakkMar 17, 2026
  21. Patrick SteinhardtMar 19, 2026
  22. 8/8 meson: precompile "git-compat-util.h"Patrick Steinhardt, Mar 10, 2026
  23. Phillip WoodMar 11, 2026
  24. Patrick SteinhardtMar 12, 2026
  25. Junio C HamanoMar 10, 2026
  26. Patrick SteinhardtMar 11, 2026
  27. Junio C HamanoMar 13, 2026
  28. Patrick SteinhardtMar 16, 2026
  29. 0/8 Some build system improvementsPatrick Steinhardt, Mar 16, 2026
  30. 1/8 Introduce new "tools/" directoryPatrick Steinhardt, Mar 16, 2026
  31. 2/8 contrib: move "coccinelle/" directory into "tools/"Patrick Steinhardt, Mar 16, 2026
  32. 3/8 contrib: move "coverage-diff.sh" script into "tools/"Patrick Steinhardt, Mar 16, 2026
  33. 4/8 contrib: move "update-unicode.sh" script into "tools/"Patrick Steinhardt, Mar 16, 2026
  34. 5/8 builds: move build scripts into "tools/"Patrick Steinhardt, Mar 16, 2026
  35. 6/8 git-compat-util.h: move warning infra to prepare for PCHsPatrick Steinhardt, Mar 16, 2026
  36. 7/8 meson: compile compatibility sources separatelyPatrick Steinhardt, Mar 16, 2026
  37. 8/8 meson: precompile "git-compat-util.h"Patrick Steinhardt, Mar 16, 2026
  38. Phillip WoodMar 16, 2026
  39. 0/8 Some build system improvementsPatrick Steinhardt, Mar 19, 2026
  40. 1/8 Introduce new "tools/" directoryPatrick Steinhardt, Mar 19, 2026
  41. 2/8 contrib: move "coccinelle/" directory into "tools/"Patrick Steinhardt, Mar 19, 2026
  42. 3/8 contrib: move "coverage-diff.sh" script into "tools/"Patrick Steinhardt, Mar 19, 2026
  43. Toon ClaesMar 20, 2026
  44. 4/8 contrib: move "update-unicode.sh" script into "tools/"Patrick Steinhardt, Mar 19, 2026
  45. 5/8 builds: move build scripts into "tools/"Patrick Steinhardt, Mar 19, 2026
  46. 6/8 git-compat-util.h: move warning infra to prepare for PCHsPatrick Steinhardt, Mar 19, 2026
  47. Toon ClaesMar 20, 2026
  48. 7/8 meson: compile compatibility sources separatelyPatrick Steinhardt, Mar 19, 2026
  49. 8/8 meson: precompile "git-compat-util.h"Patrick Steinhardt, Mar 19, 2026
  50. Toon ClaesMar 20, 2026
  51. SZEDER GáborApr 10, 2026
  52. Phillip WoodApr 10, 2026
  53. SZEDER GáborApr 10, 2026

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.