Home | History | Annotate | Download | only in jni
      1 #include <android/api-level.h>
      2 
      3 #if !__LP64__ && !defined(__arm__) || __ANDROID_API__ == 3
      4 
      5 // This checks that simply including <wchar.h> with
      6 // _WCHAR_IS_8BIT defined will provice an 8-bit wchar_t
      7 // and 8-bit WCHAR_MIN/WCHAR_MAX.
      8 
      9 // Force WCHAR_MIN/WCHAR_MAX to 32-bit values.
     10 #define __STDC_LIMIT_MACROS
     11 // Force wchar_t to be 8 bits.
     12 #define _WCHAR_IS_8BIT
     13 #include <wchar.h>
     14 
     15 #define CONCAT(x,y) CONCAT_(x,y)
     16 #define CONCAT_(x,y) x ## y
     17 
     18 #define STATIC_ASSERT(condition) \
     19   static char CONCAT(dummy_,__LINE__)[1 - 2*(!(condition))];
     20 
     21 #if defined(__arm__) || __ANDROID_API__ < 9
     22 STATIC_ASSERT(sizeof(__WCHAR_TYPE__) == 1);
     23 #else
     24 STATIC_ASSERT(sizeof(__WCHAR_TYPE__) == 4);
     25 #endif
     26 
     27 // wchar_t is never redefined by <stddef.h> because it's a C++ keyword,
     28 // unlike in C.
     29 STATIC_ASSERT(sizeof(wchar_t) == 4);
     30 
     31 // This is C++ code but __STDC_LIMIT_MACROS was defined, and
     32 // _WCHAR_IS_8BIT is defined, so the values are always 32-bit signed.
     33 STATIC_ASSERT(WCHAR_MIN == 0x80000000);
     34 STATIC_ASSERT(WCHAR_MAX == 0x7fffffff);
     35 
     36 #endif