On Wed, Oct 12, 2016 at 12:52:49AM +0200, Bernd Schmidt wrote: > On 10/12/2016 12:34 AM, Bernd Schmidt wrote: > > >> * c.opt (Wextra): Add as C/C++/ObjC/ObjC++ option. > >> (Wimplicit-fallthrough=): Enable for these languages by -Wextra. > > > >This bit looks like it does a bit more magic than is immediately > >obvious. Could you elaborate how this works? > > Ok, so it looks like these are just declarations for things defined in > common.opt - but why not move Wimplicit-fallthrough over to c.opt entirely, > or alternatively keep everything in common.opt as it is now? I feel like I'm > missing something.
The reason to keep the option in common.opt is that we need to use the warn_* flag and OPT_W* in the middle end. Dunno if it is possible at all to configure gcc such that it builds only non-c-family cross-compiler (then it wouldn't compile because of that), but even if it is not possible it would look unclean to depend in the generic code on something from c-family/c.opt only. The extension of entries is something done for lots of options. What I perhaps should try is removing the Common keyword from the Wimplicit-fallthrough and Wimplicit-fallthrough= entries, e.g. similarly to how Wnonnull-compare is defined just as Var(...) Warning in common.opt (so that it can be used in the middle-end), but then only c-family/c.opt extends it and says the option is C C++ ObjC ObjC++. And it seems to work well for that option, ./f951 -Wnonnull-compare gives Warning: command line option ‘-Wnonnull-compare’ is valid for C/C++/ObjC/ObjC++ but not for Fortran Can I do that as a follow-up? Jakub