Hi, This patch is a first step towards encoding the fact that some flags enable other flags in the .opt files. As a proof-of-concept, I have only implemented the check for a group option not overriding the value of the suboption if the suboption was set. In the future, we should handle more stuff automatically. However, I think this patch already leads to the removal of a big chunk of code.
Bootstrapped and tested. I don't provide changelog and the code has some stylistic issues that I will fix if the strategy is acceptable. About the implementation, in PR53063 I proposed Wall C ObjC C++ ObjC++ Warning Enable most warning messages Enables(Wwhatever, Wfoo=2) However this would make difficult to implement options that are enabled by the combination of two options, like -Wunused -Wextra enables -Wunused-parameter. So I decided for, Wunused-value -Common Var(warn_unused_value) Init(-1) Warning +Common Var(warn_unused_value) Init(-1) Warning EnabledBy(Wunused) This can be easily extended to EnabledBy(Wunused & Wextra) or an arbitrary combination of options and logical operators. 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? Cheers, Manuel.
group-options.diff
Description: Binary data