office-gobmx/cppu/source
Michael Weghorn 123bb44f4a Extend '-Werror=attributes' workaround to GCC versions < 12.1
Adapt the GCC version check from the workaround introduced
in

    commit 2c6cea672a
    Date:   Wed May 18 10:46:55 2022 +0200

        Work around bogus -Werror=attributes with old GCC

        ...after 9c3c6a6b66 "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
2022-05-23 08:46:50 +02:00
..
AffineBridge
cppu
helper/purpenv clang-tidy modernize-pass-by-value in cppu 2022-05-17 17:36:36 +02:00
LogBridge
threadpool clang-tidy modernize-pass-by-value in cppu 2022-05-17 17:36:36 +02:00
typelib
uno Extend '-Werror=attributes' workaround to GCC versions < 12.1 2022-05-23 08:46:50 +02:00
UnsafeBridge