[PATCH] Use CHAR_BIT instead of NBBY in libctf

Tom Tromey tromey@adacore.com
Tue Jun 4 20:10:00 GMT 2019

>>>>> "Nick" == Nick Alcock <nick.alcock@oracle.com> writes:

>> ../../binutils-gdb/libctf/ctf-create.c: In function 'ctf_add_type':
>> ../../binutils-gdb/libctf/ctf-create.c:1822:16: warning: unknown conversion type character 'z' in format [-Wformat=]
>> ctf_dprintf ("Conflict for type %s against ID %lx: "
>> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Nick> I suppose we could explicitly cast size_t arguments instead of using
Nick> %zi. I can implement that if you think it's sensible. (Ironically, it's
Nick> not that long ago that I ripped those casts out and moved to %zi
Nick> everywhere...)

FWIW I am not sure if this is really an ongoing problem or whether it's
gcc being conservative.  However, apparently at least some versions of
Windows don't support %z.

BFD defines various BFD_PRI* macros that you can use if you want to try
for the full approach.  I suppose this could be extended to cover "%z".

Casting is fine with me, though of course it can fail if there is
overflow, so some thought is required.


More information about the Binutils mailing list