| 1 |
/* PR c/98487 */ |
| 2 |
/* { dg-do compile { target { c || c++11 } } } */ |
| 3 |
/* { dg-options "-Wsuggest-attribute=format" } */ |
| 4 |
|
| 5 |
#include <stdarg.h> |
| 6 |
|
| 7 |
[[gnu::__format__(__printf__, 1, 2)]] |
| 8 |
void |
| 9 |
do_printf(const char * const a0, ...) |
| 10 |
{ |
| 11 |
va_list ap; |
| 12 |
va_start(ap, a0); |
| 13 |
__builtin_vprintf(a0, ap); |
| 14 |
va_end(ap); |
| 15 |
} |
| 16 |
|
| 17 |
[[gnu::__format__(__scanf__, 1, 2)]] |
| 18 |
void |
| 19 |
do_scanf(const char * const a0, ...) |
| 20 |
{ |
| 21 |
va_list ap; |
| 22 |
va_start(ap, a0); |
| 23 |
__builtin_vscanf(a0, ap); |
| 24 |
va_end(ap); |
| 25 |
} |
| 26 |
|
| 27 |
struct tm; |
| 28 |
|
| 29 |
[[gnu::__format__(__strftime__, 1, 0)]] |
| 30 |
void |
| 31 |
do_strftime(const char * const a0, struct tm * a1) |
| 32 |
{ |
| 33 |
char buff[256]; |
| 34 |
__builtin_strftime(buff, sizeof(buff), a0, a1); |
| 35 |
__builtin_puts(buff); |
| 36 |
} |