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_MIN/WCHAR_MAX to 32-bit values.
      7 #define __STDC_LIMIT_MACROS
      8 // Force wchar_t to be 8 bits.
      9 #define _WCHAR_IS_8BIT
     10 #include <wchar.h>
     11 
     12 #if defined(__arm__) && __ANDROID_API__ != 3
     13 #error "You should target API level 3 when compiling this file!"
     14 #endif
     15 
     16 #define CONCAT(x,y) CONCAT_(x,y)
     17 #define CONCAT_(x,y) x ## y
     18 
     19 #define STATIC_ASSERT(condition) \
     20   static char CONCAT(dummy_,__LINE__)[1 - 2*(!(condition))];
     21 
     22 #ifdef __arm__
     23 STATIC_ASSERT(sizeof(__WCHAR_TYPE__) == 1);
     24 #else
     25 STATIC_ASSERT(sizeof(__WCHAR_TYPE__) == 4);
     26 #endif
     27 
     28 // wchar_t is never redefined by <stddef.h> because it's a C++ keyword,
     29 // unlike in C.
     30 STATIC_ASSERT(sizeof(wchar_t) == 4);
     31 
     32 // This is C++ code but __STDC_LIMIT_MACROS was defined, and
     33 // _WCHAR_IS_8BIT is defined, so the values are always 32-bit signed.
     34 STATIC_ASSERT(WCHAR_MIN == 0x80000000);
     35 STATIC_ASSERT(WCHAR_MAX == 0x7fffffff);
     36