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