aboutsummaryrefslogtreecommitdiff
path: root/AT91SAM7S256/Source/stdconst.h
diff options
context:
space:
mode:
authorNicolas Schodet2010-07-06 13:25:39 +0200
committerNicolas Schodet2010-08-20 00:18:21 +0200
commit9e5cc1159a47f6978f1fdbface3c03914875fcdb (patch)
tree5b7af0e282b8e7bb336734f2ada1a33b978afb63 /AT91SAM7S256/Source/stdconst.h
parent3b044ab379a0e6a644a1bba47663f1b92c1df8dc (diff)
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.
Diffstat (limited to 'AT91SAM7S256/Source/stdconst.h')
-rw-r--r--AT91SAM7S256/Source/stdconst.h17
1 files changed, 17 insertions, 0 deletions
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