From 9127774a4d0762d35ec0a9a9e00b662126a8de3c Mon Sep 17 00:00:00 2001 From: uz Date: Tue, 5 Aug 2008 21:11:26 +0000 Subject: [PATCH] Pass a complete ExprDesc and not just the Flags field to GlobalModeFlags to allow for better debugging (output) in case of problems. git-svn-id: svn://svn.cc65.org/cc65/trunk@3879 b7a2c559-68d2-44c3-8de9-860c34a00d81 --- src/cc65/expr.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/cc65/expr.c b/src/cc65/expr.c index e7537aca8..9a803848c 100644 --- a/src/cc65/expr.c +++ b/src/cc65/expr.c @@ -76,15 +76,15 @@ static GenDesc GenOASGN = { TOK_OR_ASSIGN, GEN_NOPUSH, g_or }; -static unsigned GlobalModeFlags (unsigned Flags) -/* Return the addressing mode flags for the variable with the given flags */ +static unsigned GlobalModeFlags (const ExprDesc* Expr) +/* Return the addressing mode flags for the given expression */ { - switch (Flags & E_MASK_LOC) { + switch (ED_GetLoc (Expr)) { case E_LOC_GLOBAL: return CF_EXTERNAL; case E_LOC_STATIC: return CF_STATIC; case E_LOC_REGISTER: return CF_REGVAR; default: - Internal ("GlobalModeFlags: Invalid flags value: %u", Flags); + Internal ("GlobalModeFlags: Invalid location flags value: 0x%04X", Expr->Flags); /* NOTREACHED */ return 0; } @@ -975,7 +975,7 @@ static void ArrayRef (ExprDesc* Expr) if (ED_IsLocStack (&SubScript)) { g_addlocal (Flags, SubScript.IVal); } else { - Flags |= GlobalModeFlags (SubScript.Flags); + Flags |= GlobalModeFlags (&SubScript); g_addstatic (Flags, SubScript.Name, SubScript.IVal); } } else { @@ -992,7 +992,7 @@ static void ArrayRef (ExprDesc* Expr) } } else { /* Base address is a static variable address */ - unsigned Flags = CF_INT | GlobalModeFlags (Expr->Flags); + unsigned Flags = CF_INT | GlobalModeFlags (Expr); if (ED_IsRVal (Expr)) { /* Add the address of the location */ g_addaddr_static (Flags, Expr->Name, Expr->IVal); @@ -1982,7 +1982,7 @@ static void parseadd (ExprDesc* Expr) flags |= CF_CONST; } else { /* Constant address label */ - flags |= GlobalModeFlags (Expr->Flags) | CF_CONSTADDR; + flags |= GlobalModeFlags (Expr) | CF_CONSTADDR; } /* Check for pointer arithmetic */