1 /* Example of a fix-it hint that adds a #include directive,
2 adding them to the top of the file, given that there is no
3 pre-existing #include. */
5 /* { dg-options "-fdiagnostics-show-caret -fdiagnostics-show-line-numbers" } */
7 void test (int i
, int j
)
9 printf ("%i of %i\n", i
, j
); /* { dg-warning "implicit declaration" } */
10 /* { dg-message "include '<stdio.h>' or provide a declaration of 'printf'" "" { target *-*-* } .-1 } */
12 /* { dg-begin-multiline-output "" }
13 9 | printf ("%i of %i\n", i, j);
15 { dg-end-multiline-output "" } */
16 /* { dg-regexp ".*missing-header-fixit-3.c:1:1:" } */
17 /* { dg-begin-multiline-output "" }
18 + |+#include <stdio.h>
19 1 | /* Example of a fix-it hint that adds a #include directive,
20 { dg-end-multiline-output "" } */
21 /* { dg-regexp ".*missing-header-fixit-3.c:9:3:" } */
22 /* { dg-begin-multiline-output "" }
23 9 | printf ("%i of %i\n", i, j);
25 { dg-end-multiline-output "" } */