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
3 changed files with 12 additions and 4 deletions
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.
|
||||
*
|
||||
|
|
1
labels.h
1
labels.h
|
@ -25,5 +25,6 @@ void define_common(char *label, int32_t segment, int32_t size, char *special,
|
|||
void declare_as_global(char *label, char *special, efunc error);
|
||||
int init_labels(void);
|
||||
void cleanup_labels(void);
|
||||
char *local_scope(char *label);
|
||||
|
||||
#endif /* LABELS_H */
|
||||
|
|
Loading…
Reference in a new issue