Fix ssize_t, WCHAR_MIN and WCHAR_MAX

1) ssize_t is int, instead of long int
2) WCHAR_MIN and WCHAR_MAX be consistent with bionic's:
   respond to __WCHAR_UNSIGNED__, work for both signed (X86/MIPS)
   and unsigned (ARM) wchar_t, and work for -fshort-wchar too

Change-Id: Ief1be007571b50c5d63a819df489f9d3f9b47bc8
This commit is contained in:
Andrew Hsieh
2014-06-10 10:50:38 +08:00
parent 0e85aa033e
commit 9983b467e5
3 changed files with 9 additions and 16 deletions

View File

@@ -251,7 +251,7 @@ typedef int64_t intmax_t;
/* size_t is defined by the GCC-specific <stddef.h> */
#ifndef _SSIZE_T_DEFINED_
#define _SSIZE_T_DEFINED_
typedef long int ssize_t;
typedef int ssize_t;
#endif
#define _BITSIZE 32

View File

@@ -86,21 +86,14 @@
# else
/* Otherwise, the value is derived from the toolchain configuration.
* to avoid putting explicit CPU checks in this header. */
# ifndef __WCHAR_MAX__
# error "__WCHAR_MAX__ is not defined. Check your toolchain!"
# define WCHAR_MAX __WCHAR_MAX__
/* Clang does not define __WCHAR_MIN__ */
# if defined(__WCHAR_UNSIGNED__)
# define WCHAR_MIN L'\0'
# else
# define WCHAR_MIN (-(WCHAR_MAX) - 1)
# endif
/* Clang does define __WCHAR_MAX__, but not __WCHAR_MIN__ */
# ifndef __WCHAR_MIN__
# if __WCHAR_MAX__ == 4294967295
# define __WCHAR_MIN__ (0U)
# elif __WCHAR_MAX__ == 2147483647
# define __WCHAR_MIN__ (-2147483647 - 1)
# else
# error "Invalid __WCHAR_MAX__ value. Check your toolchain!"
# endif
# endif /* !__WCHAR_MIN__ */
# define WCHAR_MIN __WCHAR_MIN__
# define WCHAR_MAX __WCHAR_MAX__
# endif /* !_WCHAR_IS_ALWAYS_SIGNED */
#endif /* !WCHAR_MIN */

View File

@@ -87,7 +87,7 @@ typedef .... pthread_t;
#ifndef _SSIZE_T_DEFINED_
#define _SSIZE_T_DEFINED_
typedef long int ssize_t;
typedef int ssize_t;
#endif
typedef __kernel_suseconds_t suseconds_t;