[FFmpeg-devel] [patch] libswscale: fix warning regarding "no return in non void function"

Dominique Leuenberger dominique
Sun May 16 20:54:36 CEST 2010


On Tue, 2010-04-27 at 15:48 +0200, Michael Niedermayer wrote:
> On Tue, Apr 27, 2010 at 12:58:45AM +0300, Dominique Leuenberger wrote:
> > Quoting Michael Niedermayer <michaelni at gmx.at>:
> >
> >> On Mon, Apr 26, 2010 at 05:23:56PM +0300, Dominique Leuenberger wrote:
> >>> Quoting Dominique Leuenberger <dominique-ffmpeg-devel at leuenberger.net>:
> >>>
> >>>> In libswscale, in case HAVE_7REGS is not defined to true, there are  two
> >>>> functions that result in empty code blocks.
> >>>>
> >>>> And as a consequence, the compiler warns about no return value in a  non
> >>>> void function.
> >>>>
> >>>> The attached patch fixes this by:
> >>>> - Moving the #if HAVE_7REGS out of the function declaraion (meaning  the
> >>>> function does not exist at all if we do not HAVE_7REGS.
> >>>> - Change some logic to not call the functions if they would not return
> >>>> useful result anyway.
> >>>
> >>> Just to bring it back to life:
> >>> is a compiler warning about an empty function block 'cleaner' than 
> >>> avoiding
> >>> this using an #if directive?
> >>
> >> a #if* is always worse than a warning
> >
> > Any reference that staes that other than your own opinion?
> 
> iam sure you can find other people with similar oppinions,
> iam sure you can find ones with differing oppinion.
> they arent maintainer of this file though
> 
> that said, i agree with mans that there likely is a way to get rid of
> the warning without am additional #if

Well, would you accept an

+#else
+  return 0;

in _template.c ? This is certainly not a clean solution neither, but
would keep the #if's together and the compiler happy.

If this is fine with me, I'll gladly submit a patch here too.

Dominique




More information about the ffmpeg-devel mailing list