From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id EF37F3858C20 for ; Tue, 8 Aug 2023 20:35:32 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org EF37F3858C20 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1691526932; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=MS5EJRenT+PBRNR33lwwYew50iOlJ0FWoihi1cI7MLg=; b=Il2Jz6R303uIWqRZHzNeuRfuURdo6ZogZnGfvfB8/BjUZof5NfFMPLjOPrEVcv03tMKfTn jQ6r5LP9T70kaEmD5m0SnVddUYWlC6mqniibtRTX9y893RyFY8hxYNUcl+5IojKhQgRqE1 8LjQI6EZ6MOxIo92TP+iin2issKYnfs= Received: from mail-lf1-f69.google.com (mail-lf1-f69.google.com [209.85.167.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-681-Aj6f7isVPVmDw_Rru8nuVQ-1; Tue, 08 Aug 2023 16:35:31 -0400 X-MC-Unique: Aj6f7isVPVmDw_Rru8nuVQ-1 Received: by mail-lf1-f69.google.com with SMTP id 2adb3069b0e04-4fe21fda5e3so5858484e87.0 for ; Tue, 08 Aug 2023 13:35:30 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691526929; x=1692131729; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=MS5EJRenT+PBRNR33lwwYew50iOlJ0FWoihi1cI7MLg=; b=ST10xvX0ZUUr3yY/wmrLEfUnhQJ5gaelxpIGd5Lc/2sxOoxCSfB7eDQ+EpdFVsBY4N Q/FXLZ69c7S2AFVBoAZHmD8JvB3cZyYdJ9Y7gfGFKVE3O+A8fyWaakBEoaeJKv5BolPx OoQ+zGwMRZNB+cEp56V/QByClbCDrcDvsULggOd6e03GoDWIp7vQcydEvsiknXQxaxPr hSs2qKJiuqSoAlkBf3KPuuMGEfSpYWOBdCq2zfl85cPpYQvkSqLTrlzoSrDuJlYwY6Dn SQB4VNp3SR235dcy2Cbl3xBMTdBZ6epIejb+nm9oP2qamLimgX3F6lUsISjgKDAtLYLQ hfZQ== X-Gm-Message-State: AOJu0YyI9jr9AoFo8yCI+ktu/5UfSr7wbV3wPk7ckDt8g6rCeo2jw9oi /qIa0PeUzc8AscQMHWbK80aNEgrqlzxXhi2B/BkLupo0III3Ktjmh1N+18kITiTm5Zwojd+5mRM MDWr2OzgcRL1C9yfAZh5+Gs/yj6YNlXk= X-Received: by 2002:a2e:908e:0:b0:2b9:f007:9910 with SMTP id l14-20020a2e908e000000b002b9f0079910mr411673ljg.53.1691526929538; Tue, 08 Aug 2023 13:35:29 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHZUru9GqtwzLL4uKD+sd0SCklo1RhJD3g/+uIgO/qfsOWoxRTIRe5PzYBDfY4MyB7f0Giy1F4j6iudr/a4t2c= X-Received: by 2002:a2e:908e:0:b0:2b9:f007:9910 with SMTP id l14-20020a2e908e000000b002b9f0079910mr411663ljg.53.1691526929128; Tue, 08 Aug 2023 13:35:29 -0700 (PDT) MIME-Version: 1.0 References: <20230708051137.63707-1-kmatsui@gcc.gnu.org> <20230713023731.15571-1-kmatsui@gcc.gnu.org> <20230713023731.15571-5-kmatsui@gcc.gnu.org> In-Reply-To: <20230713023731.15571-5-kmatsui@gcc.gnu.org> From: Jonathan Wakely Date: Tue, 8 Aug 2023 21:35:18 +0100 Message-ID: Subject: Re: [PATCH v10 4/5] libstdc++: Use new built-in trait __is_function for std::is_function To: Ken Matsui Cc: gcc-patches@gcc.gnu.org, libstdc++@gcc.gnu.org X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: multipart/alternative; boundary="000000000000bd3b0f06026f4d88" X-Spam-Status: No, score=-13.5 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,HTML_MESSAGE,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE,TXREP autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: --000000000000bd3b0f06026f4d88 Content-Type: text/plain; charset="UTF-8" On Thu, 13 Jul 2023 at 03:41, Ken Matsui via Libstdc++ < libstdc++@gcc.gnu.org> wrote: > This patch gets std::is_function to dispatch to new built-in trait > __is_function. > > libstdc++-v3/ChangeLog: > > * include/std/type_traits (is_function): Use __is_function built-in > trait. > (is_function_v): Likewise. Optimize its implementation. > > Signed-off-by: Ken Matsui > OK for trunk (after the compiler change is approved). > --- > libstdc++-v3/include/std/type_traits | 19 ++++++++++++++++++- > 1 file changed, 18 insertions(+), 1 deletion(-) > > diff --git a/libstdc++-v3/include/std/type_traits > b/libstdc++-v3/include/std/type_traits > index 2a14df7e5f9..7ef50a2e64f 100644 > --- a/libstdc++-v3/include/std/type_traits > +++ b/libstdc++-v3/include/std/type_traits > @@ -594,6 +594,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION > { }; > > /// is_function > +#if __has_builtin(__is_function) > + template > + struct is_function > + : public __bool_constant<__is_function(_Tp)> > + { }; > +#else > template > struct is_function > : public __bool_constant::value> { }; > @@ -605,6 +611,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION > template > struct is_function<_Tp&&> > : public false_type { }; > +#endif > > #define __cpp_lib_is_null_pointer 201309L > > @@ -3197,8 +3204,18 @@ template > inline constexpr bool is_union_v = __is_union(_Tp); > template > inline constexpr bool is_class_v = __is_class(_Tp); > + > +#if __has_builtin(__is_function) > template > - inline constexpr bool is_function_v = is_function<_Tp>::value; > + inline constexpr bool is_function_v = __is_function(_Tp); > +#else > +template > + inline constexpr bool is_function_v = !is_const_v; > +template > + inline constexpr bool is_function_v<_Tp&> = false; > +template > + inline constexpr bool is_function_v<_Tp&&> = false; > +#endif > > #if __has_builtin(__is_reference) > template > -- > 2.41.0 > > --000000000000bd3b0f06026f4d88--