mirror of
https://github.com/netwide-assembler/nasm.git
synced 2024-11-27 08:10:07 +08:00
Display fully qualified local label in "not defined" message
Add new function "local_scope" to label subsystem to return the previous non-local label for a given local label, and invoke this funcion in eval.c to display the fully qualified name in the "not defined" error message.
This commit is contained in:
parent
aed5cfea58
commit
d60059ef41
10
eval.c
10
eval.c
@ -668,6 +668,7 @@ static expr *expr6(int critical)
|
||||
expr *e;
|
||||
int32_t label_seg;
|
||||
int64_t label_ofs;
|
||||
char *scope;
|
||||
|
||||
switch (i) {
|
||||
case '-':
|
||||
@ -783,14 +784,15 @@ static expr *expr6(int critical)
|
||||
label_ofs = in_abs_seg ? abs_offset : location->offset;
|
||||
} else {
|
||||
if (!labelfunc(tokval->t_charptr, &label_seg, &label_ofs)) {
|
||||
scope = local_scope(tokval->t_charptr);
|
||||
if (critical == 2) {
|
||||
error(ERR_NONFATAL, "symbol `%s' undefined",
|
||||
tokval->t_charptr);
|
||||
error(ERR_NONFATAL, "symbol `%s%s' undefined",
|
||||
scope,tokval->t_charptr);
|
||||
return NULL;
|
||||
} else if (critical == 1) {
|
||||
error(ERR_NONFATAL,
|
||||
"symbol `%s' not defined before use",
|
||||
tokval->t_charptr);
|
||||
"symbol `%s%s' not defined before use",
|
||||
scope,tokval->t_charptr);
|
||||
return NULL;
|
||||
} else {
|
||||
if (opflags)
|
||||
|
5
labels.c
5
labels.c
@ -443,6 +443,11 @@ static char *perm_copy(const char *string)
|
||||
return p;
|
||||
}
|
||||
|
||||
char *local_scope(char *label)
|
||||
{
|
||||
return islocal(label) ? prevlabel : "";
|
||||
}
|
||||
|
||||
/*
|
||||
* Notes regarding bug involving redefinition of external segments.
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user