mirror of
https://github.com/gbdev/rgbds.git
synced 2025-11-20 18:22:07 +00:00
Fix passing constant label to BANK() causing an error
This commit is contained in:
@@ -42,8 +42,8 @@ void rpn_HIGH(struct Expression *expr, const struct Expression *src);
|
|||||||
void rpn_LOW(struct Expression *expr, const struct Expression *src);
|
void rpn_LOW(struct Expression *expr, const struct Expression *src);
|
||||||
void rpn_UNNEG(struct Expression *expr, const struct Expression *src);
|
void rpn_UNNEG(struct Expression *expr, const struct Expression *src);
|
||||||
void rpn_UNNOT(struct Expression *expr, const struct Expression *src);
|
void rpn_UNNOT(struct Expression *expr, const struct Expression *src);
|
||||||
void rpn_BankSymbol(struct Expression *expr, char *tzSym);
|
void rpn_BankSymbol(struct Expression *expr, char const *tzSym);
|
||||||
void rpn_BankSection(struct Expression *expr, char *tzSectionName);
|
void rpn_BankSection(struct Expression *expr, char const *tzSectionName);
|
||||||
void rpn_BankSelf(struct Expression *expr);
|
void rpn_BankSelf(struct Expression *expr);
|
||||||
void rpn_Init(struct Expression *expr);
|
void rpn_Init(struct Expression *expr);
|
||||||
void rpn_Free(struct Expression *expr);
|
void rpn_Free(struct Expression *expr);
|
||||||
|
|||||||
@@ -59,10 +59,14 @@ static inline bool sym_IsNumeric(struct sSymbol const *sym)
|
|||||||
|| sym->type == SYM_SET;
|
|| sym->type == SYM_SET;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline bool sym_IsLabel(struct sSymbol const *sym)
|
||||||
|
{
|
||||||
|
return sym->type == SYM_LABEL || sym->type == SYM_REF;
|
||||||
|
}
|
||||||
|
|
||||||
static inline bool sym_IsLocal(struct sSymbol const *sym)
|
static inline bool sym_IsLocal(struct sSymbol const *sym)
|
||||||
{
|
{
|
||||||
return (sym->type == SYM_LABEL || sym->type == SYM_REF)
|
return sym_IsLabel(sym) && strchr(sym->tzName, '.');
|
||||||
&& strchr(sym->tzName, '.');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline bool sym_IsExported(struct sSymbol const *sym)
|
static inline bool sym_IsExported(struct sSymbol const *sym)
|
||||||
|
|||||||
@@ -165,7 +165,7 @@ void rpn_BankSelf(struct Expression *expr)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void rpn_BankSymbol(struct Expression *expr, char *tzSym)
|
void rpn_BankSymbol(struct Expression *expr, char const *tzSym)
|
||||||
{
|
{
|
||||||
struct sSymbol const *sym = sym_FindSymbol(tzSym);
|
struct sSymbol const *sym = sym_FindSymbol(tzSym);
|
||||||
|
|
||||||
@@ -176,7 +176,7 @@ void rpn_BankSymbol(struct Expression *expr, char *tzSym)
|
|||||||
}
|
}
|
||||||
|
|
||||||
rpn_Init(expr);
|
rpn_Init(expr);
|
||||||
if (sym && sym_IsConstant(sym)) {
|
if (sym && !sym_IsLabel(sym)) {
|
||||||
yyerror("BANK argument must be a relocatable identifier");
|
yyerror("BANK argument must be a relocatable identifier");
|
||||||
} else {
|
} else {
|
||||||
sym_Ref(tzSym);
|
sym_Ref(tzSym);
|
||||||
@@ -198,7 +198,7 @@ void rpn_BankSymbol(struct Expression *expr, char *tzSym)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void rpn_BankSection(struct Expression *expr, char *tzSectionName)
|
void rpn_BankSection(struct Expression *expr, char const *tzSectionName)
|
||||||
{
|
{
|
||||||
rpn_Init(expr);
|
rpn_Init(expr);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user