• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // This checks that, by default, wchar_t is 32-bit and
2 // WCHAR_MIN/WCHAR_MAX are 32-bit signed on all platforms except ARM.
3 #include <android/api-level.h>
4 #include <wchar.h>
5 
6 #if defined(__arm__) && __ANDROID_API__ != 3
7 #error "You should target API level 3 when compiling this file!"
8 #endif
9 
10 #define CONCAT(x,y) CONCAT_(x,y)
11 #define CONCAT_(x,y) x ## y
12 
13 #define STATIC_ASSERT(condition) \
14   static char CONCAT(dummy_,__LINE__)[1 - 2*(!(condition))];
15 
16 STATIC_ASSERT(sizeof(wchar_t) == 4);
17 
18 #ifdef __arm__
19 STATIC_ASSERT(WCHAR_MIN == 0U);
20 STATIC_ASSERT(WCHAR_MAX == 2*2147483647U + 1U);
21 #else
22 STATIC_ASSERT(WCHAR_MIN == -1-2147483647);
23 STATIC_ASSERT(WCHAR_MAX == 2147483647);
24 #endif
25