diff mbox series

[d] Committed fix building on hosts missing _MIN and MAX macros

Message ID CABOHX+c8MdHiiJS3m+V6yUeMwGvy1MMh_Z=0aZXDGtBc9u5URw@mail.gmail.com
State New
Headers show
Series [d] Committed fix building on hosts missing _MIN and MAX macros | expand

Commit Message

Iain Buclaw April 17, 2019, 6:02 a.m. UTC
Hi,

This patch adds missing macros that the dmd front-end makes use of, as
seen on one of the BSDs where the include for int_const.h is guarded,
and defines any __unix__ system as being POSIX.

Bootstrapped and regression tested on x86_64-linux-gnu.

Committed to trunk as r270403.
diff mbox series

Patch

diff --git a/gcc/d/d-system.h b/gcc/d/d-system.h
index 142b03dc80f..b6f4ee5302a 100644
--- a/gcc/d/d-system.h
+++ b/gcc/d/d-system.h
@@ -25,7 +25,7 @@ 
 /* Used by the dmd front-end to determine if we have POSIX-style IO.  */
 #define POSIX (__linux__ || __GLIBC__ || __gnu_hurd__ || __APPLE__ \
 	       || __FreeBSD__ || __NetBSD__ || __OpenBSD__ || __DragonFly__ \
-	       || __sun)
+	       || __sun || __unix__)
 
 /* Forward assert invariants to gcc_assert.  */
 #undef assert
@@ -61,4 +61,21 @@ 
 #define _mkdir(p) mkdir(p, 0)
 #endif
 
+/* Define any missing _MAX and _MIN macros.  */
+#ifndef INT32_MAX
+# define INT32_MAX INTTYPE_MAXIMUM (int32_t)
+#endif
+#ifndef INT32_MIN
+# define INT32_MIN INTTYPE_MINIMUM (int32_t)
+#endif
+#ifndef INT64_MIN
+# define INT64_MIN INTTYPE_MINIMUM (int64_t)
+#endif
+#ifndef UINT32_MAX
+# define UINT32_MAX INTTYPE_MAXIMUM (uint32_t)
+#endif
+#ifndef UINT64_MAX
+# define UINT64_MAX INTTYPE_MAXIMUM (uint64_t)
+#endif
+
 #endif  /* GCC_D_SYSTEM_H  */