mirror of
https://github.com/gbdev/rgbds.git
synced 2025-11-20 18:22:07 +00:00
rgbasm: Report conflicting file/line number for duplicate sections
This commit is contained in:
@@ -22,6 +22,8 @@ struct Section {
|
|||||||
char *name;
|
char *name;
|
||||||
enum SectionType type;
|
enum SectionType type;
|
||||||
enum SectionModifier modifier;
|
enum SectionModifier modifier;
|
||||||
|
struct FileStackNode *src; /* Where the section was defined */
|
||||||
|
uint32_t fileLine; /* Line where the section was defined */
|
||||||
uint32_t size;
|
uint32_t size;
|
||||||
uint32_t org;
|
uint32_t org;
|
||||||
uint32_t bank;
|
uint32_t bank;
|
||||||
|
|||||||
@@ -230,8 +230,9 @@ static void mergeSections(struct Section *sect, enum SectionType type, uint32_t
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case SECTION_NORMAL:
|
case SECTION_NORMAL:
|
||||||
// TODO: this should report where the section was defined
|
fail("Section already defined previously at ");
|
||||||
fail("Section already defined previously\n");
|
fstk_Dump(sect->src, sect->fileLine);
|
||||||
|
putc('\n', stderr);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -325,6 +326,8 @@ static struct Section *getSection(char const *name, enum SectionType type, uint3
|
|||||||
|
|
||||||
sect->type = type;
|
sect->type = type;
|
||||||
sect->modifier = mod;
|
sect->modifier = mod;
|
||||||
|
sect->src = fstk_GetFileStack();
|
||||||
|
sect->fileLine = lexer_GetLineNo();
|
||||||
sect->size = 0;
|
sect->size = 0;
|
||||||
sect->org = org;
|
sect->org = org;
|
||||||
sect->bank = bank;
|
sect->bank = bank;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
ERROR: duplicate-section.asm(4):
|
ERROR: duplicate-section.asm(4):
|
||||||
Section already defined previously
|
Section already defined previously at duplicate-section.asm(2)
|
||||||
FATAL: duplicate-section.asm(4):
|
FATAL: duplicate-section.asm(4):
|
||||||
Cannot create section "sec" (1 error)
|
Cannot create section "sec" (1 error)
|
||||||
|
|||||||
Reference in New Issue
Block a user