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

Reply via email to