public inbox for libstdc++-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc(refs/users/aoliva/heads/testme)] don't use wchar_t as default in locale_conv if wchar_t is not in use
@ 2021-01-14 22:27 Alexandre Oliva
  0 siblings, 0 replies; 2+ messages in thread
From: Alexandre Oliva @ 2021-01-14 22:27 UTC (permalink / raw)
  To: gcc-cvs, libstdc++-cvs

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


^ permalink raw reply	[flat|nested] 2+ messages in thread

* [gcc(refs/users/aoliva/heads/testme)] don't use wchar_t as default in locale_conv if wchar_t is not in use
@ 2021-01-15 16:37 Alexandre Oliva
  0 siblings, 0 replies; 2+ messages in thread
From: Alexandre Oliva @ 2021-01-15 16:37 UTC (permalink / raw)
  To: gcc-cvs, libstdc++-cvs

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

commit d5c67fae7aea2627cf1aa64f0f7d73547b34e2b7
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


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-01-15 16:37 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-14 22:27 [gcc(refs/users/aoliva/heads/testme)] don't use wchar_t as default in locale_conv if wchar_t is not in use Alexandre Oliva
2021-01-15 16:37 Alexandre Oliva

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).