[FFmpeg-devel] [PATCH] Make DECLARE_ALIGNED macros take array specifiers as separate argument

Måns Rullgård mans
Wed Jan 20 23:17:55 CET 2010

Reimar D?ffinger <Reimar.Doeffinger at gmx.de> writes:

> On Wed, Jan 20, 2010 at 09:08:13PM +0000, Mans Rullgard wrote:
>>  void dsputil_init_sh4(DSPContext* c, AVCodecContext *avctx);
>>  void dsputil_init_vis(DSPContext* c, AVCodecContext *avctx);
>> -#define DECLARE_ALIGNED_16(t, v) DECLARE_ALIGNED(16, t, v)
>> -#define DECLARE_ALIGNED_8(t, v)  DECLARE_ALIGNED(8, t, v)
>> +#define DECLARE_ALIGNED_16(t, v, ...) DECLARE_ALIGNED(16, t, v, __VA_ARGS__)
>> +#define DECLARE_ALIGNED_8(t, v, ...)  DECLARE_ALIGNED(8, t, v, __VA_ARGS__)
> Sorry for being a pain, but doesn't this kind of macro strictly not
> allow you to use DECLARE_ALIGNED_16 with only two arguments?

Thanks, you're right.  Variadic functions are not like that though, grr.

I have a different idea which should work, although it's slightly less
flexible.  It is possible to define the macros such that a declaration
will look like this instead:

    DECLARE_ALIGNED(16, type, var)[x]

Does that look reasonable?

M?ns Rullg?rd
mans at mansr.com

More information about the ffmpeg-devel mailing list