From c0a873e0c8198a1c0111e766f15e028a527c01bb Mon Sep 17 00:00:00 2001 From: acqn Date: Thu, 27 Aug 2020 08:02:05 +0800 Subject: [PATCH] Reduced exess errors on wrong initializations with curly braces. --- src/cc65/expr.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/cc65/expr.c b/src/cc65/expr.c index 89c7ff108..75d695623 100644 --- a/src/cc65/expr.c +++ b/src/cc65/expr.c @@ -959,7 +959,16 @@ static void Primary (ExprDesc* E) /* Illegal primary. Be sure to skip the token to avoid endless ** error loops. */ - { + if (CurTok.Tok == TOK_LCURLY) { + /* Statement block */ + NextToken (); + Error ("Expression expected"); + hie0 (E); + if (CurTok.Tok == TOK_RCURLY) { + NextToken (); + } + break; + } else { /* Let's see if this is a C99-style declaration */ DeclSpec Spec; InitDeclSpec (&Spec);