mirror of
https://github.com/netwide-assembler/nasm
synced 2026-08-26 16:23:04 -04:00
parser: add the actual name of a label to the label-orphan warning
The label-orphan warning is *way* more useful if it includes the actual label name; this way the programmer can usually spot immediately if it is a label or misspelled instruction. Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
This commit is contained in:
parent
d66187c1de
commit
6df250aee3
5 changed files with 8 additions and 6 deletions
|
|
@ -746,6 +746,7 @@ restart_parse:
|
|||
|
||||
if (i == TOKEN_ID || (insn_is_label && i == TOKEN_INSN)) {
|
||||
/* there's a label here */
|
||||
struct tokenval label = tokval;
|
||||
first = false;
|
||||
result->label = tokval.t_charptr;
|
||||
i = stdscan(NULL, &tokval);
|
||||
|
|
@ -753,8 +754,9 @@ restart_parse:
|
|||
if (i == ':') { /* skip over the optional colon */
|
||||
i = stdscan(NULL, &tokval);
|
||||
} else if (i == 0) {
|
||||
nasm_warn(WARN_LABEL_ORPHAN ,
|
||||
"label alone on a line without a colon might be in error");
|
||||
nasm_warn(WARN_LABEL_ORPHAN,
|
||||
"label `%*s' alone on a line without a colon might be in error",
|
||||
(int)label.t_len, label.t_start);
|
||||
}
|
||||
if (i != TOKEN_INSN || tokval.t_integer != I_EQU) {
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
./travis/test/aoutso.asm:79: warning: label alone on a line without a colon might be in error [-w+label-orphan]
|
||||
./travis/test/aoutso.asm:79: warning: label `.end' alone on a line without a colon might be in error [-w+label-orphan]
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
./travis/test/elfso.asm:83: warning: label alone on a line without a colon might be in error [-w+label-orphan]
|
||||
./travis/test/elfso.asm:83: warning: label `.end' alone on a line without a colon might be in error [-w+label-orphan]
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
./travis/test/elfso.asm:83: warning: label alone on a line without a colon might be in error [-w+label-orphan]
|
||||
./travis/test/elfso.asm:83: warning: label `.end' alone on a line without a colon might be in error [-w+label-orphan]
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
./travis/test/tmap.asm:938: warning: label alone on a line without a colon might be in error [-w+label-orphan]
|
||||
./travis/test/tmap.asm:938: warning: label `.loop' alone on a line without a colon might be in error [-w+label-orphan]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue