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

[PATCH] compat: drop inclusion of <git-compat-util.h>

From
Junio C Hamano <gitster@pobox.com>
Date
Feb 24, 2024, 20:32 UTC
Message-ID
<xmqqwmqtli18.fsf@gitster.g>

These two header files are included from ordinary source files that already include <git-compat-util.h> as the first header file as they should. There is no need to include the compat-util in these headers.

"make hdr-check" is not affected, as it is designed to assume that what <git-compat-util.h> offers is available to everybody without being included.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
 * There is an obvious alternative that goes in the complete
   opposite direction possible, to update "make hdr-check" to ensure
   that things that are depended upon in each header file
   (e.g. pager.h refers to uintmax_t) are brought in by the header
   file to include the compat-util in it, i.e.
	diff --git c/Makefile w/Makefile
	index 78e874099d..d7b360f15e 100644
	--- c/Makefile
	+++ w/Makefile
	@@ -3259,7 +3259,7 @@ HCO = $(patsubst %.h,%.hco,$(CHK_HDRS))
	 HCC = $(HCO:hco=hcc)
	 
	 %.hcc: %.h
	-	@echo '#include "git-compat-util.h"' >$@
	+	@echo '/* #include "git-compat-util.h" */' >$@
	 	@echo '#include "$<"' >>$@
	 
	 $(HCO): %.hco: %.hcc FORCE
   which would require in a noisy diff to add inclusion of
   git-compat-util.h to many header files.  For purposes of folks
   who may want to carve out only pieces of our source tree, such an
   approach might work better, but for that to happen and yield any
   useful result, I suspect that compat-util header needs to be
   split into "compatibility essentials" and other "it is convenient
   if these are available everywhere, even though they do not have
   much to do with hiding system dependencies from the sources"
   parts first.
 compat/compiler.h | 1 -
 compat/disk.h     | 1 -
 2 files changed, 2 deletions(-)
diff --git c/compat/compiler.h w/compat/compiler.h
index 10dbb65937..e9ad9db84f 100644
--- c/compat/compiler.h
+++ w/compat/compiler.h
@@ -1,7 +1,6 @@
 #ifndef COMPILER_H
 #define COMPILER_H
 
-#include "git-compat-util.h"
 #include "strbuf.h"
 
 #ifdef __GLIBC__
diff --git c/compat/disk.h w/compat/disk.h
index 6c979c27d8..23bc1bef86 100644
--- c/compat/disk.h
+++ w/compat/disk.h
@@ -1,7 +1,6 @@
 #ifndef COMPAT_DISK_H
 #define COMPAT_DISK_H
 
-#include "git-compat-util.h"
 #include "abspath.h"
 #include "gettext.h"
 
Next: Kyle Lippincott
Message 1 of 2 in “compat: drop inclusion of <git-compat-util.h>”
  1. compat: drop inclusion of <git-compat-util.h>Junio C Hamano, Feb 24, 2024
  2. Kyle LippincottFeb 24, 2024

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.