summaryrefslogtreecommitdiff
path: root/string/bug-strspn1.c
diff options
context:
space:
mode:
Diffstat (limited to 'string/bug-strspn1.c')
-rw-r--r--string/bug-strspn1.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/string/bug-strspn1.c b/string/bug-strspn1.c
index a657bafc43..e3487ab8f9 100644
--- a/string/bug-strspn1.c
+++ b/string/bug-strspn1.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 strspn 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");
strspn (b++, "");
+ DIAG_POP_NEEDS_COMMENT;
if (b != a + 1)
return 1;