diff --git a/tools/qfcc/test/Makefile.am b/tools/qfcc/test/Makefile.am index 73528545d..d43706b9b 100644 --- a/tools/qfcc/test/Makefile.am +++ b/tools/qfcc/test/Makefile.am @@ -73,7 +73,9 @@ test_progs_dat=\ vecexpr.dat \ vecinit.dat \ voidfor.dat \ - while.dat + while.dat \ + zerolinker.dat \ + $e fail_progs_dat= @@ -514,6 +516,15 @@ while.run: Makefile build-run include ./$(DEPDIR)/while.Qo # am--include-marker r_depfiles_remade += ./$(DEPDIR)/while.Qo +zerolinker_dat_SOURCES=zerolinker.r +zerolinker_obj=$(zerolinker_dat_SOURCES:.r=.qfo) +zerolinker.dat$(EXEEXT): $(zerolinker_obj) $(QFCC_DEP) + $(QFCC) $(QCFLAGS) -o $@ $(zerolinker_obj) +zerolinker.run: Makefile build-run + @$(srcdir)/build-run $@ +include ./$(DEPDIR)/zerolinker.Qo # am--include-marker +r_depfiles_remade += ./$(DEPDIR)/zerolinker.Qo + $(r_depfiles_remade): @$(MKDIR_P) $(@D) @echo '# dummy' >$@-t && $(am__mv) $@-t $@ diff --git a/tools/qfcc/test/zerolinker.r b/tools/qfcc/test/zerolinker.r new file mode 100644 index 000000000..2babf2b1c --- /dev/null +++ b/tools/qfcc/test/zerolinker.r @@ -0,0 +1,45 @@ +#include + +// 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 size = type.size; + if (!size) + size = 4; + return (qfot_type_t *) ((int *) type + size); +} + +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)) { + if (type.meta == ty_struct) { + if (type.t.strct.tag == "tag @param") { + found_param = 1; + } + if (type.t.strct.tag == "tag @zero") { + found_zero = 1; + } + } + } + if (!(found_param && found_zero)) { + printf ("missing struct: param: %d zero:%d\n", + found_param, found_zero); + return 1; + } + return 0; +}