public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "cvs-commit at gcc dot gnu.org" <gcc-bugzilla@gcc.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 [thread overview] Message-ID: <bug-110734-4-8kjNyKFAec@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-110734-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110734 --- Comment #21 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Jakub Jelinek <jakub@gcc.gnu.org>: https://gcc.gnu.org/g:e5153e7d63b4cd9a3df490809c4f3fe1e94d3d37 commit r14-6187-ge5153e7d63b4cd9a3df490809c4f3fe1e94d3d37 Author: Jakub Jelinek <jakub@redhat.com> 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= we are 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=foo::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-NULL, 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 != 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 <jakub@redhat.com> 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.
next prev parent reply other threads:[~2023-12-05 16:39 UTC|newest] Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top 2023-07-19 7:45 [Bug c++/110734] New: Attributes cannot be applied to asm statements tanksherman27 at gmail dot com 2023-07-19 7:47 ` [Bug c++/110734] " tanksherman27 at gmail dot com 2023-07-19 7:50 ` pinskia at gcc dot gnu.org 2023-07-19 7:57 ` tanksherman27 at gmail dot com 2023-07-19 9:43 ` rguenth at gcc dot gnu.org 2023-07-22 3:30 ` tanksherman27 at gmail dot com 2023-11-23 2:33 ` tanksherman27 at gmail dot com 2023-11-29 10:45 ` tanksherman27 at gmail dot com 2023-11-29 10:47 ` tanksherman27 at gmail dot com 2023-11-30 14:59 ` [Bug c++/110734] Attributes cannot be applied to asm declarations tanksherman27 at gmail dot com 2023-11-30 16:22 ` xry111 at gcc dot gnu.org 2023-11-30 16:24 ` xry111 at gcc dot gnu.org 2023-11-30 16:27 ` mpolacek at gcc dot gnu.org 2023-12-01 4:52 ` tanksherman27 at gmail dot com 2023-12-01 5:34 ` [Bug c++/110734] Attributes cannot be applied to asm statements xry111 at gcc dot gnu.org 2023-12-01 5:43 ` xry111 at gcc dot gnu.org 2023-12-01 5:51 ` [Bug c++/110734] Attributes cannot be applied to asm declaration xry111 at gcc dot gnu.org 2023-12-01 5:53 ` xry111 at gcc dot gnu.org 2023-12-01 6:22 ` tanksherman27 at gmail dot com 2023-12-01 6:23 ` tanksherman27 at gmail dot com 2023-12-01 6:56 ` jakub at gcc dot gnu.org 2023-12-02 14:11 ` tanksherman27 at gmail dot com 2023-12-05 16:39 ` cvs-commit at gcc dot gnu.org [this message] 2023-12-05 17:03 ` jakub at gcc dot gnu.org 2023-12-05 17:04 ` jakub at gcc dot gnu.org
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-110734-4-8kjNyKFAec@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).