Commit 0db2d942 authored by Luca Barbato's avatar Luca Barbato Committed by Martin Storsjö

dsputil: workaround __VA_ARGS__ missing tokenization for MSVC

A second expansion forces the preprocessor to tokenize properly.
Signed-off-by: 's avatarMartin Storsjö <martin@martin.st>
parent b797f3c4
...@@ -622,22 +622,26 @@ void ff_mlp_init_x86(DSPContext* c, AVCodecContext *avctx); ...@@ -622,22 +622,26 @@ void ff_mlp_init_x86(DSPContext* c, AVCodecContext *avctx);
# define STRIDE_ALIGN 8 # define STRIDE_ALIGN 8
#endif #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, ...) \ #define LOCAL_ALIGNED_A(a, t, v, s, o, ...) \
uint8_t la_##v[sizeof(t s o) + (a)]; \ uint8_t la_##v[sizeof(t s o) + (a)]; \
t (*v) o = (void *)FFALIGN((uintptr_t)la_##v, 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_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 #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 #else
# define LOCAL_ALIGNED_8(t, v, ...) LOCAL_ALIGNED(8, t, v, __VA_ARGS__) # define LOCAL_ALIGNED_8(t, v, ...) LOCAL_ALIGNED(8, t, v, __VA_ARGS__)
#endif #endif
#if HAVE_LOCAL_ALIGNED_16 #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 #else
# define LOCAL_ALIGNED_16(t, v, ...) LOCAL_ALIGNED(16, t, v, __VA_ARGS__) # define LOCAL_ALIGNED_16(t, v, ...) LOCAL_ALIGNED(16, t, v, __VA_ARGS__)
#endif #endif
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment