1
0
mirror of https://github.com/cc65/cc65.git synced 2024-12-25 02:29:52 +00:00

Merge pull request #2074 from bbbradsmith/zp_override_not_suspicious

Explicit z: should suppress "Suspicious address expression" warning
This commit is contained in:
Bob Andrews 2023-05-03 14:09:23 +02:00 committed by GitHub
commit f3c0f7c6ce
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 1 deletions

View File

@ -43,6 +43,10 @@
/*****************************************************************************/
/* EffAddr Flags */
#define EFFADDR_OVERRIDE_ZP 0x00000001UL
/* GetEA result struct */
typedef struct EffAddr EffAddr;
@ -51,6 +55,7 @@ struct EffAddr {
unsigned long AddrModeSet; /* Possible addressing modes */
struct ExprNode* Expr; /* Expression if any (NULL otherwise) */
unsigned Reg; /* Register number in sweet16 mode */
unsigned long Flags; /* Other properties */
/* The following fields are used inside instr.c */
unsigned AddrMode; /* Actual addressing mode used */

View File

@ -72,11 +72,13 @@ void GetEA (EffAddr* A)
/* Clear the output struct */
A->AddrModeSet = 0;
A->Expr = 0;
A->Flags = 0;
/* Handle an addressing size override */
switch (CurTok.Tok) {
case TOK_OVERRIDE_ZP:
Restrictions = AM65_DIR | AM65_DIR_X | AM65_DIR_Y;
A->Flags |= EFFADDR_OVERRIDE_ZP;
NextTok ();
break;

View File

@ -1269,7 +1269,8 @@ static int EvalEA (const InsDesc* Ins, EffAddr* A)
ExprNode* Left = A->Expr->Left;
if ((A->Expr->Op == EXPR_BYTE0 || A->Expr->Op == EXPR_BYTE1) &&
Left->Op == EXPR_SYMBOL &&
GetSymAddrSize (Left->V.Sym) != ADDR_SIZE_ZP) {
GetSymAddrSize (Left->V.Sym) != ADDR_SIZE_ZP &&
!(A->Flags & EFFADDR_OVERRIDE_ZP)) {
/* Output a warning */
Warning (1, "Suspicious address expression");