blob: 7d6a024f6a300156014bdcd285f4493be904b052 [file] [log] [blame]
#include <android/api-level.h>
#if !__LP64__ && !defined(__arm__) || __ANDROID_API__ == 3
// This checks that simply including <wchar.h> with
// _WCHAR_IS_8BIT defined will provice an 8-bit wchar_t
// and 8-bit WCHAR_MIN/WCHAR_MAX.
// Force WCHAR_MIN/WCHAR_MAX to 32-bit values.
#define __STDC_LIMIT_MACROS
// Force wchar_t to be 8 bits.
#define _WCHAR_IS_8BIT
#include <wchar.h>
#define CONCAT(x,y) CONCAT_(x,y)
#define CONCAT_(x,y) x ## y
#define STATIC_ASSERT(condition) \
static char CONCAT(dummy_,__LINE__)[1 - 2*(!(condition))];
#if defined(__arm__) || __ANDROID_API__ < 9
STATIC_ASSERT(sizeof(__WCHAR_TYPE__) == 1);
#else
STATIC_ASSERT(sizeof(__WCHAR_TYPE__) == 4);
#endif
// wchar_t is never redefined by <stddef.h> because it's a C++ keyword,
// unlike in C.
STATIC_ASSERT(sizeof(wchar_t) == 4);
// This is C++ code but __STDC_LIMIT_MACROS was defined, and
// _WCHAR_IS_8BIT is defined, so the values are always 32-bit signed.
STATIC_ASSERT(WCHAR_MIN == 0x80000000);
STATIC_ASSERT(WCHAR_MAX == 0x7fffffff);
#endif