(root)/
gcc-13.2.0/
gcc/
testsuite/
gcc.dg/
format/
ext-9.c
       1  /* Test for printf format extensions using formats from or recommended by
       2     C2X.  */
       3  /* { dg-do compile } */
       4  /* { dg-options "-std=gnu2x -Wformat" } */
       5  
       6  #include "format.h"
       7  
       8  void
       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, int_least8_t i8, int_least16_t i16,
      12       int_least32_t i32, int_least64_t i64, uint_least8_t u8,
      13       uint_least16_t u16, uint_least32_t u32, uint_least64_t u64,
      14       int_fast8_t if8, int_fast16_t if16, int_fast32_t if32, int_fast64_t if64,
      15       uint_fast8_t uf8, uint_fast16_t uf16, uint_fast32_t uf32,
      16       uint_fast64_t uf64)
      17  {
      18    /* Deprecated length modifiers with %b and %B.  */
      19    printf ("%qb%qB", uq, uq);
      20    printf ("%Lb%LB", ull, ull);
      21    printf ("%Zb%ZB", z, z);
      22    /* Use of %B in cases valid for %b.  */
      23    printf ("%B %hB %hhB %lB %llB %jB %zB %tB\n", u, us, uc, ul, ull, uj, z, ut);
      24    printf ("%*.*llB\n", 1, 2, ull);
      25    printf ("%-B\n", u);
      26    printf ("%#B\n", u);
      27    printf ("%08B\n", u);
      28    /* Flags valid on signed conversions only.  */
      29    printf ("%+B\n", u); /* { dg-warning "flag" } */
      30    printf ("% B\n", u); /* { dg-warning "flag" } */
      31    /* Flags ignored in certain combinations.  */
      32    printf ("%-08B\n", u); /* { dg-warning "ignored" } */
      33    printf ("%08.5B\n", u); /* { dg-warning "ignored" } */
      34    /* Use of %wN and %wfN with %B.  */
      35    printf ("%w8B %w16B %w32B %w64B %wf8B %wf16B %wf32B %wf64B",
      36  	  u8, u16, u32, u64, uf8, uf16, uf32, uf64);
      37  }