[FFmpeg-devel] [PATCH 3/4] avutil/eval: check av_expr_parse_and_eval error code in the test build
gajjanag at mit.edu
Sun Nov 1 21:28:36 CET 2015
On Sun, Nov 1, 2015 at 1:33 PM, Ganesh Ajjanagadde <gajjanag at mit.edu> wrote:
> On Sun, Nov 1, 2015 at 12:52 PM, Michael Niedermayer
> <michael at niedermayer.cc> wrote:
>> On Sat, Oct 31, 2015 at 10:47:56AM -0400, Ganesh Ajjanagadde wrote:
>>> This returns the error code from main in the test, in this case ENOMEM.
>>> This should not matter, and will ensure that no warnings are triggered
>>> when av_warn_unused_result is added to avutil/eval.h.
>>> Signed-off-by: Ganesh Ajjanagadde <gajjanagadde at gmail.com>
>>> libavutil/eval.c | 22 +++++++++++++---------
>>> 1 file changed, 13 insertions(+), 9 deletions(-)
>> breaks fate
>> TEST eval
>> --- ./tests/ref/fate/eval 2015-10-30 03:22:52.209691909 +0100
>> +++ tests/data/fate/eval 2015-11-01 18:48:37.730502524 +0100
>> @@ -1,281 +1 @@
>> Evaluating ''
>> -'' -> nan
>> -Evaluating '1;2'
>> -'1;2' -> 2.000000
>> -Evaluating '-20'
>> -'-20' -> -20.000000
>> -Evaluating '-PI'
>> -'-PI' -> -3.141593
>> -12.700000 == 12.7
>> -0.931323 == 0.931322575
>> Test eval failed. Look at tests/data/fate/eval.err for details.
>> make: *** [fate-eval] Error 234
>> make: *** Waiting for unfinished jobs....
>> cat tests/data/fate/eval.err
>> [Eval @ 0x7ffe40285770] Undefined constant or missing '(' in ''
> So I know why this occurs: it is the first condition with the nan
> stuff, which returns an error code < 0. There are various methods I
> can think of:
> 1. Let the fate build be slightly noisy, with one -Warn-unused-result for this.
> 2. Simply do a ret = av_expr_parse_and_eval(...) for the first one.
> This kills the warning, and is quite readable.
> 3. in addition to the above, do a check for ENOMEM. I find this quite
> silly, since it is a test build.
> Let me know what you prefer, and sorry for not being thorough with this.
v2 posted using the ENOMEM check - it maybe silly, but is correct,
suppresses the warning, and is consistent with the approach I adopted
for the filters.
>> Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
>> Dictatorship naturally arises out of democracy, and the most aggravated
>> form of tyranny and slavery out of the most extreme liberty. -- Plato
>> ffmpeg-devel mailing list
>> ffmpeg-devel at ffmpeg.org
More information about the ffmpeg-devel