From d9f1121763c126316ab338ca8b1b9d51967a33b1 Mon Sep 17 00:00:00 2001 From: Quentin Carbonneaux Date: Tue, 7 Feb 2017 23:04:37 -0500 Subject: tests for variable argument lists --- test/vararg1.ssa | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 test/vararg1.ssa (limited to 'test/vararg1.ssa') diff --git a/test/vararg1.ssa b/test/vararg1.ssa new file mode 100644 index 0000000..28b3d0e --- /dev/null +++ b/test/vararg1.ssa @@ -0,0 +1,30 @@ +export +function d $f(l %x, ...) { +@start + %vp =l alloc8 24 + vastart %vp + %i =l vaarg %vp + %n =d vaarg %vp + ret %n +} + +export +function w $g(l %fmt, ...) { +@start + %vp =l alloc8 24 + vastart %vp + %r =w call $vprintf(l %fmt, l %vp) + ret %r +} + +# >>> driver +# extern double f(int, ...); +# extern int g(char *, ...); +# int main() { +# g("Hell%c %s %g!\n", 'o', "world", f(42, "x", 42.0)); +# } +# <<< + +# >>> output +# Hello world 42! +# <<< -- cgit 1.4.1