"Manuel López-Ibáñez" <[EMAIL PROTECTED]> writes:

> On 30 May 2007 16:12:12 -0700, Ian Lance Taylor <[EMAIL PROTECTED]> wrote:
>> Joe Buck <[EMAIL PROTECTED]> writes:
>>
>> > How about: have -Wall still set warn_strict_overflow
>> > to 1, but to have -Wall -Wstrict-overflow *or* -Wstrict-overflow -Wall
>> > *or* just -Wstrict-overflow set it to 2?  The only change would be
>> > to prevent -Wall from *decreasing* the value.
>>
>> Sure, makes sense.
>>
>> But, consider:
> [snip]
>> If we want to fix this issue, it seems to me we should fix it
>> everywhere.
>
> I was going to submit a formal proposal about options handling (with
> patches). Since this was raised before I had time to think it through
> properly, it may have some flaws.
>
> Two kinds of options: group options (-Wall, -Wextra, -O1, -O2) and
> simple options (-fpeephole, -Waddress, -Wstrict-overflow).
>
> * Group options can only affect default values of simple options. So a
> group option will not change the settings of a explicit simple option
> no matter their order in the command-line. So, "-Wno-address -Wall" ==
> "-Wall -Wno-address"
>
> * Options are evaluated according to their order in the command-line.
> So, "-Wno-address -Waddress" will turn on -Waddress, while "-Waddress
> -Wno-address" will turn it off.
>
> Both rules combined mean that you can do: "-Wall -Wno-all" disabling
> "-Wall" warnings. However, if you do "-Waddress -Wall -Wno-all", you
> still get -Waddress. You will need an explicit -Wno-address to disable
> it.
>
> I think this corresponds to the principle of least surprise. Bad idea?

I like the idea. I'd also suggest that group options won't do anything
else but affecting [default values of] simple options. It means that one
will be able to substitute a set of simple options for a "group option"
without change in behavior (for example, this is not currently the case
for -O,-O1,-O2 options).

-- Sergei.

Reply via email to