1 /* Test for warnings for extra format arguments being disabled by
2 -Wno-format-extra-args. Test which warnings still apply with $
4 /* Origin: Joseph Myers <jsm28@cam.ac.uk> */
5 /* { dg-do compile } */
6 /* { dg-options "-std=gnu99 -Wformat -Wno-format-extra-args" } */
11 foo (int i
, int *ip
, va_list va
)
13 printf ("%3$d%1$d", i
, i
, i
); /* { dg-warning "before used" "unused $ operand" } */
14 printf ("%2$d%1$d", i
, i
, i
);
15 vprintf ("%3$d%1$d", va
); /* { dg-warning "before used" "unused $ operand" } */
16 /* With scanf formats, gaps in the used arguments are allowed only if the
17 arguments are all pointers. In such a case, should only give the lesser
18 warning about unused arguments rather than the more serious one about
20 scanf ("%3$d%1$d", ip
, ip
, ip
);
21 /* If there are non-pointer arguments unused at the end, this is also OK. */
22 scanf ("%3$d%1$d", ip
, ip
, ip
, i
);
23 scanf ("%3$d%1$d", ip
, i
, ip
); /* { dg-warning "before used" "unused $ scanf non-pointer operand" } */
24 /* Can't check the arguments in the vscanf case, so should suppose the
26 vscanf ("%3$d%1$d", va
);