[vlc-devel] [PATCH 2/4] vlc_common.h: Split __has_attribute in a different directive
Steve Lhomme
robux4 at ycbcr.xyz
Thu Oct 22 09:53:18 CEST 2020
LGTM
On 2020-10-22 9:49, Hugo Beauzée-Luyssen wrote:
> Once we know that we are using clang, we can use __has_attribute. Doing
> so in a single directive confuses some compilers (in this case, MSVC)
> ---
> include/vlc_common.h | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/include/vlc_common.h b/include/vlc_common.h
> index 22a6c089d7..323df74653 100644
> --- a/include/vlc_common.h
> +++ b/include/vlc_common.h
> @@ -559,11 +559,13 @@ static inline size_t vlc_align(size_t v, size_t align)
> return (v + (align - 1)) & ~(align - 1);
> }
>
> -#if defined(__clang__) && __has_attribute(diagnose_if)
> +#if defined(__clang__)
> +#if __has_attribute(diagnose_if)
> static inline size_t vlc_align(size_t v, size_t align)
> __attribute__((diagnose_if(((align & (align - 1)) || (align == 0)),
> "align must be power of 2", "error")));
> #endif
> +#endif
>
> /** Greatest common divisor */
> VLC_USED
> --
> 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