This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH][libstdc++][Testsuite] isctype test fails for newlib.
- From: Matthew Wahab <matthew dot wahab at arm dot com>
- To: gcc-patches <gcc-patches at gcc dot gnu dot org>
- Cc: libstdc++ <libstdc++ at gcc dot gnu dot org>, Jonathan Wakely <jwakely dot gcc at gmail dot com>
- Date: Mon, 09 Feb 2015 17:50:07 +0000
- Subject: Re: [PATCH][libstdc++][Testsuite] isctype test fails for newlib.
- Authentication-results: sourceware.org; auth=none
- References: <54CF9C84 dot 4020706 at arm dot com> <54CFA31F dot 9020601 at oracle dot com> <CAH6eHdQNytx0NCcZEPUBorenk+f=8BE86BSGiJ7=FpXZFYuL3A at mail dot gmail dot com> <54D0A034 dot 1040306 at arm dot com> <54D0A291 dot 4010702 at oracle dot com> <54D0A5B1 dot 2000806 at arm dot com> <CAH6eHdT2O7rqKPG+auYPPeRmEZsorteub3vgazHpnti3DVdapQ at mail dot gmail dot com> <54D8992B dot 6060707 at arm dot com> <alpine dot BSF dot 2 dot 02 dot 1502090812040 dot 67721 at arjuna dot pair dot com>
On 09/02/15 13:18, Hans-Peter Nilsson wrote:
On Mon, 9 Feb 2015, Matthew Wahab wrote:
On 07/02/15 00:11, Jonathan Wakely wrote:
Any idea why HP still sees the tests fail? See comment 8 at
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64467#c8
It looks like he's found the problem: that _NEWLIB_ is a recent addition that
isn't in the version he's using. I'll try replacing _NEWLIB_ with
_NEWLIB_VERSION_ as suggested.
(Careful with that macro spelling, if nothing else.)
Better to use existing mechanisms and stop playing with
target-related macros. Add this at the top (see other
placements of dg-options) and replace "#if defined (__NEWLIB__)"
with "#ifdef NEWLINE_IN_CLASS_BLANK":
// { dg-options "-DNEWLINE_IN_CLASS_BLANK" { target newlib } }
Attached a patch to replace the test for macro __NEWLIB__ with a test
for macro NEWLINE_IN_CLASS_BLANK, defined by
{ dg-additional-options "-DNEWLINE_IN_CLASS_BLANK" { target newlib } }
Tested with check-target-libstdc++-v3, with the modified tests, for
arm-none-eabi and aarch64-none-linux-gnu.
Does this look ok to commit?
Matthew
libstdc++-v3/testsuite/
2015-02-09 Matthew Wahab <matthew.wahab@arm.com>
* 28_regex/traits/char/isctype.cc (test01): Replace test
for __NEWLIB__ macro with a dejagnu set macro.
* 28_regex/traits/wchar_t/isctype.cc (test01): Likewise.
diff --git a/libstdc++-v3/testsuite/28_regex/traits/char/isctype.cc b/libstdc++-v3/testsuite/28_regex/traits/char/isctype.cc
index 7c47045..b6fd6ff 100644
--- a/libstdc++-v3/testsuite/28_regex/traits/char/isctype.cc
+++ b/libstdc++-v3/testsuite/28_regex/traits/char/isctype.cc
@@ -1,5 +1,6 @@
// { dg-do run }
// { dg-options "-std=gnu++11" }
+// { dg-additional-options "-DNEWLINE_IN_CLASS_BLANK" { target newlib } }
//
// 2010-06-23 Stephen M. Webb <stephen.webb@bregmasoft.ca>
@@ -53,8 +54,8 @@ test01()
VERIFY(!t.isctype('_', t.lookup_classname(range(digit))));
VERIFY( t.isctype(' ', t.lookup_classname(range(blank))));
VERIFY( t.isctype('\t', t.lookup_classname(range(blank))));
-#if defined (__NEWLIB__)
- /* newlib includes '\n' in class 'blank'.
+#if defined (NEWLINE_IN_CLASS_BLANK)
+ /* On some targets, '\n' is in class 'blank'.
See https://gcc.gnu.org/ml/gcc-patches/2015-02/msg00059.html. */
VERIFY( t.isctype('\n', t.lookup_classname(range(blank))));
#else
diff --git a/libstdc++-v3/testsuite/28_regex/traits/wchar_t/isctype.cc b/libstdc++-v3/testsuite/28_regex/traits/wchar_t/isctype.cc
index 1b3d69a..9ba609c 100644
--- a/libstdc++-v3/testsuite/28_regex/traits/wchar_t/isctype.cc
+++ b/libstdc++-v3/testsuite/28_regex/traits/wchar_t/isctype.cc
@@ -1,5 +1,6 @@
// { dg-do run }
// { dg-options "-std=gnu++11" }
+// { dg-additional-options "-DNEWLINE_IN_CLASS_BLANK" { target newlib } }
// Copyright (C) 2010-2015 Free Software Foundation, Inc.
//
@@ -51,7 +52,7 @@ test01()
VERIFY( t.isctype(L' ', t.lookup_classname(range(blank))));
VERIFY( t.isctype(L'\t', t.lookup_classname(range(blank))));
#if defined (__NEWLIB__)
- /* newlib includes '\n' in class 'blank'.
+ /* On some targets, '\n' is in class 'blank'.
See https://gcc.gnu.org/ml/gcc-patches/2015-02/msg00059.html. */
VERIFY( t.isctype(L'\n', t.lookup_classname(range(blank))));
#else