| 1 |
/* Example of a fix-it hint that adds a #include directive, |
| 2 |
adding them after a pre-existing #include directive. */ |
| 3 |
#include "empty.h" |
| 4 |
int the_next_line; |
| 5 |
|
| 6 |
/* { dg-options "-fdiagnostics-show-caret -fdiagnostics-show-line-numbers" } */ |
| 7 |
|
| 8 |
void test (int i, int j) |
| 9 |
{ |
| 10 |
printf ("%i of %i\n", i, j); /* { dg-line printf } */ |
| 11 |
/* { dg-error "implicit declaration of function" "" { target *-*-* } printf } */ |
| 12 |
/* { dg-begin-multiline-output "" } |
| 13 |
10 | printf ("%i of %i\n", i, j); |
| 14 |
| ^~~~~~ |
| 15 |
{ dg-end-multiline-output "" } */ |
| 16 |
/* { dg-warning "incompatible implicit declaration" "" { target *-*-* } printf } */ |
| 17 |
/* { dg-begin-multiline-output "" } |
| 18 |
10 | printf ("%i of %i\n", i, j); |
| 19 |
| ^~~~~~ |
| 20 |
{ dg-end-multiline-output "" } */ |
| 21 |
/* { dg-message "include '<stdio.h>' or provide a declaration of 'printf'" "" { target *-*-* } 4 } */ |
| 22 |
/* { dg-begin-multiline-output "" } |
| 23 |
3 | #include "empty.h" |
| 24 |
+++ |+#include <stdio.h> |
| 25 |
4 | int the_next_line; |
| 26 |
{ dg-end-multiline-output "" } */ |
| 27 |
} |