[C PATCH] Abate -Wformat-signedness warnings (PR c/65040)
Joseph Myers
joseph@codesourcery.com
Thu Feb 12 23:45:00 GMT 2015
On Thu, 12 Feb 2015, Marek Polacek wrote:
> This patch tries to avoid emitting -Wformat-signedness warnings in cases
> where integer promotions are performed on unsigned values such as:
> unsigned short arg = N;
> printf ("%u\n", arg);
> here we can know that the promoted value of arg is in range <0, USHRT_MAX>, or
> printf ("%" PRIx8, (uint8_t) val);
> where the warning is just irritating.
>
> Fixed by bailing out when we see a value of unsigned type that has been
> promoted and the conversion specifier is of unsigned type.
>
> Bootstrapped/regtested on x86_64-linux, ok for trunk?
OK.
--
Joseph S. Myers
joseph@codesourcery.com
More information about the Gcc-patches
mailing list