PR middle-end/85602 - -Wsizeof-pointer-memaccess for strncat with size of source
[official-gcc.git] / gcc / testsuite / gcc.dg / missing-header-fixit-1.c
blob2b28357e1db9a7978e6e8a8dadaf81873f49a247
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
6 directives). */
8 /* { dg-options "-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
23 a comment. */
24 #if 0
25 { dg-begin-multiline-output "" }
26 @@ -1,3 +1,4 @@
27 +#include <stdio.h>
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 "" }
32 #endif
34 /* FIXME: should we attempt to skip leading comments when determining the
35 insertion location?
36 Similarly, should we attempt to be within single-inclusion guards, etc? */