From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id D4F79384773A; Tue, 5 Dec 2023 16:39:48 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D4F79384773A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1701794388; bh=mLO+SJL64hg349OuuNgsW9kIUxhuAoBFevl/6PFuScE=; h=From:To:Subject:Date:In-Reply-To:References:From; b=J66KDrbWl1Etm4G1puRtkytX6z3Bl80aWeQ0GEqFkco38jYUUHKsg9ezT1xBlfvcO wEzy8tnbGQ2Vb/TzYQ6qfT6jOBCvEf4ATLnIefhoZoe2Jrca1kEKzfXSu5b2CTb9Op lpsYO862O1QfruqsfxsKaRk4Wuz0BhVh++l/h8lo= From: "cvs-commit at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/110734] Attributes cannot be applied to asm declaration Date: Tue, 05 Dec 2023 16:39:47 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Version: 13.2.0 X-Bugzilla-Keywords: diagnostic, inline-asm X-Bugzilla-Severity: enhancement X-Bugzilla-Who: cvs-commit at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D110734 --- Comment #21 from GCC Commits --- The master branch has been updated by Jakub Jelinek : https://gcc.gnu.org/g:e5153e7d63b4cd9a3df490809c4f3fe1e94d3d37 commit r14-6187-ge5153e7d63b4cd9a3df490809c4f3fe1e94d3d37 Author: Jakub Jelinek Date: Tue Dec 5 17:38:46 2023 +0100 c++: Implement C++ DR 2262 - Attributes for asm-definition [PR110734] Seems in 2017 attribute-specifier-seq[opt] was added to asm-declaration and the change was voted in as a DR. The following patch implements it by parsing the attributes and warning about them. I found one attribute parsing bug I'll send a fix for momentarily. And there is another thing I wonder about: with -Wno-attributes=3D we a= re supposed to ignore the attributes altogether, but we are actually still warning about them when we emit these generic warnings about ignoring all attributes which appertain to this and that (perhaps with some exceptions we first remove from the attribute chain), like: void foo () { [[foo::bar]]; } with -Wattributes -Wno-attributes=3Dfoo::bar Shouldn't we call some helper function in cases like this and warn not when std_attrs (or how the attribute chain var is called) is non-NU= LL, but if it is non-NULL and contains at least one non-attribute_ignored_p attribute? cp_parser_declaration at least tries: if (std_attrs !=3D NULL_TREE && !attribute_ignored_p (std_attrs)) warning_at (make_location (attrs_loc, attrs_loc, parser->lexer), OPT_Wattributes, "attribute ignored"); but attribute_ignored_p here checks the first attribute rather than the whole chain. So it will incorrectly not warn if there is an ignored attribute followed by non-ignored. 2023-12-05 Jakub Jelinek PR c++/110734 * parser.cc (cp_parser_block_declaration): Implement C++ DR 2262 - Attributes for asm-definition. Call cp_parser_asm_definition even if RID_ASM token is only seen after sequence of standard attributes. (cp_parser_asm_definition): Parse standard attributes before RID_ASM token and warn for them with -Wattributes. * g++.dg/DRs/dr2262.C: New test. * g++.dg/cpp0x/gen-attrs-76.C (foo, bar): Don't expect errors on attributes on asm definitions. * g++.dg/gomp/attrs-11.C: Remove 2 expected errors.=