[SCM] libav/experimental: Make LOCAL_ALIGNED macro fully C99 compatible

siretart at users.alioth.debian.org siretart at users.alioth.debian.org
Sun Jun 30 17:22:28 UTC 2013


The following commit has been merged in the experimental branch:
commit 96aad41e8157b7c6b577803054e20a0771857424
Author: Mans Rullgard <mans at mansr.com>
Date:   Thu Jan 20 02:04:54 2011 +0000

    Make LOCAL_ALIGNED macro fully C99 compatible
    
    C99 variadic macros require more arguments than there are named
    parameters in the definition.  This means we must use an extra
    indirection to avoid having two different macros for arrays with
    one resp more than one dimension.
    
    Signed-off-by: Mans Rullgard <mans at mansr.com>

diff --git a/libavcodec/dsputil.h b/libavcodec/dsputil.h
index c619b78..842d727 100644
--- a/libavcodec/dsputil.h
+++ b/libavcodec/dsputil.h
@@ -661,20 +661,24 @@ static inline void emms(void)
 #   define STRIDE_ALIGN 8
 #endif
 
-#define LOCAL_ALIGNED(a, t, v, s, ...)                          \
-    uint8_t la_##v[sizeof(t s __VA_ARGS__) + (a)];              \
-    t (*v) __VA_ARGS__ = (void *)FFALIGN((uintptr_t)la_##v, a)
+#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__,,)
 
 #if HAVE_LOCAL_ALIGNED_8
-#   define LOCAL_ALIGNED_8(t, v, s, ...) DECLARE_ALIGNED(8, t, v) s __VA_ARGS__
+#   define LOCAL_ALIGNED_8(t, v, ...) LOCAL_ALIGNED_D(8, t, v, __VA_ARGS__,,)
 #else
-#   define LOCAL_ALIGNED_8(t, v, s, ...) LOCAL_ALIGNED(8, t, v, s, __VA_ARGS__)
+#   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, s, ...) DECLARE_ALIGNED(16, t, v) s __VA_ARGS__
+#   define LOCAL_ALIGNED_16(t, v, ...) LOCAL_ALIGNED_D(16, t, v, __VA_ARGS__,,)
 #else
-#   define LOCAL_ALIGNED_16(t, v, s, ...) LOCAL_ALIGNED(16, t, v, s, __VA_ARGS__)
+#   define LOCAL_ALIGNED_16(t, v, ...) LOCAL_ALIGNED(16, t, v, __VA_ARGS__)
 #endif
 
 /* PSNR */

-- 
Libav/FFmpeg packaging



More information about the pkg-multimedia-commits mailing list