3 storage: idata, pdata, xdata, code,
6 #define STORAGE {storage}
9 #if defined (__GNUC__) && defined (__alpha__) && (__GNUC__ < 3)
10 /* since g fails on GCC 2.95.4 on alpha... */
20 typedef unsigned int size_t;
21 #define offsetof(s,m) (size_t)&(((s *)0)->m)
23 #if defined(PORT_HOST) || defined(SDCC_z80) || defined(SDCC_gbz80)
30 #if defined(SDCC_hc08)
35 const char *string1 = "\x00\x01";
36 const char string2[] = "\x00\x01";
39 #pragma disable_warning 147 //no warning about excess initializers (W_EXCESS_INITIALIZERS)
40 //array will be truncated but warning will be suppressed
41 //if truncation is incorrect, other ASSERTs will fail with high probability
42 char STORAGE trunc[2] = {'a', 'b', 'c'};
45 char STORAGE array[5] = {'a', 'b', 'c'};
63 struct x STORAGE teststruct[5] = {
64 { 10, { 1, 2, 3, 4, 5} },
75 struct y STORAGE incompletestruct = {
83 ASSERT(string1[1] == '\x01');
84 ASSERT(string2[1] == '\x01');
86 ASSERT(array[2] == 'c');
87 ASSERT(array[4] == 0);
90 ASSERT(g[1].a == 'y');
92 ASSERT(g[2].a == 'z');
96 ASSERT(teststruct[0].b[1] == 2);
97 ASSERT(teststruct[0].b[5] == 0);
98 ASSERT(teststruct[1].b[0] == 11);
99 ASSERT(teststruct[4].b[9] == 0);
101 ASSERT(sizeof(teststruct[2].a) == 2);
102 ASSERT(sizeof(teststruct[1].b) == 10);
103 ASSERT(sizeof(teststruct[1]) == 12);
104 ASSERT(sizeof(teststruct) == 60);
107 ASSERT(incompletestruct.a == 10);
108 ASSERT(incompletestruct.b[0] == 1);
109 ASSERT(incompletestruct.b[4] == 5);
111 ASSERT(sizeof(incompletestruct) == sizeof(struct y));
112 ASSERT(sizeof(incompletestruct) == offsetof(struct y, b));
113 ASSERT(sizeof(incompletestruct) == offsetof(struct x, b));