| 1 |
|
| 2 |
/* Forget to include any standard headers, all for built-in functions. |
| 3 |
Rely on -Wimplicit-function-declaration for fixit hints, not on |
| 4 |
-Wbuiltin-declaration-mismatch (which misses abs, isdigit, putchar). */ |
| 5 |
|
| 6 |
/* { dg-options "-fpermissive -fdiagnostics-show-caret -fdiagnostics-show-line-numbers -Wimplicit-function-declaration -Wno-builtin-declaration-mismatch" } */ |
| 7 |
|
| 8 |
int |
| 9 |
foo (char *m, int i) |
| 10 |
{ |
| 11 |
if (isdigit (m[0])) /* { dg-warning "implicit declaration of function" } */ |
| 12 |
/* { dg-begin-multiline-output "" } |
| 13 |
11 | if (isdigit (m[0])) |
| 14 |
| ^~~~~~~ |
| 15 |
{ dg-end-multiline-output "" } */ |
| 16 |
/* { dg-begin-multiline-output "" } |
| 17 |
+++ |+#include <ctype.h> |
| 18 |
1 | |
| 19 |
{ dg-end-multiline-output "" } */ |
| 20 |
{ |
| 21 |
return abs (i); /* { dg-warning "implicit declaration of function" } */ |
| 22 |
/* { dg-begin-multiline-output "" } |
| 23 |
21 | return abs (i); |
| 24 |
| ^~~ |
| 25 |
{ dg-end-multiline-output "" } */ |
| 26 |
/* { dg-begin-multiline-output "" } |
| 27 |
+++ |+#include <stdlib.h> |
| 28 |
1 | |
| 29 |
{ dg-end-multiline-output "" } */ |
| 30 |
} |
| 31 |
else |
| 32 |
putchar (m[0]); /* { dg-warning "implicit declaration of function" } */ |
| 33 |
/* { dg-begin-multiline-output "" } |
| 34 |
32 | putchar (m[0]); |
| 35 |
| ^~~~~~~ |
| 36 |
{ dg-end-multiline-output "" } */ |
| 37 |
/* { dg-begin-multiline-output "" } |
| 38 |
+++ |+#include <stdio.h> |
| 39 |
1 | |
| 40 |
{ dg-end-multiline-output "" } */ |
| 41 |
return i; |
| 42 |
} |