From 4dfc1a5ded78e4c2b75e3bf34d3f6ae749ecd5a2 Mon Sep 17 00:00:00 2001 From: acqn Date: Mon, 10 Aug 2020 09:32:47 +0800 Subject: [PATCH] Using a dedicated SC_FICTITIOUS flag in case of parsing errors. --- src/cc65/compile.c | 2 +- src/cc65/declare.c | 2 +- src/cc65/locals.c | 2 +- src/cc65/symentry.h | 1 + 4 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/cc65/compile.c b/src/cc65/compile.c index d045473ff..6c881d9a8 100644 --- a/src/cc65/compile.c +++ b/src/cc65/compile.c @@ -148,7 +148,7 @@ static void Parse (void) break; } - if ((Decl.StorageClass & SC_ALIAS) == SC_ALIAS) { + if ((Decl.StorageClass & SC_FICTITIOUS) == SC_FICTITIOUS) { /* Failed parsing */ goto SkipOneDecl; } diff --git a/src/cc65/declare.c b/src/cc65/declare.c index 9539a09b6..ac58948bf 100644 --- a/src/cc65/declare.c +++ b/src/cc65/declare.c @@ -1907,7 +1907,7 @@ void ParseDecl (const DeclSpec* Spec, Declaration* D, declmode_t Mode) if (PrevErrorCount != ErrorCount) { /* Don't give storage if the declaration is not parsed correctly */ - D->StorageClass |= SC_DECL | SC_ALIAS; + D->StorageClass |= SC_DECL | SC_FICTITIOUS; } } } diff --git a/src/cc65/locals.c b/src/cc65/locals.c index de2074211..12caa7aa2 100644 --- a/src/cc65/locals.c +++ b/src/cc65/locals.c @@ -455,7 +455,7 @@ static void ParseOneDecl (const DeclSpec* Spec) } /* If the symbol is not marked as external, it will be defined now */ - if ((Decl.StorageClass & SC_ALIAS) == 0 && + if ((Decl.StorageClass & SC_FICTITIOUS) == 0 && (Decl.StorageClass & SC_EXTERN) == 0) { Decl.StorageClass |= SC_DEF; } diff --git a/src/cc65/symentry.h b/src/cc65/symentry.h index 1d8af3f50..cfc6379d3 100644 --- a/src/cc65/symentry.h +++ b/src/cc65/symentry.h @@ -106,6 +106,7 @@ struct CodeEntry; #define SC_GOTO_IND 0x800000U /* Indirect goto */ #define SC_ALIAS 0x01000000U /* Alias of anonymous field */ +#define SC_FICTITIOUS 0x02000000U /* Symbol is fictitious */