[FFmpeg-devel] [PATCH] avutil/opt: add av_warn_unused_result

wm4 nfxjfg at googlemail.com
Thu Oct 29 10:23:23 CET 2015


On Thu, 29 Oct 2015 09:17:16 +0100
Hendrik Leppkes <h.leppkes at gmail.com> wrote:

> On Thu, Oct 29, 2015 at 3:51 AM, Ganesh Ajjanagadde
> <gajjanagadde at gmail.com> wrote:
> > On Thu, Oct 15, 2015 at 6:12 PM, Ganesh Ajjanagadde
> > <gajjanagadde at gmail.com> wrote:  
> >> Some warnings do get triggered that will need to be fixed.
> >>
> >> Signed-off-by: Ganesh Ajjanagadde <gajjanagadde at gmail.com>
> >> ---
> >>  libavutil/opt.h | 2 ++
> >>  1 file changed, 2 insertions(+)
> >>
> >> diff --git a/libavutil/opt.h b/libavutil/opt.h
> >> index 753434d..5abe963 100644
> >> --- a/libavutil/opt.h
> >> +++ b/libavutil/opt.h
> >> @@ -414,6 +414,7 @@ void av_opt_set_defaults2(void *s, int mask, int flags);
> >>   * the error code issued by av_opt_set() if a key/value pair
> >>   * cannot be set
> >>   */
> >> +av_warn_unused_result
> >>  int av_set_options_string(void *ctx, const char *opts,
> >>                            const char *key_val_sep, const char *pairs_sep);
> >>
> >> @@ -444,6 +445,7 @@ int av_set_options_string(void *ctx, const char *opts,
> >>   * Separators must use characters distinct from option names and from each
> >>   * other.
> >>   */
> >> +av_warn_unused_result
> >>  int av_opt_set_from_string(void *ctx, const char *opts,
> >>                             const char *const *shorthand,
> >>                             const char *key_val_sep, const char *pairs_sep);
> >> --
> >> 2.6.1
> >>  
> >
> > ping  
> 
> I would argue that failure from these functions is hardly critical,
> ie. it can fail if an option is not found, and enforcing checks here
> seems a bit too aggressive to me.

+1

You might often set options on e.g. a codec generically, without caring
much whether it fails or not. This is because different codecs have
different options, and those which lack a certain option will work
without setting it. (Just as an example.)


More information about the ffmpeg-devel mailing list