| 1 |
/* Test for scanf formats. Test that the C90 functions get their default |
| 2 |
attributes in strict C90 mode, but the C99 and gettext functions |
| 3 |
do not. |
| 4 |
*/ |
| 5 |
/* Origin: Joseph Myers <[email protected]> */ |
| 6 |
/* { dg-do compile { target { *-*-mingw* } } } */ |
| 7 |
/* { dg-options "-std=iso9899:1990 -pedantic -Wformat" } */ |
| 8 |
|
| 9 |
#define USE_SYSTEM_FORMATS |
| 10 |
#include "format.h" |
| 11 |
|
| 12 |
void |
| 13 |
foo (int *ip, char *s, va_list v0, va_list v1, va_list v2, va_list v3, |
| 14 |
va_list v4, va_list v5) |
| 15 |
{ |
| 16 |
fscanf (stdin, "%d", ip); |
| 17 |
fscanf (stdin, "%ld", ip); /* { dg-warning "format" "fscanf" } */ |
| 18 |
scanf ("%d", ip); |
| 19 |
scanf ("%ld", ip); /* { dg-warning "format" "scanf" } */ |
| 20 |
sscanf (s, "%d", ip); |
| 21 |
sscanf (s, "%ld", ip); /* { dg-warning "format" "sscanf" } */ |
| 22 |
vfscanf (stdin, "%d", v0); |
| 23 |
vscanf ("%d", v2); |
| 24 |
vsscanf (s, "%d", v4); |
| 25 |
scanf (gettext ("%d"), ip); |
| 26 |
scanf (gettext ("%ld"), ip); |
| 27 |
scanf (dgettext ("", "%d"), ip); |
| 28 |
scanf (dgettext ("", "%ld"), ip); |
| 29 |
scanf (dcgettext ("", "%d", 0), ip); |
| 30 |
scanf (dcgettext ("", "%ld", 0), ip); |
| 31 |
} |