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

Karl-Johan Karlsson via cfe-commits cfe-commits at lists.llvm.org
Tue Nov 12 03:52:28 PST 2024


karka228 wrote:

> I think this diagnostic should not be firing on `%x` format specifiers:

In the C-standard (7.21.6.1 The fprintf function) when reading about the o,u,x,X format specifiers it say "The unsigned int argument is converted to unsigned octal (o), unsigned decimal (u), or unsigned hexadecimal notation (x or X) in the style dddd; the letters abcdef are used for x conversion and the letters ABCDEF for X conversion.". That's the reason why this diagnostic give a warning in this case. When this was implemented in clang we also said that we should follow the gcc behavior (as much as possible) as this warning have been available in gcc for a long time and gcc give a warning in this case.


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


More information about the cfe-commits mailing list