Skip to content

Commit 447c7c6

Browse files
committed
Added warning for rep without @
1 parent 4357350 commit 447c7c6

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

backends/dat/outdat.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1544,6 +1544,16 @@ AssembleInstruction(Flexbuf *f, AST *ast, Flexbuf *relocs)
15441544
operand[0] = AstInteger(count);
15451545
opimm[0] = P2_IMM_DST;
15461546
immmask |= P2_IMM_DST;
1547+
} else if (IsIdentifier(operand[0])) {
1548+
const char *internal_name = GetIdentifierName(operand[0]);
1549+
const char *user_name = GetUserIdentifierName(operand[0]);
1550+
Symbol *sym = LookupSymbol(internal_name);
1551+
if (sym && sym->kind == SYM_LABEL) {
1552+
Label *lab = (Label *)sym->v.ptr;
1553+
if (lab && (lab->flags & LABEL_HAS_INSTR)) {
1554+
WARNING(line, "%s to %s without @; are you sure this is correct? If so, change the first operand to %s-0 to suppress this warning", instr->name, user_name, user_name);
1555+
}
1556+
}
15471557
}
15481558
}
15491559
// fall through

0 commit comments

Comments
 (0)