emulators/spim: fix incorrect version comparisons, PR 57056 from "VMS"

It seems the lexer logic was checking the flex version with #if to
perform undocumented/unsupported frobs of the generated scanner's
internal state, but it had the version test wrong and so would have
been failing since flex's last minor version bump. The consequences
are apparently an infinite loop.

With the fix it no longer loops, but it still doesn't pass its own
very basic tests. It also uses its own builtin assembler (hence flex)
with nonstandard syntax (looks like also nonstandard semantics) and
who knows what else, so you're probably better off looking for a
different emulator.
This commit is contained in:
dholland 2023-05-09 20:43:22 +00:00
parent 824606e320
commit ab62bf4cdc
3 changed files with 19 additions and 3 deletions

View file

@ -1,7 +1,7 @@
# $NetBSD: Makefile,v 1.46 2020/03/20 11:57:36 nia Exp $
# $NetBSD: Makefile,v 1.47 2023/05/09 20:43:22 dholland Exp $
DISTNAME= spim-8.0
PKGREVISION= 1
PKGREVISION= 2
CATEGORIES= emulators
MASTER_SITES= http://pages.cs.wisc.edu/~larus/SPIM/

View file

@ -1,7 +1,8 @@
$NetBSD: distinfo,v 1.16 2021/10/26 10:24:01 nia Exp $
$NetBSD: distinfo,v 1.17 2023/05/09 20:43:22 dholland Exp $
BLAKE2s (spim-8.0.tar.gz) = 9a5373bce04ded172e0e063a9ebbcc870977fee6a6c3121de202777b72ff48c7
SHA512 (spim-8.0.tar.gz) = c4eb66863a931b74d6c6ecd92860d16fd6369c85caecba1e71a1149e73e708502d1070f17a9beb6d0af1368db1ee5a85c040b596866a1236275cdd410a661adf
Size (spim-8.0.tar.gz) = 355204 bytes
SHA1 (patch-aa) = 8232ff358f1bf2ede3216187faf77aad85b1da87
SHA1 (patch-ad) = 056ef015de5daff3003a834ff4867f97db70c79f
SHA1 (patch-scanner.l) = 51e1c1b5e3c0db28d3fa0790729ddfa836631e2d

View file

@ -0,0 +1,15 @@
$NetBSD: patch-scanner.l,v 1.1 2023/05/09 20:43:22 dholland Exp $
Use correct version comparison logic.
--- CPU/scanner.l~ 2010-01-09 05:22:52.000000000 +0000
+++ CPU/scanner.l
@@ -316,7 +316,7 @@ initialize_scanner (FILE *in_file)
yyin = in_file;
#ifdef FLEX_SCANNER
yyrestart(in_file);
-#if (YY_FLEX_MAJOR_VERSION==2 && YY_FLEX_MINOR_VERSION==5 && YY_FLEX_SUBMINOR_VERSION>=33)
+#if (YY_FLEX_MAJOR_VERSION==2 && YY_FLEX_MINOR_VERSION==5 && YY_FLEX_SUBMINOR_VERSION>=33) || (YY_FLEX_MAJOR_VERSION==2 && YY_FLEX_MINOR_VERSION>5)
/* flex 2.5.33 flipped the polarity of this flag (sigh) */
yy_init = 0;
#else