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