From bde5be67933e247a6362de21e011c7f4147fbea6 Mon Sep 17 00:00:00 2001 From: acqn Date: Sun, 9 Aug 2020 06:25:36 +0800 Subject: [PATCH] Improved error message on initializing extern variables inside functions. --- src/cc65/locals.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/cc65/locals.c b/src/cc65/locals.c index 6b4c13fce..de2074211 100644 --- a/src/cc65/locals.c +++ b/src/cc65/locals.c @@ -493,7 +493,10 @@ static void ParseOneDecl (const DeclSpec* Spec) if ((Decl.StorageClass & SC_EXTERN) == SC_EXTERN) { /* External identifier - may not get initialized */ if (CurTok.Tok == TOK_ASSIGN) { - Error ("Cannot initialize externals"); + Error ("Cannot initialize extern variable '%s'", Decl.Ident); + /* Avoid excess errors */ + NextToken (); + ParseInit (Decl.Type); } }