diff options
| author | Shinichiro Hamaji <shinichiro.hamaji@gmail.com> | 2010-12-28 19:32:40 +0900 |
|---|---|---|
| committer | Shinichiro Hamaji <shinichiro.hamaji@gmail.com> | 2010-12-28 19:32:40 +0900 |
| commit | 0ed7ba3f5e79f407a206b387079c9fd68327064b (patch) | |
| tree | 1e1ddb5103cf8a90b8cef2b7c28eef1606ac4a41 /tests | |
| parent | 07fd82b4113c9f912383dff448e3dd8b71179b7b (diff) | |
| download | tinycc-0ed7ba3f5e79f407a206b387079c9fd68327064b.tar.gz tinycc-0ed7ba3f5e79f407a206b387079c9fd68327064b.tar.bz2 | |
Support struct arguments with stdarg.h
- add __builtin_va_arg_types to check how arguments were passed
- move most code of stdarg into libtcc1.c
- remove __builtin_malloc and __builtin_free
- add a test case based on the bug report
(http://www.mail-archive.com/tinycc-devel@nongnu.org/msg03036.html)
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/tcctest.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/tcctest.c b/tests/tcctest.c index 9ceca94..14ad1e6 100644 --- a/tests/tcctest.c +++ b/tests/tcctest.c @@ -1834,10 +1834,30 @@ void vprintf1(const char *fmt, ...) va_end(ap); } +struct myspace { + short int profile; +}; + +void stdarg_for_struct(struct myspace bob, ...) +{ + struct myspace george, bill; + va_list ap; + short int validate; + + va_start(ap, bob); + bill = va_arg(ap, struct myspace); + george = va_arg(ap, struct myspace); + validate = va_arg(ap, int); + printf("stdarg_for_struct: %d %d %d %d\n", + bob.profile, bill.profile, george.profile, validate); + va_end(ap); +} void stdarg_test(void) { long double ld = 1234567891234LL; + struct myspace bob; + vprintf1("%d %d %d\n", 1, 2, 3); vprintf1("%f %d %f\n", 1.0, 2, 3.0); vprintf1("%l %l %d %f\n", 1234567891234LL, 987654321986LL, 3, 1234.0); @@ -1879,6 +1899,9 @@ void stdarg_test(void) 0.1, 1.2, 2.3, 3.4, 4.5, 5.6, 6.7, 7.8, 8.9, 9.0, ld, 1234567891234LL, 987654321986LL, 42.0, 43.0, ld); + + bob.profile = 42; + stdarg_for_struct(bob, bob, bob, bob.profile); } void whitespace_test(void) |
