On 19 October 2012 18:17, Joseph S. Myers <jos...@codesourcery.com> wrote:
> On Wed, 17 Oct 2012, Manuel López-Ibáñez wrote:
>
>> documentation but I can also implement -Wformat=0 being an alias for
>> -Wno-format and -Wformat=1 an alias for -Wformat and simply reject
>> -Wno-format=.
>
> I think that's what's wanted; -Wno-format= should be rejected, -Wformat=
> should take an arbitrary integer level (of which at present all those
> above 2 are equivalent to 2, just as -O<n> for n > 3 is equivalent to
> -O3).

The problem is how to represent that Wformat-y2k is enabled by
-Wformat=X with X >= 2, while Wformat-zero-length is enabled by X >=1.

One possiblity is to allow to specify a condition directly:

Wformat-y2k
C ObjC C++ ObjC++ Var(warn_format_y2k) Warning LangEnabledByCond(C
ObjC C++ ObjC++,Wformat=,warn_format >= 2)
Warn about strftime formats yielding 2-digit years

Wformat-zero-length
C ObjC C++ ObjC++ Var(warn_format_zero_length) Warning
LangEnabledByCond(C ObjC C++ ObjC++,Wformat=,warn_format >= 2)
Warn about zero-length formats

Wformat=
C ObjC C++ ObjC++ Joined RejectNegative UInteger Var(warn_format) Warning

I think this is both flexible and easy to implement given the current
infrastructure. But I wanted to get your approval before. What do you
think?

Reply via email to