[cfe-commits] [Patch] Make -Wformat accept printf("%hhx", c); with -funsigned-char (PR12761)

David Blaikie dblaikie at gmail.com
Tue May 8 08:26:39 PDT 2012


On Tue, May 8, 2012 at 3:20 AM, Hans Wennborg <hans at chromium.org> wrote:
> Hi all,
>
> For "%hhx", printf expects an unsigned char. This patch makes Clang
> accept a 'char' argument for that when using -funsigned-char.
>
> (Also removing some trailing whitespace and adding a few curly braces
> while we're here.)
>
> Please let me know if this is OK to commit.

There's a few unrelated whitespace changes here - those are usually
avoided (changing only whitespace on lines your patch is touching
anyway) or at least committed separately to keep the revision history
more clear.

Also, your test case only tests one case, but the code change modifies
at least a couple fo the switch cases - it'd be nice to test all your
changes. If possible, please add the test cases to an existing test
file (I assume there are existing test cases for these warnings)
rather than adding a new one. Though I realize you need to pass extra
flags - they may not conflict with the existing test cases (or perhaps
they do - I'm not sure)

& one naive question: I assume there's no way to detect that the user
wrote the type 'char', not 'unsigned char' or 'signed char'?

Thanks,
- David



More information about the cfe-commits mailing list