diff options
author | Eric Botcazou <ebotcazou@adacore.com> | 2019-09-26 21:43:51 +0000 |
---|---|---|
committer | Eric Botcazou <ebotcazou@gcc.gnu.org> | 2019-09-26 21:43:51 +0000 |
commit | 0900e29cdbc533fecf2a311447bbde17f101bbd6 (patch) | |
tree | 99d96116ec1656e4b86de00444ee3569f3d46ba7 /gcc | |
parent | d7326aaf20871a81feb39673d78922c1bc83efec (diff) | |
download | gcc-0900e29cdbc533fecf2a311447bbde17f101bbd6.zip gcc-0900e29cdbc533fecf2a311447bbde17f101bbd6.tar.gz gcc-0900e29cdbc533fecf2a311447bbde17f101bbd6.tar.bz2 |
charset.c (UCS_LIMIT): New macro.
* charset.c (UCS_LIMIT): New macro.
(ucn_valid_in_identifier): Use it instead of a hardcoded constant.
(_cpp_valid_ucn): Issue a pedantic warning for UCNs larger than
UCS_LIMIT outside of identifiers in C and in C++2a or later.
From-SVN: r276167
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/testsuite/ChangeLog | 8 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/cpp/ucn-1.C | 2 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/cpp2a/ucn1.C | 7 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/attr-alias-5.c | 2 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/cpp/ucs.c | 6 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/cpp/utf8-5byte-1.c | 2 |
6 files changed, 23 insertions, 4 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 7cdc8f0..82607de 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,11 @@ +2019-09-26 Eric Botcazou <ebotcazou@adacore.com> + + * gcc.dg/cpp/ucs.c: Add test for new warning and adjust. + * gcc.dg/cpp/utf8-5byte-1.c: Add -w to the options. + * gcc.dg/attr-alias-5.c: Likewise. + * g++.dg/cpp/ucn-1.C: Add test for new warning. + * g++.dg/cpp2a/ucn1.C: New test. + 2019-09-26 Max Filippov <jcmvbkbc@gmail.com> * gcc.target/xtensa/pr91880.c: New test case. diff --git a/gcc/testsuite/g++.dg/cpp/ucn-1.C b/gcc/testsuite/g++.dg/cpp/ucn-1.C index d929078..9596a42 100644 --- a/gcc/testsuite/g++.dg/cpp/ucn-1.C +++ b/gcc/testsuite/g++.dg/cpp/ucn-1.C @@ -12,4 +12,6 @@ int main() int c\u0024c; // { dg-error "not valid in an identifier" "" { target { powerpc-ibm-aix* } } } U"\uD800"; // { dg-error "not a valid universal character" } + + U'\U00110000'; // { dg-warning "outside" "110000 outside UCS" { target c++2a } } } diff --git a/gcc/testsuite/g++.dg/cpp2a/ucn1.C b/gcc/testsuite/g++.dg/cpp2a/ucn1.C new file mode 100644 index 0000000..e73c77d --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp2a/ucn1.C @@ -0,0 +1,7 @@ +// { dg-do compile } +// { dg-options "-std=c++2a" } + +int main() +{ + U'\U00110000'; // { dg-warning "outside" "110000 outside UCS" } +} diff --git a/gcc/testsuite/gcc.dg/attr-alias-5.c b/gcc/testsuite/gcc.dg/attr-alias-5.c index 91e63f8..a65fe0b 100644 --- a/gcc/testsuite/gcc.dg/attr-alias-5.c +++ b/gcc/testsuite/gcc.dg/attr-alias-5.c @@ -1,7 +1,7 @@ /* Verify diagnostics for aliases to strings containing extended identifiers or bad characters. */ /* { dg-do compile } */ -/* { dg-options "-std=gnu99" } */ +/* { dg-options "-std=gnu99 -w" } */ /* { dg-require-alias "" } */ /* { dg-require-ascii-locale "" } */ /* { dg-skip-if "" { powerpc*-*-aix* } } */ diff --git a/gcc/testsuite/gcc.dg/cpp/ucs.c b/gcc/testsuite/gcc.dg/cpp/ucs.c index 4f76fa9..cac83f3 100644 --- a/gcc/testsuite/gcc.dg/cpp/ucs.c +++ b/gcc/testsuite/gcc.dg/cpp/ucs.c @@ -39,7 +39,7 @@ #endif #if WCHAR_MAX >= 0x7ffffff -# if L'\U1234abcd' != 0x1234abcd +# if L'\U1234abcd' != 0x1234abcd /* { dg-warning "outside" "" } */ # error bad long ucs /* { dg-bogus "bad" "bad U1234abcd evaluation" } */ # endif #endif @@ -49,7 +49,7 @@ void foo () int c; c = L'\ubad'; /* { dg-error "incomplete" "incomplete UCN 1" } */ - c = L"\U1234"[0]; /* { dg-error "incomplete" "incompete UCN 2" } */ + c = L"\U1234"[0]; /* { dg-error "incomplete" "incomplete UCN 2" } */ c = L'\u000x'; /* { dg-error "incomplete" "non-hex digit in UCN" } */ /* If sizeof(HOST_WIDE_INT) > sizeof(wchar_t), we can get a multi-character @@ -64,4 +64,6 @@ void foo () c = '\u0025'; /* { dg-error "not a valid" "0025 invalid UCN" } */ c = L"\uD800"[0]; /* { dg-error "not a valid" "D800 invalid UCN" } */ c = L'\U0000DFFF'; /* { dg-error "not a valid" "DFFF invalid UCN" } */ + + c = L'\U00110000'; /* { dg-warning "outside" "110000 outside UCS" } */ } diff --git a/gcc/testsuite/gcc.dg/cpp/utf8-5byte-1.c b/gcc/testsuite/gcc.dg/cpp/utf8-5byte-1.c index 7f96a56..50e6c05 100644 --- a/gcc/testsuite/gcc.dg/cpp/utf8-5byte-1.c +++ b/gcc/testsuite/gcc.dg/cpp/utf8-5byte-1.c @@ -1,7 +1,7 @@ /* Test for bug in conversions from 5-byte UTF-8 sequences in cpplib. */ /* { dg-do run { target { 4byte_wchar_t } } } */ -/* { dg-options "-std=gnu99" } */ +/* { dg-options "-std=gnu99 -w" } */ extern void abort (void); extern void exit (int); |