https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115310

--- Comment #6 from Richard Biener <rguenth at gcc dot gnu.org> ---
(In reply to Florian Weimer from comment #3)
> This is just following the previous GCC behavior. For example, with GCC 11:
> 
> $ gcc -S -Werror=return-type -std=gnu89 t.c
> t.c:1:1: error: return type defaults to ‘int’ [-Werror=return-type]
>     1 | main () { return 0; }
>       | ^~~~
> 
> I'm not sure how this is a problem in practice.
> 
> Using -Werror=return-type at the distribution level is … problematic. It's
> why we split -Werror=return-mismatch from it, and only enabled the latter by
> default in GCC 14.

But -Wreturn-mismatch doesn't diagnose the following, only -Wreturn-type does.
IIRC we made -Werror=return-type the default mainly because of this.

int foo()
{
}

I realize -std=gnu89 isn't perfect but if sources are happy with that
it's much better than -fpermissive - not only because -fpermissive
only works (is not diagnosed) with GCC14 for C.

I also realize -std=gnu89 is going to run into this very same issue with
older compilers.  Bah.

Reply via email to