On 12 May 2012 18:12, Joseph S. Myers <jos...@codesourcery.com> wrote: > On Sat, 12 May 2012, Manuel López-Ibáñez wrote: > >> Let's assume C-specific option -Wx enables common option -Wy. How can >> I record this information in c.opt? Using Wx LangEnables(C, Wy) does > > Wy > LangEnabledBy(C C++, Wx) > > There is no restriction on c.opt to contain only options marked as > specific to C-family languages - though it's clearly a bad idea to have > entries there with nothing at all C-family-specific about them. All the > entries for an option in all .opt files are merged by opt-gather.awk > before the other awk code deals with them. (You'd need to handle having > multiple LangEnabledBy fields on the merged option produced by > opt-gather.awk, but the principle is clear.)
Well, I was trying to avoid "merging" flags. Are there any examples of other such flags that are merged? The thing is that the "merge" done right now is really just concatenating existing flags. It doesn't work to set Init(1) and Init(0) in two different .opt files, so it wouldn't work to set LangEnabledBy in different files for the same option. One option is to parse LangEnabledBy before merging (which actually happens in optc-gen.awk), which seems ugly, but probably is the most straightforward solution. Would that be ok? Do you see a better alternative? Cheers, Manuel. > -- > Joseph S. Myers > jos...@codesourcery.com