1 /* 2 strct-stdarg-1.c from the execute part of the gcc torture tests. 3 */ 4 5 #include <testfwk.h> 6 7 #include <stdarg.h> 8 9 struct tiny 10 { 11 char c; 12 char d; 13 char e; 14 char f; 15 char g; 16 }; 17 18 #if 0 // TODO: enable when SDCC supports passing struct arguments! 19 f (int n, ...) 20 { 21 struct tiny x; 22 int i; 23 24 va_list ap; 25 va_start (ap,n); 26 for (i = 0; i < n; i++) 27 { 28 x = va_arg (ap,struct tiny); 29 if (x.c != i + 10) 30 ASSERT(0); 31 if (x.d != i + 20) 32 ASSERT(0); 33 if (x.e != i + 30) 34 ASSERT(0); 35 if (x.f != i + 40) 36 ASSERT(0); 37 if (x.g != i + 50) 38 ASSERT(0); 39 } 40 { 41 long x = va_arg (ap, long); 42 if (x != 123) 43 ASSERT(0); 44 } 45 va_end (ap); 46 } 47 #endif 48 49 void testTortureExecute(void)50testTortureExecute (void) 51 { 52 #if 0 // TODO: enable when SDCC supports passing struct arguments! 53 struct tiny x[3]; 54 x[0].c = 10; 55 x[1].c = 11; 56 x[2].c = 12; 57 x[0].d = 20; 58 x[1].d = 21; 59 x[2].d = 22; 60 x[0].e = 30; 61 x[1].e = 31; 62 x[2].e = 32; 63 x[0].f = 40; 64 x[1].f = 41; 65 x[2].f = 42; 66 x[0].g = 50; 67 x[1].g = 51; 68 x[2].g = 52; 69 f (3, x[0], x[1], x[2], (long) 123); 70 return; 71 #endif 72 } 73