]>
Commit | Line | Data |
---|---|---|
02fb3d17 | 1 | #undef __USE_STRING_INLINES |
9c3b1ceb UD |
2 | #define __USE_STRING_INLINES |
3 | #include <string.h> | |
4 | #include <stdlib.h> | |
5 | #include <stdio.h> | |
1760daad | 6 | #include <libc-diag.h> |
9c3b1ceb UD |
7 | |
8 | int | |
9 | main (void) | |
10 | { | |
11 | const char *a = "abc"; | |
12 | const char *b = a; | |
13 | ||
1760daad JM |
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"); | |
9c3b1ceb | 20 | strspn (b++, ""); |
1760daad | 21 | DIAG_POP_NEEDS_COMMENT; |
9c3b1ceb | 22 | if (b != a + 1) |
bf4de8f3 | 23 | return 1; |
9c3b1ceb | 24 | |
bf4de8f3 | 25 | return 0; |
9c3b1ceb | 26 | } |