Warning: That file was not part of the compilation database. It may have many parsing errors.

1/* Test case by Joseph S. Myers <jsm28@cam.ac.uk>. */
2#undef __USE_STRING_INLINES
3#define __USE_STRING_INLINES
4#include <stdio.h>
5#include <stdlib.h>
6#include <string.h>
7#include <libc-diag.h>
8
9char d[3] = "\0\1\2";
10
11int
12main (void)
13{
14 DIAG_PUSH_NEEDS_COMMENT;
15#if __GNUC_PREREQ (8, 0)
16 /* GCC 8 warns about strncat truncating output; this is deliberately
17 tested here. */
18 DIAG_IGNORE_NEEDS_COMMENT (8, "-Wstringop-truncation");
19#endif
20 strncat (d, "\5\6", 1);
21 DIAG_POP_NEEDS_COMMENT;
22 if (d[0] != '\5')
23 {
24 puts ("d[0] != '\\5'");
25 exit (1);
26 }
27 if (d[1] != '\0')
28 {
29 puts ("d[1] != '\\0'");
30 exit (1);
31 }
32 if (d[2] != '\2')
33 {
34 puts ("d[2] != '\\2'");
35 exit (1);
36 }
37
38 return 0;
39}
40

Warning: That file was not part of the compilation database. It may have many parsing errors.