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 /* This is padding (to avoid the generated patch containing DejaGnu
8 /* { dg-options "-fpermissive -fdiagnostics-generate-patch" } */
10 void test (int i
, int j
)
12 printf ("%i of %i\n", i
, j
); /* { dg-warning "implicit declaration" } */
13 /* { dg-message "include '<stdio.h>' or provide a declaration of 'printf'" "" { target *-*-* } .-1 } */
16 /* Verify the output from -fdiagnostics-generate-patch.
17 We expect the patch to begin with a header, containing this
18 source filename, via an absolute path.
19 Given the path, we can only capture it via regexps. */
20 /* { dg-regexp "\\-\\-\\- .*" } */
21 /* { dg-regexp "\\+\\+\\+ .*" } */
22 /* Use #if 0/#endif rather than comments, to allow the text to contain
25 { dg
-begin
-multiline
-output
"" }
28 /* Example of a fix-it hint that adds a #include directive,
29 adding them to the top of the file, given that there is no
30 pre-existing #include. */
31 { dg
-end
-multiline
-output
"" }
34 /* FIXME: should we attempt to skip leading comments when determining the
36 Similarly, should we attempt to be within single-inclusion guards, etc? */