Module: libav
Branch: master
Commit: 0db2d94280e260af5f3ad7993c5a6357462f17c9

Author:    Luca Barbato <lu_z...@gentoo.org>
Committer: Martin Storsjö <mar...@martin.st>
Date:      Wed Jul 25 16:22:34 2012 +0200

dsputil: workaround __VA_ARGS__ missing tokenization for MSVC

A second expansion forces the preprocessor to tokenize properly.

Signed-off-by: Martin Storsjö <mar...@martin.st>

---

 libavcodec/dsputil.h |   10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/libavcodec/dsputil.h b/libavcodec/dsputil.h
index e47cd2c..bb70428 100644
--- a/libavcodec/dsputil.h
+++ b/libavcodec/dsputil.h
@@ -622,22 +622,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

_______________________________________________
libav-commits mailing list
libav-commits@libav.org
https://lists.libav.org/mailman/listinfo/libav-commits

Reply via email to