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 13E7C385841C for ; Tue, 8 Aug 2023 20:35:33 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 13E7C385841C 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-lj1-f200.google.com (mail-lj1-f200.google.com [209.85.208.200]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-117-dYsnz7c5NiC0PWN2vwRflw-1; Tue, 08 Aug 2023 16:35:30 -0400 X-MC-Unique: dYsnz7c5NiC0PWN2vwRflw-1 Received: by mail-lj1-f200.google.com with SMTP id 38308e7fff4ca-2ba0f27a4c9so32147411fa.1 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=cjv9fpXvB7dl04MFlQ6ee3vrX2nH2OoZ6e1vGOOLjoo16vCfTeGIxyCcevPJIDdUtc 7S3hGZTED2gySrmVnKDwU4ggBORlWeEisdWqFhdE7j8OHdwh1BdNlVpU5p0JwW061FXU 4gChCxQvv1NBDu+Kg98qibavYk0oPE5qDUHd5xqNQ47H1CGsJ8g5Cgka4swB34CEWVrU jT6Ff+bg/Xue8MABbZvGeREaawRcGukEDqdC2FrWMoVAP8hiO4jhokZ7Q7bjQ6eBGoeV H3t/Zl0uquF3lekJVnAlGT2qOEN7FJaU8qddbpHvmVzy6ysBNonm8CipwwFwmzwJm7eQ wUhQ== X-Gm-Message-State: AOJu0YyNfrSWGTKx4QbYZZ+LDNJFrcB92yD9rcq4bild5A9YWgXNeYHK h7s8Q+0tsrRWtl6iXeu7IiMzZlEJVW7xQsb2mrDNjejWgpwlAnH5ZkezQwIcCTozy6Tbb2hB9YI lWhMRjQlrCRSGl10+kcLhVP8n9nNXJFKy/ytQUYNGaSdH X-Received: by 2002:a2e:908e:0:b0:2b9:f007:9910 with SMTP id l14-20020a2e908e000000b002b9f0079910mr411674ljg.53.1691526929539; 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=-12.2 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--