mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-01-31 21:20:33 +00:00
[qfcc] Add failing test for static init
The function local static init is being treated as a non-static init (ie, initialized each call).
This commit is contained in:
parent
41b3661869
commit
1205c935d0
2 changed files with 30 additions and 0 deletions
|
@ -36,6 +36,7 @@ test_progs_dat=\
|
||||||
tools/qfcc/test/return-ivar.dat \
|
tools/qfcc/test/return-ivar.dat \
|
||||||
tools/qfcc/test/sendv.dat \
|
tools/qfcc/test/sendv.dat \
|
||||||
tools/qfcc/test/state.dat \
|
tools/qfcc/test/state.dat \
|
||||||
|
tools/qfcc/test/static-init.dat \
|
||||||
tools/qfcc/test/struct-init-param.dat \
|
tools/qfcc/test/struct-init-param.dat \
|
||||||
tools/qfcc/test/struct-nil-init.dat \
|
tools/qfcc/test/struct-nil-init.dat \
|
||||||
tools/qfcc/test/structarray.dat \
|
tools/qfcc/test/structarray.dat \
|
||||||
|
@ -411,6 +412,16 @@ tools/qfcc/test/state.run: $(qfcc_test_run_deps)
|
||||||
include $(state_dep) # am--include-marker
|
include $(state_dep) # am--include-marker
|
||||||
r_depfiles_remade += $(state_dep)
|
r_depfiles_remade += $(state_dep)
|
||||||
|
|
||||||
|
tools_qfcc_test_static_init_dat_SOURCES=tools/qfcc/test/static-init.r
|
||||||
|
static_init_obj=$(tools_qfcc_test_static_init_dat_SOURCES:.r=.o)
|
||||||
|
static_init_dep=$(call qcautodep,$(tools_qfcc_test_static_init_dat_SOURCES))
|
||||||
|
tools/qfcc/test/static-init.dat$(EXEEXT): $(static_init_obj) $(QFCC_DEP)
|
||||||
|
$(V_QFCCLD)$(QLINK) -o $@ $(static_init_obj)
|
||||||
|
tools/qfcc/test/static-init.run: $(qfcc_test_run_deps)
|
||||||
|
@$(top_srcdir)/tools/qfcc/test/build-run $@
|
||||||
|
include $(static_init_dep) # am--include-marker
|
||||||
|
r_depfiles_remade += $(static_init_dep)
|
||||||
|
|
||||||
tools_qfcc_test_struct_init_param_dat_SOURCES=tools/qfcc/test/struct-init-param.r
|
tools_qfcc_test_struct_init_param_dat_SOURCES=tools/qfcc/test/struct-init-param.r
|
||||||
struct_init_param_obj=$(tools_qfcc_test_struct_init_param_dat_SOURCES:.r=.o)
|
struct_init_param_obj=$(tools_qfcc_test_struct_init_param_dat_SOURCES:.r=.o)
|
||||||
struct_init_param_dep=$(call qcautodep,$(tools_qfcc_test_struct_init_param_dat_SOURCES))
|
struct_init_param_dep=$(call qcautodep,$(tools_qfcc_test_struct_init_param_dat_SOURCES))
|
||||||
|
|
19
tools/qfcc/test/static-init.r
Normal file
19
tools/qfcc/test/static-init.r
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
#include "test-harness.h"
|
||||||
|
|
||||||
|
int count_down ()
|
||||||
|
{
|
||||||
|
static int count = 2;
|
||||||
|
count--;
|
||||||
|
return count > 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
int ret = 0;
|
||||||
|
count_down ();
|
||||||
|
if (count_down ()) {
|
||||||
|
printf ("did not reach 0\n");
|
||||||
|
ret |= 1;
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
}
|
Loading…
Reference in a new issue