public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/103649] New: -Wno-attribute=foo::bar implies no arguments
@ 2021-12-10 13:54 jakub at gcc dot gnu.org
2021-12-10 13:56 ` [Bug c/103649] " mpolacek at gcc dot gnu.org
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: jakub at gcc dot gnu.org @ 2021-12-10 13:54 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103649
Bug ID: 103649
Summary: -Wno-attribute=foo::bar implies no arguments
Product: gcc
Version: 12.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
Assignee: unassigned at gcc dot gnu.org
Reporter: jakub at gcc dot gnu.org
Target Milestone: ---
[[foo::bar(1, 2)]];
is accepted with a warning:
pr103587-2.c:1:1: warning: attribute ignored [-Wattributes]
1 | [[foo::bar(1, 2)]];
| ^~~~~~~~~~~~~~~~~~
but with -Wno-attributes=foo::bar
it is rejected:
pr103587-2.c:1:11: error: ‘bar’ attribute does not take any arguments
1 | [[foo::bar(1, 2)]];
| ^
and with -Wno-attributes=foo::*
with
<built-in>: error: wrong argument to ignored attributes
pr103587-2.c:1:1: warning: attribute ignored [-Wattributes]
1 | [[foo::bar(1, 2)]];
| ^~~~~~~~~~~~~~~~~~
I think it should be accepted with whatever arguments it has.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug c/103649] -Wno-attribute=foo::bar implies no arguments
2021-12-10 13:54 [Bug c/103649] New: -Wno-attribute=foo::bar implies no arguments jakub at gcc dot gnu.org
@ 2021-12-10 13:56 ` mpolacek at gcc dot gnu.org
2021-12-17 22:56 ` cvs-commit at gcc dot gnu.org
2021-12-17 22:57 ` mpolacek at gcc dot gnu.org
2 siblings, 0 replies; 4+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2021-12-10 13:56 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103649
Marek Polacek <mpolacek at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Last reconfirmed| |2021-12-10
Ever confirmed|0 |1
Assignee|unassigned at gcc dot gnu.org |mpolacek at gcc dot gnu.org
Status|UNCONFIRMED |ASSIGNED
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug c/103649] -Wno-attribute=foo::bar implies no arguments
2021-12-10 13:54 [Bug c/103649] New: -Wno-attribute=foo::bar implies no arguments jakub at gcc dot gnu.org
2021-12-10 13:56 ` [Bug c/103649] " mpolacek at gcc dot gnu.org
@ 2021-12-17 22:56 ` cvs-commit at gcc dot gnu.org
2021-12-17 22:57 ` mpolacek at gcc dot gnu.org
2 siblings, 0 replies; 4+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-12-17 22:56 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103649
--- Comment #1 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The trunk branch has been updated by Marek Polacek <mpolacek@gcc.gnu.org>:
https://gcc.gnu.org/g:6afb8a68a9113897ccf39e40983e042ed90d7aed
commit r12-6052-g6afb8a68a9113897ccf39e40983e042ed90d7aed
Author: Marek Polacek <polacek@redhat.com>
Date: Thu Dec 16 16:29:41 2021 -0500
attribs: Fix wrong error with -Wno-attribute=A::b [PR103649]
My patch to implement -Wno-attribute=A::b caused a bogus error when
parsing
[[foo::bar(1, 2)]];
when -Wno-attributes=foo::bar was specified on the command line, because
when we create a fake foo::bar attribute and insert it into our attribute
table, it is created with max_length == 0 which doesn't allow any args.
That is wrong -- we know nothing about the attribute, so we shouldn't
require any specific number of arguments. And since unknown attributes
can be rather complex (see for example omp::{directive,sequence}), we
must skip parsing their arguments. To that end, I'm using max_length
with value -2.
Also let's not warn about things like
[[vendor::assume(true)]];
because they may have some meaning (this is reminiscent of C++ Portable
Assumptions).
PR c/103649
gcc/ChangeLog:
* attribs.c (handle_ignored_attributes_option): Create the fake
attribute with max_length == -2.
(attribute_ignored_p): New overloads.
* attribs.h (attribute_ignored_p): Declare them.
* tree-core.h (struct attribute_spec): Document that max_length
can be -2.
gcc/c/ChangeLog:
* c-decl.c (c_warn_unused_attributes): Don't warn for
attribute_ignored_p.
* c-parser.c (c_parser_std_attribute): Skip parsing of the
attribute
arguments when the attribute is ignored.
gcc/cp/ChangeLog:
* parser.c (cp_parser_declaration): Don't warn for
attribute_ignored_p.
(cp_parser_std_attribute): Skip parsing of the attribute
arguments when the attribute is ignored.
gcc/testsuite/ChangeLog:
* c-c++-common/Wno-attributes-6.c: New test.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug c/103649] -Wno-attribute=foo::bar implies no arguments
2021-12-10 13:54 [Bug c/103649] New: -Wno-attribute=foo::bar implies no arguments jakub at gcc dot gnu.org
2021-12-10 13:56 ` [Bug c/103649] " mpolacek at gcc dot gnu.org
2021-12-17 22:56 ` cvs-commit at gcc dot gnu.org
@ 2021-12-17 22:57 ` mpolacek at gcc dot gnu.org
2 siblings, 0 replies; 4+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2021-12-17 22:57 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103649
Marek Polacek <mpolacek at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |FIXED
Status|ASSIGNED |RESOLVED
--- Comment #2 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Fixed.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2021-12-17 22:57 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-10 13:54 [Bug c/103649] New: -Wno-attribute=foo::bar implies no arguments jakub at gcc dot gnu.org
2021-12-10 13:56 ` [Bug c/103649] " mpolacek at gcc dot gnu.org
2021-12-17 22:56 ` cvs-commit at gcc dot gnu.org
2021-12-17 22:57 ` mpolacek at gcc dot gnu.org
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).