Home | History | Annotate | Download | only in jni
      1 // This checks that simply including <wchar.h> with
      2 // _WCHAR_IS_8BIT defined will provice an 8-bit wchar_t
      3 // and 8-bit WCHAR_MIN/WCHAR_MAX.
      4 #include <android/api-level.h>
      5 
      6 // Force wchar_t to be 8 bits.
      7 #define _WCHAR_IS_8BIT
      8 #include <wchar.h>
      9 
     10 #if defined(__arm__) && __ANDROID_API__ != 3
     11 #error "You should target API level 3 when compiling this file!"
     12 #endif
     13 
     14 #define CONCAT(x,y) CONCAT_(x,y)
     15 #define CONCAT_(x,y) x ## y
     16 
     17 #define STATIC_ASSERT(condition) \
     18   static char CONCAT(dummy_,__LINE__)[1 - 2*(!(condition))];
     19 
     20 #ifdef __arm__
     21 STATIC_ASSERT(sizeof(__WCHAR_TYPE__) == 1);
     22 STATIC_ASSERT(sizeof(wchar_t) == 1);
     23 #else
     24 STATIC_ASSERT(sizeof(__WCHAR_TYPE__) == 4);
     25 STATIC_ASSERT(sizeof(wchar_t) == 4);
     26 #endif
     27 
     28 // Since this is C code, the old behaviour was to always define
     29 // these constants as signed 32 bit values.
     30 STATIC_ASSERT(WCHAR_MIN == 0x80000000);
     31 STATIC_ASSERT(WCHAR_MAX == 0x7fffffff);
     32