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
5 /* Origin: Joseph Myers <jsm28@cam.ac.uk> */
6 /* { dg-do compile } */
7 /* { dg-options "-std=iso9899:1990 -pedantic -Wformat" } */
9 /* This may not be correct in the particular case, but allows the
10 prototypes to be declared, and we don't try to link.
12 typedef struct _FILE FILE;
15 typedef __builtin_va_list va_list;
17 extern int fscanf (FILE *, const char *, ...);
18 extern int scanf (const char *, ...);
19 extern int sscanf (const char *, const char *, ...);
21 extern int vfscanf (FILE *, const char *, va_list);
22 extern int vscanf (const char *, va_list);
23 extern int vsscanf (const char *, const char *, va_list);
25 extern char *gettext (const char *);
26 extern char *dgettext (const char *, const char *);
27 extern char *dcgettext (const char *, const char *, int);
30 foo (int *ip, char *s, va_list v0, va_list v1, va_list v2, va_list v3,
31 va_list v4, va_list v5)
33 fscanf (stdin, "%d", ip);
34 fscanf (stdin, "%ld", ip); /* { dg-warning "format" "fscanf" } */
36 scanf ("%ld", ip); /* { dg-warning "format" "scanf" } */
38 sscanf (s, "%ld", ip); /* { dg-warning "format" "sscanf" } */
39 vfscanf (stdin, "%d", v0);
40 vfscanf (stdin, "%Y", v1);
43 vsscanf (s, "%d", v4);
44 vsscanf (s, "%Y", v5);
45 scanf (gettext ("%d"), ip);
46 scanf (gettext ("%ld"), ip);
47 scanf (dgettext ("", "%d"), ip);
48 scanf (dgettext ("", "%ld"), ip);
49 scanf (dcgettext ("", "%d", 0), ip);
50 scanf (dcgettext ("", "%ld", 0), ip);