mirror of
https://github.com/gbdev/rgbds.git
synced 2025-11-20 18:22:07 +00:00
Prevent passing assertions that RGBASM passed to RGBLINK
This commit is contained in:
@@ -814,7 +814,11 @@ assert_type : /* empty */ { $$ = ASSERT_ERROR; }
|
||||
|
||||
assert : T_POP_ASSERT assert_type relocexpr
|
||||
{
|
||||
if (rpn_isKnown(&$3) && $3.nVal == 0) {
|
||||
if (!rpn_isKnown(&$3)) {
|
||||
if (!out_CreateAssert($2, &$3, ""))
|
||||
yyerror("Assertion creation failed: %s",
|
||||
strerror(errno));
|
||||
} else if ($3.nVal == 0) {
|
||||
switch ($2) {
|
||||
case ASSERT_FATAL:
|
||||
fatalerror("Assertion failed");
|
||||
@@ -826,16 +830,16 @@ assert : T_POP_ASSERT assert_type relocexpr
|
||||
"Assertion failed");
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
if (!out_CreateAssert($2, &$3, ""))
|
||||
yyerror("Assertion creation failed: %s",
|
||||
strerror(errno));
|
||||
}
|
||||
rpn_Free(&$3);
|
||||
}
|
||||
| T_POP_ASSERT assert_type relocexpr ',' string
|
||||
{
|
||||
if (rpn_isKnown(&$3) && $3.nVal == 0) {
|
||||
if (!rpn_isKnown(&$3)) {
|
||||
if (!out_CreateAssert($2, &$3, $5))
|
||||
yyerror("Assertion creation failed: %s",
|
||||
strerror(errno));
|
||||
} else if ($3.nVal == 0) {
|
||||
switch ($2) {
|
||||
case ASSERT_FATAL:
|
||||
fatalerror("Assertion failed: %s",
|
||||
@@ -850,10 +854,6 @@ assert : T_POP_ASSERT assert_type relocexpr
|
||||
$5);
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
if (!out_CreateAssert($2, &$3, $5))
|
||||
yyerror("Assertion creation failed: %s",
|
||||
strerror(errno));
|
||||
}
|
||||
rpn_Free(&$3);
|
||||
}
|
||||
|
||||
7
test/asm/assert-const.asm
Normal file
7
test/asm/assert-const.asm
Normal file
@@ -0,0 +1,7 @@
|
||||
; The following link-time assertion is known by RGBASM to be okay.
|
||||
; This previously caused it to still pass the assertion to RGBLINK with an empty
|
||||
; RPN expression
|
||||
|
||||
SECTION "rgbasm passing asserts", ROM0[0]
|
||||
db 0
|
||||
assert @
|
||||
0
test/asm/assert-const.err
Normal file
0
test/asm/assert-const.err
Normal file
0
test/asm/assert-const.out
Normal file
0
test/asm/assert-const.out
Normal file
BIN
test/asm/assert-const.out.bin
Normal file
BIN
test/asm/assert-const.out.bin
Normal file
Binary file not shown.
Reference in New Issue
Block a user