From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from eggs.gnu.org (eggs.gnu.org [IPv6:2001:470:142:3::10]) by sourceware.org (Postfix) with ESMTPS id BDEE23858401 for ; Wed, 31 Jan 2024 20:38:06 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org BDEE23858401 Authentication-Results: sourceware.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=fail smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org BDEE23858401 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2001:470:142:3::10 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1706733488; cv=none; b=afyV/I/0Ulg0no5QD6f4rFlooSdvP78Ce1nkViCuvTQVuYf8/KeVs2+kodXelzymxWVeXeOZ5HwubsQUV93InE1LDHqYn9yR1CzMOHf5KWZ0EUTmoHa/+m9gS3vPq7H0F/nwB/PG2Fw+Q4Mp8ORJOpeW8n6PPX289SgP9uzgepM= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1706733488; c=relaxed/simple; bh=PbTADnLeocI9SejwS1+XCUVWZvz2aKr/7ETAklt0w9c=; h=DKIM-Signature:Date:From:To:Subject:Message-ID:MIME-Version; b=Isja5xrpXYn1iBLl9U9SURXdRxSUtOM3mbRJRiaSFuYJ2am7kj7t1xZIXDt4QGnSdOuVereU7L/RmbjGpk5NlKz2MIvTQqk9LOuFAi5srZ4x4+eJxV2j/IiHqnBmPjkAuha9DrSmtWczCqkRscGeRaQaV8ipAz9QX1u3Jj8XrzA= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rVHLQ-0001ve-OQ for gcc-patches@gnu.org; Wed, 31 Jan 2024 15:38:06 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1706733482; h=from:from:reply-to: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=q1L7qZfG296zS4kle1EyFflLOpPwxDDXowWv8j4gH9E=; b=ACyYR6bkk45nY1+yYLTV06aUHk+DTdNTr97K5XunVvWHrAspufZpEAeBGZ5Cvtqz2vM0Pj ceOTkerlROv4+R+LgKYP5SdncTKMyDnkQcB1NWNsh7DZceLqMeO94hdUSZYzAypGeqcxny /aypZqQB8MtYvd3lJo0NQghFz6VZmEU= Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-649-Ig7pLqhCMKSr9hgZSZGT4g-1; Wed, 31 Jan 2024 15:36:01 -0500 X-MC-Unique: Ig7pLqhCMKSr9hgZSZGT4g-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 0FF161C0DB08; Wed, 31 Jan 2024 20:36:01 +0000 (UTC) Received: from tucnak.zalov.cz (unknown [10.39.192.70]) by smtp.corp.redhat.com (Postfix) with ESMTPS id BE5D8134; Wed, 31 Jan 2024 20:36:00 +0000 (UTC) Received: from tucnak.zalov.cz (localhost [127.0.0.1]) by tucnak.zalov.cz (8.17.1/8.17.1) with ESMTPS id 40VKZv9i296136 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Wed, 31 Jan 2024 21:35:58 +0100 Received: (from jakub@localhost) by tucnak.zalov.cz (8.17.1/8.17.1/Submit) id 40VKZuJ0296135; Wed, 31 Jan 2024 21:35:56 +0100 Date: Wed, 31 Jan 2024 21:35:56 +0100 From: Jakub Jelinek To: Andi Kleen Cc: Marek Polacek , gcc-patches@gnu.org Subject: Re: [PATCH v3 2/5] C++: Support clang compatible [[musttail]] (PR83324) Message-ID: Reply-To: Jakub Jelinek References: <20240131021808.151575-1-ak@linux.intel.com> <20240131021808.151575-3-ak@linux.intel.com> MIME-Version: 1.0 In-Reply-To: X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.1 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Received-SPF: pass client-ip=170.10.133.124; envelope-from=jakub@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -33 X-Spam_score: -3.4 X-Spam_bar: --- X-Spam_report: (-3.4 / 5.0 requ) BAYES_00=-1.9,DKIMWL_WL_HIGH=-1.292,DKIM_SIGNED=0.1,DKIM_VALID=-0.1,DKIM_VALID_AU=-0.1,DKIM_VALID_EF=-0.1,RCVD_IN_DNSWL_NONE=-0.0001,RCVD_IN_MSPIKE_H5=0.001,RCVD_IN_MSPIKE_WL=0.001,SPF_HELO_NONE=0.001,SPF_PASS=-0.001,T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_PASS,SPF_NONE,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 Wed, Jan 31, 2024 at 12:21:38PM -0800, Andi Kleen wrote: > > > + case RID_RETURN: > > > + { > > > + bool musttail_p = false; > > > + std_attrs = process_stmt_hotness_attribute (std_attrs, attrs_loc); > > > + if (lookup_attribute ("", "musttail", std_attrs)) > > > + { > > > + musttail_p = true; > > > + std_attrs = remove_attribute ("", "musttail", std_attrs); > > > + } Using "" looks wrong to me, that is for standard attributes which are also gnu attributes, say [[noreturn]]/[[gnu::noreturn]]. That is not the case here. Even the __attribute__((musttail)) form will have gnu namespace. > > > + // support this for compatibility > > > + if (lookup_attribute ("clang", "musttail", std_attrs)) > > > + { > > > + musttail_p = true; > > > + std_attrs = remove_attribute ("clang", "musttail", std_attrs); > > > + } > > > > Doing lookup_attribute unconditionally twice seems like a lot. > > You could do just lookup_attribute ("musttail", std_attrs) and then > > check get_attribute_namespace() == nullptr/gnu_identifier? I agree with Marek here. The fact that it is most often NULL std_attrs is indeed already optimized by lookup_attribute, but people write all kinds of code. The remove_attribute can be done separately of course. Though, I'd also prefer not to add clang attributes, just add gnu ones. Jakub