From 6999cd135729e0ea18a8ce88471b44170f9d3d75 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Sat, 2 Jan 2021 13:48:43 +0100 Subject: [PATCH] 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. --- ChangeLog | 8 ++++++++ tests/test-getgroups.c | 9 +++++++++ 2 files changed, 17 insertions(+) diff --git a/ChangeLog b/ChangeLog index 5d5c05a757..4dd088d871 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,13 @@ 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. * tests/test-timespec_get.c: New file. * modules/timespec_get-tests: New file. 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) { -- 2.11.4.GIT