3 storage: idata, xdata, code,
6 #define STORAGE {storage}
10 #define FLEXARRAY (__GNUC__ >= 3)
17 typedef unsigned int size_t;
18 #define offsetof(s,m) (size_t)&(((s *)0)->m)
20 #if defined(PORT_HOST) || defined(SDCC_z80) || defined(SDCC_gbz80)
26 char STORAGE array[5] = {'a', 'b', 'c'};
42 struct x STORAGE teststruct[5] = {
43 { 10, { 1, 2, 3, 4, 5} },
54 struct y STORAGE incompletestruct = {
62 ASSERT(array[2] == 'c');
63 ASSERT(array[4] == 0);
65 ASSERT(g[1].a == 'y');
67 ASSERT(g[2].a == 'z');
70 ASSERT(teststruct[0].b[1] == 2);
71 ASSERT(teststruct[0].b[5] == 0);
72 ASSERT(teststruct[1].b[0] == 11);
73 ASSERT(teststruct[4].b[9] == 0);
75 ASSERT(sizeof(teststruct[2].a) == 2);
76 ASSERT(sizeof(teststruct[1].b) == 10);
77 ASSERT(sizeof(teststruct[1]) == 12);
78 ASSERT(sizeof(teststruct) == 60);
81 ASSERT(incompletestruct.a == 10);
82 ASSERT(incompletestruct.b[0] == 1);
83 ASSERT(incompletestruct.b[4] == 5);
85 ASSERT(sizeof(incompletestruct) == sizeof(struct y));
86 ASSERT(sizeof(incompletestruct) == offsetof(struct y, b));
87 ASSERT(sizeof(incompletestruct) == offsetof(struct x, b));