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> |
7 | |
8 | int |
9 | main (void) |
10 | { |
11 | const char *a = "abc" ; |
12 | const char *b = a; |
13 | |
14 | DIAG_PUSH_NEEDS_COMMENT; |
15 | /* GCC 9 correctly warns that this call to strspn 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 | strspn (b++, "" ); |
21 | DIAG_POP_NEEDS_COMMENT; |
22 | if (b != a + 1) |
23 | return 1; |
24 | |
25 | return 0; |
26 | } |
27 | |