Ensure that <stdint.h> defines SIZE_MAX and friends.
We were missing SIG_ATOMIC_MAX, SIG_ATOMIC_MIN, SIZE_MAX,
WCHAR_MAX, WCHAR_MIN, WINT_MAX, and WINT_MIN.
Change-Id: I2535f36bc220fbaea009b483599b7af811c4cb5c
diff --git a/libc/include/stdint.h b/libc/include/stdint.h
index 222ff1b..293fb03 100644
--- a/libc/include/stdint.h
+++ b/libc/include/stdint.h
@@ -30,7 +30,6 @@
#include <stddef.h>
#include <sys/_types.h>
-#include <machine/limits.h> /* For SIZE_MAX. */
#if !defined(__cplusplus) || defined(__STDC_LIMIT_MACROS)
# define __STDINT_LIMITS
@@ -227,6 +226,25 @@
# define UINTMAX_C(c) UINT64_C(c)
#endif
+/*
+ * sig_atomic_t, size_t, wchar_t, and wint_t.
+ */
+
+#ifdef __STDINT_LIMITS
+# define SIG_ATOMIC_MAX INT32_MAX
+# define SIG_ATOMIC_MIN INT32_MIN
+
+# define SIZE_MAX UINT32_MAX
+
+# ifndef WCHAR_MAX /* These might also have been defined by <wchar.h>. */
+# define WCHAR_MAX INT32_MAX
+# define WCHAR_MIN INT32_MIN
+# endif
+
+# define WINT_MAX INT32_MAX
+# define WINT_MIN INT32_MIN
+#endif
+
#define _BITSIZE 32
/* Keep the kernel from trying to define these types... */
diff --git a/libc/include/wchar.h b/libc/include/wchar.h
index a4e19f0..76ac02c 100644
--- a/libc/include/wchar.h
+++ b/libc/include/wchar.h
@@ -65,8 +65,11 @@
WC_TYPE_MAX
} wctype_t;
+#ifndef WCHAR_MAX
#define WCHAR_MAX INT_MAX
#define WCHAR_MIN INT_MIN
+#endif
+
#define WEOF ((wint_t)(-1))
extern wint_t btowc(int);