aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.apple/inttypes-wchar-2.c
blob: 0021b3dc0fca5cf56884e33b0a5998752d167340 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
/* APPLE LOCAL file test that the definition of wchar_t in
   inttypes.h gives sizeof(wchar_t) == 2 when using -fshort-wchar. */

/* { dg-do run } */
/* { dg-options "-Wall -W -fshort-wchar" } */

#include <inttypes.h>
#include <stdint.h>

/* Verify that WCHAR_MAX is the largest unsigned 16-bit integer. */
#if WCHAR_MAX != 0xffffU
#  error WCHAR_MAX has incorrect value
#endif

/* Verify that WCHAR_MIN is 0 */
#if WCHAR_MIN != 0
#  error WCHAR_MIN has incorrect value
#endif

int dummy1[3 - sizeof(wchar_t)] = { 0 };
int dummy2[sizeof(wchar_t) - 1] = { 0 };

int main ()
{
  return (sizeof(wchar_t) == 2) ? 0 : 1;
}