about summary refs log tree commit diff
path: root/string/tst-cmp.c
diff options
context:
space:
mode:
authorJoseph Myers <joseph@codesourcery.com>2020-09-07 18:11:12 +0000
committerJoseph Myers <joseph@codesourcery.com>2020-09-07 18:11:12 +0000
commite74b61c09a2a2ab52153e731225ccba5078659b1 (patch)
tree731765c3e5e4f193c20d1e9b5d9bea845c0e8762 /string/tst-cmp.c
parent3357087b2a95a33dbb38579c9bf7b23f1f85c7a1 (diff)
downloadglibc-e74b61c09a2a2ab52153e731225ccba5078659b1.tar.gz
glibc-e74b61c09a2a2ab52153e731225ccba5078659b1.tar.xz
glibc-e74b61c09a2a2ab52153e731225ccba5078659b1.zip
Disable -Wstringop-overread for some string tests
Similarly to Maciej's changes to fix the build of rawmemchr in the
presence of GCC 11's -Wstringop-overread, also disable that option in
two string function tests that have similar warnings and other string
function warnings already disabled.

Tested with build-many-glibcs.py for aarch64-linux-gnu and
arm-linux-gnueabi that it fixes building the glibc testsuite.
Diffstat (limited to 'string/tst-cmp.c')
-rw-r--r--string/tst-cmp.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/string/tst-cmp.c b/string/tst-cmp.c
index 13af0fcb83..e73025cfdf 100644
--- a/string/tst-cmp.c
+++ b/string/tst-cmp.c
@@ -105,6 +105,10 @@ strncmp_max (const char *left, const char *right)
      PTRDIFF_MAX; the use of SIZE_MAX is deliberate here.  */
   DIAG_IGNORE_NEEDS_COMMENT (9, "-Wstringop-overflow=");
 #endif
+#if __GNUC_PREREQ (11, 0)
+  /* Likewise GCC 11, with a different warning option.  */
+  DIAG_IGNORE_NEEDS_COMMENT (11, "-Wstringop-overread");
+#endif
   return strncmp (left, right, SIZE_MAX);
   DIAG_POP_NEEDS_COMMENT;
 }
@@ -118,6 +122,10 @@ strncasecmp_max (const char *left, const char *right)
      than PTRDIFF_MAX; the use of SIZE_MAX is deliberate here.  */
   DIAG_IGNORE_NEEDS_COMMENT (9, "-Wstringop-overflow=");
 #endif
+#if __GNUC_PREREQ (11, 0)
+  /* Likewise GCC 11, with a different warning option.  */
+  DIAG_IGNORE_NEEDS_COMMENT (11, "-Wstringop-overread");
+#endif
   return strncasecmp (left, right, SIZE_MAX);
   DIAG_POP_NEEDS_COMMENT;
 }