[FFmpeg-devel] [PATCH 1/2] Make DECLARE_ALIGNED macros work with external array specifiers
Måns Rullgård
mans
Thu Jan 21 14:04:40 CET 2010
Mans Rullgard <mans at mansr.com> writes:
> The macro implementation might need the name of the variable being
> declared for compiler-specific syntax. Moving array specifiers outside
> the macro invocation allows this to work.
> ---
> libavutil/mem.h | 6 +++---
> 1 files changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/libavutil/mem.h b/libavutil/mem.h
> index aa083a7..ec5d4f9 100644
> --- a/libavutil/mem.h
> +++ b/libavutil/mem.h
> @@ -29,11 +29,11 @@
> #include "common.h"
>
> #if defined(__ICC) || defined(__SUNPRO_C)
> - #define DECLARE_ALIGNED(n,t,v) t v __attribute__ ((aligned (n)))
> + #define DECLARE_ALIGNED(n,t,v) t __attribute__ ((aligned (n))) v
> #define DECLARE_ASM_CONST(n,t,v) const t __attribute__ ((aligned (n))) v
> #elif defined(__GNUC__)
> - #define DECLARE_ALIGNED(n,t,v) t v __attribute__ ((aligned (n)))
> - #define DECLARE_ASM_CONST(n,t,v) static const t v attribute_used __attribute__ ((aligned (n)))
> + #define DECLARE_ALIGNED(n,t,v) t __attribute__ ((aligned (n))) v
> + #define DECLARE_ASM_CONST(n,t,v) static const t attribute_used __attribute__ ((aligned (n))) v
> #elif defined(_MSC_VER)
> #define DECLARE_ALIGNED(n,t,v) __declspec(align(n)) t v
> #define DECLARE_ASM_CONST(n,t,v) __declspec(align(n)) static const t v
This seemed safe enough so I applied it. The gcc manual clearly
states that attributes can be mixed with type qualifiers preceding the
identifier.
--
M?ns Rullg?rd
mans at mansr.com
More information about the ffmpeg-devel
mailing list