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