From patchwork Sat Oct 9 00:13:48 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Wakely X-Patchwork-Id: 46021 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 964F43858038 for ; Sat, 9 Oct 2021 00:15:24 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 964F43858038 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1633738524; bh=QE2m/qQH4gUYRYTPsLQzSEV9H1JAbBHJ1sy5rOQKYqQ=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=JlJTLKKx1iC/xqWpe6Mn1WARbP+EauYN6WtpGJA6NK6OGs752YNtvWZ1cJYpeNkEE wpzRmLjVZFlHTfq6/yBLaceqF7CfpcxlP1+G2Yv2sduLX3E8g5ct0fXZR5/7B8rh7y 2dCiw0UklEIe9A5JFhe03c1FCTjac2gOtNi2WnDk= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTP id 9C91F385840C for ; Sat, 9 Oct 2021 00:13:59 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 9C91F385840C Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-176-4hnmAmkyO8irBLcesjsxRQ-1; Fri, 08 Oct 2021 20:13:58 -0400 X-MC-Unique: 4hnmAmkyO8irBLcesjsxRQ-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 855FB10A8E01; Sat, 9 Oct 2021 00:13:57 +0000 (UTC) Received: from localhost (unknown [10.33.37.44]) by smtp.corp.redhat.com (Postfix) with ESMTP id 33DE45D9DE; Sat, 9 Oct 2021 00:13:57 +0000 (UTC) To: libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org Subject: [PATCH 5/8] libstdc++: Enable type traits for wchar_t unconditionally [PR98725] Date: Sat, 9 Oct 2021 01:13:48 +0100 Message-Id: <20211009001351.659647-5-jwakely@redhat.com> In-Reply-To: <20211009001351.659647-1-jwakely@redhat.com> References: <20211009001351.659647-1-jwakely@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-13.8 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Jonathan Wakely via Gcc-patches From: Jonathan Wakely Reply-To: Jonathan Wakely Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" 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. --- 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)