diff options
Diffstat (limited to 'gcc/testsuite/gcc.apple/inttypes-wchar-2.c')
-rw-r--r-- | gcc/testsuite/gcc.apple/inttypes-wchar-2.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.apple/inttypes-wchar-2.c b/gcc/testsuite/gcc.apple/inttypes-wchar-2.c new file mode 100644 index 00000000000..0021b3dc0fc --- /dev/null +++ b/gcc/testsuite/gcc.apple/inttypes-wchar-2.c @@ -0,0 +1,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; +} |