[vlc-devel] [PATCH v3 1/3] display: add a macro to set the callbacks and check type of the Open callback

Rémi Denis-Courmont remi at remlab.net
Tue Jul 9 16:33:34 CEST 2019


Le tiistaina 9. heinäkuuta 2019, 16.19.10 EEST Steve Lhomme a écrit :
> ---
>  include/vlc_vout_display.h | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/include/vlc_vout_display.h b/include/vlc_vout_display.h
> index aa00003c8e0..dc94a8971d4 100644
> --- a/include/vlc_vout_display.h
> +++ b/include/vlc_vout_display.h
> @@ -208,6 +208,11 @@ typedef int (*vout_display_open_cb)(vout_display_t *vd,
> video_format_t *fmtp,
>                                      vlc_video_context *context);
> 
> +#define set_callbacks_display(Activate, Deactivate) \
> +    static_assert(_Generic( Activate, vout_display_open_cb: 1, default: 0 )
> == 1, \ +                  "Not a display activate callback"); \
> +    set_callbacks( Activate, Deactivate )

IMO, this should be trigger a warning like any other potentially 
invalidfunction pointer conversion. You can do that with a static inline 
'identity' function.

It's a separate question whether that class of warnings should be made into an 
error by default with -Werror=whatever.

-- 
雷米‧德尼-库尔蒙
http://www.remlab.net/





More information about the vlc-devel mailing list