| 1 |
#include "compat-common.h" |
| 2 |
|
| 3 |
#define T(N, NAME, TYPE) \ |
| 4 |
struct S##NAME##N { TYPE i[N]; }; \ |
| 5 |
struct S##NAME##N g1s##NAME##N, g2s##NAME##N; \ |
| 6 |
struct S##NAME##N g3s##NAME##N, g4s##NAME##N; \ |
| 7 |
struct S##NAME##N g5s##NAME##N, g6s##NAME##N; \ |
| 8 |
struct S##NAME##N g7s##NAME##N, g8s##NAME##N; \ |
| 9 |
struct S##NAME##N g9s##NAME##N, g10s##NAME##N; \ |
| 10 |
struct S##NAME##N g11s##NAME##N, g12s##NAME##N; \ |
| 11 |
struct S##NAME##N g13s##NAME##N, g14s##NAME##N; \ |
| 12 |
struct S##NAME##N g15s##NAME##N, g16s##NAME##N; \ |
| 13 |
\ |
| 14 |
extern void init##NAME##N (struct S##NAME##N *p, int i); \ |
| 15 |
extern void checkg##NAME##N (void); \ |
| 16 |
extern void \ |
| 17 |
test##NAME##N (struct S##NAME##N s1, struct S##NAME##N s2, \ |
| 18 |
struct S##NAME##N s3, struct S##NAME##N s4, \ |
| 19 |
struct S##NAME##N s5, struct S##NAME##N s6, \ |
| 20 |
struct S##NAME##N s7, struct S##NAME##N s8, \ |
| 21 |
struct S##NAME##N s9, struct S##NAME##N s10, \ |
| 22 |
struct S##NAME##N s11, struct S##NAME##N s12, \ |
| 23 |
struct S##NAME##N s13, struct S##NAME##N s14, \ |
| 24 |
struct S##NAME##N s15, struct S##NAME##N s16); \ |
| 25 |
extern void testva##NAME##N (int n, ...); \ |
| 26 |
extern void \ |
| 27 |
test2_##NAME##N (struct S##NAME##N s1, struct S##NAME##N s2, \ |
| 28 |
struct S##NAME##N s3, struct S##NAME##N s4, \ |
| 29 |
struct S##NAME##N s5, struct S##NAME##N s6, \ |
| 30 |
struct S##NAME##N s7, struct S##NAME##N s8); \ |
| 31 |
\ |
| 32 |
void \ |
| 33 |
check##NAME##N (struct S##NAME##N *p, int i) \ |
| 34 |
{ \ |
| 35 |
int j; \ |
| 36 |
for (j = 0; j < N; j++) \ |
| 37 |
if (p->i[j] != (TYPE) (i + j)) \ |
| 38 |
DEBUG_CHECK \ |
| 39 |
} \ |
| 40 |
\ |
| 41 |
void \ |
| 42 |
test2_##NAME##N (struct S##NAME##N s1, struct S##NAME##N s2, \ |
| 43 |
struct S##NAME##N s3, struct S##NAME##N s4, \ |
| 44 |
struct S##NAME##N s5, struct S##NAME##N s6, \ |
| 45 |
struct S##NAME##N s7, struct S##NAME##N s8) \ |
| 46 |
{ \ |
| 47 |
test##NAME##N (s1, g2s##NAME##N, s2, g4s##NAME##N, \ |
| 48 |
s3, g6s##NAME##N, s4, g8s##NAME##N, \ |
| 49 |
s5, g10s##NAME##N, s6, g12s##NAME##N, \ |
| 50 |
s7, g14s##NAME##N, s8, g16s##NAME##N); \ |
| 51 |
} \ |
| 52 |
\ |
| 53 |
void \ |
| 54 |
testit##NAME##N (void) \ |
| 55 |
{ \ |
| 56 |
DEBUG_FPUTS (#NAME "[" #N "]"); \ |
| 57 |
DEBUG_FPUTS (" init: "); \ |
| 58 |
init##NAME##N ( &g1s##NAME##N, 1*16); \ |
| 59 |
init##NAME##N ( &g2s##NAME##N, 2*16); \ |
| 60 |
init##NAME##N ( &g3s##NAME##N, 3*16); \ |
| 61 |
init##NAME##N ( &g4s##NAME##N, 4*16); \ |
| 62 |
init##NAME##N ( &g5s##NAME##N, 5*16); \ |
| 63 |
init##NAME##N ( &g6s##NAME##N, 6*16); \ |
| 64 |
init##NAME##N ( &g7s##NAME##N, 7*16); \ |
| 65 |
init##NAME##N ( &g8s##NAME##N, 8*16); \ |
| 66 |
init##NAME##N ( &g9s##NAME##N, 9*16); \ |
| 67 |
init##NAME##N (&g10s##NAME##N, 10*16); \ |
| 68 |
init##NAME##N (&g11s##NAME##N, 11*16); \ |
| 69 |
init##NAME##N (&g12s##NAME##N, 12*16); \ |
| 70 |
init##NAME##N (&g13s##NAME##N, 13*16); \ |
| 71 |
init##NAME##N (&g14s##NAME##N, 14*16); \ |
| 72 |
init##NAME##N (&g15s##NAME##N, 15*16); \ |
| 73 |
init##NAME##N (&g16s##NAME##N, 16*16); \ |
| 74 |
checkg##NAME##N (); \ |
| 75 |
DEBUG_NL; \ |
| 76 |
DEBUG_FPUTS (#NAME "[" #N "]"); \ |
| 77 |
DEBUG_FPUTS (" test: "); \ |
| 78 |
test##NAME##N (g1s##NAME##N, g2s##NAME##N, \ |
| 79 |
g3s##NAME##N, g4s##NAME##N, \ |
| 80 |
g5s##NAME##N, g6s##NAME##N, \ |
| 81 |
g7s##NAME##N, g8s##NAME##N, \ |
| 82 |
g9s##NAME##N, g10s##NAME##N, \ |
| 83 |
g11s##NAME##N, g12s##NAME##N, \ |
| 84 |
g13s##NAME##N, g14s##NAME##N, \ |
| 85 |
g15s##NAME##N, g16s##NAME##N); \ |
| 86 |
DEBUG_NL; \ |
| 87 |
DEBUG_FPUTS (#NAME "[" #N "]"); \ |
| 88 |
DEBUG_FPUTS (" testva:"); \ |
| 89 |
testva##NAME##N (16, \ |
| 90 |
g1s##NAME##N, g2s##NAME##N, \ |
| 91 |
g3s##NAME##N, g4s##NAME##N, \ |
| 92 |
g5s##NAME##N, g6s##NAME##N, \ |
| 93 |
g7s##NAME##N, g8s##NAME##N, \ |
| 94 |
g9s##NAME##N, g10s##NAME##N, \ |
| 95 |
g11s##NAME##N, g12s##NAME##N, \ |
| 96 |
g13s##NAME##N, g14s##NAME##N, \ |
| 97 |
g15s##NAME##N, g16s##NAME##N); \ |
| 98 |
DEBUG_NL; \ |
| 99 |
DEBUG_FPUTS (#NAME "[" #N "]"); \ |
| 100 |
DEBUG_FPUTS (" test2: "); \ |
| 101 |
test2_##NAME##N (g1s##NAME##N, g3s##NAME##N, \ |
| 102 |
g5s##NAME##N, g7s##NAME##N, \ |
| 103 |
g9s##NAME##N, g11s##NAME##N, \ |
| 104 |
g13s##NAME##N, g15s##NAME##N); \ |
| 105 |
DEBUG_NL; \ |
| 106 |
} |
| 107 |
|
| 108 |
#ifndef SKIP_ZERO_ARRAY |
| 109 |
T(0, uc, unsigned char) |
| 110 |
#endif |
| 111 |
T(1, uc, unsigned char) |
| 112 |
T(2, uc, unsigned char) |
| 113 |
T(3, uc, unsigned char) |
| 114 |
T(4, uc, unsigned char) |
| 115 |
T(5, uc, unsigned char) |
| 116 |
T(6, uc, unsigned char) |
| 117 |
T(7, uc, unsigned char) |
| 118 |
T(8, uc, unsigned char) |
| 119 |
T(9, uc, unsigned char) |
| 120 |
T(10, uc, unsigned char) |
| 121 |
T(11, uc, unsigned char) |
| 122 |
T(12, uc, unsigned char) |
| 123 |
T(13, uc, unsigned char) |
| 124 |
T(14, uc, unsigned char) |
| 125 |
T(15, uc, unsigned char) |
| 126 |
#ifndef SKIP_ZERO_ARRAY |
| 127 |
T(0, us, unsigned short) |
| 128 |
#endif |
| 129 |
T(1, us, unsigned short) |
| 130 |
T(2, us, unsigned short) |
| 131 |
T(3, us, unsigned short) |
| 132 |
T(4, us, unsigned short) |
| 133 |
T(5, us, unsigned short) |
| 134 |
T(6, us, unsigned short) |
| 135 |
T(7, us, unsigned short) |
| 136 |
T(8, us, unsigned short) |
| 137 |
T(9, us, unsigned short) |
| 138 |
T(10, us, unsigned short) |
| 139 |
T(11, us, unsigned short) |
| 140 |
T(12, us, unsigned short) |
| 141 |
T(13, us, unsigned short) |
| 142 |
T(14, us, unsigned short) |
| 143 |
T(15, us, unsigned short) |
| 144 |
#ifndef SKIP_ZERO_ARRAY |
| 145 |
T(0, ui, unsigned int) |
| 146 |
#endif |
| 147 |
T(1, ui, unsigned int) |
| 148 |
T(2, ui, unsigned int) |
| 149 |
T(3, ui, unsigned int) |
| 150 |
T(4, ui, unsigned int) |
| 151 |
T(5, ui, unsigned int) |
| 152 |
T(6, ui, unsigned int) |
| 153 |
T(7, ui, unsigned int) |
| 154 |
T(8, ui, unsigned int) |
| 155 |
T(9, ui, unsigned int) |
| 156 |
T(10, ui, unsigned int) |
| 157 |
T(11, ui, unsigned int) |
| 158 |
T(12, ui, unsigned int) |
| 159 |
T(13, ui, unsigned int) |
| 160 |
T(14, ui, unsigned int) |
| 161 |
T(15, ui, unsigned int) |
| 162 |
|
| 163 |
#undef T |
| 164 |
|
| 165 |
void |
| 166 |
struct_by_value_2_x () |
| 167 |
{ |
| 168 |
DEBUG_INIT |
| 169 |
|
| 170 |
#define T(N, NAME, TYPE) testit##NAME##N (); |
| 171 |
|
| 172 |
#ifndef SKIP_ZERO_ARRAY |
| 173 |
T(0, uc, unsigned char) |
| 174 |
#endif |
| 175 |
T(1, uc, unsigned char) |
| 176 |
T(2, uc, unsigned char) |
| 177 |
T(3, uc, unsigned char) |
| 178 |
T(4, uc, unsigned char) |
| 179 |
T(5, uc, unsigned char) |
| 180 |
T(6, uc, unsigned char) |
| 181 |
T(7, uc, unsigned char) |
| 182 |
T(8, uc, unsigned char) |
| 183 |
T(9, uc, unsigned char) |
| 184 |
T(10, uc, unsigned char) |
| 185 |
T(11, uc, unsigned char) |
| 186 |
T(12, uc, unsigned char) |
| 187 |
T(13, uc, unsigned char) |
| 188 |
T(14, uc, unsigned char) |
| 189 |
T(15, uc, unsigned char) |
| 190 |
#ifndef SKIP_ZERO_ARRAY |
| 191 |
T(0, us, unsigned short) |
| 192 |
#endif |
| 193 |
T(1, us, unsigned short) |
| 194 |
T(2, us, unsigned short) |
| 195 |
T(3, us, unsigned short) |
| 196 |
T(4, us, unsigned short) |
| 197 |
T(5, us, unsigned short) |
| 198 |
T(6, us, unsigned short) |
| 199 |
T(7, us, unsigned short) |
| 200 |
T(8, us, unsigned short) |
| 201 |
T(9, us, unsigned short) |
| 202 |
T(10, us, unsigned short) |
| 203 |
T(11, us, unsigned short) |
| 204 |
T(12, us, unsigned short) |
| 205 |
T(13, us, unsigned short) |
| 206 |
T(14, us, unsigned short) |
| 207 |
T(15, us, unsigned short) |
| 208 |
#ifndef SKIP_ZERO_ARRAY |
| 209 |
T(0, ui, unsigned int) |
| 210 |
#endif |
| 211 |
T(1, ui, unsigned int) |
| 212 |
T(2, ui, unsigned int) |
| 213 |
T(3, ui, unsigned int) |
| 214 |
T(4, ui, unsigned int) |
| 215 |
T(5, ui, unsigned int) |
| 216 |
T(6, ui, unsigned int) |
| 217 |
T(7, ui, unsigned int) |
| 218 |
T(8, ui, unsigned int) |
| 219 |
T(9, ui, unsigned int) |
| 220 |
T(10, ui, unsigned int) |
| 221 |
T(11, ui, unsigned int) |
| 222 |
T(12, ui, unsigned int) |
| 223 |
T(13, ui, unsigned int) |
| 224 |
T(14, ui, unsigned int) |
| 225 |
T(15, ui, unsigned int) |
| 226 |
|
| 227 |
DEBUG_FINI |
| 228 |
|
| 229 |
if (fails != 0) |
| 230 |
abort (); |
| 231 |
|
| 232 |
#undef T |
| 233 |
} |