ISSOtm / rgbds-structs

A macro pack adding struct-like functionality to RGBDS
MIT License
21 stars 3 forks source link

Fix version information, and use compound assignment operator #20

Closed Rangi42 closed 1 month ago

Rangi42 commented 1 month ago

The += operator was added in RGBDS 0.5.2 from November 2021 (https://github.com/gbdev/rgbds/pull/944). The REDEF = syntax it's currently using was added in RGBDS 0.5.0 from April 2021 (https://github.com/gbdev/rgbds/pull/791).

Also the parentheses-allow-commas behavior we just added in place of manually escaping \, was added in RGBDS 0.5.1 from May 2021 (https://github.com/gbdev/rgbds/pull/852). So this no longer supports 0.5.0 anyway.

ISSOtm commented 1 month ago

Should the README be updated to mention the new compat level?

Rangi42 commented 1 month ago

Oops, yes it should! Thanks.

Rangi42 commented 1 month ago

...apparently it's not compatible with 0.5.2 any more. Here's the error when running rgbasm 0.5.2 on correct.asm (after fixing its expected rgbds-structs version):

error: correct.asm(97) -> ../structs.inc::dstruct(286) -> ../structs.inc::dstruct::REPT~1(301):
    syntax error, unexpected =
while expanding symbol "        .Color1=$1E,$0A,$06"
error: correct.asm(97) -> ../structs.inc::dstruct(321) -> ../structs.inc::structs_assert(28):
    Assertion failed: rgbds-structs 4.0.0 bug. Please report at https://github.com/ISSOtm/rgbds-structs, and share the above stack trace *and* your code there!
error: Assembly aborted (2 errors)!
Rangi42 commented 1 month ago

Looks like rgbds-structs v4.0.1 broke support for rgbds 0.5.2. (That release neglected to update the STRUCTS_VERSION definition...)

The sole change in rgbds-structs v4.0.1 was this:

-        REDEF IS_NAMED_INSTANTIATION = STRIN("\3", "=")
+        DEF IS_NAMED_INSTANTIATION = !STRCMP(STRSUB("\3", 1, 1), ".") && STRIN("\3", "=")

I think the relevant change in rgbds is that 0.6.0 had "Whitespace is now trimmed in macro arguments, even after line continuations", which affects the result of that STRSUB check for a leading period.

Rangi42 commented 1 month ago

I just checked and rgbds 0.6.0 is still supported even after that structs 0.4.1 change. :)