On Sun, 6 May 2012, Manuel López-Ibáñez wrote:

> Wuninitialized is enabled by both Wall and Wextra. Wextra enables it
> in the common part, however, Wall does it in the FE specific part
> (c-family, fortran, ada). When enabled via Wall, opts_set does not get
> updated. What is the best way to enable a sub-option?
> 
> Using handle_option_generated does not set opt_set either, so the test
> in finish_options_generated does not work as intended. (And the
> setting of -Wall gets overridden by the setting of -Wextra).

That's where the notion of distance comes in - if there's an explicit 
-Wuninitialized or -Wno-uninitialized option, the last one of those takes 
precedence, but otherwise the last -Wall / -Wno-all / -Wextra / -Wno-extra 
determines the setting of -Wuninitialized, but otherwise the default value 
applies.  (I'd guess that -Werror=extra should count as a -Wextra variant 
- at the same distance from any options implied by -Wextra as -Wextra 
itself - though I'm not entirely sure.)

(I don't think you actually need to record distance explicitly for these 
particular options.  You do need to process them as they are seen, so that 
you can distinguish -Wall -Wno-extra and -Wno-extra -Wall.)

> I could move the setting of Wall to something like what we do for
> Wextra. However, this seems to me a step backwards. I think your
> original idea was to drive everything through the *_handle_option
> functions. Ideally, Wuninitialized should be handled like Wimplicit,
> using handle_option_generated to enable suboptions. But I am not sure
> what is the best way to implement this. Or in other words, what kind
> of code we want to autogenerate to handle this transparently.
> 
> One idea could be to have an additional auto_handle_option() that is
> generated from the awk scripts and called after all other
> handle_option functions. This function will populate a switch with
> group options and the respective calls to handle_option_generated for
> sub-options.
> 
>  Is this a good idea? Where would be the best place to call this function?

That certainly seems one reasonable way to handle implications.

-- 
Joseph S. Myers
jos...@codesourcery.com

Reply via email to