On Tue, Nov 07, 2017 at 11:08:58AM +0100, Martin Liška wrote: > > Hasn't it enabled it also for any other FEs other than C family and Fortran? > > Say jit, brig, go, lto?, ... > > I think better would be to remove the initialization to -1 and revert the > > fortran/options.c change, and instead use in the C family: > > if (!global_options_set.x_warn_return_type) > > warn_return_type = c_dialect_cxx (); > > > > Unless it for some reason doesn't work for -Wall or -W or similar. > > > > Hello. > > Sorry for the inconvenience, however using Jakub's approach really does not > work properly > with -Wall.
If -Wall had an underlying variable, then we could use: if (!global_options_set.x_warn_return_type && !global_options_set.x_warn_all) warn_return_type = c_dialect_cxx (); But we don't. Wonder if in addition to your patch or instead of it it wouldn't be safer (especially for FEs added in the future) to: /* If we see "return;" in some basic block, then we do reach the end without returning a value. */ - else if (warn_return_type + else if (warn_return_type > 0 && !TREE_NO_WARNING (fun->decl) && EDGE_COUNT (EXIT_BLOCK_PTR_FOR_FN (fun)->preds) > 0 && !VOID_TYPE_P (TREE_TYPE (TREE_TYPE (fun->decl)))) in tree-cfg.c. That change is preapproved if it works, and your patch if you want in addition to that is ok too. Jakub