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

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Thu Mar 21 08:40:58 PDT 2024


AaronBallman wrote:

> > I need to extend the tablegen backend ClangDiagnosticsEmitter with some kind of new option to handle this, right?
> 
> Alternatively, you could probably use `DiagnosticsEngine::isIgnored` to check if the `-Wformat-signedness` is enabled or not, and control whether `MatchSignedNess` is `NoMatch` or `Match`, as your first implementation did. This way we can achieve GCC compatibility for 1, 2, 3, 4, 6, 7, while benefitting from a real warning flag. However, in this implementation `-Wformat-signedness` would be an _dummy warning_ which never gets emitted. As far as I know, there isn't anything similar in the codebase, so it might not be the ideal way.

Sorry for the delayed response, this fell off my radar (thanks @Endilll for mentioning this after meeting with @hazohelet!).

This would be novel but might not be a terrible approach. I'm not convinced that #3 is a particularly good design (and #6 doesn't seem critical to me either), but I think modifying tablegen to improve support here would be a heavy lift for little benefit. I'd say let's try that approach and see how we like it, and go from there. WDYT?

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


More information about the cfe-commits mailing list