[RFC] PR 53063 encode group options in .opt files
Joseph S. Myers
joseph@codesourcery.com
Sat May 12 15:12:00 GMT 2012
On Sat, 12 May 2012, Manuel López-Ibáñez wrote:
> On 11 May 2012 21:23, Joseph S. Myers <joseph@codesourcery.com> wrote:
> >
> > There's nothing wrong with having separate autogenerated functions for
> > each language if you want to split things out that way, but it would seem
> > simpler just to have one function called somewhere central, whatever
> > option it is (common or not) that is enabling other options.
>
> The problem with this approach is that it is not clear how to decide
> in this single function that -Wextra needs to enable a C-only option
> or not. The function would need to know that it is called from the
> C-FE somehow. Having a separate function for each language easily
> overcomes this issue.
I don't see why the function would need to know which front end it is
called from. If it's called from another front end, enabling a C-only
option should be harmless (do nothing because nothing will actually check
the gcc_options field set by the C-only option / because no handler
actually gets called for the option)
> This is my current draft patch. It bootstraps and passes regression
> tests. It seems flexible enough to implement almost all of Wall and
> Wextra. Missing features are options that enabled by the combination
> of two options (like Wunused-parameter) and options that are
> conditional on something else (Wmain).
>
> Is this approach ok with you? Should I clean it up and provide a changelog?
The approach is OK (even if I don't think separate functions are
necessary, they are more modular and so logically better in that sense).
I don't think common.opt should have LangEnabledBy listing different
languages, though; that information should be in the front ends' .opt
files. And, before we add such language-specific enabling of a
language-independent option, I'd like a good reason not to make -Wall a
common option (also having language-specific aspects) that enables
-Wunused for all languages - or else -Wall should (as a separate patch) be
made to enable -Wunused for all languages, to make the semantics simpler
and more consistent.
--
Joseph S. Myers
joseph@codesourcery.com
More information about the Gcc-patches
mailing list