[vlc-devel] [PATCH 1/2] player: fix unused var warning with NDEBUG

Steve Lhomme robux4 at ycbcr.xyz
Wed Sep 4 09:54:48 CEST 2019


Shouldn't assert to a no-op in non debug builds ? Both calls result in 
an assert so should have no effect.

Also I think it's better to put the ifdef inside the function to always 
keep the signature.

On 2019-09-04 9:14, Thomas Guillem wrote:
> ---
>   src/player/player.h | 4 ++++
>   1 file changed, 4 insertions(+)
> 
> diff --git a/src/player/player.h b/src/player/player.h
> index 36caa46299..60321cb8d0 100644
> --- a/src/player/player.h
> +++ b/src/player/player.h
> @@ -169,6 +169,7 @@ struct vlc_player_t
>       } destructor;
>   };
>   
> +#ifndef NDEBUG
>   /*
>    * Assert that the player mutex is locked.
>    *
> @@ -181,6 +182,9 @@ vlc_player_assert_locked(vlc_player_t *player)
>       assert(player);
>       vlc_mutex_assert(&player->lock);
>   }
> +#else
> +#define vlc_player_assert_locked(x) VLC_UNUSED(x)
> +#endif
>   
>   static inline struct vlc_player_input *
>   vlc_player_get_input_locked(vlc_player_t *player)
> -- 
> 2.20.1
> 
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> https://mailman.videolan.org/listinfo/vlc-devel
> 


More information about the vlc-devel mailing list