From 7c89506e3af3ee97691a98329f0d7b5edef49218 Mon Sep 17 00:00:00 2001 From: Elliott Hughes Date: Thu, 13 Jun 2013 16:02:53 -0700 Subject: [PATCH] Ensure that 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 --- libc/include/stdint.h | 20 +++++++++++++++++++- libc/include/wchar.h | 3 +++ 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/libc/include/stdint.h b/libc/include/stdint.h index 222ff1bbd..293fb03f6 100644 --- a/libc/include/stdint.h +++ b/libc/include/stdint.h @@ -30,7 +30,6 @@ #include #include -#include /* For SIZE_MAX. */ #if !defined(__cplusplus) || defined(__STDC_LIMIT_MACROS) # define __STDINT_LIMITS @@ -227,6 +226,25 @@ typedef int64_t intmax_t; # 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 . */ +# 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 a4e19f09a..76ac02c88 100644 --- a/libc/include/wchar.h +++ b/libc/include/wchar.h @@ -65,8 +65,11 @@ typedef enum { 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);