From 9e5cc1159a47f6978f1fdbface3c03914875fcdb Mon Sep 17 00:00:00 2001 From: Nicolas Schodet Date: Tue, 6 Jul 2010 13:25:39 +0200 Subject: gcc: patch *.txt data files, with minimum impact on sources gcc do not allow to store a structure containing a flexible array member in an array. Also, sizeof (s), with s a structure containing a flexible array member will return the offset of the flexible array member, not the actual size. This patch handle those problems with minimum impact on sources. --- AT91SAM7S256/Source/stdconst.h | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'AT91SAM7S256/Source/stdconst.h') diff --git a/AT91SAM7S256/Source/stdconst.h b/AT91SAM7S256/Source/stdconst.h index fa1c59e..29bf239 100644 --- a/AT91SAM7S256/Source/stdconst.h +++ b/AT91SAM7S256/Source/stdconst.h @@ -44,5 +44,22 @@ typedef char* PSZ; #define BASETYPES +#ifdef __GNUC__ +#define DEFINE_DATA(type, name) \ + extern const type name ## _; \ + const type * const name = &name ## _; \ + const type name ## _ +#define BEGIN_DATA { +#define END_DATA } +#define POINTER_TO_DATA(name) (&name ## _) +#define SIZEOF_DATA(name) (sizeof_ ## name) +#else +#define DEFINE_DATA(type, name) \ + const type name[] +#define BEGIN_DATA +#define END_DATA +#define POINTER_TO_DATA(name) (name) +#define SIZEOF_DATA(name) (sizeof (name)) +#endif #endif -- cgit v1.2.3