public inbox for libstdc++-cvs@sourceware.org
help / color / mirror / Atom feed
From: Alexandre Oliva <aoliva@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org, libstdc++-cvs@gcc.gnu.org
Subject: [gcc(refs/users/aoliva/heads/testme)] don't use wchar_t as default in locale_conv if wchar_t is not in use
Date: Thu, 14 Jan 2021 22:27:35 +0000 (GMT)	[thread overview]
Message-ID: <20210114222735.42F4639558A4@sourceware.org> (raw)

https://gcc.gnu.org/g:d54adc3f2f72c95217cbfcae1c89fb0b1e60a320

commit d54adc3f2f72c95217cbfcae1c89fb0b1e60a320
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Thu Jan 14 19:23:22 2021 -0300

    don't use wchar_t as default in locale_conv if wchar_t is not in use

Diff:
---
 libstdc++-v3/include/bits/locale_conv.h | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/libstdc++-v3/include/bits/locale_conv.h b/libstdc++-v3/include/bits/locale_conv.h
index 0e409da9876..d8a4d0851f4 100644
--- a/libstdc++-v3/include/bits/locale_conv.h
+++ b/libstdc++-v3/include/bits/locale_conv.h
@@ -222,11 +222,17 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 #endif  // _GLIBCXX_USE_CHAR8_T
 
 #ifdef _GLIBCXX_USE_WCHAR_T
+# define _GLIBCXX_WCHAR_DEFAULT_TEMPL_ARG = wchar_t
+#else
+// wstring_convert and wbuffer_convert are still defined for targets without
+// wchar_t support, but the second template argument must be given explictly.
+# define _GLIBCXX_WCHAR_DEFAULT_TEMPL_ARG
+#endif
 
 _GLIBCXX_BEGIN_NAMESPACE_CXX11
 
   /// String conversions
-  template<typename _Codecvt, typename _Elem = wchar_t,
+  template<typename _Codecvt, typename _Elem _GLIBCXX_WCHAR_DEFAULT_TEMPL_ARG,
 	   typename _Wide_alloc = allocator<_Elem>,
 	   typename _Byte_alloc = allocator<char>>
     class wstring_convert
@@ -382,7 +388,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11
 _GLIBCXX_END_NAMESPACE_CXX11
 
   /// Buffer conversions
-  template<typename _Codecvt, typename _Elem = wchar_t,
+  template<typename _Codecvt, typename _Elem _GLIBCXX_WCHAR_DEFAULT_TEMPL_ARG,
 	   typename _Tr = char_traits<_Elem>>
     class wbuffer_convert : public basic_streambuf<_Elem, _Tr>
     {
@@ -606,8 +612,6 @@ _GLIBCXX_END_NAMESPACE_CXX11
       bool			_M_always_noconv;
     };
 
-#endif  // _GLIBCXX_USE_WCHAR_T
-
   /// @} group locales
 
 _GLIBCXX_END_NAMESPACE_VERSION


             reply	other threads:[~2021-01-14 22:27 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-14 22:27 Alexandre Oliva [this message]
2021-01-15 16:37 Alexandre Oliva

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=20210114222735.42F4639558A4@sourceware.org \
    --to=aoliva@gcc.gnu.org \
    --cc=gcc-cvs@gcc.gnu.org \
    --cc=libstdc++-cvs@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).