2000-10-30 04:08:58 +00:00
|
|
|
/* Test case by Joseph S. Myers <jsm28@cam.ac.uk>. */
|
2000-10-31 04:38:55 +00:00
|
|
|
#undef __USE_STRING_INLINES
|
2000-10-30 04:08:58 +00:00
|
|
|
#define __USE_STRING_INLINES
|
|
|
|
#include <string.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <stdio.h>
|
2018-06-20 22:18:22 +00:00
|
|
|
#include <libc-diag.h>
|
2000-10-30 04:08:58 +00:00
|
|
|
|
|
|
|
int
|
|
|
|
main (void)
|
|
|
|
{
|
|
|
|
const char *a = "abc";
|
|
|
|
const char *b = a;
|
|
|
|
|
2018-06-20 22:18:22 +00:00
|
|
|
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");
|
2000-10-30 04:08:58 +00:00
|
|
|
strspn (b++, "");
|
2018-06-20 22:18:22 +00:00
|
|
|
DIAG_POP_NEEDS_COMMENT;
|
2000-10-30 04:08:58 +00:00
|
|
|
if (b != a + 1)
|
2000-12-31 10:52:32 +00:00
|
|
|
return 1;
|
2000-10-30 04:08:58 +00:00
|
|
|
|
2000-12-31 10:52:32 +00:00
|
|
|
return 0;
|
2000-10-30 04:08:58 +00:00
|
|
|
}
|