Luca Barbato <[email protected]> writes:

> A second expansion forces the preprocessor to tokenize properly.
> ---
>
> Not sure if we have other broken preprocessors to mention there.

I've never seen or heard of anything else being that completely broken.

>  libavcodec/dsputil.h |   10 +++++++---
>  1 files changed, 7 insertions(+), 3 deletions(-)
>
> diff --git a/libavcodec/dsputil.h b/libavcodec/dsputil.h
> index 77980e0..52b0f41 100644
> --- a/libavcodec/dsputil.h
> +++ b/libavcodec/dsputil.h
> @@ -640,22 +640,26 @@ void ff_mlp_init_x86(DSPContext* c, AVCodecContext 
> *avctx);
>  #   define STRIDE_ALIGN 8
>  #endif
>  
> +// Some broken preprocessors need a second expansion
> +// to be forced to tokenize __VA_ARGS__
> +#define E(x) x
> +
>  #define LOCAL_ALIGNED_A(a, t, v, s, o, ...)             \
>      uint8_t la_##v[sizeof(t s o) + (a)];                \
>      t (*v) o = (void *)FFALIGN((uintptr_t)la_##v, a)
>  
>  #define LOCAL_ALIGNED_D(a, t, v, s, o, ...) DECLARE_ALIGNED(a, t, v) s o
>  
> -#define LOCAL_ALIGNED(a, t, v, ...) LOCAL_ALIGNED_A(a, t, v, __VA_ARGS__,,)
> +#define LOCAL_ALIGNED(a, t, v, ...) E(LOCAL_ALIGNED_A(a, t, v, 
> __VA_ARGS__,,))
>  
>  #if HAVE_LOCAL_ALIGNED_8
> -#   define LOCAL_ALIGNED_8(t, v, ...) LOCAL_ALIGNED_D(8, t, v, __VA_ARGS__,,)
> +#   define LOCAL_ALIGNED_8(t, v, ...) E(LOCAL_ALIGNED_D(8, t, v, 
> __VA_ARGS__,,))
>  #else
>  #   define LOCAL_ALIGNED_8(t, v, ...) LOCAL_ALIGNED(8, t, v, __VA_ARGS__)
>  #endif
>  
>  #if HAVE_LOCAL_ALIGNED_16
> -#   define LOCAL_ALIGNED_16(t, v, ...) LOCAL_ALIGNED_D(16, t, v, 
> __VA_ARGS__,,)
> +#   define LOCAL_ALIGNED_16(t, v, ...) E(LOCAL_ALIGNED_D(16, t, v, 
> __VA_ARGS__,,))
>  #else
>  #   define LOCAL_ALIGNED_16(t, v, ...) LOCAL_ALIGNED(16, t, v, __VA_ARGS__)
>  #endif
> -- 

This is starting to look like it could be reluctantly tolerated.  I'd
still prefer if you kept it in a dev branch until the rest of the msvc
support is more complete.

-- 
Måns Rullgård
[email protected]
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to