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
GCC 7 for now.)

Change-Id: I28ec8914b60c98dce769ad40ef4141aec4960aa3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134509
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
This commit is contained in:
Stephan Bergmann 2022-05-18 10:46:55 +02:00
parent 41a967af06
commit 2c6cea672a

View file

@ -260,7 +260,14 @@ static_assert(sizeof(second) == sizeof(int), "sizeof(second) != sizeof(int)");
struct Char4
{
#if defined __GNUC__ && __GNUC__ == 7 && !defined __clang__
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wattributes"
#endif
[[maybe_unused]] Char3 chars;
#if defined __GNUC__ && __GNUC__ == 7 && !defined __clang__
#pragma GCC diagnostic pop
#endif
char c;
};