karka228 wrote:

> > 1. The option -Wformat-signedness is default off.
> > 
> > 2. The -Wformat-signedness warnings are not enabled alone by the -Wformat 
> > option.
> > 
> > 3. The -Wformat-signedness warnings are not enabled alone by the 
> > -Wformat-signedness option.
> > 
> > 4. The -Wformat-signedness warnings are enabled by the option -Wformat 
> > together with the option -Wformat-signedness.
> > 
> > 5. Parts of the -Wformat-signedness warnings (regarding scanf) are enabled 
> > by the options -Wformat together with the option -pedantic.
> > 
> > 6. Warnings produced by -Wformat-signedness is reported as a -Wformat 
> > warnings (e.g "warning: format ‘%u’ expects argument of type ‘unsigned 
> > int’, but argument 2 has type ‘int’ [-Wformat=]"
> > 
> > 7. Warnings produced by -Wformat-signedness can be suppressed by "#pragma 
> > GCC diagnostic ignored -Wformat"
>
> I agree, 1, 2, 4 (same idea as 2, basically), and 7 are the critical things 
> we'd need for compatibility. I personally find 3, 5, and 6 to be kind of 
> strange behavior though I can see how it would arise.

Good, then I know what the implementation have to adhere too. I agree that 
there are some strange behavior in the gcc implementation.

I think the first commit in my warn_format_signedness branch adhered to the 
important 1, 2, 4 and 7 points, but it implemented -Wformat-signedness as a 
simple clang option.

However when defining the option config in DiagnosticSemaKinds.td it will be a 
bit harder to implement. Too be able to handle 7) I simply have to add 
-Wformat-signedness to the -Wformat group, but then the implementation will 
violate 2). As far as I understand this can't be configured with the current 
framework. I need to extend the tablegen backend ClangDiagnosticsEmitter with 
some kind of new option to handle this, right?


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