[FFmpeg-cvslog] dsputil: workaround __VA_ARGS__ missing tokenization for MSVC

Luca Barbato git at videolan.org
Thu Sep 6 16:12:44 CEST 2012


ffmpeg | branch: master | Luca Barbato <lu_zero at gentoo.org> | Wed Jul 25 16:22:34 2012 +0200| [0db2d94280e260af5f3ad7993c5a6357462f17c9] | committer: Martin Storsjö

dsputil: workaround __VA_ARGS__ missing tokenization for MSVC

A second expansion forces the preprocessor to tokenize properly.

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

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=0db2d94280e260af5f3ad7993c5a6357462f17c9
---

 libavcodec/dsputil.h |   10 +++++++---
 1 file 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



More information about the ffmpeg-cvslog mailing list