From 97065faf1a8ca3906d587ef404b6395bee111f83 Mon Sep 17 00:00:00 2001 From: acqn Date: Wed, 5 Aug 2020 00:19:28 +0800 Subject: [PATCH] Disallowed struct/union types of 0 size as cc65 is not ready to support them. --- src/cc65/declare.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/cc65/declare.c b/src/cc65/declare.c index ac58948bf..636e0d61d 100644 --- a/src/cc65/declare.c +++ b/src/cc65/declare.c @@ -919,6 +919,11 @@ NextMember: if (CurTok.Tok != TOK_COMMA) { FieldTab = GetSymTab (); LeaveStructLevel (); + /* Empty union is not supported now */ + if (UnionSize == 0) { + Error ("Empty union type '%s' is not supported", Name); + } + /* Make a real entry from the forward decl and return it */ return AddStructSym (Name, SC_UNION | SC_DEF, UnionSize, FieldTab); } @@ -1101,6 +1106,11 @@ NextMember: if (CurTok.Tok != TOK_COMMA) { FieldTab = GetSymTab (); LeaveStructLevel (); + /* Empty struct is not supported now */ + if (StructSize == 0) { + Error ("Empty struct type '%s' is not supported", Name); + } + /* Make a real entry from the forward decl and return it */ return AddStructSym (Name, SC_STRUCT | SC_DEF, StructSize, FieldTab); }