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 1F8F03858417 for ; Mon, 14 Aug 2023 18:32:56 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 1F8F03858417 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=1692037975; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=p7x7TNP91DHnfFZHdlS3kv6BLVPAblJsISkDTHT2veQ=; b=alkWoP1x1xVwzJYH5VOsjZb2zKZgcXuCNX6/gMIza/iW9Oi3sbBoNZZADilipFdKrD2H40 nuSLl7Wp26pIIAJ9yXxGZuxZ4D91DrCputXXamPXMBXHDVYoGPVOyQcBbKp3nsC5VjRTYX d2iJv4+RrFX2CE2EGa4YEgPiskexXoc= Received: from mail-qk1-f200.google.com (mail-qk1-f200.google.com [209.85.222.200]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-423-rRPzDHe0Mii2Bk-xnGFV2A-1; Mon, 14 Aug 2023 14:32:54 -0400 X-MC-Unique: rRPzDHe0Mii2Bk-xnGFV2A-1 Received: by mail-qk1-f200.google.com with SMTP id af79cd13be357-76cfaa583dcso499908985a.2 for ; Mon, 14 Aug 2023 11:32:54 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692037973; x=1692642773; h=content-transfer-encoding:in-reply-to:content-language:references :to:subject:from:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=p7x7TNP91DHnfFZHdlS3kv6BLVPAblJsISkDTHT2veQ=; b=jyve9LgYBEassFEdyulpcLpzACFjcoURgbyhuvjGVK+9w2voLUP0up+/JyDksvlUOw kPWT06M8PHX1tv3WrJh4mfRSvvvkT8nolWsrTiWVhSjKNBfs/Hor0mVk22zhcIuQTSV8 ZNsBdgAf3ZxANuE1ISc5a32d7IWYZIc4vytZZOCImBwImV/UDg4vCZVt+TBbceo+5msH 2CYmJL734Lg7CHDLppCoT3htVq+A4Zj5y4H7nWgPBUAp/bfow3LgBVKxArYrrqMALtFG UI4UGAazXRuYUjYhXgCTvu+OWhciwoC1/6HccZkqEQyiWe1dtCWpnrFAKRuJC0tZYyxl uPKA== X-Gm-Message-State: AOJu0YwK6vWx6rzsTqGH45xk9U202XRF78GNacSMG+UWwB3N6zrEeLhz b+VRY4G26wMT5+OphkIawdvVi4zv7tJwO5/0a5XYJv+GH1K2PdwtO+JC2F8hJd9zJbqiZNGJMo/ tRL7a3wa2szcTDJ2dRbEcc4QfVA== X-Received: by 2002:a05:620a:4513:b0:768:1be:98ff with SMTP id t19-20020a05620a451300b0076801be98ffmr14395424qkp.47.1692037973653; Mon, 14 Aug 2023 11:32:53 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGfowFLf2m6e1G0sTuDUWWw7sHFF2R3WdfrgUdWV3BBcy9+fAmyPYdD6piZobvC4LRRDbg77Q== X-Received: by 2002:a05:620a:4513:b0:768:1be:98ff with SMTP id t19-20020a05620a451300b0076801be98ffmr14395407qkp.47.1692037973311; Mon, 14 Aug 2023 11:32:53 -0700 (PDT) Received: from [192.168.1.104] (121.56.59.66.in-addr.crocker.net. [66.59.56.121]) by smtp.gmail.com with ESMTPSA id t26-20020a05620a005a00b0076d1e149701sm3180296qkt.115.2023.08.14.11.32.52 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 14 Aug 2023 11:32:52 -0700 (PDT) Message-ID: <44ec5f96-088f-c0be-8ca1-9f09a0faabb8@redhat.com> Date: Mon, 14 Aug 2023 14:32:52 -0400 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.14.0 From: Jason Merrill Subject: Re: [PATCH v3] c++: extend cold, hot attributes to classes To: Javier Martinez , gcc-patches@gcc.gnu.org References: In-Reply-To: X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE,TXREP 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 8/11/23 09:18, Javier Martinez wrote: > Hi Jason, > > Regarding the initialization example - no, the set of classes that we > consider cold is more loosely defined. > > On Thu, Aug 10, 2023 at 11:01 PM Jason Merrill > wrote: > > Yes, but that's because the implicit op== isn't declared lazily like > > some other special member functions (CLASSTYPE_LAZY_*/lazily_declare_fn) > > which can happen after the class is complete. > > I see, thanks. I have fixed this now by injecting it directly from > lazily_declare_fn, works well. Doing it from grokclassfn instead seems > to be a nuisance because the explicit method attribute might be > processed after the class-propagated attribute is injected, which is the > wrong way around for the desired precedence. > > > I think it would work to check for (flags & (ATTR_FLAG_FUNCTION_NEXT | > > ATTR_FLAG_DECL_NEXT)) and return without warning in that case.  You'd > > still set *no_add_attr. > > Correct, done. > > I have added the patch as an attachment, if it garbles it then I will > use git-send-email next time. That worked fine, thanks. > @@ -1110,6 +1110,28 @@ handle_hot_attribute (tree *node, tree name, tree ARG_UNUSED (args), > { > /* Attribute hot processing is done later with lookup_attribute. */ > } > + else if ((TREE_CODE (*node) == RECORD_TYPE > + || TREE_CODE (*node) == UNION_TYPE) > + && c_dialect_cxx ()) I think you also want to check for ATTR_FLAG_TYPE_IN_PLACE. > @@ -7866,6 +7891,10 @@ finish_struct (tree t, tree attributes) > && !LAMBDA_TYPE_P (t)) > add_stmt (build_min (TAG_DEFN, t)); > > + /* This must be done after all lazily declared special member functions > + have been injected. */ > + propagate_class_warmth_attribute (t); Maybe call this in check_bases_and_members instead? Jason