On 6 May 2012 13:56, Joseph S. Myers <jos...@codesourcery.com> wrote:
> On Sat, 5 May 2012, Manuel López-Ibáñez wrote:
>
>> Thanks for the hints. This is what I am currently
>> bootstrapping+regtesting. It builds and works on a few manual tests.
>>
>> OK if it passes?
>>
>> 2012-05-05  Manuel López-Ibáñez  <m...@gcc.gnu.org>
>>
>>       PR c/53063
>> gcc/
>>       * doc/options.texi (EnabledBy): Document.
>>       * opts.c (finish_options): Call finish_options_generated instead
>>       of handling some options explicitly.
>>       * optc-gen.awk: Handle EnabledBy.
>>       * opth-gen.awk: Declare finish_options_generated.
>>       * common.opt (Wuninitialized): Use EnabledBy. Delete Init.
>>       (Wunused-but-set-variable): Likewise.
>>       (Wunused-function): Likewise.
>>       (Wunused-label): Likewise.
>>       (Wunused-value): Likewise.
>>       (Wunused-variable): Likewise.
>>       * opt-read.awk: Create opt_numbers array.
>
> OK.

Unfortunately, there are some issues with moving Wuninitialized to the
new system.

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).

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?

Cheers,

Manuel.

Reply via email to