From ab1cde2399826caa3373eb981bad8b5cdbb57ee5 Mon Sep 17 00:00:00 2001 From: Danny Smith Date: Tue, 6 May 2008 02:59:12 +0000 Subject: [PATCH] target_supports.exp (check_effective_target_4byte_wchar_t): New proc. * lib/target_supports.exp (check_effective_target_4byte_wchar_t): New proc. * gcc.dg/utf16-4.c: Use it. * gcc.dg/utf32-4.c: Use it. * g++.dg/ext/utf16-4.C: Use it. * gcc.dg/ext/utf32-4.C: Use it. From-SVN: r134971 --- gcc/testsuite/ChangeLog | 9 +++++++++ gcc/testsuite/g++.dg/ext/utf16-4.C | 4 ++-- gcc/testsuite/g++.dg/ext/utf32-4.C | 2 +- gcc/testsuite/gcc.dg/utf16-4.c | 3 ++- gcc/testsuite/gcc.dg/utf32-4.c | 2 +- gcc/testsuite/lib/target-supports.exp | 8 ++++++++ 6 files changed, 23 insertions(+), 5 deletions(-) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index a27c269da3d..9adb755b600 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,12 @@ +2008-05-06 Danny Smith + + * lib/target_supports.exp (check_effective_target_4byte_wchar_t): + New proc. + * gcc.dg/utf16-4.c: Use it. + * gcc.dg/utf32-4.c: Use it. + * g++.dg/ext/utf16-4.C: Use it. + * gcc.dg/ext/utf32-4.C: Use it. + 2008-05-05 Danny Smith * gfortran.dg/dev_null.f90. Remove and replace with... diff --git a/gcc/testsuite/g++.dg/ext/utf16-4.C b/gcc/testsuite/g++.dg/ext/utf16-4.C index 0fb7459c21e..21cdb53bdeb 100644 --- a/gcc/testsuite/g++.dg/ext/utf16-4.C +++ b/gcc/testsuite/g++.dg/ext/utf16-4.C @@ -13,6 +13,6 @@ const static char16_t c5 = U'\u2029'; const static char16_t c6 = U'\U00064321'; /* { dg-warning "implicitly truncated" } */ const static char16_t c7 = L'a'; const static char16_t c8 = L'\u2029'; -const static char16_t c9 = L'\U00064321'; /* { dg-warning "implicitly truncated" } */ - +const static char16_t c9 = L'\U00064321'; /* { dg-warning "implicitly truncated" "" { target { 4byte_wchar_t } } 16 } */ + /* { dg-warning "constant too long" "" { target { ! 4byte_wchar_t } } 16 } */ int main () {} diff --git a/gcc/testsuite/g++.dg/ext/utf32-4.C b/gcc/testsuite/g++.dg/ext/utf32-4.C index af2fa8db1b1..5da2e822702 100644 --- a/gcc/testsuite/g++.dg/ext/utf32-4.C +++ b/gcc/testsuite/g++.dg/ext/utf32-4.C @@ -13,6 +13,6 @@ const static char32_t c5 = u'\u2029'; const static char32_t c6 = u'\U00064321'; /* { dg-warning "constant too long" } */ const static char32_t c7 = L'a'; const static char32_t c8 = L'\u2029'; -const static char32_t c9 = L'\U00064321'; +const static char32_t c9 = L'\U00064321'; /* { dg-warning "constant too long" { target { ! 4byte_wchar_t } } } */ int main () {} diff --git a/gcc/testsuite/gcc.dg/utf16-4.c b/gcc/testsuite/gcc.dg/utf16-4.c index 812c8d2cd4a..86597b370e1 100644 --- a/gcc/testsuite/gcc.dg/utf16-4.c +++ b/gcc/testsuite/gcc.dg/utf16-4.c @@ -15,6 +15,7 @@ char16_t c5 = U'\u2029'; char16_t c6 = U'\U00064321'; /* { dg-warning "implicitly truncated" } */ char16_t c7 = L'a'; char16_t c8 = L'\u2029'; -char16_t c9 = L'\U00064321'; /* { dg-warning "implicitly truncated" } */ +char16_t c9 = L'\U00064321'; /* { dg-warning "implicitly truncated" "" { target { 4byte_wchar_t } } 18 } */ + /* { dg-warning "constant too long" "" { target { ! 4byte_wchar_t } } 18 } */ int main () {} diff --git a/gcc/testsuite/gcc.dg/utf32-4.c b/gcc/testsuite/gcc.dg/utf32-4.c index dd05a9a6c39..48d84fd4219 100644 --- a/gcc/testsuite/gcc.dg/utf32-4.c +++ b/gcc/testsuite/gcc.dg/utf32-4.c @@ -15,6 +15,6 @@ char32_t c5 = u'\u2029'; char32_t c6 = u'\U00064321'; /* { dg-warning "constant too long" } */ char32_t c7 = L'a'; char32_t c8 = L'\u2029'; -char32_t c9 = L'\U00064321'; +char32_t c9 = L'\U00064321'; /* { dg-warning "constant too long" { target { ! 4byte_wchar_t } } } */ int main () {} diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp index 5309ee2074f..e071934a947 100644 --- a/gcc/testsuite/lib/target-supports.exp +++ b/gcc/testsuite/lib/target-supports.exp @@ -2352,3 +2352,11 @@ proc check_effective_target_c99_runtime { } { $contents [add_options_for_c99_runtime ""] }] } + +# Return 1 if target wchar_t is at least 4 bytes. + +proc check_effective_target_4byte_wchar_t { } { + return [check_no_compiler_messages 4byte_wchar_t object { + int dummy[sizeof (wchar_t) >= 4 ? 1 : -1]; + }] +} -- 2.30.2