mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-10 07:11:41 +00:00
[qfcc] Add test for var = func(var)
That is, updating a variable using a function that takes the same variable, probably very common in iterators, thus the name. It happens to be the first qfcc test specific to Ruamoko. It's really just the typedef, zerolinker, and vkgen type encoding loop stripped down for ease of debugging. Of course, it fails :)
This commit is contained in:
parent
4ec3486a4b
commit
9b81d27f1a
2 changed files with 44 additions and 0 deletions
|
@ -30,6 +30,7 @@ test_progs_dat=\
|
|||
tools/qfcc/test/func-static.dat \
|
||||
tools/qfcc/test/gcd.dat \
|
||||
tools/qfcc/test/infloop.dat \
|
||||
tools/qfcc/test/iterfunc.dat \
|
||||
tools/qfcc/test/ivar-struct-return.dat \
|
||||
tools/qfcc/test/link_order.dat \
|
||||
tools/qfcc/test/lost-use.dat \
|
||||
|
@ -379,6 +380,16 @@ tools/qfcc/test/infloop.run: $(qfcc_test_run_deps)
|
|||
include $(infloop_dep) # am--include-marker
|
||||
r_depfiles_remade += $(infloop_dep)
|
||||
|
||||
tools_qfcc_test_iterfunc_dat_SOURCES=tools/qfcc/test/iterfunc.r
|
||||
iterfunc_obj=$(tools_qfcc_test_iterfunc_dat_SOURCES:.r=.o)
|
||||
iterfunc_dep=$(call qcautodep,$(tools_qfcc_test_iterfunc_dat_SOURCES))
|
||||
tools/qfcc/test/iterfunc.dat$(EXEEXT): $(iterfunc_obj) $(QFCC_DEP)
|
||||
$(V_QFCCLD)$(QLINK) -o $@ $(iterfunc_obj)
|
||||
tools/qfcc/test/iterfunc.run: $(qfcc_test_run_deps)
|
||||
@$(top_srcdir)/tools/qfcc/test/build-run $@
|
||||
include $(iterfunc_dep) # am--include-marker
|
||||
r_depfiles_remade += $(iterfunc_dep)
|
||||
|
||||
tools_qfcc_test_ivar_struct_return_dat_SOURCES=tools/qfcc/test/ivar-struct-return.r
|
||||
ivar_struct_return_obj=$(tools_qfcc_test_ivar_struct_return_dat_SOURCES:.r=.o)
|
||||
ivar_struct_return_dep=$(call qcautodep,$(tools_qfcc_test_ivar_struct_return_dat_SOURCES))
|
||||
|
|
33
tools/qfcc/test/iterfunc.r
Normal file
33
tools/qfcc/test/iterfunc.r
Normal file
|
@ -0,0 +1,33 @@
|
|||
#include <types.h>
|
||||
|
||||
// can't link against libr.a (may not be built)
|
||||
void *PR_FindGlobal (string name) = #0;
|
||||
void printf (string fmt, ...) = #0;
|
||||
|
||||
qfot_type_encodings_t *encodings;
|
||||
qfot_type_t *next_type (qfot_type_t *type);
|
||||
|
||||
int
|
||||
main (void)
|
||||
{
|
||||
int found_param = 0;
|
||||
int found_zero = 0;
|
||||
qfot_type_t *type;
|
||||
|
||||
encodings = PR_FindGlobal (".type_encodings");
|
||||
|
||||
for (type = encodings.types;
|
||||
((int *)type - (int *) encodings.types) < encodings.size;
|
||||
type = next_type (type)) {
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
qfot_type_t *
|
||||
next_type (qfot_type_t *type)
|
||||
{
|
||||
int size = type.size;
|
||||
if (!size)
|
||||
size = 4;
|
||||
return (qfot_type_t *) ((int *) type + size);
|
||||
}
|
Loading…
Reference in a new issue