mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-10 07:11:41 +00:00
Add a test for function local static variables.
It turns out they're not getting allocated properly (they're put in the function's locals defspace rather than near data), but fixing it proved a little more problematic than expected, so the test is marked as XFAIL for now to remind me to fix it.
This commit is contained in:
parent
7412a45c65
commit
1eb3349510
2 changed files with 29 additions and 0 deletions
|
@ -21,13 +21,18 @@ QFCC_TEST_INCS=@QFCC_TEST_INCS@
|
|||
test_progs_dat=\
|
||||
chewed-alias.dat \
|
||||
chewed-return.dat \
|
||||
func-static.dat \
|
||||
deadbool.dat \
|
||||
infloop.dat \
|
||||
modulo.dat \
|
||||
structptr.dat \
|
||||
while.dat
|
||||
|
||||
fail_progs_dat=\
|
||||
func-static.dat
|
||||
|
||||
TESTS=$(test_progs_dat:.dat=.run)
|
||||
XFAIL_TESTS=$(fail_progs_dat:.dat=.run)
|
||||
|
||||
check_PROGRAMS=test-harness $(test_progs_dat)
|
||||
|
||||
|
@ -49,6 +54,13 @@ chewed-return.dat: $(chewed_return_obj) $(QFCC_DEP)
|
|||
chewed-return.run: Makefile build-run
|
||||
TEST_HARNESS_OPTS=--float $(srcdir)/build-run $@
|
||||
|
||||
func_static_dat_SOURCES=func-static.r
|
||||
func_static_obj=$(func_static_dat_SOURCES:.r=.qfo)
|
||||
func-static.dat: $(func_static_obj) $(QFCC_DEP)
|
||||
$(QFCC) $(QCFLAGS) -o $@ $(func_static_obj)
|
||||
func-static.run: Makefile build-run
|
||||
$(srcdir)/build-run $@
|
||||
|
||||
deadbool_dat_SOURCES=deadbool.r
|
||||
deadbool_obj=$(deadbool_dat_SOURCES:.r=.qfo)
|
||||
deadbool.dat: $(deadbool_obj) $(QFCC_DEP)
|
||||
|
|
17
tools/qfcc/test/func-static.r
Normal file
17
tools/qfcc/test/func-static.r
Normal file
|
@ -0,0 +1,17 @@
|
|||
int count;
|
||||
|
||||
void foo (void)
|
||||
{
|
||||
@static int x;
|
||||
|
||||
if (!x)
|
||||
count++;
|
||||
x = 1;
|
||||
}
|
||||
|
||||
int main(void)
|
||||
{
|
||||
foo ();
|
||||
foo ();
|
||||
return count != 1;
|
||||
}
|
Loading…
Reference in a new issue