syslog: Improve fortify with clang
[glibc.git] / string / bug-strpbrk1.c
blobca0bc11308c5a9a00a4d7ca4f55c3a4c768b0a05
1 #undef __USE_STRING_INLINES
2 #define __USE_STRING_INLINES
3 #include <string.h>
4 #include <stdlib.h>
5 #include <stdio.h>
6 #include <libc-diag.h>
8 int
9 main (void)
11 const char *a = "abc";
12 const char *b = a;
14 DIAG_PUSH_NEEDS_COMMENT;
15 /* GCC 9 correctly warns that this call to strpbrk is useless. That
16 is deliberate; this test is verifying that a side effect in an
17 argument still occurs when the call itself is useless and could
18 be optimized to return a constant. */
19 DIAG_IGNORE_NEEDS_COMMENT (9, "-Wunused-value");
20 strpbrk (b++, "");
21 DIAG_POP_NEEDS_COMMENT;
22 if (b != a + 1)
23 return 1;
25 return 0;