diff --git a/tools/qfcc/source/type.c b/tools/qfcc/source/type.c index c6b92b94e..56991b790 100644 --- a/tools/qfcc/source/type.c +++ b/tools/qfcc/source/type.c @@ -729,8 +729,8 @@ encode_type (dstring_t *encoding, const type_t *type) if (!type) return; switch (type->meta) { - case ty_alias: // XXX do I want this, or just the unaliased type? - dasprintf (encoding, "{%s>", type->name); + case ty_alias: + dasprintf (encoding, "{%s>", type->name ? type->name : ""); encode_type (encoding, type->t.alias.aux_type); dasprintf (encoding, "}"); return; diff --git a/tools/qfcc/test/Makemodule.am b/tools/qfcc/test/Makemodule.am index 4263803fe..54bb87dcf 100644 --- a/tools/qfcc/test/Makemodule.am +++ b/tools/qfcc/test/Makemodule.am @@ -33,6 +33,7 @@ test_progs_dat=\ tools/qfcc/test/overload.dat \ tools/qfcc/test/paramret.dat \ tools/qfcc/test/postop.dat \ + tools/qfcc/test/ptraliasenc.dat \ tools/qfcc/test/quaternion.dat \ tools/qfcc/test/return-ivar.dat \ tools/qfcc/test/sendv.dat \ @@ -383,6 +384,16 @@ tools/qfcc/test/postop.run: $(qfcc_test_run_deps) include $(postop_dep) # am--include-marker r_depfiles_remade += $(postop_dep) +tools_qfcc_test_ptraliasenc_dat_SOURCES=tools/qfcc/test/ptraliasenc.r +ptraliasenc_obj=$(tools_qfcc_test_ptraliasenc_dat_SOURCES:.r=.o) +ptraliasenc_dep=$(call qcautodep,$(tools_qfcc_test_ptraliasenc_dat_SOURCES)) +tools/qfcc/test/ptraliasenc.dat$(EXEEXT): $(ptraliasenc_obj) $(QFCC_DEP) + $(V_QFCCLD)$(QLINK) -o $@ $(ptraliasenc_obj) +tools/qfcc/test/ptraliasenc.run: $(qfcc_test_run_deps) + @$(top_srcdir)/tools/qfcc/test/build-run $@ +include $(ptraliasenc_dep) # am--include-marker +r_depfiles_remade += $(ptraliasenc_dep) + tools_qfcc_test_quaternion_dat_SOURCES=tools/qfcc/test/quaternion.r quaternion_obj=$(tools_qfcc_test_quaternion_dat_SOURCES:.r=.o) quaternion_dep=$(call qcautodep,$(tools_qfcc_test_quaternion_dat_SOURCES)) diff --git a/tools/qfcc/test/ptraliasenc.r b/tools/qfcc/test/ptraliasenc.r new file mode 100644 index 000000000..2f305617f --- /dev/null +++ b/tools/qfcc/test/ptraliasenc.r @@ -0,0 +1,25 @@ +#include + +#include "test-harness.h" + +typedef int int32_t; +int32_t *int32_ptr; + +typedef struct xdef_s { + qfot_type_t *type; ///< pointer to type definition + void *ofs; ///< 32-bit version of ddef_t.ofs +} xdef_t; + +void *PR_FindGlobal (string name) = #0; + +int +main (void) +{ + //FIXME need a simple way to get at a def's meta-data + xdef_t *xdefs = PR_FindGlobal (".xdefs"); + while (xdefs.ofs != &int32_ptr) { + xdefs++; + } + printf ("int32_ptr: %s\n", xdefs.type.encoding); + return xdefs.type.encoding != "{>^i}"; +}