shithub: rgbds

Download patch

ref: 714d39c86ff4115f9d1a413bfd0ef41bc5f6353f
parent: f11241c2aea6d1ca5b2825786e0458a1aa7f3008
author: ISSOtm <eldredhabert0@gmail.com>
date: Tue Mar 9 19:52:40 EST 2021

Make some INCBIN errors non-fatal

--- a/src/asm/section.c
+++ b/src/asm/section.c
@@ -764,7 +764,8 @@
 			oFailedOnMissingInclude = true;
 			return;
 		}
-		fatalerror("Error opening INCBIN file '%s': %s\n", s, strerror(errno));
+		error("Error opening INCBIN file '%s': %s\n", s, strerror(errno));
+		return;
 	}
 
 	int32_t fsize = -1;
@@ -830,7 +831,8 @@
 			oFailedOnMissingInclude = true;
 			return;
 		}
-		fatalerror("Error opening INCBIN file '%s': %s\n", s, strerror(errno));
+		error("Error opening INCBIN file '%s': %s\n", s, strerror(errno));
+		return;
 	}
 
 	checkcodesection();
@@ -846,8 +848,11 @@
 			return;
 		}
 
-		if ((start_pos + length) > fsize)
-			fatalerror("Specified range in INCBIN is out of bounds\n");
+		if ((start_pos + length) > fsize) {
+			error("Specified range in INCBIN is out of bounds (%" PRIu32 " + %" PRIu32
+			      " > %" PRIu32 ")\n", start_pos, length, fsize);
+			return;
+		}
 
 		fseek(f, start_pos, SEEK_SET);
 	} else {
--- a/test/asm/incbin-empty-bad.err
+++ b/test/asm/incbin-empty-bad.err
@@ -1,2 +1,3 @@
-FATAL: incbin-empty-bad.asm(3):
-    Specified range in INCBIN is out of bounds
+ERROR: incbin-empty-bad.asm(3):
+    Specified range in INCBIN is out of bounds (0 + 1 > 0)
+error: Assembly aborted (1 errors)!
--- a/test/asm/incbin-end-bad.err
+++ b/test/asm/incbin-end-bad.err
@@ -1,2 +1,3 @@
-FATAL: incbin-end-bad.asm(3):
-    Specified range in INCBIN is out of bounds
+ERROR: incbin-end-bad.asm(3):
+    Specified range in INCBIN is out of bounds (123 + 1 > 123)
+error: Assembly aborted (1 errors)!