diff options
author | Martin Sebor <msebor@redhat.com> | 2020-05-11 11:29:39 -0600 |
---|---|---|
committer | Martin Sebor <msebor@redhat.com> | 2020-05-11 11:38:02 -0600 |
commit | 978e8ac39f8ba2d694031e521511da1ae803ccfc (patch) | |
tree | 0c04918e10ce1632476d991bf3f3a07b6567b90d /posix/test-errno.c | |
parent | e627106266ad8785457fadbf5bf67ed604d2a353 (diff) | |
download | glibc-978e8ac39f8ba2d694031e521511da1ae803ccfc.tar.gz glibc-978e8ac39f8ba2d694031e521511da1ae803ccfc.tar.xz glibc-978e8ac39f8ba2d694031e521511da1ae803ccfc.zip |
Suppress GCC 10 true positive warnings [BZ #25967]
Suppress or avoid warnings in tests that exercise failure modes by making calls with invalid arguments. Reviewed-by: DJ Delorie <dj@redhat.com> Reviewed-by: Florian Weimer <fweimer@redhat.com> Reviewed-by: Joseph Myers <joseph@codesourcery.com>
Diffstat (limited to 'posix/test-errno.c')
-rw-r--r-- | posix/test-errno.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/posix/test-errno.c b/posix/test-errno.c index 6afadcd102..492fd66bb5 100644 --- a/posix/test-errno.c +++ b/posix/test-errno.c @@ -34,6 +34,7 @@ #include <sys/uio.h> #include <unistd.h> #include <netinet/in.h> +#include <libc-diag.h> /* This is not an exhaustive test: only system calls that can be persuaded to fail with a consistent error code and no side effects @@ -119,7 +120,16 @@ do_test (void) fails |= test_wrp (EBADF, fstatfs, -1, &sfs); fails |= test_wrp (EBADF, fsync, -1); fails |= test_wrp (EBADF, ftruncate, -1, 0); + +#if __GNUC_PREREQ (7, 0) + DIAG_PUSH_NEEDS_COMMENT; + /* Avoid warnings about the second (size) argument being negative. */ + DIAG_IGNORE_NEEDS_COMMENT (10.1, "-Wstringop-overflow"); +#endif fails |= test_wrp (EINVAL, getgroups, -1, 0); +#if __GNUC_PREREQ (7, 0) + DIAG_POP_NEEDS_COMMENT; +#endif fails |= test_wrp (EBADF, getpeername, -1, &sa, &sl); fails |= test_wrp (EBADF, getsockname, -1, &sa, &sl); fails |= test_wrp (EBADF, getsockopt, -1, 0, 0, buf, &sl); @@ -134,7 +144,7 @@ do_test (void) fails |= test_wrp (EINVAL, munmap, (void *) -1, 0); fails |= test_wrp (EISDIR, open, "/bin", EISDIR, O_WRONLY); fails |= test_wrp (EBADF, read, -1, buf, 1); - fails |= test_wrp (EINVAL, readlink, "/", buf, -1); + fails |= test_wrp (EINVAL, readlink, "/", buf, sizeof buf); fails |= test_wrp (EBADF, readv, -1, iov, 1); fails |= test_wrp (EBADF, recv, -1, buf, 1, 0); fails |= test_wrp (EBADF, recvfrom, -1, buf, 1, 0, &sa, &sl); |