On Fri, 12 May 2023, Florian Weimer wrote:

> This sone seems to be a good candidate for additional errors, though:
> 
>   warned_here = pedwarn
>     (loc, warn_return_type >= 0 ? OPT_Wreturn_type : 0,
>      "%<return%> with no value, in function returning non-void");
> 
> It's a clear type volation that can lead to obscure bugs.  Maybe the
> converse as well.

This one is valid before C99 (the pedwarn is conditional on flag_isoc99, 
otherwise it's a warning).  The converse is unconditionally invalid 
(though the case where the returned expression from the function with void 
return type itself has void type is valid in C++ and only a 
pedwarn-if-pedantic for C; that case is a reasonable extension).

-- 
Joseph S. Myers
jos...@codesourcery.com

Reply via email to