tests for variable argument lists
This commit is contained in:
parent
b99a8b0d07
commit
d9f1121763
3 changed files with 783 additions and 0 deletions
30
test/vararg1.ssa
Normal file
30
test/vararg1.ssa
Normal file
|
@ -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!
|
||||
# <<<
|
Loading…
Add table
Add a link
Reference in a new issue