struct / union in initializer, RFE #901.
[sdcc.git] / sdcc / support / regression / tests / sdcccall.c.in
blobcb8b58058ba4be28b98215dd36a24cf0f8511e71
1 /*
2 sdcccall.c. Test support for differnrt ABI versions.
3 typearg: unsigned char, unsigned int
4 typeret: unsigned char, unsigned int
5 version: 0, 1
6 */
8 #include <testfwk.h>
10 #if (defined(__SDCC_stm8) || defined(__SDCC_sm83) || defined(__SDCC_z80) || defined(__SDCC_z80n) || defined(__SDCC_z180))
11 #define SDCCCALL __sdcccall({version})
12 #else
13 #define SDCCCALL
14 #endif
16 {typeret} f({typearg} i) SDCCCALL
18 return ++i;
21 {typeret} g({typearg} i, unsigned int j) SDCCCALL
23 return i + j;
26 #ifndef __SDCC_pic16 // TODO: enable when pic16 supports long long
27 {typeret} h({typearg} i, unsigned int j, unsigned long long k) SDCCCALL
29 return i + j + k;
31 #endif
33 {typeret} f_wrap_default({typearg} i)
35 return f(i);
38 {typeret} f_wrap_explicit({typearg} i) SDCCCALL
40 return f(i);
43 void
44 testCallingConvention(void)
46 ASSERT(f(23) == ({typeret})24);
47 ASSERT(g(23, 1001u) == ({typeret})1024ul);
48 #ifndef __SDCC_pic16 // TODO: enable when pic16 supports long long
49 ASSERT(h(23, 1001u, 10000000000ul) == ({typeret})10000001024ull);
50 #endif
51 ASSERT(f_wrap_default(23) == ({typeret})24);
52 ASSERT(f_wrap_explicit(23) == ({typeret})24);