On Thu, 19 Oct 2023, Florian Weimer wrote: > diff --git a/gcc/c/c-typeck.cc b/gcc/c/c-typeck.cc > index 6e044b4afbc..1da622160a3 100644 > --- a/gcc/c/c-typeck.cc > +++ b/gcc/c/c-typeck.cc > @@ -11281,17 +11281,10 @@ c_finish_return (location_t loc, tree retval, tree > origtype) > if ((warn_return_type >= 0 || flag_isoc99) > && valtype != NULL_TREE && TREE_CODE (valtype) != VOID_TYPE) > { > - bool warned_here; > - if (flag_isoc99) > - warned_here = pedwarn > - (loc, warn_return_type >= 0 ? OPT_Wreturn_type : 0, > - "%<return%> with no value, in function returning non-void"); > - else > - warned_here = warning_at > - (loc, OPT_Wreturn_type, > - "%<return%> with no value, in function returning non-void"); > no_warning = true; > - if (warned_here) > + if (pedwarn (loc, OPT_Wreturn_mismatch, > + "%<return%> with no value," > + " in function returning non-void"))
This should not be a pedwarn before C99 (should not be an error with -std=c90 -pedantic-errors -Wreturn-type), such a return is valid before C99. -- Joseph S. Myers jos...@codesourcery.com