diff options
author | Michael Weghorn <m.weghorn@posteo.de> | 2022-05-20 08:15:26 +0200 |
---|---|---|
committer | Michael Weghorn <m.weghorn@posteo.de> | 2022-05-23 08:46:50 +0200 |
commit | 123bb44f4a23acad6acb0bdaf43705680d8739c9 (patch) | |
tree | fa5f8574da5ebaf6053d09c450db366ce8f2a074 /sw | |
parent | 7ee7e966bd123fc571144b08bc07b1536a2e23e9 (diff) |
Extend '-Werror=attributes' workaround to GCC versions < 12.1
Adapt the GCC version check from the workaround introduced
in
commit 2c6cea672a852b85cfb6d2e313d806f257481417
Date: Wed May 18 10:46:55 2022 +0200
Work around bogus -Werror=attributes with old GCC
...after 9c3c6a6b661ea8f84c1285b07a502de5c98a1495 "Replace OFFSET_OF macro with
a function template", as seen at
<https://ci.libreoffice.org//job/lo_tb_master_linux_dbg/38076/>,
> /home/tdf/lode/jenkins/workspace/lo_tb_master_linux_dbg/cppu/source/uno/check.cxx:263:28: error: ‘maybe_unused’ attribute ignored [-Werror=attributes]
> [[maybe_unused]] Char3 chars;
> ^~~~~
(Not sure which versions of GCC are affected exactly; lets restrict this to
to all versions before 12.1.
My GCC 11.3.0 build on Debian testing failed just the
same way otherwise.
A `git log --grep=maybe_unused` in the GCC git repo suggests
that this is no longer necessary from the following
GCC 12.1 commit [1] on:
commit c0f769fa3114ea852a26d93f0ee3f9595463de0b
Author: Jason Merrill <jason@redhat.com>
Date: Fri Jun 11 16:10:50 2021 -0400
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.
[1] https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff;h=c0f769fa3114ea852a26d93f0ee3f9595463de0b
Change-Id: I815e4a24da13e0ae66b1dff2941e636c7ebdfd9c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134653
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Tested-by: Jenkins
Diffstat (limited to 'sw')
0 files changed, 0 insertions, 0 deletions