diff options
author | Jason Merrill <jason@redhat.com> | 2021-06-11 16:10:50 -0400 |
---|---|---|
committer | Jason Merrill <jason@redhat.com> | 2021-06-12 12:46:28 -0400 |
commit | c0f769fa3114ea852a26d93f0ee3f9595463de0b (patch) | |
tree | 0c00779a9b0041d2c1e61c37cfaaf968e525d290 /gcc/tree-inline.c | |
parent | 08e1ff9d6e5a419d5b4a60c077df549e81601d9b (diff) | |
download | gcc-c0f769fa3114ea852a26d93f0ee3f9595463de0b.zip gcc-c0f769fa3114ea852a26d93f0ee3f9595463de0b.tar.gz gcc-c0f769fa3114ea852a26d93f0ee3f9595463de0b.tar.bz2 |
c-family: don't warn for [[maybe_unused]] on data member
The C++17 standard (and C2x) says that [[maybe_unused]] may be applied to a
non-static data member, so we shouldn't warn about it. And I don't see a
reason not to handle a FIELD_DECL the same as any other decl, by setting
TREE_USED on it. It doesn't look like anything yet cares about that flag on
a FIELD_DECL, but setting it shouldn't hurt.
gcc/c-family/ChangeLog:
* c-attribs.c (handle_unused_attribute): Handle FIELD_DECL.
gcc/testsuite/ChangeLog:
* g++.dg/ext/attrib62.C: No longer warn.
* g++.dg/diagnostic/maybe_unused1.C: New test.
gcc/ChangeLog:
* doc/extend.texi (unused variable attribute): Applies to
structure fields as well.
Diffstat (limited to 'gcc/tree-inline.c')
0 files changed, 0 insertions, 0 deletions