]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
Disable -Wstringop-overread for some string tests
authorJoseph Myers <joseph@codesourcery.com>
Mon, 7 Sep 2020 18:11:12 +0000 (18:11 +0000)
committerJoseph Myers <joseph@codesourcery.com>
Mon, 7 Sep 2020 18:11:12 +0000 (18:11 +0000)
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.

string/tester.c
string/tst-cmp.c

index bcd7148c2ee0ac4502c37f7eafbeb4e4819a01a4..b7acf29c81c3a667c1db25634ffd21cd5a5e6e2f 100644 (file)
@@ -47,6 +47,9 @@ DIAG_IGNORE_NEEDS_COMMENT (7, "-Wstringop-overflow=");
 #if __GNUC_PREREQ (8, 0)
 DIAG_IGNORE_NEEDS_COMMENT (8, "-Wstringop-truncation");
 #endif
+#if __GNUC_PREREQ (11, 0)
+DIAG_IGNORE_NEEDS_COMMENT (11, "-Wstringop-overread");
+#endif
 
 
 #define        STREQ(a, b)     (strcmp((a), (b)) == 0)
index 13af0fcb83ecdaa2f872d1c161dfd948166a7c6c..e73025cfdfa5f27131958db2be1e098916cdc12c 100644 (file)
@@ -104,6 +104,10 @@ strncmp_max (const char *left, const char *right)
   /* GCC 9 warns about the size passed to strncmp being larger 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 strncmp (left, right, SIZE_MAX);
   DIAG_POP_NEEDS_COMMENT;
@@ -117,6 +121,10 @@ strncasecmp_max (const char *left, const char *right)
   /* GCC 9 warns about the size passed to strncasecmp being larger
      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;