ref: 4e2a035838630e736111af8235370e12e51a6170
parent: df25fa73af3033d58a33e892d279862434a2c6af
author: Antonio Niño Díaz <[email protected]>
date: Sun Jul 9 11:09:03 EDT 2017
Print location of definition of redefined symbols When trying to define a symbol with a name that is used by another one, print the location of the first definition in the error message. Signed-off-by: Antonio Niño Díaz <[email protected]>
--- a/src/asm/symbol.c
+++ b/src/asm/symbol.c
@@ -521,7 +521,8 @@
if ((nsym = findsymbol(tzSym, NULL)) != NULL) {
if (nsym->nType & SYMF_DEFINED) {
- yyerror("'%s' already defined", tzSym);
+ yyerror("'%s' already defined in %s(%d)",
+ tzSym, nsym->tzFileName, nsym->nFileLine);
}
} else
nsym = createsymbol(tzSym);
@@ -553,7 +554,8 @@
if ((nsym = findsymbol(tzSym, NULL)) != NULL) {
if (nsym->nType & SYMF_DEFINED) {
- yyerror("'%s' already defined", tzSym);
+ yyerror("'%s' already defined in %s(%d)",
+ tzSym, nsym->tzFileName, nsym->nFileLine);
}
} else
nsym = createsymbol(tzSym);
@@ -656,7 +658,8 @@
if ((nsym = findsymbol(tzSym, scope)) != NULL) {
if (nsym->nType & SYMF_DEFINED) {
- yyerror("'%s' already defined", tzSym);
+ yyerror("'%s' already defined in %s(%d)",
+ tzSym, nsym->tzFileName, nsym->nFileLine);
}
} else
nsym = createsymbol(tzSym);
@@ -785,7 +788,8 @@
if ((nsym = findsymbol(tzSym, NULL)) != NULL) {
if (nsym->nType & SYMF_DEFINED) {
- yyerror("'%s' already defined", tzSym);
+ yyerror("'%s' already defined in %s(%d)",
+ tzSym, nsym->tzFileName, nsym->nFileLine);
}
} else
nsym = createsymbol(tzSym);