]>
Commit | Line | Data |
---|---|---|
9c3b1ceb | 1 | /* Test case by Joseph S. Myers <jsm28@cam.ac.uk>. */ |
02fb3d17 | 2 | #undef __USE_STRING_INLINES |
9c3b1ceb UD |
3 | #define __USE_STRING_INLINES |
4 | #include <string.h> | |
5 | #include <stdlib.h> | |
6 | #include <stdio.h> | |
1760daad | 7 | #include <libc-diag.h> |
9c3b1ceb UD |
8 | |
9 | int | |
10 | main (void) | |
11 | { | |
12 | const char *a = "abc"; | |
13 | const char *b = a; | |
14 | ||
1760daad JM |
15 | DIAG_PUSH_NEEDS_COMMENT; |
16 | /* GCC 9 correctly warns that this call to strspn is useless. That | |
17 | is deliberate; this test is verifying that a side effect in an | |
18 | argument still occurs when the call itself is useless and could | |
19 | be optimized to return a constant. */ | |
20 | DIAG_IGNORE_NEEDS_COMMENT (9, "-Wunused-value"); | |
9c3b1ceb | 21 | strspn (b++, ""); |
1760daad | 22 | DIAG_POP_NEEDS_COMMENT; |
9c3b1ceb | 23 | if (b != a + 1) |
bf4de8f3 | 24 | return 1; |
9c3b1ceb | 25 | |
bf4de8f3 | 26 | return 0; |
9c3b1ceb | 27 | } |