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

Måns Rullgård mans
Tue Apr 27 00:13:55 CEST 2010


Dominique Leuenberger <dominique-ffmpeg-devel at leuenberger.net> writes:

> 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?

I'm generally against ifdef clutter, but floods of warnings are
certainly worse in my opinion.  That said, there is usually a way to
avoid both.

-- 
M?ns Rullg?rd
mans at mansr.com



More information about the ffmpeg-devel mailing list