AaronBallman wrote:

> > Can you also add a test showing the difference between `-Wformat 
> > -Wformat-signedness` and `-Wformat-signedness` by itself (which does 
> > nothing)?
> 
> 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. But we should have tests for this just the same:

* `-Wformat-signedness`
* `-Wformat-signedness -Wno-format`
* `-Wno-format -Wformat-signedness`

The first test helps demonstrate that we intentionally deviate from GCC, but it 
also helps show whether `-Wformat-signedness` implies `-Wformat` or not. The 
second test helps answer whether `-Wformat-signedness` is turned off by 
disabling `-Wformat`. The third test helps answer whether format signedness can 
be turned on while turning off all other formatting warnings -- this test may 
not be needed if `-Wformat-signedness` by itself enables only the signedness 
diagnostics.

> > I'd also like to see a test demonstrating that `#pragma GCC diagnostic 
> > ignored -Wformat` disables the signedness warnings.
> 
> There is a single test in the end of 
> clang/test/Sema/format-strings-signedness.c that demonstrate this.

Ah thank you!

https://github.com/llvm/llvm-project/pull/74440
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to