diagnostics: fix bad interaction between line spans and line numbers
[official-gcc.git] / gcc / testsuite / gcc.dg / missing-header-fixit-3.c
blob8f2fb5b044a3d7cac61988259ceb6f07608b7de4
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 } */
11 #if 0
12 /* { dg-begin-multiline-output "" }
13 9 | printf ("%i of %i\n", i, j);
14 | ^~~~~~
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);
24 | ^~~~~~
25 { dg-end-multiline-output "" } */
26 #endif