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

Reimar Döffinger Reimar.Doeffinger
Thu Jan 21 19:19:19 CET 2010


On Wed, Jan 20, 2010 at 10:17:55PM +0000, M?ns Rullg?rd wrote:
> 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?

I don't mind much, but wouldn't be simpler to do a separate
DECLARE_ALIGNED_ARRAY(16, type, var, dimensions)
instead of beating the current macro with varargs to handle it?
I guess your suggestion is nicer if you're somewhat confident
it won't break with the next compiler you try to add support for :-)



More information about the ffmpeg-devel mailing list