From: Bruno Haible Date: Sat, 2 Jan 2021 12:48:43 +0000 (+0100) Subject: getgroups test: Avoid warning with glibc >= 2.32 and gcc >= 10. X-Git-Tag: v1.0~3235 X-Git-Url: https://gitweb.git.savannah.gnu.org/gitweb/?a=commitdiff_plain;h=6999cd135729e0ea18a8ce88471b44170f9d3d75;p=gnulib.git getgroups test: Avoid warning with glibc >= 2.32 and gcc >= 10. Reported by Bernhard Voelker in . * tests/test-getgroups.c: Silence gcc warnings of type -Wstringop-overflow. --- diff --git a/ChangeLog b/ChangeLog index 5d5c05a757..4dd088d871 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2021-01-02 Bruno Haible + + getgroups test: Avoid warning with glibc >= 2.32 and gcc >= 10. + Reported by Bernhard Voelker in + . + * tests/test-getgroups.c: Silence gcc warnings of type + -Wstringop-overflow. + 2021-01-02 Bruno Haible timespec_get: Add tests. diff --git a/tests/test-getgroups.c b/tests/test-getgroups.c index 14e0e8ff1a..dcea0332bb 100644 --- a/tests/test-getgroups.c +++ b/tests/test-getgroups.c @@ -30,6 +30,15 @@ SIGNATURE_CHECK (getgroups, int, (int, gid_t[])); #include "macros.h" +/* Tell GCC not to warn about the specific edge cases tested here. + GCC >= 10 with glibc >= 2.32 would otherwise trigger warnings, even without + any -W options, because getgroups() is declared with + __attribute__ ((__access__ (__write_only__, 2, 1))) + */ +#if __GNUC__ >= 7 +# pragma GCC diagnostic ignored "-Wstringop-overflow" +#endif + int main (int argc, char **argv _GL_UNUSED) {