1 /* Verify that when we suggest adding #include directives that they 2 are added to the affected file. */ 3 4 /* The following header file is missing a "#include <stdio.h>". */ 5 6 #include "missing-header-fixit-2.h" 7 8 /* These directives actually apply to the header. */ 9 /* { dg-warning "implicit declaration of function 'printf'" "" { target *-*-* } 6 } */ 10 /* { dg-warning "incompatible implicit declaration of built-in function 'printf'" "" { target *-*-* } 6 } */ 11 12 /* { dg-options "-fdiagnostics-generate-patch" } */ 13 14 /* Verify the output from -fdiagnostics-generate-patch. 15 We expect the patch to begin with a header, containing the 16 filename of the header, via an absolute path. 17 Given the path, we can only capture it via regexps. */ 18 /* { dg-regexp "\\-\\-\\- .*" } */ 19 /* { dg-regexp "\\+\\+\\+ .*" } */ 20 /* Use #if 0/#endif rather than comments, to allow the text to contain 21 a comment. 22 We expect the *header* to have been patched, adding the missing include. */ 23 #if 0 24 { dg-begin-multiline-output "" } 25 @@ -1,3 +1,4 @@ 26 +#include <stdio.h> 27 /* This is missing-header-fixit-2.h, for use by 28 missing-header-fixit-2.c */ 29 30 { dg-end-multiline-output "" } 31 #endif 32