1 /* Test for printf format extensions using formats from or recommended by
3 /* { dg-do compile } */
4 /* { dg-options "-std=gnu2x -Wformat" } */
9 foo (u_quad_t uq
, unsigned int u
, unsigned short us
, unsigned char uc
,
10 unsigned long ul
, unsigned long long ull
, uintmax_t uj
, size_t z
,
11 unsigned_ptrdiff_t ut
)
13 /* Deprecated length modifiers with %b and %B. */
14 printf ("%qb%qB", uq
, uq
);
15 printf ("%Lb%LB", ull
, ull
);
16 printf ("%Zb%ZB", z
, z
);
17 /* Use of %B in cases valid for %b. */
18 printf ("%B %hB %hhB %lB %llB %jB %zB %tB\n", u
, us
, uc
, ul
, ull
, uj
, z
, ut
);
19 printf ("%*.*llB\n", 1, 2, ull
);
23 /* Flags valid on signed conversions only. */
24 printf ("%+B\n", u
); /* { dg-warning "flag" } */
25 printf ("% B\n", u
); /* { dg-warning "flag" } */
26 /* Flags ignored in certain combinations. */
27 printf ("%-08B\n", u
); /* { dg-warning "ignored" } */
28 printf ("%08.5B\n", u
); /* { dg-warning "ignored" } */