1/* PR c/59717 */
2/* { dg-do compile } */
3/* { dg-options "-std=gnu11 -Wno-implicit-function-declaration" } */
4
5void
6math (double d, int *ex, double *dp)
7{
8  acos (d); /* { dg-warning "incompatible implicit" } */
9  /* { dg-message "include ..math.h.." "" { target *-*-* } 8 } */
10  acosh (d); /* { dg-warning "incompatible implicit" } */
11  /* { dg-message "include ..math.h.." "" { target *-*-* } 10 } */
12  asin (d); /* { dg-warning "incompatible implicit" } */
13  /* { dg-message "include ..math.h.." "" { target *-*-* } 12 } */
14  asinh (d); /* { dg-warning "incompatible implicit" } */
15  /* { dg-message "include ..math.h.." "" { target *-*-* } 14 } */
16  atan (d); /* { dg-warning "incompatible implicit" } */
17  /* { dg-message "include ..math.h.." "" { target *-*-* } 16 } */
18  atanh (d); /* { dg-warning "incompatible implicit" } */
19  /* { dg-message "include ..math.h.." "" { target *-*-* } 18 } */
20  atan2 (d, d); /* { dg-warning "incompatible implicit" } */
21  /* { dg-message "include ..math.h.." "" { target *-*-* } 20 } */
22  cbrt (d); /* { dg-warning "incompatible implicit" } */
23  /* { dg-message "include ..math.h.." "" { target *-*-* } 22 } */
24  ceil (d); /* { dg-warning "incompatible implicit" } */
25  /* { dg-message "include ..math.h.." "" { target *-*-* } 24 } */
26  copysign (d, d); /* { dg-warning "incompatible implicit" } */
27  /* { dg-message "include ..math.h.." "" { target *-*-* } 26 } */
28  cos (d); /* { dg-warning "incompatible implicit" } */
29  /* { dg-message "include ..math.h.." "" { target *-*-* } 28 } */
30  cosh (d); /* { dg-warning "incompatible implicit" } */
31  /* { dg-message "include ..math.h.." "" { target *-*-* } 30 } */
32  erf (d); /* { dg-warning "incompatible implicit" } */
33  /* { dg-message "include ..math.h.." "" { target *-*-* } 32 } */
34  erfc (d); /* { dg-warning "incompatible implicit" } */
35  /* { dg-message "include ..math.h.." "" { target *-*-* } 34 } */
36  exp (d); /* { dg-warning "incompatible implicit" } */
37  /* { dg-message "include ..math.h.." "" { target *-*-* } 36 } */
38  exp2 (d); /* { dg-warning "incompatible implicit" } */
39  /* { dg-message "include ..math.h.." "" { target *-*-* } 38 } */
40  expm1 (d); /* { dg-warning "incompatible implicit" } */
41  /* { dg-message "include ..math.h.." "" { target *-*-* } 40 } */
42  fabs (d); /* { dg-warning "incompatible implicit" } */
43  /* { dg-message "include ..math.h.." "" { target *-*-* } 42 } */
44  fdim (d, d); /* { dg-warning "incompatible implicit" } */
45  /* { dg-message "include ..math.h.." "" { target *-*-* } 44 } */
46  floor (d); /* { dg-warning "incompatible implicit" } */
47  /* { dg-message "include ..math.h.." "" { target *-*-* } 46 } */
48  fma (d, d, d); /* { dg-warning "incompatible implicit" } */
49  /* { dg-message "include ..math.h.." "" { target *-*-* } 48 } */
50  fmax (d, d); /* { dg-warning "incompatible implicit" } */
51  /* { dg-message "include ..math.h.." "" { target *-*-* } 50 } */
52  fmin (d, d); /* { dg-warning "incompatible implicit" } */
53  /* { dg-message "include ..math.h.." "" { target *-*-* } 52 } */
54  fmod (d, d); /* { dg-warning "incompatible implicit" } */
55  /* { dg-message "include ..math.h.." "" { target *-*-* } 54 } */
56  frexp (d, ex); /* { dg-warning "incompatible implicit" } */
57  /* { dg-message "include ..math.h.." "" { target *-*-* } 56 } */
58  hypot (d, d); /* { dg-warning "incompatible implicit" } */
59  /* { dg-message "include ..math.h.." "" { target *-*-* } 58 } */
60  /* We don't generate the warning for ilogb.  */
61  ilogb (d);
62  ldexp (d, *ex); /* { dg-warning "incompatible implicit" } */
63  /* { dg-message "include ..math.h.." "" { target *-*-* } 62 } */
64  lgamma (d); /* { dg-warning "incompatible implicit" } */
65  /* { dg-message "include ..math.h.." "" { target *-*-* } 64 } */
66  llrint (d); /* { dg-warning "incompatible implicit" } */
67  /* { dg-message "include ..math.h.." "" { target *-*-* } 66 } */
68  llround (d); /* { dg-warning "incompatible implicit" } */
69  /* { dg-message "include ..math.h.." "" { target *-*-* } 68 } */
70  log (d); /* { dg-warning "incompatible implicit" } */
71  /* { dg-message "include ..math.h.." "" { target *-*-* } 70 } */
72  log10 (d); /* { dg-warning "incompatible implicit" } */
73  /* { dg-message "include ..math.h.." "" { target *-*-* } 72 } */
74  log1p (d); /* { dg-warning "incompatible implicit" } */
75  /* { dg-message "include ..math.h.." "" { target *-*-* } 74 } */
76  log2 (d); /* { dg-warning "incompatible implicit" } */
77  /* { dg-message "include ..math.h.." "" { target *-*-* } 76 } */
78  logb (d); /* { dg-warning "incompatible implicit" } */
79  /* { dg-message "include ..math.h.." "" { target *-*-* } 78 } */
80  lrint (d); /* { dg-warning "incompatible implicit" } */
81  /* { dg-message "include ..math.h.." "" { target *-*-* } 80 } */
82  lround (d); /* { dg-warning "incompatible implicit" } */
83  /* { dg-message "include ..math.h.." "" { target *-*-* } 82 } */
84  modf (d, dp); /* { dg-warning "incompatible implicit" } */
85  /* { dg-message "include ..math.h.." "" { target *-*-* } 84 } */
86  nan (""); /* { dg-warning "incompatible implicit" } */
87  /* { dg-message "include ..math.h.." "" { target *-*-* } 86 } */
88  nearbyint (d); /* { dg-warning "incompatible implicit" } */
89  /* { dg-message "include ..math.h.." "" { target *-*-* } 88 } */
90  nextafter (d, d); /* { dg-warning "incompatible implicit" } */
91  /* { dg-message "include ..math.h.." "" { target *-*-* } 90 } */
92  nexttoward (d, 20.0L); /* { dg-warning "incompatible implicit" } */
93  /* { dg-message "include ..math.h.." "" { target *-*-* } 92 } */
94  pow (d, d); /* { dg-warning "incompatible implicit" } */
95  /* { dg-message "include ..math.h.." "" { target *-*-* } 94 } */
96  remainder (d, d); /* { dg-warning "incompatible implicit" } */
97  /* { dg-message "include ..math.h.." "" { target *-*-* } 96 } */
98  remquo (d, d, ex); /* { dg-warning "incompatible implicit" } */
99  /* { dg-message "include ..math.h.." "" { target *-*-* } 98 } */
100  rint (d); /* { dg-warning "incompatible implicit" } */
101  /* { dg-message "include ..math.h.." "" { target *-*-* } 100 } */
102  round (d); /* { dg-warning "incompatible implicit" } */
103  /* { dg-message "include ..math.h.." "" { target *-*-* } 102 } */
104  scalbln (d, 100L); /* { dg-warning "incompatible implicit" } */
105  /* { dg-message "include ..math.h.." "" { target *-*-* } 104 } */
106  scalbn (d, 100); /* { dg-warning "incompatible implicit" } */
107  /* { dg-message "include ..math.h.." "" { target *-*-* } 106 } */
108  sin (d); /* { dg-warning "incompatible implicit" } */
109  /* { dg-message "include ..math.h.." "" { target *-*-* } 108 } */
110  sinh (d); /* { dg-warning "incompatible implicit" } */
111  /* { dg-message "include ..math.h.." "" { target *-*-* } 110 } */
112  sincos (d, dp, dp); /* { dg-warning "incompatible implicit" } */
113  /* { dg-message "include ..math.h.." "" { target *-*-* } 112 } */
114  sqrt (d); /* { dg-warning "incompatible implicit" } */
115  /* { dg-message "include ..math.h.." "" { target *-*-* } 114 } */
116  tan (d); /* { dg-warning "incompatible implicit" } */
117  /* { dg-message "include ..math.h.." "" { target *-*-* } 116 } */
118  tanh (d); /* { dg-warning "incompatible implicit" } */
119  /* { dg-message "include ..math.h.." "" { target *-*-* } 118 } */
120  tgamma (d); /* { dg-warning "incompatible implicit" } */
121  /* { dg-message "include ..math.h.." "" { target *-*-* } 120 } */
122  trunc (d); /* { dg-warning "incompatible implicit" } */
123  /* { dg-message "include ..math.h.." "" { target *-*-* } 122 } */
124}
125
126void
127cmplx (double _Complex z)
128{
129  cabs (z); /* { dg-warning "incompatible implicit" } */
130  /* { dg-message "include ..complex.h.." "" { target *-*-* } 129 } */
131  cacos (z); /* { dg-warning "incompatible implicit" } */
132  /* { dg-message "include ..complex.h.." "" { target *-*-* } 131 } */
133  cacosh (z); /* { dg-warning "incompatible implicit" } */
134  /* { dg-message "include ..complex.h.." "" { target *-*-* } 133 } */
135  carg (z); /* { dg-warning "incompatible implicit" } */
136  /* { dg-message "include ..complex.h.." "" { target *-*-* } 135 } */
137  casin (z); /* { dg-warning "incompatible implicit" } */
138  /* { dg-message "include ..complex.h.." "" { target *-*-* } 137 } */
139  casinh (z); /* { dg-warning "incompatible implicit" } */
140  /* { dg-message "include ..complex.h.." "" { target *-*-* } 139 } */
141  catan (z); /* { dg-warning "incompatible implicit" } */
142  /* { dg-message "include ..complex.h.." "" { target *-*-* } 141 } */
143  catanh (z); /* { dg-warning "incompatible implicit" } */
144  /* { dg-message "include ..complex.h.." "" { target *-*-* } 143 } */
145  ccos (z); /* { dg-warning "incompatible implicit" } */
146  /* { dg-message "include ..complex.h.." "" { target *-*-* } 145 } */
147  ccosh (z); /* { dg-warning "incompatible implicit" } */
148  /* { dg-message "include ..complex.h.." "" { target *-*-* } 147 } */
149  cexp (z); /* { dg-warning "incompatible implicit" } */
150  /* { dg-message "include ..complex.h.." "" { target *-*-* } 149 } */
151  cimag (z); /* { dg-warning "incompatible implicit" } */
152  /* { dg-message "include ..complex.h.." "" { target *-*-* } 151 } */
153  clog (z); /* { dg-warning "incompatible implicit" } */
154  /* { dg-message "include ..complex.h.." "" { target *-*-* } 153 } */
155  conj (z); /* { dg-warning "incompatible implicit" } */
156  /* { dg-message "include ..complex.h.." "" { target *-*-* } 155 } */
157  cpow (z, z); /* { dg-warning "incompatible implicit" } */
158  /* { dg-message "include ..complex.h.." "" { target *-*-* } 157 } */
159  cproj (z); /* { dg-warning "incompatible implicit" } */
160  /* { dg-message "include ..complex.h.." "" { target *-*-* } 159 } */
161  creal (z); /* { dg-warning "incompatible implicit" } */
162  /* { dg-message "include ..complex.h.." "" { target *-*-* } 161 } */
163  csin (z); /* { dg-warning "incompatible implicit" } */
164  /* { dg-message "include ..complex.h.." "" { target *-*-* } 163 } */
165  csinh (z); /* { dg-warning "incompatible implicit" } */
166  /* { dg-message "include ..complex.h.." "" { target *-*-* } 165 } */
167  csqrt (z); /* { dg-warning "incompatible implicit" } */
168  /* { dg-message "include ..complex.h.." "" { target *-*-* } 167 } */
169  ctan (z); /* { dg-warning "incompatible implicit" } */
170  /* { dg-message "include ..complex.h.." "" { target *-*-* } 169 } */
171  ctanh (z); /* { dg-warning "incompatible implicit" } */
172  /* { dg-message "include ..complex.h.." "" { target *-*-* } 171 } */
173}
174
175void
176string (void *p, void *q, __SIZE_TYPE__ sz)
177{
178  memchr (p, 2, sz); /* { dg-warning "incompatible implicit" } */
179  /* { dg-message "include ..string.h.." "" { target *-*-* } 178 } */
180  /* We don't generate the warning for memcmp.  */
181  memcmp (p, q, sz);
182  memcpy (p, q, sz); /* { dg-warning "incompatible implicit" } */
183  /* { dg-message "include ..string.h.." "" { target *-*-* } 182 } */
184  memmove (p, q, sz); /* { dg-warning "incompatible implicit" } */
185  /* { dg-message "include ..string.h.." "" { target *-*-* } 184 } */
186  memset (p, 0, sz); /* { dg-warning "incompatible implicit" } */
187  /* { dg-message "include ..string.h.." "" { target *-*-* } 186 } */
188  strcat (p, q); /* { dg-warning "incompatible implicit" } */
189  /* { dg-message "include ..string.h.." "" { target *-*-* } 188 } */
190  strchr (p, 'a'); /* { dg-warning "incompatible implicit" } */
191  /* { dg-message "include ..string.h.." "" { target *-*-* } 190 } */
192  /* We don't generate the warning for strcmp.  */
193  strcmp (p, q);
194  strcpy (p, q); /* { dg-warning "incompatible implicit" } */
195  /* { dg-message "include ..string.h.." "" { target *-*-* } 194 } */
196  strcspn (p, q); /* { dg-warning "incompatible implicit" } */
197  /* { dg-message "include ..string.h.." "" { target *-*-* } 196 } */
198  strlen (p); /* { dg-warning "incompatible implicit" } */
199  /* { dg-message "include ..string.h.." "" { target *-*-* } 198 } */
200  strncat (p, q, sz); /* { dg-warning "incompatible implicit" } */
201  /* { dg-message "include ..string.h.." "" { target *-*-* } 200 } */
202  /* We don't generate the warning for strncmp.  */
203  strncmp (p, q, sz);
204  strncpy (p, q, sz); /* { dg-warning "incompatible implicit" } */
205  /* { dg-message "include ..string.h.." "" { target *-*-* } 204 } */
206  strpbrk (p, q); /* { dg-warning "incompatible implicit" } */
207  /* { dg-message "include ..string.h.." "" { target *-*-* } 206 } */
208  strrchr (p, 'q'); /* { dg-warning "incompatible implicit" } */
209  /* { dg-message "include ..string.h.." "" { target *-*-* } 208 } */
210  strspn (p, q); /* { dg-warning "incompatible implicit" } */
211  /* { dg-message "include ..string.h.." "" { target *-*-* } 210 } */
212  strstr (p, q); /* { dg-warning "incompatible implicit" } */
213  /* { dg-message "include ..string.h.." "" { target *-*-* } 212 } */
214}
215
216/* Fake FILE.  */
217typedef struct { int i; } FILE;
218
219void
220stdio (FILE *fp, void *p, __SIZE_TYPE__ sz)
221{
222  fprintf (fp, ""); /* { dg-warning "incompatible implicit" } */
223  /* { dg-message "include ..stdio.h.." "" { target *-*-* } 222 } */
224  fscanf (fp, ""); /* { dg-warning "incompatible implicit" } */
225  /* { dg-message "include ..stdio.h.." "" { target *-*-* } 224 } */
226  fwrite (p, sz, sz, fp); /* { dg-warning "incompatible implicit" } */
227  /* { dg-message "include ..stdio.h.." "" { target *-*-* } 226 } */
228  printf (""); /* { dg-warning "incompatible implicit" } */
229  /* { dg-message "include ..stdio.h.." "" { target *-*-* } 228 } */
230  scanf (""); /* { dg-warning "incompatible implicit" } */
231  /* { dg-message "include ..stdio.h.." "" { target *-*-* } 230 } */
232  snprintf ("", sz, ""); /* { dg-warning "incompatible implicit" } */
233  /* { dg-message "include ..stdio.h.." "" { target *-*-* } 232 } */
234  sprintf ("", ""); /* { dg-warning "incompatible implicit" } */
235  /* { dg-message "include ..stdio.h.." "" { target *-*-* } 234 } */
236  sscanf ("", ""); /* { dg-warning "incompatible implicit" } */
237  /* { dg-message "include ..stdio.h.." "" { target *-*-* } 236 } */
238}
239
240void
241stdlib (void *p, void *q, __SIZE_TYPE__ sz)
242{
243  abort (); /* { dg-warning "incompatible implicit" } */
244  /* { dg-message "include ..stdlib.h.." "" { target *-*-* } 243 } */
245  calloc (sz, 1); /* { dg-warning "incompatible implicit" } */
246  /* { dg-message "include ..stdlib.h.." "" { target *-*-* } 245 } */
247  exit (1); /* { dg-warning "incompatible implicit" } */
248  /* { dg-message "include ..stdlib.h.." "" { target *-*-* } 247 } */
249  free (p); /* { dg-warning "incompatible implicit" } */
250  /* { dg-message "include ..stdlib.h.." "" { target *-*-* } 249 } */
251  labs (1L); /* { dg-warning "incompatible implicit" } */
252  /* { dg-message "include ..stdlib.h.." "" { target *-*-* } 251 } */
253  llabs (1LL); /* { dg-warning "incompatible implicit" } */
254  /* { dg-message "include ..stdlib.h.." "" { target *-*-* } 253 } */
255  malloc (sz); /* { dg-warning "incompatible implicit" } */
256  /* { dg-message "include ..stdlib.h.." "" { target *-*-* } 255 } */
257  realloc (p, sz); /* { dg-warning "incompatible implicit" } */
258  /* { dg-message "include ..stdlib.h.." "" { target *-*-* } 257 } */
259  aligned_alloc (sz, sz); /* { dg-warning "incompatible implicit" } */
260  /* { dg-message "include ..stdlib.h.." "" { target *-*-* } 259 } */
261}
262
263void
264inttypes (__INTMAX_TYPE__ j)
265{
266  imaxabs (j); /* { dg-warning "incompatible implicit" } */
267  /* { dg-message "include ..inttypes.h.." "" { target *-*-* } 266 } */
268}
269
270struct tm;
271
272void
273timeh (char *s, __SIZE_TYPE__ sz, struct tm *tm)
274{
275  strftime (s, sz, "", tm); /* { dg-warning "incompatible implicit" } */
276  /* { dg-message "include ..time.h.." "" { target *-*-* } 275 } */
277}
278