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.


On 5 May 2012 16:22, Joseph S. Myers <jos...@codesourcery.com> wrote:
> On Sat, 5 May 2012, Manuel López-Ibáñez wrote:
>
>> Comments?  My knowledge of awk is basically zero, so suggestions on
>> how to improve the code are very welcome.
>>
>> Should I cleanup the patch and submit it with a Changelog?
>
> Yes please.  Some observations:
>
> * finish_options_generated should take an opts_set pointer and use that,
> not initializers of -1, to determine whether particular options were
> previously set.  Thus you should be able to remove the Init(-1) for the
> options you move to the new scheme (obviously you need to make sure
> nothing else is checking for the -1 value or setting the relevant fields
> without also updating the _set information; I did a spot check for
> warn_unused_function and that looks OK, for example, as nothing sets it
> except the -Wunused-function option via the Var flag, and the code you are
> moving to the new system).
>
> * Rather than having the linear search in find_flags_by_name, build up a
> mapping from option names to numbers in opt-read.awk.  (All awk arrays are
> actually associative arrays, you just need to put opt_numbers[$1] = n_opts
> at an appropriate point when each option is read in.)
>
> --
> Joseph S. Myers
> jos...@codesourcery.com

Attachment: group-options.diff
Description: Binary data

Reply via email to