public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "redi at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug libstdc++/98725] New: Review what is disabled in libstdc++ by --disable-wchar_t
Date: Mon, 18 Jan 2021 11:08:10 +0000	[thread overview]
Message-ID: <bug-98725-4@http.gcc.gnu.org/bugzilla/> (raw)

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98725

            Bug ID: 98725
           Summary: Review what is disabled in libstdc++ by
                    --disable-wchar_t
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: redi at gcc dot gnu.org
  Target Milestone: ---

Currently libstdc++ guards *any* use of wchar_t with a check for
_GLIBCXX_USE_WCHAR_T. This has unfortunate consequences such as
std::wstring_convert being unusable to convert between char and char16_t (which
doesn't use wchar_t at all). That's because we do this in <bits/locale_conv.h>:

 #ifdef _GLIBCXX_USE_WCHAR_T

 _GLIBCXX_BEGIN_NAMESPACE_CXX11

   /// String conversions
   template<typename _Codecvt, typename _Elem = wchar_t,
           typename _Wide_alloc = allocator<_Elem>,
           typename _Byte_alloc = allocator<char>>
     class wstring_convert


The wchar_t type exists unconditionally for C++, so traits like
std::is_integral_v<wchar_t> are already always defined as true.
std::char_traits<wchar_t> also works, by using the primary template (which
works for any character-like type). That means that even std::wstring works,
albeit slower than if we had optimized support for <wchar.h> in libc.

The consequences of --disable-wchar_t (whether implicit or explicit) should to
disable explicit instantiations for std::wstring, std::wifstream etc. and to
disable wchar_t support in locales and std::filesystem. It doesn't need to
disable everything that refers to wchar_t.

             reply	other threads:[~2021-01-18 11:08 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-18 11:08 redi at gcc dot gnu.org [this message]
2021-01-18 14:23 ` [Bug libstdc++/98725] " cvs-commit at gcc dot gnu.org
2021-01-18 14:24 ` redi at gcc dot gnu.org
2021-04-19 10:40 ` redi at gcc dot gnu.org
2021-10-08 12:03 ` redi at gcc dot gnu.org
2021-10-08 14:08 ` redi at gcc dot gnu.org
2021-10-08 14:48 ` redi at gcc dot gnu.org
2021-10-08 14:51 ` cvs-commit at gcc dot gnu.org
2021-10-08 19:12 ` redi at gcc dot gnu.org
2021-10-08 23:31 ` redi at gcc dot gnu.org
2021-10-09  0:15 ` cvs-commit at gcc dot gnu.org
2021-10-09  0:15 ` cvs-commit at gcc dot gnu.org
2021-10-09  0:15 ` cvs-commit at gcc dot gnu.org
2021-10-09  0:15 ` cvs-commit at gcc dot gnu.org
2021-10-09  0:15 ` cvs-commit at gcc dot gnu.org
2021-10-09  0:15 ` cvs-commit at gcc dot gnu.org
2021-10-09  0:16 ` redi at gcc dot gnu.org
2021-11-24 11:51 ` cvs-commit at gcc dot gnu.org

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=bug-98725-4@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /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).