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

[RFH/PATCH] git-compat-util.h: do not #include <sys/param.h> by default

From
Junio C Hamano <gitster@pobox.com>
Date
Dec 18, 2012, 17:35 UTC
Message-ID
<7v623zgt5m.fsf_-_@alter.siamese.dyndns.org>
In-Reply-To
<7vobhrgupr.fsf_-_@alter.siamese.dyndns.org>

Earlier we allowed platforms that lack <sys/param.h> not to include the header file from git-compat-util.h; we have included this header file since the early days back when we used MAXPATHLEN (which we no longer use) and also depended on it slurping ULONG_MAX (which we get by including stdint.h or inttypes.h these days).

It turns out that we can compile our modern codebase just file without including it on many platforms (so far, Debian, Ubuntu, MinGW, HP-Nonstop, QNX and z/OS are reported to be OK).

Let's stop including it by default, and on platforms that need it to be included, leave "make NEEDS_SYS_PARAM_H=YesPlease" as an escape hatch and ask them to report to us, so that we can find out about the real dependency and fix it in a more platform agnostic way.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
 * I'd propose queuing this on top of dm/port topic, cook it in
   'next' for a while and then unleash it to the public.
 Makefile          | 8 +++++---
 configure.ac      | 6 ------
 git-compat-util.h | 2 +-
 3 files changed, 6 insertions(+), 10 deletions(-)
diff --git a/Makefile b/Makefile
index 5cd1de0..2c1f04f 100644
--- a/Makefile
+++ b/Makefile
@@ -167,7 +167,9 @@ all::
 # Define NO_POLL if you do not have or don't want to use poll().
 # This also implies NO_SYS_POLL_H.
 #
-# Define NO_SYS_PARAM_H if you don't have sys/param.h.
+# Define NEEDS_SYS_PARAM_H if you need to include sys/param.h to compile,
+# *PLEASE* REPORT to git@vger.kernel.org if your platform needs this;
+# we want to know more about the issue.
 #
 # Define NO_PTHREADS if you do not have or do not want to use Pthreads.
 #
@@ -1747,8 +1749,8 @@ endif
 ifdef NO_SYS_POLL_H
 	BASIC_CFLAGS += -DNO_SYS_POLL_H
 endif
-ifdef NO_SYS_PARAM_H
-	BASIC_CFLAGS += -DNO_SYS_PARAM_H
+ifdef NEEDS_SYS_PARAM_H
+	BASIC_CFLAGS += -DNEEDS_SYS_PARAM_H
 endif
 ifdef NO_INTTYPES_H
 	BASIC_CFLAGS += -DNO_INTTYPES_H
diff --git a/configure.ac b/configure.ac
index e3ab6fe..8fbb533 100644
--- a/configure.ac
+++ b/configure.ac
@@ -699,12 +699,6 @@ AC_CHECK_HEADER([sys/poll.h],
 [NO_SYS_POLL_H=UnfortunatelyYes])
 GIT_CONF_SUBST([NO_SYS_POLL_H])
 #
-# Define NO_SYS_PARAM_H if you don't have sys/param.h
-AC_CHECK_HEADER([sys/param.h],
-[NO_SYS_PARAM_H=],
-[NO_SYS_PARAM_H=UnfortunatelyYes])
-GIT_CONF_SUBST([NO_SYS_PARAM_H])
-#
 # Define NO_INTTYPES_H if you don't have inttypes.h
 AC_CHECK_HEADER([inttypes.h],
 [NO_INTTYPES_H=],
diff --git a/git-compat-util.h b/git-compat-util.h
index d7359ef..a88147b 100644
--- a/git-compat-util.h
+++ b/git-compat-util.h
@@ -104,7 +104,7 @@
 #endif
 #include <errno.h>
 #include <limits.h>
-#ifndef NO_SYS_PARAM_H
+#ifdef NEEDS_SYS_PARAM_H
 #include <sys/param.h>
 #endif
 #include <sys/types.h>
-- 
1.8.1.rc2.136.gb42b73a
Previous: Junio C HamanoNext: Torsten Bögershausen
Message 5 of 9 in “Re: What's cooking in git.git (Dec 2012, #04; Sun, 16)”
  1. Matt KraaiDec 17, 2012
  2. Joachim SchmitzDec 18, 2012
  3. Johannes SixtDec 18, 2012
  4. sys/param.hJunio C Hamano, Dec 18, 2012
  5. git-compat-util.h: do not #include <sys/param.h> by defaultJunio C Hamano, Dec 18, 2012
  6. Torsten BögershausenDec 18, 2012
  7. Erik Faye-LundDec 19, 2012
  8. Mark LevedahlDec 20, 2012
  9. Junio C HamanoDec 20, 2012

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.