about summary refs log tree commit diff
path: root/string/bug-strpbrk1.c
diff options
context:
space:
mode:
Diffstat (limited to 'string/bug-strpbrk1.c')
-rw-r--r--string/bug-strpbrk1.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/string/bug-strpbrk1.c b/string/bug-strpbrk1.c
index 28238b0f50..8e909a1e21 100644
--- a/string/bug-strpbrk1.c
+++ b/string/bug-strpbrk1.c
@@ -4,6 +4,7 @@
 #include <string.h>
 #include <stdlib.h>
 #include <stdio.h>
+#include <libc-diag.h>
 
 int
 main (void)
@@ -11,7 +12,14 @@ main (void)
   const char *a = "abc";
   const char *b = a;
 
+  DIAG_PUSH_NEEDS_COMMENT;
+  /* GCC 9 correctly warns that this call to strpbrk is useless.  That
+     is deliberate; this test is verifying that a side effect in an
+     argument still occurs when the call itself is useless and could
+     be optimized to return a constant.  */
+  DIAG_IGNORE_NEEDS_COMMENT (9, "-Wunused-value");
   strpbrk (b++, "");
+  DIAG_POP_NEEDS_COMMENT;
   if (b != a + 1)
     return 1;