Mercurial > hg > CbC > CbC_gcc
comparison gcc/testsuite/gcc.dg/cpp/ucs.c @ 145:1830386684a0
gcc-9.2.0
author | anatofuz |
---|---|
date | Thu, 13 Feb 2020 11:34:05 +0900 |
parents | 04ced10e8804 |
children |
comparison
equal
deleted
inserted
replaced
131:84e7813d76e9 | 145:1830386684a0 |
---|---|
14 #define int +0 | 14 #define int +0 |
15 #define char +1 | 15 #define char +1 |
16 #define short +2 | 16 #define short +2 |
17 #define long +3 | 17 #define long +3 |
18 | 18 |
19 #if !defined(WCHAR_MAX) | |
20 | |
19 #if __WCHAR_TYPE__ == 0 | 21 #if __WCHAR_TYPE__ == 0 |
20 # define WCHAR_MAX INT_MAX | 22 # define WCHAR_MAX INT_MAX |
21 #elif __WCHAR_TYPE__ == 1 | 23 #elif __WCHAR_TYPE__ == 1 |
22 # define WCHAR_MAX CHAR_MAX | 24 # define WCHAR_MAX CHAR_MAX |
23 #elif __WCHAR_TYPE__ == 2 | 25 #elif __WCHAR_TYPE__ == 2 |
24 # define WCHAR_MAX SHRT_MAX | 26 # define WCHAR_MAX SHRT_MAX |
25 #elif __WCHAR_TYPE__ == 3 | 27 #elif __WCHAR_TYPE__ == 3 |
26 # define WCHAR_MAX LONG_MAX | 28 # define WCHAR_MAX LONG_MAX |
27 #else | 29 #else |
28 # error wacky wchar_t | 30 # error wacky wchar_t |
31 #endif | |
32 | |
29 #endif | 33 #endif |
30 | 34 |
31 #undef unsigned | 35 #undef unsigned |
32 #undef int | 36 #undef int |
33 #undef char | 37 #undef char |
37 #if L'\u1234' != 0x1234 | 41 #if L'\u1234' != 0x1234 |
38 #error bad short ucs /* { dg-bogus "bad" "bad u1234 evaluation" } */ | 42 #error bad short ucs /* { dg-bogus "bad" "bad u1234 evaluation" } */ |
39 #endif | 43 #endif |
40 | 44 |
41 #if WCHAR_MAX >= 0x7ffffff | 45 #if WCHAR_MAX >= 0x7ffffff |
42 # if L'\U1234abcd' != 0x1234abcd | 46 # if L'\U1234abcd' != 0x1234abcd /* { dg-warning "outside" "" } */ |
43 # error bad long ucs /* { dg-bogus "bad" "bad U1234abcd evaluation" } */ | 47 # error bad long ucs /* { dg-bogus "bad" "bad U1234abcd evaluation" } */ |
44 # endif | 48 # endif |
45 #endif | 49 #endif |
46 | 50 |
47 void foo () | 51 void foo () |
48 { | 52 { |
49 int c; | 53 int c; |
50 | 54 |
51 c = L'\ubad'; /* { dg-error "incomplete" "incomplete UCN 1" } */ | 55 c = L'\ubad'; /* { dg-error "incomplete" "incomplete UCN 1" } */ |
52 c = L"\U1234"[0]; /* { dg-error "incomplete" "incompete UCN 2" } */ | 56 c = L"\U1234"[0]; /* { dg-error "incomplete" "incomplete UCN 2" } */ |
53 | 57 |
54 c = L'\u000x'; /* { dg-error "incomplete" "non-hex digit in UCN" } */ | 58 c = L'\u000x'; /* { dg-error "incomplete" "non-hex digit in UCN" } */ |
55 /* If sizeof(HOST_WIDE_INT) > sizeof(wchar_t), we can get a multi-character | 59 /* If sizeof(HOST_WIDE_INT) > sizeof(wchar_t), we can get a multi-character |
56 constant warning even for wide characters. */ | 60 constant warning even for wide characters. */ |
57 /* { dg-warning "too long|multi-character" "" { target *-*-* } .-3 } */ | 61 /* { dg-warning "too long|multi-character" "" { target *-*-* } .-3 } */ |
62 c = '\U00000060'; /* { dg-bogus "invalid" "0060 is a valid UCN" } */ | 66 c = '\U00000060'; /* { dg-bogus "invalid" "0060 is a valid UCN" } */ |
63 | 67 |
64 c = '\u0025'; /* { dg-error "not a valid" "0025 invalid UCN" } */ | 68 c = '\u0025'; /* { dg-error "not a valid" "0025 invalid UCN" } */ |
65 c = L"\uD800"[0]; /* { dg-error "not a valid" "D800 invalid UCN" } */ | 69 c = L"\uD800"[0]; /* { dg-error "not a valid" "D800 invalid UCN" } */ |
66 c = L'\U0000DFFF'; /* { dg-error "not a valid" "DFFF invalid UCN" } */ | 70 c = L'\U0000DFFF'; /* { dg-error "not a valid" "DFFF invalid UCN" } */ |
71 | |
72 c = L'\U00110000'; /* { dg-warning "outside" "110000 outside UCS" } */ | |
67 } | 73 } |