OSDN Git Service

* gcc.dg/cpp/ucs.c: Adjust expected warning for 64-bit hosts.
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gcc.dg / cpp / ucs.c
1 /* Copyright (C) 2001 Free Software Foundation, Inc.  */
2
3 /* { dg-do compile } */
4 /* { dg-options "-std=c99" } */
5
6 /* This tests universal character sequences.
7
8    Neil Booth, 22 May 2001.  */
9
10 #if L'\u1234' != 0x1234
11 #error bad short ucs    /* { dg-bogus "bad" "bad \u1234 evaluation" } */
12 #endif
13 #if L'\U1234abcd' != 0x1234abcd
14 #error bad long ucs     /* { dg-bogus "bad" "bad \U1234abcd evaluation" } */
15 #endif
16
17 void foo ()
18 {
19   int c;
20
21   c = L'\ubad';         /* { dg-error "incomplete" "incompete UCN 1" } */
22   c = L"\U1234"[0];     /* { dg-error "incomplete" "incompete UCN 2" } */
23
24   c = L'\u000x';        /* { dg-error "non-hex" "non-hex digit in UCN" } */
25   /* If sizeof(HOST_WIDE_INT) > sizeof(wchar_t), we can get a multi-character
26      constant warning even for wide characters.  */
27   /* { dg-warning "too long|multi-character" "" { target *-*-* } 24 } */
28
29   c = '\u0024';         /* { dg-bogus "invalid" "0024 is a valid UCN" } */
30   c = "\u0040"[0];      /* { dg-bogus "invalid" "0040 is a valid UCN" } */
31   c = '\u00a0';         /* { dg-bogus "invalid" "00a0 is a valid UCN" } */
32   c = '\U00000060';     /* { dg-bogus "invalid" "0060 is a valid UCN" } */
33
34   c = '\u0025';         /* { dg-error "range" "0025 is an invalid UCN" } */
35   c = L"\uD800"[0];     /* { dg-error "range" "D800 is an invalid UCN" } */
36   c = L'\U0000DFFF';    /* { dg-error "range" "DFFF is an invalid UCN" } */
37 }