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 const char *string1 = "\x00\x01";
24 const char string2[] = "\x00\x01";
27 #pragma disable_warning 147 //no warning about excess initializers (W_EXCESS_INITIALIZERS)
28 //array will be truncated but warning will be suppressed
29 //if truncation is incorrect, other ASSERTs will fail with high probability
30 char STORAGE trunc[2] = {'a', 'b', 'c'};
33 char STORAGE array[5] = {'a', 'b', 'c'};
51 struct x STORAGE teststruct[5] = {
52 { 10, { 1, 2, 3, 4, 5} },
63 struct y STORAGE incompletestruct = {
71 ASSERT(string1[1] == '\x01');
72 ASSERT(string2[1] == '\x01');
74 ASSERT(array[2] == 'c');
75 ASSERT(array[4] == 0);
78 ASSERT(g[1].a == 'y');
80 ASSERT(g[2].a == 'z');
84 ASSERT(teststruct[0].b[1] == 2);
85 ASSERT(teststruct[0].b[5] == 0);
86 ASSERT(teststruct[1].b[0] == 11);
87 ASSERT(teststruct[4].b[9] == 0);
89 ASSERT(sizeof(teststruct[2].a) == 2);
90 ASSERT(sizeof(teststruct[1].b) == 10);
91 ASSERT(sizeof(teststruct[1]) == 12);
92 ASSERT(sizeof(teststruct) == 60);
95 ASSERT(incompletestruct.a == 10);
96 ASSERT(incompletestruct.b[0] == 1);
97 ASSERT(incompletestruct.b[4] == 5);
99 ASSERT(sizeof(incompletestruct) == sizeof(struct y));
100 ASSERT(sizeof(incompletestruct) == offsetof(struct y, b));
101 ASSERT(sizeof(incompletestruct) == offsetof(struct x, b));