]> gcc.gnu.org Git - gcc.git/commitdiff
libstdc++: Enable type traits for wchar_t unconditionally [PR98725]
authorJonathan Wakely <jwakely@redhat.com>
Fri, 8 Oct 2021 13:52:07 +0000 (14:52 +0100)
committerJonathan Wakely <jwakely@redhat.com>
Fri, 8 Oct 2021 23:57:49 +0000 (00:57 +0100)
None of these traits depend on libc support for wchar_t, so they should
be defined unconditionally. The wchar_t type is always defined in C++.

libstdc++-v3/ChangeLog:

PR libstdc++/98725
* include/c_global/cstddef [!_GLIBCXX_USE_WCHAR_T]
(__byte_operand<wchar_t>): Define specialization.
* include/std/type_traits (__make_signed<wchar_t>)
(__make_unsigned<wchar_t>): Remove redundant check for
__WCHAR_TYPE__ being defined.
* include/tr1/type_traits [!_GLIBCXX_USE_WCHAR_T]
(__is_integral_helper<wchar_t>): Likewise.

libstdc++-v3/include/c_global/cstddef
libstdc++-v3/include/std/type_traits
libstdc++-v3/include/tr1/type_traits

index 13ef7f03c12584804e4dd1635954723f628addc0..a96319e31ef34b8a890df7620111ddc05b89dbbc 100644 (file)
@@ -73,9 +73,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
   template<> struct __byte_operand<char> { using __type = byte; };
   template<> struct __byte_operand<signed char> { using __type = byte; };
   template<> struct __byte_operand<unsigned char> { using __type = byte; };
-#ifdef _GLIBCXX_USE_WCHAR_T
   template<> struct __byte_operand<wchar_t> { using __type = byte; };
-#endif
 #ifdef _GLIBCXX_USE_CHAR8_T
   template<> struct __byte_operand<char8_t> { using __type = byte; };
 #endif
index 35ff5806c5d47e1cc83bc60f4503b95c583c549c..d3693b1069e5f23aa6db9d84e4670a78e10ba8b9 100644 (file)
@@ -309,12 +309,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 
   // We want is_integral<wchar_t> to be true (and make_signed/unsigned to work)
   // even when libc doesn't provide working <wchar.h> and related functions,
-  // so check __WCHAR_TYPE__ instead of _GLIBCXX_USE_WCHAR_T.
-#ifdef __WCHAR_TYPE__
+  // so don't check _GLIBCXX_USE_WCHAR_T here.
   template<>
     struct __is_integral_helper<wchar_t>
     : public true_type { };
-#endif
 
 #ifdef _GLIBCXX_USE_CHAR8_T
   template<>
@@ -1828,14 +1826,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
   // neither signed integer types nor unsigned integer types, so must be
   // transformed to the unsigned integer type with the smallest rank.
   // Use the partial specialization for enumeration types to do that.
-#ifdef __WCHAR_TYPE__
   template<>
     struct __make_unsigned<wchar_t>
     {
       using __type
        = typename __make_unsigned_selector<wchar_t, false, true>::__type;
     };
-#endif
 
 #ifdef _GLIBCXX_USE_CHAR8_T
   template<>
@@ -1960,14 +1956,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
   // signed integer types nor unsigned integer types, so must be
   // transformed to the signed integer type with the smallest rank.
   // Use the partial specialization for enumeration types to do that.
-#if defined(__WCHAR_TYPE__)
   template<>
     struct __make_signed<wchar_t>
     {
       using __type
        = typename __make_signed_selector<wchar_t, false, true>::__type;
     };
-#endif
 
 #if defined(_GLIBCXX_USE_CHAR8_T)
   template<>
index e62369c9f4c80101fe66da1a3b0f02c5f6e16fe1..16d7e338bfefe7811b2ec694aea868c2481bffc6 100644 (file)
@@ -109,9 +109,7 @@ namespace tr1
   _DEFINE_SPEC(0, __is_integral_helper, char, true)
   _DEFINE_SPEC(0, __is_integral_helper, signed char, true)
   _DEFINE_SPEC(0, __is_integral_helper, unsigned char, true)
-#ifdef _GLIBCXX_USE_WCHAR_T
   _DEFINE_SPEC(0, __is_integral_helper, wchar_t, true)
-#endif
   _DEFINE_SPEC(0, __is_integral_helper, short, true)
   _DEFINE_SPEC(0, __is_integral_helper, unsigned short, true)
   _DEFINE_SPEC(0, __is_integral_helper, int, true)
This page took 0.072056 seconds and 5 git commands to generate.