~mcf/cproc

792beff25a6ca5aaf26d5a6dd2449f2e0aefbebb — Michael Forney 2 years ago 8040e25
Ignore qualifiers when parsing initializers
3 files changed, 3 insertions(+), 1 deletions(-)

M init.c
A tests/const-init.c
A tests/const-init.qbe
M init.c => init.c +1 -1
@@ 211,7 211,7 @@ parseinit(struct scope *s, struct type *t)
	p.cur = NULL;
	p.sub = p.obj;
	p.sub->offset = 0;
	p.sub->type = t;
	p.sub->type = typeunqual(t, NULL);
	for (;;) {
		if (p.cur) {
			if (tok.kind == TLBRACK || tok.kind == TPERIOD)

A tests/const-init.c => tests/const-init.c +1 -0
@@ 0,0 1,1 @@
const struct {struct {int x, y;} t;} s = {{{1}, 2}};

A tests/const-init.qbe => tests/const-init.qbe +1 -0
@@ 0,0 1,1 @@
export data $s = align 4 { w 1, w 2, }