This is the mail archive of the mailing list for the binutils project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Use CHAR_BIT instead of NBBY in libctf

On 4 Jun 2019, Tom Tromey uttered the following:

>>>>>> "Nick" == Nick Alcock <> 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.

Yeah, I found references elsewhere to other allegedly-C99 compilers not
supporting %z too. I'll switch back to just casting: these are all only
debugging messages anyway. (Because a well-behaved library shouldn't be
printing stuff unless you turn on a debugging option.)

> 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.

These are all for things like type IDs, for which the file format
imposes a 2^32 maximum anyway. So we should always be safe, since GNU
software assumes long is at least that long.

NULL && (void)

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]