shithub: rgbds

Download patch

ref: 23effcc3f0121f384d9addc50f539ed36b092fa2
parent: ea0c5581a5598bbea541de1d569c5851a90544d0
author: ISSOtm <[email protected]>
date: Tue Mar 10 20:03:19 EDT 2020

Fix error messages in `sym_GetConstantValue`

--- a/include/asm/symbol.h
+++ b/include/asm/symbol.h
@@ -77,7 +77,7 @@
 
 int32_t sym_GetValue(struct sSymbol const *sym);
 uint32_t sym_CalcHash(const char *s);
-void sym_SetExportAll(uint8_t set);
+void sym_SetExportAll(bool set);
 struct sSymbol *sym_AddLocalReloc(char const *tzSym);
 struct sSymbol *sym_AddReloc(char const *tzSym);
 void sym_Export(char const *tzSym);
--- a/src/asm/symbol.c
+++ b/src/asm/symbol.c
@@ -279,11 +279,11 @@
 		if (sym_IsConstant(psym))
 			return sym_GetValue(psym);
 
-		fatalerror("\"%s\" does not have a constant value", s);
+		yyerror("\"%s\" does not have a constant value", s);
+	} else {
+		yyerror("'%s' not defined", s);
 	}
 
-	yyerror("'%s' not defined", s);
-
 	return 0;
 }
 
@@ -706,7 +706,7 @@
 /*
  * Set whether to export all relocatable symbols by default
  */
-void sym_SetExportAll(uint8_t set)
+void sym_SetExportAll(bool set)
 {
 	exportall = set;
 }
--- a/test/asm/bracketed-symbols.asm
+++ b/test/asm/bracketed-symbols.asm
@@ -18,3 +18,4 @@
 SECTION "Test", ROM0
 Label:
 PRINTT "{x:Label}\n"
+PRINTT "{x:@}\n"
--- a/test/asm/bracketed-symbols.err
+++ b/test/asm/bracketed-symbols.err
@@ -2,3 +2,6 @@
     Print types are only allowed for numbers
 ERROR: bracketed-symbols.asm(20):
     "Label" does not have a constant value
+ERROR: bracketed-symbols.asm(21):
+    Expected constant PC but section is not fixed
+error: Assembly aborted (3 errors)!
--- a/test/asm/bracketed-symbols.out
+++ b/test/asm/bracketed-symbols.out
@@ -6,3 +6,5 @@
 10100111001
 0
 You can't format me!
+0
+0