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

Hans Wennborg hans at chromium.org
Tue May 8 10:23:25 PDT 2012


On Tue, May 8, 2012 at 4:27 PM, Matt Beaumont-Gay <matthewbg at google.com> wrote:
> LGTM, just a couple of minor suggestions:
>
>           case BuiltinType::Char_S:
>           case BuiltinType::SChar:
> -            return T == C.UnsignedCharTy;
> +            return T == C.SignedCharTy || T == C.UnsignedCharTy;
>           case BuiltinType::Char_U:
> -          case BuiltinType::UChar:
> -            return T == C.SignedCharTy;
> +          case BuiltinType::UChar:
> +            return T == C.UnsignedCharTy || T == C.SignedCharTy;
>
> Might as well just have all four BuiltinType::*Char* cases fall
> through to the same return statement.

Done.

> +// RUN: %clang_cc1 -fsyntax-only -verify -fno-signed-char %s
>
> Maybe explicitly say -Wformat here?
Done.

>> (Also removing some trailing whitespace and adding a few curly braces
>> while we're here.)
>
> If you want to do this cleanup, please do it in a separate commit.
OK, taking this out of the patch.

Landed r156388.

Thanks,
Hans




More information about the cfe-commits mailing list