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.133.124]) by sourceware.org (Postfix) with ESMTPS id EDB293858D33 for ; Wed, 9 Nov 2022 12:18:26 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org EDB293858D33 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=1667996306; 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=AiA5YqCLE+5Y+aRyvp76OhxQ0pUxZa6gk+inlGGb4eE=; b=KiBdpbHXJdCJlor88fYqlHWyXotphf9TIKPtpJ+4zvnOC5acaxLDMISee6OTasyraeqHYZ DMPJAkTtWg5JNb4FN+zAVGLFuUEBQM455upQZVqB+Nk6dxNCHbF0UOgaG5+LAVSJ84/kGF uoCxBGNd+ab1NMJnnlI3CH9XxabjEPE= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-634-2iwcH3XRM1u2tkHhetuGIQ-1; Wed, 09 Nov 2022 07:18:25 -0500 X-MC-Unique: 2iwcH3XRM1u2tkHhetuGIQ-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 28F33185A78B for ; Wed, 9 Nov 2022 12:18:25 +0000 (UTC) Received: from tucnak.zalov.cz (unknown [10.39.194.183]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D75F840C6EC3; Wed, 9 Nov 2022 12:18:24 +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 2A9CIM074105318 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Wed, 9 Nov 2022 13:18:22 +0100 Received: (from jakub@localhost) by tucnak.zalov.cz (8.17.1/8.17.1/Submit) id 2A9CIL0W4105317; Wed, 9 Nov 2022 13:18:21 +0100 Date: Wed, 9 Nov 2022 13:18:21 +0100 From: Jakub Jelinek To: Jason Merrill Cc: gcc-patches@gcc.gnu.org Subject: Re: [RFC PATCH] c++: Minimal handling of carries_dependency attribute Message-ID: Reply-To: Jakub Jelinek References: MIME-Version: 1.0 In-Reply-To: X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Spam-Status: No, score=-3.5 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,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 Tue, Nov 08, 2022 at 01:40:03PM -1000, Jason Merrill wrote: > > A comment in D2552R1: > > "The only questionable (but still conforming) case we found was > > [[carries_dependency(some_argument)]] on GCC, where the emitted diagnostic said that the > > carries_dependency attribute is not supported, but did not specifically call out the syntax error > > in the argument clause." > > made me try the following patch, where we'll error at least > > for arguments to the attribute and for some uses of the attribute > > appertaining to something not mentioned in the standard warn > > with different diagnostics (or should that be an error?; clang++ > > does that, but I think we never do for any attribute, standard or not). > > The diagnostics on toplevel attribute declaration is still an > > attribute ignored warning and on empty statement different wording. > > > > The paper additionally mentions > > struct X { [[nodiscard]]; }; // no diagnostic on GCC > > and 2 cases of missing diagnostics on [[fallthrough]] (guess I should > > file a PR about those; one problem is that do { ... } while (0); there > > is replaced during genericization just by ... and another that > > [[fallthrough]] there is followed by a label, but not user/case/default > > label, but an artificial one created from while loop genericization. > > > > Thoughts on this? > > LGTM. Thanks, committed now. Given CWG2538, I wonder whether we shouldn't at least pedwarn rather than warning{,_at} for standard attributes that appertain to wrong entities (and keep warning{,_at} for non-standard attributes including gnu variants of standard attributes). If yes, we'd need to differentiate between the standard attributes and gnu variants thereof (I think the C FE does, but C++ FE has /* We used to treat C++11 noreturn attribute as equivalent to GNU's, but no longer: we have to be able to tell [[noreturn]] and __attribute__((noreturn)) apart. */ /* C++14 deprecated attribute is equivalent to GNU's. */ if (is_attribute_p ("deprecated", attr_id)) TREE_PURPOSE (TREE_PURPOSE (attribute)) = gnu_identifier; /* C++17 fallthrough attribute is equivalent to GNU's. */ else if (is_attribute_p ("fallthrough", attr_id)) TREE_PURPOSE (TREE_PURPOSE (attribute)) = gnu_identifier; /* C++23 assume attribute is equivalent to GNU's. */ else if (is_attribute_p ("assume", attr_id)) TREE_PURPOSE (TREE_PURPOSE (attribute)) = gnu_identifier; so we'd need to remove that and make sure those standard attributes are handled. Jakub