public inbox for libstdc++@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jonathan Wakely <jwakely.gcc@gmail.com>
To: Alexandre Oliva <oliva@adacore.com>
Cc: Jonathan Wakely <jwakely@redhat.com>,
	"libstdc++" <libstdc++@gcc.gnu.org>,
	gcc-patches@gcc.gnu.org, Corentin Gay <gay@adacore.com>
Subject: Re: Add dg-require-wchars to libstdc++ testsuite
Date: Fri, 15 Jan 2021 10:09:46 +0000	[thread overview]
Message-ID: <CAH6eHdRF64DBGsB-3bRa44mg2j5rxRO-EzqYs0TJNFNTrNmBiA@mail.gmail.com> (raw)
In-Reply-To: <orh7nji2ip.fsf@lxoliva.fsfla.org>

On Thu, 14 Jan 2021, 22:22 Alexandre Oliva, <oliva@adacore.com> wrote:

> On Jan 14, 2021, Jonathan Wakely <jwakely@redhat.com> wrote:
>
> > The problem is that <bits/locale_conv.h> uses wchar_t in default
> > template arguments:
>
> > I think we should fix the header, not disable tests that don't use
> > that default template argument. The attached patch should allow you to
> > use wstring_convert and wbuffer_convert without wchar_t support. The
> > tests which instantiate it with char16_t or char32_t instead of
> > wchar_t should work with this patch, right?
>
> Thanks, I'll give it a spin.  That said, ...
>
> > <aside>
> > Is it the case that the wchar_t type is defined on this target, it's
> > just that libc doesn't have support for wcslen etc?
>
> ... it is definitely the case that the target currently defines wchar_t,
> and it even offers wchar.h and a lot of (maybe all?) wcs* functions.
> This was likely not the case when the patch was first written.
>
> I'll double check whether any of the patch is still needed for current
> versions.
>
> I figured it would a waste to just discard Corentin's identification of
> testcases that failed when glibc wchar_t support was not enabled.
>

Definitely not a waste, as it's led to this discussion and plan for
improvement.



> This also means that the test results I'm going to get are likely to not
> reflect the conditions for which these patches were originally written.
>
>
> FWIW, I like very much the notion of offering a fallback wchar_t
> implementation within libstdc++-v3, so that users get the expected C++
> functionality even when libc doesn't offer it.  Even a (conditional?)
> typedef to introduce wchar_t could be there.
>
> Perhaps the test that sets or clears _GLIBCXX_USE_WCHAR_T should be used
> to decide whether or not to offer a wchar.h header in libstdc++, and
> then (pipe dream?) all other uses of this macro would be just gone?
>


That would be great. We might be able to get close even if not all the way
there. However, some small embedded systems might not want the extra
symbols for explicit instantiations of std::wstring, std::wistream in
libstdc++.so so we might want a way to suppress them (they could still
instantiate those templates implicitly by using them, we just wouldn't have
them pre-instantiated in the library).

Anyway, let's start just by making wstring_convert usable without wchar_t.

  reply	other threads:[~2021-01-15 10:09 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-22 21:12 Alexandre Oliva
2020-12-28 18:23 ` François Dumont
2021-01-13 17:29   ` Alexandre Oliva
2021-01-14 13:08     ` Jonathan Wakely
2020-12-28 18:27 ` François Dumont
2021-01-14 13:41 ` Jonathan Wakely
2021-01-14 13:47   ` Add dg-require-wchars to libstdc++ testsuite# Jonathan Wakely
2021-01-14 22:20   ` Add dg-require-wchars to libstdc++ testsuite Alexandre Oliva
2021-01-15 10:09     ` Jonathan Wakely [this message]
2021-01-15 16:18       ` Alexandre Oliva
2021-01-15 19:47         ` Jonathan Wakely
2021-10-09  7:31           ` Jonathan Wakely

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAH6eHdRF64DBGsB-3bRa44mg2j5rxRO-EzqYs0TJNFNTrNmBiA@mail.gmail.com \
    --to=jwakely.gcc@gmail.com \
    --cc=gay@adacore.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jwakely@redhat.com \
    --cc=libstdc++@gcc.gnu.org \
    --cc=oliva@adacore.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).