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?
As said: we do have build log checks that fail in various cases known
to cause program errors: one of them is no return in non-void function
(which happens to be triggered in this specific case).
Yes, I agree, the compiler might get it wrong. But why not tell the
compiler that we're smarter? Another day somebody might call the
function without if (HAVE_7REGS), and then at least the compiler knows
this is not supposed to be and strictly tells: function is not defined.
Don't only look at the current situation: think a little bit ahead.
Dominique