[qfcc] Add a failing test for struct init to param

This actually took a bit to reproduce.
This commit is contained in:
Bill Currie 2020-03-06 22:28:04 +09:00
parent f7757cf894
commit faa6eabfbe
2 changed files with 40 additions and 0 deletions

View file

@ -50,6 +50,7 @@ test_progs_dat=\
return-ivar.dat \ return-ivar.dat \
sendv.dat \ sendv.dat \
state.dat \ state.dat \
struct-init-param.dat \
struct-nil-init.dat \ struct-nil-init.dat \
structarray.dat \ structarray.dat \
structlive.dat \ structlive.dat \
@ -322,6 +323,15 @@ state.run: Makefile build-run
include ./$(DEPDIR)/state.Qo # am--include-marker include ./$(DEPDIR)/state.Qo # am--include-marker
r_depfiles_remade += ./$(DEPDIR)/state.Qo r_depfiles_remade += ./$(DEPDIR)/state.Qo
struct_init_param_dat_SOURCES=struct-init-param.r
struct_init_param_obj=$(struct_init_param_dat_SOURCES:.r=.qfo)
struct-init-param.dat$(EXEEXT): $(struct_init_param_obj) $(QFCC_DEP)
$(QFCC) $(QCFLAGS) -o $@ $(struct_init_param_obj)
struct-init-param.run: Makefile build-run
@$(srcdir)/build-run $@
include ./$(DEPDIR)/struct-init-param.Qo # am--include-marker
r_depfiles_remade += ./$(DEPDIR)/struct-init-param.Qo
struct_nil_init_dat_SOURCES=struct-nil-init.r struct_nil_init_dat_SOURCES=struct-nil-init.r
struct_nil_init_obj=$(struct_nil_init_dat_SOURCES:.r=.qfo) struct_nil_init_obj=$(struct_nil_init_dat_SOURCES:.r=.qfo)
struct-nil-init.dat$(EXEEXT): $(struct_nil_init_obj) $(QFCC_DEP) struct-nil-init.dat$(EXEEXT): $(struct_nil_init_obj) $(QFCC_DEP)

View file

@ -0,0 +1,30 @@
typedef struct {
int x;
int y;
} Point;
typedef struct {
int width;
int height;
} Extent;
typedef struct Rect_s {
Point offset;
Extent extent;
} Rect;
void *foo (void *obj, void *cmd, void *o, Point pos, Rect r)
{
return obj;
}
void *bar (Rect *obj, void *cmd, void *o, Point pos)
{
Rect rect = { {}, obj.extent };
return foo (obj, cmd, o, pos, rect);
}
int main (void)
{
return 1;// don't want this to pass until I've checked the generated code
}