c-family: Support format checking C2X %b, %B formats
[official-gcc.git] / gcc / testsuite / gcc.dg / format / c2x-scanf-1.c
blobf46a715276945b4186bb4cdac078dce8a5026c5b
1 /* Test for scanf formats. Formats using C2X features. */
2 /* { dg-do compile } */
3 /* { dg-options "-std=c2x -pedantic -Wformat" } */
5 #include "format.h"
7 void
8 foo (unsigned int *uip, unsigned short int *uhp, unsigned char *uhhp,
9 unsigned long int *ulp, unsigned long long *ullp, uintmax_t *ujp,
10 size_t *zp, unsigned_ptrdiff_t *utp)
12 scanf ("%*b");
13 scanf ("%2b", uip);
14 scanf ("%hb%hhb%lb%llb%jb%zb%tb", uhp, uhhp, ulp, ullp, ujp, zp, utp);
15 scanf ("%Lb", ullp); /* { dg-warning "does not support" } */
16 scanf ("%qb", ullp); /* { dg-warning "does not support" } */