* Florian Weimer: > The existing -Wreturn-type option covers both constraint violations > (which are mandatory to diagnose) and warnings that have known > false positives. The new -Wreturn-mismatch warning is only about > the constraint violations (missing or extra return expressions), > and should eventually be turned into a permerror. > > The -std=gnu89 test cases show that by default, we do not warn for > return; in a function not returning void. This matches previous > practice for -Wreturn-type. > > gcc/c-family/ > > * c.opt (Wreturn-mismatch): New. > > gcc/c/ > > * c-typeck.cc (c_finish_return): Use pedwarn with > OPT_Wreturn_mismatch for missing/extra return expressions. > > gcc/ > > * doc/invoke.texi (Warning Options): Document > -Wreturn-mismatch. Update -Wreturn-type documentation. > > gcc/testsuite/ > > * gcc.dg/Wreturn-mismatch-1.c: New. > * gcc.dg/Wreturn-mismatch-2.c: New. > * gcc.dg/Wreturn-mismatch-3.c: New. > * gcc.dg/Wreturn-mismatch-4.c: New. > * gcc.dg/Wreturn-mismatch-5.c: New. > * gcc.dg/Wreturn-mismatch-6.c: New. > * gcc.dg/noncompile/pr55976-1.c: Change -Werror=return-type > to -Werror=return-mismatch. > * gcc.dg/noncompile/pr55976-2.c: Likewise. > > --- > v2: Update comment in gcc.dg/noncompile/pr55976-2.c. Do not produce > an error in C90 pedantic-error mode for return; in a function > returning non-void. Add gcc.dg/Wreturn-mismatch-6.c to demonstrate > this behavior.
Ping? Original patch: <https://inbox.sourceware.org/gcc-patches/8734y523et....@oldenburg.str.redhat.com/> Thanks, Florian