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

Karl-Johan Karlsson via cfe-commits cfe-commits at lists.llvm.org
Tue Dec 5 03:45:30 PST 2023


================
@@ -918,6 +918,9 @@ def Wdeprecated : Flag<["-"], "Wdeprecated">, Group<W_Group>,
   HelpText<"Enable warnings for deprecated constructs and define __DEPRECATED">;
 def Wno_deprecated : Flag<["-"], "Wno-deprecated">, Group<W_Group>,
   Visibility<[ClangOption, CC1Option]>;
+def Wformat_signedness : Flag<["-"], "Wformat-signedness">,
----------------
karka228 wrote:

I have tried to mimic the gcc behavior when implementing this and in gcc it seems like -Wformat-signedness don't introduce a new warning but only modify the behavior of the already existing -Wformat warning.
If I place the warning option config in clang/include/clang/Basic/DiagnosticSemaKinds.td as you suggest don't I then also create a new warning with a new warning text? ... that is not what gcc do (as far as I understand).

Well, with that said we don't have to follow exactly how gcc implemented this if we think there is a better way to implement this in clang.

I agree that support for -Wno-format-signednes is missing from my patch and that should be added.


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


More information about the cfe-commits mailing list