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

Karl-Johan Karlsson via cfe-commits cfe-commits at lists.llvm.org
Wed Dec 6 11:22:55 PST 2023


karka228 wrote:

> I'd like to understand the need for this diagnostic a bit more. I realize GCC has it, but it's off-by-default in GCC and `-Wformat` does not enable it either: https://godbolt.org/z/Gxczsjdj5
> 
> We believe that users don't enable off by default warnings often enough to warrant supporting them, and this feels like a very pedantic warning in many cases. e.g., `printf("%u", 0);`

I work on an out of tree backend and our customers requested the warning -Wformat-signedness to be implemented in clang (as they found it in gcc). I agree that the warning is pedantic. Note that gcc will with the options -Wformat and -pedantic enable at least the warnings related to scanf (see https://godbolt.org/z/WjzWKj89G). 

If you feel that the clang community don't really want -Wformat-signedness I can simply implement this in our downstream llvm-project repo and abandon this pull request. We already have a large number of diffs compared to https://github.com/llvm/llvm-project and a few more probably don't make any difference.


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


More information about the cfe-commits mailing list