tccgen: continue initialization after chained designators
commit2d3eea205cb6c0f796d01d7d0858eb6c6c1d993f
authorKonstantin Baltsat <[email protected]>
Thu, 5 Nov 2026 07:04:54 +0000 (5 15:04 +0800)
committerKonstantin Baltsat <[email protected]>
Thu, 5 Nov 2026 07:04:54 +0000 (5 15:04 +0800)
treedf95b814cfa2adbb0207c7d1802dfd5e442fb958
parent32d1c0a5614b9979768b3711726db3d601750ed3
tccgen: continue initialization after chained designators

For a designator chain like "[1].x[0].b = 5, 6, 7" decl_designator
walked the whole chain in one go and returned to the outermost
container, so the items following the designated one were stored in
the next element of the outermost array ([2]) instead of the next
subobject of the innermost one (x[1].a, x[1].b).

Parse only the first designator of a chain in decl_designator and
let decl_initializer handle the rest as an elided sub-list.  An
elided list now also ends when a designator follows, which belongs
to an enclosing container, e.g. "{ [1].x[0].b = 5, [0].x[1].a = 1 }".

Duplicate initialization is tracked with a new DIF_DIRTY flag, because
the nested list does not know how much of the outer one is written.

Add tests/tests2/152_designator_chain.c.
tccgen.c
tests/tests2/152_designator_chain.c [new file with mode: 0644]
tests/tests2/152_designator_chain.expect [new file with mode: 0644]