From 2259ef626df697b2959057f78e6990071ccfc419 Mon Sep 17 00:00:00 2001 From: "Darryl L. Miles" Date: Fri, 3 Oct 2025 23:25:45 +0100 Subject: [PATCH] SimRsim.c: EMSCRIPTEN fix for select/fd_set The compiler has started to error on casting int* to fd_set* Since WASM build has presense of fd_set then the ifdef have been switched away from the legacy (pre 2000) method. --- sim/SimRsim.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sim/SimRsim.c b/sim/SimRsim.c index f06cc1cf..653db1bf 100644 --- a/sim/SimRsim.c +++ b/sim/SimRsim.c @@ -629,7 +629,7 @@ SimFillBuffer( int charsRead = 0; char *temp; int n, nfd; -#if defined(SYSV) || defined(CYGWIN) || defined(__FreeBSD__) || defined(__APPLE__) +#if defined(SYSV) || defined(CYGWIN) || defined(__FreeBSD__) || defined(__APPLE__) || defined(EMSCRIPTEN) fd_set readfds, writefds, exceptfds; #else int nr, nex; @@ -645,7 +645,7 @@ SimFillBuffer( /* read reply from Rsim */ -#if defined(SYSV) || defined(CYGWIN) || defined(__FreeBSD__) || defined(__APPLE__) +#if defined(SYSV) || defined(CYGWIN) || defined(__FreeBSD__) || defined(__APPLE__) || defined(EMSCRIPTEN) FD_ZERO(&readfds); FD_ZERO(&exceptfds); #endif /* SYSV */ @@ -661,7 +661,7 @@ SimFillBuffer( try_again: -#if defined(SYSV) || defined(CYGWIN) || defined(__FreeBSD__) || defined(__APPLE__) +#if defined(SYSV) || defined(CYGWIN) || defined(__FreeBSD__) || defined(__APPLE__) || defined(EMSCRIPTEN) FD_SET(pipeIn, &readfds); FD_ZERO(&writefds); FD_SET(pipeIn, &exceptfds); @@ -669,7 +669,7 @@ try_again: #else /* !SYSV */ nr = nex = 1 << pipeIn; - n = select(nfd, &nr, (int *) NULL, &nex, &timeout); + n = select(nfd, &nr, NULL, &nex, &timeout); #endif