On Tue, 23 Nov 2021, Daniil Stas via Gcc-patches wrote:

> On Mon, 22 Nov 2021 20:35:03 +0000
> Joseph Myers <jos...@codesourcery.com> wrote:
> 
> > On Sun, 21 Nov 2021, Daniil Stas via Gcc-patches wrote:
> > 
> > > This option is enabled by default when -Wformat option is enabled. A
> > > user can specify -Wno-format-int-precision to disable emitting
> > > warnings when passing an argument of an incompatible integer type to
> > > a 'd', 'i', 'o', 'u', 'x', or 'X' conversion specifier when it has
> > > the same precision as the expected type.  
> > 
> > I'd expect this to apply to 'b' and 'B' as well (affects commit
> > message, ChangeLog entry, option help string, documentation).
> > 
> 
> Hi Joseph,
> 
> I can't find any description of these specifiers anywhere. And looks

They're new specifiers in C23.  See the most recent working draft 
<http://www.open-std.org/jtc1/sc22/wg14/www/docs/n2731.pdf>.

> like gcc doesn't recognize them when I try to compile a sample program

GCC should recognize them (i.e., not warn about them with -Wformat) if you 
have commit bd6f2c63168e89bede631daf8b673eab16acc747 (12 October).

> with them (I just get %B printed when I run the program).

If you want runtime support for those specifiers in printf, you'll need a 
libc implementation with support for them.  In glibc that means commit 
309548bec3b89022bbc81a372ec3e9240211d799 (10 November) or later, for 
example.

-- 
Joseph S. Myers
jos...@codesourcery.com

Reply via email to