public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "joseph at codesourcery dot com" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c/101265] C2X [[maybe_unused]] ignored when placed after array declaration Date: Wed, 30 Jun 2021 16:54:45 +0000 [thread overview] Message-ID: <bug-101265-4-QhWaUtcjn8@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-101265-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101265 --- Comment #1 from joseph at codesourcery dot com <joseph at codesourcery dot com> --- On Tue, 29 Jun 2021, gcc at alanwu dot email via Gcc-bugs wrote: > [[maybe_unused]] int thisworks[1]; That attribute appertains to the declared entity. > int thisdoesnt[1] [[maybe_unused]]; Whereas that one appertains to the array type (that position after an array declarator can also be used for e.g. a pointer to an array, an array of arrays, etc., and an attribute there appertains to the specific array given by that declarator - not the declared entity as a whole). It's not clear what it would mean to declare that some particular part of the type of an entity is possibly unused like that. Appropriate places in a declaration are either at the start as in the first example, or after the identifier where an attribute specifier sequence appertains to the declared entity. In general you need to be a lot more careful about the positioning of [[]] attributes than __attribute__.
next prev parent reply other threads:[~2021-06-30 16:54 UTC|newest] Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-06-29 20:09 [Bug c/101265] New: " gcc at alanwu dot email 2021-06-30 16:54 ` joseph at codesourcery dot com [this message] 2021-06-30 22:17 ` [Bug c/101265] " gcc at alanwu dot email 2021-06-30 22:59 ` joseph at codesourcery dot com 2021-07-01 13:21 ` gcc at alanwu dot email
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-101265-4-QhWaUtcjn8@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).