When compiling GNU Make from git master I get warnings that SIZE_MAX
is redefined. This patch fixes it.

This macro is defined by glibc in stdint.h/inttypes.h but
src/makeint.h checks for it after including limits.h.

I've just placed these headers under limits.h before any *_MIN, *_MAX,
etc. macros are checked. Feel free to reorder things if you'd like.

Collin
From 9926caaa85919844de983d2c7f1b54b2debe2f08 Mon Sep 17 00:00:00 2001
From: Collin Funk <collin.fu...@gmail.com>
Date: Sat, 6 Apr 2024 19:44:23 -0700
Subject: [PATCH] Fix gcc SIZE_MAX redefined warnings.

* src/makeint.h: Include inttypes.h and stdint.h before checking if
SIZE_MAX is defined.
---
 src/makeint.h | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/src/makeint.h b/src/makeint.h
index 5a553093..d65b0ce7 100644
--- a/src/makeint.h
+++ b/src/makeint.h
@@ -139,6 +139,13 @@ extern int errno;
 # include <sys/param.h>
 #endif
 
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#endif
+#if HAVE_STDINT_H
+# include <stdint.h>
+#endif
+
 #ifndef PATH_MAX
 # ifdef MAXPATHLEN
 #  define PATH_MAX      MAXPATHLEN
@@ -279,13 +286,6 @@ char *strerror (int errnum);
 #endif  /* !ANSI_STRING.  */
 #undef ANSI_STRING
 
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#endif
-#if HAVE_STDINT_H
-# include <stdint.h>
-#endif
-
 #if HAVE_STRINGS_H
 # include <strings.h>  /* Needed for strcasecmp / strncasecmp.  */
 #endif
-- 
2.44.0

Reply via email to