https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115310
--- Comment #7 from Florian Weimer <fw at gcc dot gnu.org> ---
(In reply to Richard Biener from comment #6)
> 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.
You cannot use -Werror=return-type with legacy sources because it refuses to
compile this (implicit int/no return type):
foo()
{
}
And that's perfectly valid C89. As far as I can tell, -Werror=return-type is
intended to reject this (maybe the warning even predates -Wimplicit-int?).
I assume you're making the injection of -std=gnu89 conditional. You really need
to drop -Werror=return-type at the same time.