On 11/06/2017 06:33 PM, Jakub Jelinek wrote: > On Mon, Nov 06, 2017 at 06:23:11PM +0100, Eric Botcazou wrote: >>> Thank you for review, done that. >> >> This has enabled -Wreturn-type for Ada, what we don't want since the warning >> is outsmarted by the language, so I have applied this. >> >> >> 2017-11-06 Eric Botcazou <ebotca...@adacore.com> >> >> * gcc-interface/misc.c (gnat_post_options): Clear warn_return_type. > > 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. > > Jakub >
Hello. Sorry for the inconvenience, however using Jakub's approach really does not work properly with -Wall. Thus I'm suggesting following patch that will disable it in all *_post_options hooks. Ready after it survives regression tests? Martin
>From d5e41295202a09c98787dba436cc568bbf1bbf4a Mon Sep 17 00:00:00 2001 From: marxin <mli...@suse.cz> Date: Tue, 7 Nov 2017 10:27:13 +0100 Subject: [PATCH] Drop -Wreturn-type by default for BRIG, GO and LTO FEs. gcc/brig/ChangeLog: 2017-11-07 Martin Liska <mli...@suse.cz> * brig-lang.c (brig_langhook_post_options): Drop warn_return_type if not set. gcc/go/ChangeLog: 2017-11-07 Martin Liska <mli...@suse.cz> * go-lang.c (go_langhook_post_options): Drop warn_return_type if not set. gcc/lto/ChangeLog: 2017-11-07 Martin Liska <mli...@suse.cz> * lto-lang.c (lto_post_options): Drop warn_return_type if not set. --- gcc/brig/brig-lang.c | 3 +++ gcc/go/go-lang.c | 3 +++ gcc/lto/lto-lang.c | 3 +++ 3 files changed, 9 insertions(+) diff --git a/gcc/brig/brig-lang.c b/gcc/brig/brig-lang.c index f34d9587632..1fd558cc6df 100644 --- a/gcc/brig/brig-lang.c +++ b/gcc/brig/brig-lang.c @@ -171,6 +171,9 @@ brig_langhook_post_options (const char **pfilename ATTRIBUTE_UNUSED) broken code if not force disabling it. */ flag_strict_aliasing = 0; + if (warn_return_type == -1) + warn_return_type = 0; + /* Returning false means that the backend should be used. */ return false; } diff --git a/gcc/go/go-lang.c b/gcc/go/go-lang.c index 81eeb5c9cdc..0baebe32349 100644 --- a/gcc/go/go-lang.c +++ b/gcc/go/go-lang.c @@ -313,6 +313,9 @@ go_langhook_post_options (const char **pfilename ATTRIBUTE_UNUSED) && !global_options_set.x_flag_reorder_blocks_and_partition) global_options.x_flag_reorder_blocks_and_partition = 0; + if (warn_return_type == -1) + warn_return_type = 0; + /* Returning false means that the backend should be used. */ return false; } diff --git a/gcc/lto/lto-lang.c b/gcc/lto/lto-lang.c index 88f29705e65..892d4767f76 100644 --- a/gcc/lto/lto-lang.c +++ b/gcc/lto/lto-lang.c @@ -877,6 +877,9 @@ lto_post_options (const char **pfilename ATTRIBUTE_UNUSED) if (!flag_merge_constants) flag_merge_constants = 1; + if (warn_return_type == -1) + warn_return_type = 0; + /* Initialize the compiler back end. */ return false; } -- 2.14.3