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 "-fdiagnostics-show-caret -fdiagnostics-show-line-numbers -Wimplicit-function-declaration -Wno-builtin-declaration-mismatch" } */
7
8 int
foo(char * m,int i)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 +++ |+#include <ctype.h>
16 1 |
17 { dg-end-multiline-output "" } */
18 {
19 return abs (i); /* { dg-warning "implicit declaration of function" } */
20 /* { dg-begin-multiline-output "" }
21 19 | return abs (i);
22 | ^~~
23 +++ |+#include <stdlib.h>
24 1 |
25 { dg-end-multiline-output "" } */
26 }
27 else
28 putchar (m[0]); /* { dg-warning "implicit declaration of function" } */
29 /* { dg-begin-multiline-output "" }
30 28 | putchar (m[0]);
31 | ^~~~~~~
32 +++ |+#include <stdio.h>
33 1 |
34 { dg-end-multiline-output "" } */
35 return i;
36 }
37