shithub: rgbds

Download patch

ref: 75ce230dced14c4a622d20e41738474193a8817a
parent: 1d012682497e5060df257a12c2a3e3388d43e4ab
author: ISSOtm <eldredhabert0@gmail.com>
date: Sun May 2 19:57:03 EDT 2021

Make UNION-related errors non-fatal

--- a/src/asm/section.c
+++ b/src/asm/section.c
@@ -534,10 +534,14 @@
 
 void sect_StartUnion(void)
 {
-	if (!currentSection)
-		fatalerror("UNIONs must be inside a SECTION\n");
-	if (sect_HasData(currentSection->type))
-		fatalerror("Cannot use UNION inside of ROM0 or ROMX sections\n");
+	if (!currentSection) {
+		error("UNIONs must be inside a SECTION\n");
+		return;
+	}
+	if (sect_HasData(currentSection->type)) {
+		error("Cannot use UNION inside of ROM0 or ROMX sections\n");
+		return;
+	}
 	struct UnionStackEntry *entry = malloc(sizeof(*entry));
 
 	if (!entry)
@@ -559,15 +563,19 @@
 
 void sect_NextUnionMember(void)
 {
-	if (!unionStack)
-		fatalerror("Found NEXTU outside of a UNION construct\n");
+	if (!unionStack) {
+		error("Found NEXTU outside of a UNION construct\n");
+		return;
+	}
 	endUnionMember();
 }
 
 void sect_EndUnion(void)
 {
-	if (!unionStack)
-		fatalerror("Found ENDU outside of a UNION construct\n");
+	if (!unionStack) {
+		error("Found ENDU outside of a UNION construct\n");
+		return;
+	}
 	endUnionMember();
 	curOffset += unionStack->size;
 	struct UnionStackEntry *next = unionStack->next;