From b9b134d458e5a3771c6b657da6a58354968c15a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateusz=20Go=C5=9Blinowski?= Date: Tue, 31 Dec 2024 16:08:02 +0100 Subject: [PATCH] Fix for the GHCJS_BROWSER compilation flag of GHC JavaScript backend. Refer to: https://gitlab.haskell.org/ghc/ghc/-/issues/25613#note_602330 --- jsbits/time.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/jsbits/time.js b/jsbits/time.js index e53c9a1..d8582eb 100644 --- a/jsbits/time.js +++ b/jsbits/time.js @@ -1,4 +1,9 @@ +//#OPTIONS: CPP + function h$js_futimes(fd,atime,mtime) { +#ifdef GHCJS_BROWSER + throw "h$js_futimes unsupported"; +#else if (!h$isNode()) { throw "h$js_futimes unsupported"; } @@ -9,9 +14,13 @@ function h$js_futimes(fd,atime,mtime) { return -1; } return 0; +#endif } function h$js_utimes(path,path_offset,atime,mtime) { +#ifdef GHCJS_BROWSER + throw "h$js_utimes unsupported"; +#else if (!h$isNode()) { throw "h$js_utimes unsupported"; } @@ -23,9 +32,13 @@ function h$js_utimes(path,path_offset,atime,mtime) { return -1; } return 0; +#endif } function h$js_lutimes(path,path_offset,atime,mtime) { +#ifdef GHCJS_BROWSER + throw "h$js_lutimes unsupported"; +#else if (!h$isNode()) { throw "h$js_lutimes unsupported"; } @@ -37,5 +50,6 @@ function h$js_lutimes(path,path_offset,atime,mtime) { return -1; } return 0; +#endif }