mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-23 04:42:32 +00:00
Add a test for returning @param into an array.
This commit is contained in:
parent
3b63c31b5d
commit
88c765e210
2 changed files with 34 additions and 0 deletions
|
@ -25,6 +25,7 @@ test_progs_dat=\
|
|||
deadbool.dat \
|
||||
infloop.dat \
|
||||
modulo.dat \
|
||||
paramret.dat \
|
||||
return-ivar.dat \
|
||||
sendv.dat \
|
||||
structlive.dat \
|
||||
|
@ -87,6 +88,13 @@ modulo.dat: $(modulo_obj) $(QFCC_DEP)
|
|||
modulo.run: Makefile build-run
|
||||
TEST_HARNESS_OPTS=--float $(srcdir)/build-run $@
|
||||
|
||||
paramret_dat_SOURCES=paramret.r
|
||||
paramret_obj=$(paramret_dat_SOURCES:.r=.qfo)
|
||||
paramret.dat: $(paramret_obj) $(QFCC_DEP)
|
||||
$(QFCC) $(QCFLAGS) -o $@ $(paramret_obj)
|
||||
paramret.run: Makefile build-run
|
||||
TEST_HARNESS_OPTS=--float $(srcdir)/build-run $@
|
||||
|
||||
return_ivar_dat_SOURCES=return-ivar.r
|
||||
return_ivar_obj=$(return_ivar_dat_SOURCES:.r=.qfo)
|
||||
return-ivar.dat: $(return_ivar_obj) $(QFCC_DEP)
|
||||
|
|
26
tools/qfcc/test/paramret.r
Normal file
26
tools/qfcc/test/paramret.r
Normal file
|
@ -0,0 +1,26 @@
|
|||
@param
|
||||
foo (string str)
|
||||
{
|
||||
@param ret;
|
||||
ret = nil;
|
||||
ret.string_val = str;
|
||||
return ret;
|
||||
}
|
||||
|
||||
string
|
||||
bar (string str)
|
||||
{
|
||||
@param params[8];
|
||||
@va_list va_list = { 0, params };
|
||||
int j;
|
||||
|
||||
for (j = 0; j < 1; j++)
|
||||
va_list.list[j] = foo (str);
|
||||
return va_list.list[0].string_val;
|
||||
}
|
||||
|
||||
int
|
||||
main ()
|
||||
{
|
||||
return bar ("snafu") != "snafu";
|
||||
}
|
Loading…
Reference in a new issue