Merge "Ensure that <stdint.h> defines SIZE_MAX and friends."

This commit is contained in:
Elliott Hughes 2013-06-13 23:19:09 +00:00 committed by Gerrit Code Review
commit 560e9f7e7a
2 changed files with 22 additions and 1 deletions

View File

@ -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 @@ 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 <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... */

View File

@ -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);