3 storage: auto, idata, pdata, xdata, code,
6 #define STORAGE_{storage}
7 #define STORAGE {storage}
10 #if defined (__GNUC__) && defined (__alpha__) && (__GNUC__ < 3)
11 /* since g fails on GCC 2.95.4 on alpha... */
14 #elif defined (STORAGE_auto)
15 /* only static flexible arrays are allowed */
25 typedef unsigned int size_t;
26 #define offsetof(s,m) (size_t)&(((s *)0)->m)
28 #if defined (STORAGE_auto)
33 const char *string1 = "\x00\x01";
34 const char string2[] = "\x00\x01";
37 #pragma disable_warning 147 //no warning about excess initializers (W_EXCESS_INITIALIZERS)
38 #pragma disable_warning 85 //no warning about unreferenced variables (W_NO_REFERENCE)
39 //array will be truncated but warning will be suppressed
40 //if truncation is incorrect, other ASSERTs will fail with high probability
41 char STORAGE trunc[2] = {'a', 'b', 'c'};
44 char STORAGE array[5] = {'a', 'b', 'c'};
62 struct x STORAGE teststruct[5] = {
63 { 10, { 1, 2, 3, 4, 5} },
74 struct y STORAGE incompletestruct = {
79 #if !defined (STORAGE_auto)
84 ASSERT(string1[0] == '\x00');
85 ASSERT(string1[1] == '\x01');
86 ASSERT(string2[0] == '\x00');
87 ASSERT(string2[1] == '\x01');
89 ASSERT(array[2] == 'c');
90 ASSERT(array[4] == 0);
93 ASSERT(g[1].a == 'y');
95 ASSERT(g[2].a == 'z');
99 ASSERT(teststruct[0].b[1] == 2);
100 ASSERT(teststruct[0].b[5] == 0);
101 ASSERT(teststruct[1].b[0] == 11);
102 ASSERT(teststruct[4].b[9] == 0);
104 ASSERT(sizeof(teststruct[2].a) == 2);
105 ASSERT(sizeof(teststruct[1].b) == 10);
106 ASSERT(sizeof(teststruct[1]) == 12);
107 ASSERT(sizeof(teststruct) == 60);
110 ASSERT(incompletestruct.a == 10);
111 ASSERT(incompletestruct.b[0] == 1);
112 ASSERT(incompletestruct.b[4] == 5);
114 ASSERT(sizeof(incompletestruct) == sizeof(struct y));
115 ASSERT(sizeof(incompletestruct) == offsetof(struct y, b));
116 ASSERT(sizeof(incompletestruct) == offsetof(struct x, b));
119 #if defined (STORAGE_auto)
124 teststruct[0].b[5] = 1;
125 teststruct[4].b[9] = 1;
126 #endif //STORAGE_auto
134 #if defined (STORAGE_auto)
135 Zeropad(); //test reinitialization
136 #endif //STORAGE_auto