From 39250629bdeeaa1bb13ca75958ff2a7c5d13e660 Mon Sep 17 00:00:00 2001 From: Stephen Heumann Date: Mon, 28 Nov 2022 20:55:47 -0600 Subject: [PATCH] Support designated initialization of anonymous member fields. As noted previously, there is some ambiguity in the standards about how anonymous structs/unions participate in initialization. ORCA/C follows the model that they do participate as structs or unions, and designated initialization of them is implemented accordingly. This currently has a slight issue in that extra copies of the anonymous member field name will be printed in #pragma expand output. --- Parser.pas | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/Parser.pas b/Parser.pas index 57d5557..a1b8c5f 100644 --- a/Parser.pas +++ b/Parser.pas @@ -2627,8 +2627,15 @@ var ip := ip^.next; if ip = nil then Error(81); - NextToken; - {TODO if ip is an anonymous member field ...} + if ip^.anonMemberField then begin + PutBackToken(token, false); + token.kind := dotch; + token.class := reservedSymbol; + token.isDigraph := false; + ip := ip^.anonMember; + end {if} + else + NextToken; if token.kind in [dotch,lbrackch] then hasNestedDesignator := true else