Mercurial > pub > dyncall > dyncall
comparison test/plain/test_aggrs.c @ 629:4754d195d2b5
(older) C conformance fix
author | Tassilo Philipp |
---|---|
date | Fri, 28 Oct 2022 15:34:49 +0200 |
parents | c477ddd64718 |
children | a388de1c822e |
comparison
equal
deleted
inserted
replaced
628:cb2cbb6453e5 | 629:4754d195d2b5 |
---|---|
273 static double __cdecl fun_take_int_nested_double(Int_NestedDouble s) { return s.a + s.b.f; } | 273 static double __cdecl fun_take_int_nested_double(Int_NestedDouble s) { return s.a + s.b.f; } |
274 static double __cdecl fun_take_three_double(Three_Double s) { return s.a + s.b + s.c; } | 274 static double __cdecl fun_take_three_double(Three_Double s) { return s.a + s.b + s.c; } |
275 static double __cdecl fun_take_mixed_fp(double a, float b, float c, int d, float e, double f, float g, Three_Double s) { return a + 2.*b + 3.*c + 4.*d + 5.*e + 6.*f + 7.*g + 8.*s.a + 9.*s.b + 10.*s.c; } | 275 static double __cdecl fun_take_mixed_fp(double a, float b, float c, int d, float e, double f, float g, Three_Double s) { return a + 2.*b + 3.*c + 4.*d + 5.*e + 6.*f + 7.*g + 8.*s.a + 9.*s.b + 10.*s.c; } |
276 static int __cdecl fun_take_iiiii_il(int a, int b, int c, int d, int e, Int_LongLong f) { return a + b + c + d + e + f.a + (int)f.b; } | 276 static int __cdecl fun_take_iiiii_il(int a, int b, int c, int d, int e, Int_LongLong f) { return a + b + c + d + e + f.a + (int)f.b; } |
277 static double __cdecl fun_take_more_than_regs(More_Than_Regs s) { return s.a + s.b + s.c + s.d + s.e + s.f + s.g + s.h + s.i + s.j + s.k + s.l + s.m + s.n + s.o + s.p + s.q + s.r; } | 277 static double __cdecl fun_take_more_than_regs(More_Than_Regs s) { return s.a + s.b + s.c + s.d + s.e + s.f + s.g + s.h + s.i + s.j + s.k + s.l + s.m + s.n + s.o + s.p + s.q + s.r; } |
278 static double __cdecl fun_take_mixed_fp_vararg(double a, float b, float c, int d, ...) { double r = a + 2.*b + 3.*c + 4.*d; va_list v; va_start(v,d); r += 5.*va_arg(v,double); r += 6.*va_arg(v,double); r += 7.*va_arg(v,double); Three_Double s = va_arg(v,Three_Double); va_end(v); return r + 8.*s.a + 9.*s.b + 10.*s.c; } | 278 static double __cdecl fun_take_mixed_fp_vararg(double a, float b, float c, int d, ...) { double r = a + 2.*b + 3.*c + 4.*d; Three_Double s; va_list v; va_start(v,d); r += 5.*va_arg(v,double); r += 6.*va_arg(v,double); r += 7.*va_arg(v,double); s = va_arg(v,Three_Double); va_end(v); return r + 8.*s.a + 9.*s.b + 10.*s.c; } |
279 static int __cdecl fun_take_iiiii_il_vararg(int a, int b, int c, int d, int e, ...) { int r = a + b + c + d + e; va_list v; va_start(v,e); Int_LongLong f = va_arg(v,Int_LongLong); va_end(v); return r + f.a + (int)f.b; } | 279 static int __cdecl fun_take_iiiii_il_vararg(int a, int b, int c, int d, int e, ...) { int r = a + b + c + d + e; Int_LongLong f; va_list v; va_start(v,e); f = va_arg(v,Int_LongLong); va_end(v); return r + f.a + (int)f.b; } |
280 static double __cdecl fun_take_aggrs_vararg(Int_NestedDouble a, ...) { double r = a.a + a.b.f; va_list v; va_start(v,a); Int_NestedFloat b = va_arg(v,Int_NestedFloat); va_end(v); return r + b.a + b.b.f; } | 280 static double __cdecl fun_take_aggrs_vararg(Int_NestedDouble a, ...) { double r = a.a + a.b.f; Int_NestedFloat b; va_list v; va_start(v,a); b = va_arg(v,Int_NestedFloat); va_end(v); return r + b.a + b.b.f; } |
281 | 281 |
282 | 282 |
283 int testAggrParameters() | 283 int testAggrParameters() |
284 { | 284 { |
285 int ret = 1; | 285 int ret = 1; |
568 } | 568 } |
569 { | 569 { |
570 Int_NestedDouble t0 = { -64, { -6.6} }; | 570 Int_NestedDouble t0 = { -64, { -6.6} }; |
571 Int_NestedFloat t1 = { 112, { 7.5f } }; | 571 Int_NestedFloat t1 = { 112, { 7.5f } }; |
572 int returned; | 572 int returned; |
573 | 573 DCaggr *s0, *s0_, *s1, *s1_; |
574 DCaggr *s0_ = dcNewAggr(1, sizeof(NestedDouble)); | 574 |
575 s0_ = dcNewAggr(1, sizeof(NestedDouble)); | |
575 dcAggrField(s0_, DC_SIGCHAR_DOUBLE, offsetof(NestedDouble, f), 1); | 576 dcAggrField(s0_, DC_SIGCHAR_DOUBLE, offsetof(NestedDouble, f), 1); |
576 dcCloseAggr(s0_); | 577 dcCloseAggr(s0_); |
577 | 578 |
578 DCaggr *s0 = dcNewAggr(2, sizeof(t0)); | 579 s0 = dcNewAggr(2, sizeof(t0)); |
579 dcAggrField(s0, DC_SIGCHAR_INT, offsetof(Int_NestedDouble, a), 1); | 580 dcAggrField(s0, DC_SIGCHAR_INT, offsetof(Int_NestedDouble, a), 1); |
580 dcAggrField(s0, DC_SIGCHAR_AGGREGATE, offsetof(Int_NestedDouble, b), 1, s0_); | 581 dcAggrField(s0, DC_SIGCHAR_AGGREGATE, offsetof(Int_NestedDouble, b), 1, s0_); |
581 dcCloseAggr(s0); | 582 dcCloseAggr(s0); |
582 | 583 |
583 DCaggr *s1_ = dcNewAggr(1, sizeof(NestedFloat)); | 584 s1_ = dcNewAggr(1, sizeof(NestedFloat)); |
584 dcAggrField(s1_, DC_SIGCHAR_FLOAT, offsetof(NestedFloat, f), 1); | 585 dcAggrField(s1_, DC_SIGCHAR_FLOAT, offsetof(NestedFloat, f), 1); |
585 dcCloseAggr(s1_); | 586 dcCloseAggr(s1_); |
586 | 587 |
587 DCaggr *s1 = dcNewAggr(2, sizeof(t1)); | 588 s1 = dcNewAggr(2, sizeof(t1)); |
588 dcAggrField(s1, DC_SIGCHAR_INT, offsetof(Int_NestedFloat, a), 1); | 589 dcAggrField(s1, DC_SIGCHAR_INT, offsetof(Int_NestedFloat, a), 1); |
589 dcAggrField(s1, DC_SIGCHAR_AGGREGATE, offsetof(Int_NestedFloat, b), 1, s1_); | 590 dcAggrField(s1, DC_SIGCHAR_AGGREGATE, offsetof(Int_NestedFloat, b), 1, s1_); |
590 dcCloseAggr(s1); | 591 dcCloseAggr(s1); |
591 | 592 |
592 dcReset(vm); | 593 dcReset(vm); |