]> Savannah Git Hosting - gnulib.git/commitdiff
getgroups test: Avoid warning with glibc >= 2.32 and gcc >= 10.
authorBruno Haible <bruno@clisp.org>
Sat, 2 Jan 2021 12:48:43 +0000 (13:48 +0100)
committerBruno Haible <bruno@clisp.org>
Sat, 2 Jan 2021 12:48:43 +0000 (13:48 +0100)
Reported by Bernhard Voelker <mail@bernhard-voelker.de> in
<https://lists.gnu.org/archive/html/bug-gnulib/2020-12/msg00090.html>.

* tests/test-getgroups.c: Silence gcc warnings of type
-Wstringop-overflow.

ChangeLog
tests/test-getgroups.c

index 5d5c05a75757ba5b39a2359547c48192de34b002..4dd088d87107cd562243bc45aa706a03b581ccd8 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2021-01-02  Bruno Haible  <bruno@clisp.org>
+
+       getgroups test: Avoid warning with glibc >= 2.32 and gcc >= 10.
+       Reported by Bernhard Voelker <mail@bernhard-voelker.de> in
+       <https://lists.gnu.org/archive/html/bug-gnulib/2020-12/msg00090.html>.
+       * tests/test-getgroups.c: Silence gcc warnings of type
+       -Wstringop-overflow.
+
 2021-01-02  Bruno Haible  <bruno@clisp.org>
 
        timespec_get: Add tests.
index 14e0e8ff1afb8630d78383acf424dc9cb9bccf0a..dcea0332bb485e665cd259f99e4a92bcbd69cd53 100644 (file)
@@ -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)
 {