Blame string/bug-strpbrk1.c

Packit Service 82fcde
/* Test case by Joseph S. Myers <jsm28@cam.ac.uk>.  */
Packit Service 82fcde
#undef __USE_STRING_INLINES
Packit Service 82fcde
#define __USE_STRING_INLINES
Packit Service 82fcde
#include <string.h>
Packit Service 82fcde
#include <stdlib.h>
Packit Service 82fcde
#include <stdio.h>
Packit Service 82fcde
#include <libc-diag.h>
Packit Service 82fcde
Packit Service 82fcde
int
Packit Service 82fcde
main (void)
Packit Service 82fcde
{
Packit Service 82fcde
  const char *a = "abc";
Packit Service 82fcde
  const char *b = a;
Packit Service 82fcde
Packit Service 82fcde
  DIAG_PUSH_NEEDS_COMMENT;
Packit Service 82fcde
  /* GCC 9 correctly warns that this call to strpbrk is useless.  That
Packit Service 82fcde
     is deliberate; this test is verifying that a side effect in an
Packit Service 82fcde
     argument still occurs when the call itself is useless and could
Packit Service 82fcde
     be optimized to return a constant.  */
Packit Service 82fcde
  DIAG_IGNORE_NEEDS_COMMENT (9, "-Wunused-value");
Packit Service 82fcde
  strpbrk (b++, "");
Packit Service 82fcde
  DIAG_POP_NEEDS_COMMENT;
Packit Service 82fcde
  if (b != a + 1)
Packit Service 82fcde
    return 1;
Packit Service 82fcde
Packit Service 82fcde
  return 0;
Packit Service 82fcde
}