public inbox for glibc-cvs@sourceware.org
help / color / mirror / Atom feed
* [glibc] Use a #pragma to suppress a bogus GCC 10 warning instead of an assert [BZ 27832].
@ 2021-05-10 20:30 Martin Sebor
  0 siblings, 0 replies; only message in thread
From: Martin Sebor @ 2021-05-10 20:30 UTC (permalink / raw)
  To: glibc-cvs

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=30685597a4f81c8dcd4dd7335debdb72ae450924

commit 30685597a4f81c8dcd4dd7335debdb72ae450924
Author: Martin Sebor <msebor@redhat.com>
Date:   Mon May 10 14:26:42 2021 -0600

    Use a #pragma to suppress a bogus GCC 10 warning instead of an assert [BZ 27832].
    
    Reviewed-by: fweimer@redhat.com

Diff:
---
 nss/makedb.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/nss/makedb.c b/nss/makedb.c
index 9389f6b548..8690e11e82 100644
--- a/nss/makedb.c
+++ b/nss/makedb.c
@@ -792,7 +792,13 @@ write_output (int fd)
 			  + nhashentries_total * sizeof (stridx_t)));
   header->allocate = file_offset;
 
-  /* Help GCC 10 see iov_nelts doesn't overflow the writev argument.  */
+#if __GNUC_PREREQ (10, 0) && !__GNUC_PREREQ (11, 0)
+  DIAG_PUSH_NEEDS_COMMENT;
+  /* Avoid GCC 10 false positive warning: specified size exceeds maximum
+     object size.  */
+  DIAG_IGNORE_NEEDS_COMMENT (10, "-Wstringop-overflow");
+#endif
+
   assert (iov_nelts <= INT_MAX);
   if (writev (fd, iov, iov_nelts) != keydataoffset)
     {
@@ -800,6 +806,10 @@ write_output (int fd)
       return EXIT_FAILURE;
     }
 
+#if __GNUC_PREREQ (10, 0) && !__GNUC_PREREQ (11, 0)
+  DIAG_POP_NEEDS_COMMENT;
+#endif
+
   return EXIT_SUCCESS;
 }


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-05-10 20:30 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-10 20:30 [glibc] Use a #pragma to suppress a bogus GCC 10 warning instead of an assert [BZ 27832] Martin Sebor

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).