[clang] [llvm] [Sema] Implement support for -Wformat-signedness (PR #74440)

Karl-Johan Karlsson via cfe-commits cfe-commits at lists.llvm.org
Tue Mar 26 01:17:57 PDT 2024


karka228 wrote:

> > With the current implementation `-Wformat-signedness` by itself actually turn on the signedness warnings. This is not compatible with how gcc do it. I guess I have thought that it was not that important to be compatible with gcc in this respect. However if it is I guess this could be implemented.
> 
> Personally, I find GCC's behavior a bit surprising, so I'm okay with a divergence there.

Sorry, I'm confused. Ignore what I said above. What is not compatible with gcc is only that -Wformat is turned on default by clang and not by gcc. The handling of `-Wformat-signedness` is as far as I can tell compatible with gcc.

> But we should have tests for this just the same:
> 
>     * `-Wformat-signedness`
> 
>     * `-Wformat-signedness -Wno-format`
> 
>     * `-Wno-format -Wformat-signedness`

I agree, it is good to have tests of those combinations. I have now added them to clang/test/Sema/format-strings-signedness.c


https://github.com/llvm/llvm-project/pull/74440


More information about the cfe-commits mailing list