From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr1-x42b.google.com (mail-wr1-x42b.google.com [IPv6:2a00:1450:4864:20::42b]) by sourceware.org (Postfix) with ESMTPS id 8424E3858CDA; Wed, 14 Jun 2023 05:10:21 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 8424E3858CDA Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-wr1-x42b.google.com with SMTP id ffacd0b85a97d-30fbac9639fso3367728f8f.1; Tue, 13 Jun 2023 22:10:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1686719419; x=1689311419; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=jytRnCsZjC51L7k1JXJQVzNxLLdk/bkU0m5LBCSzyKw=; b=CCAm1uImRvHJpUzC3lDJwckmbNtZCSNTUUKoQ4QET86w9viPxnjh1teonEYx9g1VQe avRaE273z09fbHlCzicCatxXG+TIJ/yB4h3S3nksFivGbXKP3Fbs9/0dhTmTJlZ0xFWZ rXS/OyErMK8SP15FSVgSZVqINbVOTP7V6gKbc5muIvJ0wzHgc3GzO302aGtF3g8MBj/Z 4ePiI7uA8HgHApVaPbwBPMbtfV6/toySV3BbJTonQOSAK7HkereY/0fAeNvo0NR6ofCG AgxcKELvonjQ/cUliV1acYT+vSUzJlW5GyPnPkhSJqIgO7Kbmr1BISnA+b6hcCZppvp7 OQcg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686719419; x=1689311419; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=jytRnCsZjC51L7k1JXJQVzNxLLdk/bkU0m5LBCSzyKw=; b=VSGuJbd0P/SOsv1fJH4UZf/icsO6A7LGqBiHbHGyeXvFwz8nigtAGB/LHtDiXIXiyW 6CTXcRlXsChKwUp+4+777dad5eCWMBasQIJs8E6+2Poq9ZY/cE8wBQe+tYZXg3LcHQq4 q+e/NQMtLZIo/VzFtS/vl/OawQvwL553Djov/KWJaRPvBF9z5gCAGfwhvk7FzahjpZnW v1Oq7FCP22UDRLB2o0pa1Xe2LqxVBPWihCXYRqpnZXbMHhaaIQuLwfJjSOWVSzxL18Ay aVOSpGWaCjonwsbn19DdvXLD7iqky+0OTYYT4kXh2aiDoh23gd0Uh798qLQXLmTGzacc FDaw== X-Gm-Message-State: AC+VfDwhKFCYtSE3YHKlYjGWs8WbNi32kO1VRZfLnZ6uZsdF3RSGL/qk RPClTHldbejSiTols8iUcpYus28UrQU= X-Google-Smtp-Source: ACHHUZ5q8chHpbE1hFhFFiUVjTCyCJzMSEzsJQ/SdofAzGe7KdNq17+pG5CoqJINH9eHlX8SCjLZXQ== X-Received: by 2002:a5d:6e0c:0:b0:30e:412a:841b with SMTP id h12-20020a5d6e0c000000b0030e412a841bmr8800793wrz.37.1686719418938; Tue, 13 Jun 2023 22:10:18 -0700 (PDT) Received: from [10.10.0.104] ([89.207.171.96]) by smtp.gmail.com with ESMTPSA id f5-20020adffcc5000000b003110b18fc3asm316996wrs.93.2023.06.13.22.10.17 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 13 Jun 2023 22:10:18 -0700 (PDT) Message-ID: <3dfd9968-ddab-f9cf-7350-23be286f7597@gmail.com> Date: Wed, 14 Jun 2023 07:10:17 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.11.0 Subject: Re: [PATCH v5 6/6] libstdc++: make std::is_object dispatch to new built-in traits To: Ken Matsui , gcc-patches@gcc.gnu.org Cc: libstdc++@gcc.gnu.org References: <20230611024657.42846-1-kmatsui@cs.washington.edu> <20230612222515.20102-1-kmatsui@cs.washington.edu> <20230612222515.20102-7-kmatsui@cs.washington.edu> Content-Language: en-US From: =?UTF-8?Q?Fran=c3=a7ois_Dumont?= In-Reply-To: <20230612222515.20102-7-kmatsui@cs.washington.edu> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-10.6 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,GIT_PATCH_0,NICE_REPLY_A,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On 13/06/2023 00:22, Ken Matsui via Libstdc++ wrote: > This patch gets std::is_object to dispatch to new built-in traits, > __is_function, __is_reference, and __is_void. > > libstdc++-v3/ChangeLog: > * include/std/type_traits (is_object): Use new built-in traits, > __is_function, __is_reference, and __is_void. > (__is_object): Define this built-in-like macro. > (is_object_v): Use built-in traits through the build-in-like macro. > > Signed-off-by: Ken Matsui > --- > libstdc++-v3/include/std/type_traits | 19 +++++++++++++++++++ > 1 file changed, 19 insertions(+) > > diff --git a/libstdc++-v3/include/std/type_traits b/libstdc++-v3/include/std/type_traits > index 780fcc00135..93335f94385 100644 > --- a/libstdc++-v3/include/std/type_traits > +++ b/libstdc++-v3/include/std/type_traits > @@ -682,11 +682,23 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION > { }; > > /// is_object > +#if __has_builtin(__is_function) && __has_builtin(__is_reference) \ > + && __has_builtin(__is_void) > + > +#define __is_object(_Tp) \ > + (!(__is_function(_Tp) || __is_reference(_Tp) || __is_void(_Tp))) Is this evaluation order random ? Are all those builtin functions performances equivalent ? I would have felt that __is_void is the simplest/fastest cause only for 'void' so would have put it first. > + > + template > + struct is_object > + : public __bool_constant<__is_object(_Tp)> > + { }; > +#else > template > struct is_object > : public __not_<__or_, is_reference<_Tp>, > is_void<_Tp>>>::type > { }; > +#endif > > template > struct is_member_pointer; > @@ -3235,8 +3247,15 @@ template > inline constexpr bool is_arithmetic_v = is_arithmetic<_Tp>::value; > template > inline constexpr bool is_fundamental_v = is_fundamental<_Tp>::value; > + > +#ifdef __is_object > +template > + inline constexpr bool is_object_v = __is_object(_Tp); > +#else > template > inline constexpr bool is_object_v = is_object<_Tp>::value; > +#endif > + > template > inline constexpr bool is_scalar_v = is_scalar<_Tp>::value; > template