| 1 |
/* Test for format attributes: test default attributes are applied |
| 2 |
to implicit declarations. */ |
| 3 |
/* Origin: Joseph Myers <[email protected]> */ |
| 4 |
/* { dg-do compile } */ |
| 5 |
/* { dg-options "-std=gnu89 -Wformat" } */ |
| 6 |
|
| 7 |
/* We can't #include "format.h" here. */ |
| 8 |
|
| 9 |
/* Technically, none of the format functions should be implicitly declared; |
| 10 |
either the implicit type is wrong, the function has variable arguments |
| 11 |
or it requires a type declared in a header. However, some bad programming |
| 12 |
practice uses implicit declarations of some of these functions. |
| 13 |
|
| 14 |
Note that printf is not used in this test because of the declaration |
| 15 |
of it as a built-in function. */ |
| 16 |
|
| 17 |
void |
| 18 |
foo (const char *s, int *p) |
| 19 |
{ |
| 20 |
scanf("%ld", p); /* { dg-warning "12:format" "implicit scanf" } */ |
| 21 |
/* { dg-warning "implicit" "implicit decl warning" { target *-*-* } .-1 } */ |
| 22 |
} |