Skip several analyzer socket tests on hppa*-*-hpux*
[official-gcc.git] / gcc / testsuite / c-c++-common / analyzer / call-summaries-pr107158-2.c
blobb395623cccacc89a9a39690161eb7a438f6e0c89
1 /* { dg-additional-options "-fanalyzer-call-summaries -Wno-analyzer-too-complex -Wno-analyzer-symbol-too-complex" } */
2 /* { dg-skip-if "c++98 has no noreturn attribute" { c++98_only } } */
4 #ifdef __cplusplus
5 #define _Noreturn [[noreturn]]
6 #endif
8 typedef __SIZE_TYPE__ size_t;
9 typedef struct _IO_FILE FILE;
10 extern char *fgets(char *__restrict __s, int __n, FILE *__restrict __stream)
11 __attribute__((__access__(__write_only__, 1, 2)));
12 extern void perror(const char *__s);
13 enum {
14 _ISspace = ((5) < 8 ? ((1 << (5)) << 8) : ((1 << (5)) >> 8)),
16 extern const unsigned short int **__ctype_b_loc(void)
17 __attribute__((__nothrow__, __leaf__)) __attribute__((__const__));
18 extern void *malloc(size_t __size) __attribute__((__nothrow__, __leaf__))
19 __attribute__((__malloc__)) __attribute__((__alloc_size__(1)));
20 extern void exit(int __status) __attribute__((__nothrow__, __leaf__))
21 __attribute__((__noreturn__));
22 extern char *strcpy(char *__restrict __dest, const char *__restrict __src)
23 __attribute__((__nothrow__, __leaf__)) __attribute__((__nonnull__(1, 2)));
24 extern size_t strlen(const char *__s) __attribute__((__nothrow__, __leaf__))
25 __attribute__((__pure__)) __attribute__((__nonnull__(1)));
27 struct mydata {
28 struct mydata *link;
29 char *name;
30 char *type;
33 static struct mydata *all_data;
34 static int line_no;
36 _Noreturn static void failed(const char *message) {
37 perror(message);
38 exit(1);
41 static char *string_dup(const char *string) {
42 char *buf;
44 if ((buf = (char *) malloc(strlen(string) + 1)) == ((void *)0))
45 failed("malloc() failed");
47 return strcpy(buf, string);
50 static void store_data(const char *name, const char *type) {
51 struct mydata *p, *q;
53 if ((p = (struct mydata *)malloc(sizeof(struct mydata))) == ((void *)0))
54 failed("malloc() failed");
56 p->link = (struct mydata *)((void *)0);
57 p->name = string_dup(name);
58 p->type = string_dup(type);
60 if ((q = all_data) == ((void *)0))
61 all_data = p;
62 else {
63 while (q->link != ((void *)0))
64 q = q->link;
65 q->link = p;
69 static void parse_tbl(char *buffer) {
70 char *s = buffer;
71 char *t = s + strlen(s);
73 do {
74 t--;
75 if (((*__ctype_b_loc())[(int)(((int)*t))] & (unsigned short int)_ISspace))
76 *t = '\0';
77 else
78 break;
79 } while (t > s);
80 while (((*__ctype_b_loc())[(int)(((int)*s))] & (unsigned short int)_ISspace))
81 s++;
82 buffer = s;
84 line_no++;
85 if (*buffer != ';' && *buffer != '\0') {
86 if (*buffer == '#') {
87 store_data(buffer, ""); /* { dg-bogus "leak" "PR analyzer/107158" { xfail *-*-* } } */
88 } else {
90 while (*s && !((*__ctype_b_loc())[(int)(((int)*s))] &
91 (unsigned short int)_ISspace))
92 s++;
93 while (
94 ((*__ctype_b_loc())[(int)(((int)*s))] & (unsigned short int)_ISspace))
95 *s++ = '\0';
96 store_data(buffer, s); /* { dg-bogus "leak" "PR analyzer/107158" { xfail *-*-* } } */
101 /* [...snip...] */
103 static void makecfg(FILE *ifp, FILE *ofp, FILE *ofp2) {
104 char buffer[8192];
106 /* [...snip...] */
108 line_no = 0;
109 while (fgets(buffer, sizeof(buffer) - 1, ifp))
110 parse_tbl(buffer);
112 /* [...snip...] */