From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2181) id 965303857805; Sat, 9 Oct 2021 00:15:22 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 965303857805 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Jonathan Wakely To: gcc-cvs@gcc.gnu.org, libstdc++-cvs@gcc.gnu.org Subject: [gcc r12-4265] libstdc++: Enable type traits for wchar_t unconditionally [PR98725] X-Act-Checkin: gcc X-Git-Author: Jonathan Wakely X-Git-Refname: refs/heads/master X-Git-Oldrev: 4997c8b30ecfc82f9e6ce874cbd3840e227522eb X-Git-Newrev: 4bdb9d618d30fc33d7eaab374baf377fa4e9d955 Message-Id: <20211009001522.965303857805@sourceware.org> Date: Sat, 9 Oct 2021 00:15:22 +0000 (GMT) X-BeenThere: libstdc++-cvs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libstdc++-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 09 Oct 2021 00:15:22 -0000 https://gcc.gnu.org/g:4bdb9d618d30fc33d7eaab374baf377fa4e9d955 commit r12-4265-g4bdb9d618d30fc33d7eaab374baf377fa4e9d955 Author: Jonathan Wakely Date: Fri Oct 8 14:52:07 2021 +0100 libstdc++: Enable type traits for wchar_t unconditionally [PR98725] 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): Define specialization. * include/std/type_traits (__make_signed) (__make_unsigned): Remove redundant check for __WCHAR_TYPE__ being defined. * include/tr1/type_traits [!_GLIBCXX_USE_WCHAR_T] (__is_integral_helper): Likewise. Diff: --- libstdc++-v3/include/c_global/cstddef | 2 -- libstdc++-v3/include/std/type_traits | 8 +------- libstdc++-v3/include/tr1/type_traits | 2 -- 3 files changed, 1 insertion(+), 11 deletions(-) diff --git a/libstdc++-v3/include/c_global/cstddef b/libstdc++-v3/include/c_global/cstddef index 13ef7f03c12..a96319e31ef 100644 --- a/libstdc++-v3/include/c_global/cstddef +++ b/libstdc++-v3/include/c_global/cstddef @@ -73,9 +73,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION template<> struct __byte_operand { using __type = byte; }; template<> struct __byte_operand { using __type = byte; }; template<> struct __byte_operand { using __type = byte; }; -#ifdef _GLIBCXX_USE_WCHAR_T template<> struct __byte_operand { using __type = byte; }; -#endif #ifdef _GLIBCXX_USE_CHAR8_T template<> struct __byte_operand { using __type = byte; }; #endif diff --git a/libstdc++-v3/include/std/type_traits b/libstdc++-v3/include/std/type_traits index 35ff5806c5d..d3693b1069e 100644 --- a/libstdc++-v3/include/std/type_traits +++ b/libstdc++-v3/include/std/type_traits @@ -309,12 +309,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION // We want is_integral to be true (and make_signed/unsigned to work) // even when libc doesn't provide working 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 : 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 { using __type = typename __make_unsigned_selector::__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 { using __type = typename __make_signed_selector::__type; }; -#endif #if defined(_GLIBCXX_USE_CHAR8_T) template<> diff --git a/libstdc++-v3/include/tr1/type_traits b/libstdc++-v3/include/tr1/type_traits index e62369c9f4c..16d7e338bfe 100644 --- a/libstdc++-v3/include/tr1/type_traits +++ b/libstdc++-v3/include/tr1/type_traits @@ -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)