diff options
author | Sylvain Henry <sylvain@haskus.fr> | 2023-05-12 11:50:43 +0200 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2023-05-15 14:50:07 -0400 |
commit | 2f571afe1c2aeb3f4dfca2012bc6b713144fd234 (patch) | |
tree | 5e564313858d57f18b8e8469fe60a212697b9cd6 | |
parent | 5ae81842d36a6091b406bfce98c60e8a7fa24240 (diff) | |
download | haskell-2f571afe1c2aeb3f4dfca2012bc6b713144fd234.tar.gz |
Fix GHCJS OS platform (fix #23346)
-rw-r--r-- | compiler/GHC/Platform.hs | 1 | ||||
-rw-r--r-- | libraries/ghc-boot/GHC/Platform/ArchOS.hs | 2 | ||||
-rw-r--r-- | m4/fptools_set_haskell_platform_vars.m4 | 2 | ||||
-rw-r--r-- | testsuite/tests/javascript/T23346.hs | 18 | ||||
-rw-r--r-- | testsuite/tests/javascript/T23346.stdout | 1 | ||||
-rw-r--r-- | testsuite/tests/javascript/all.T | 2 |
6 files changed, 25 insertions, 1 deletions
diff --git a/compiler/GHC/Platform.hs b/compiler/GHC/Platform.hs index 6ea05b30a3..a5a609d252 100644 --- a/compiler/GHC/Platform.hs +++ b/compiler/GHC/Platform.hs @@ -208,6 +208,7 @@ osElfTarget OSQNXNTO = False osElfTarget OSAIX = False osElfTarget OSHurd = True osElfTarget OSWasi = False +osElfTarget OSGhcjs = False osElfTarget OSUnknown = False -- Defaulting to False is safe; it means don't rely on any -- ELF-specific functionality. It is important to have a default for diff --git a/libraries/ghc-boot/GHC/Platform/ArchOS.hs b/libraries/ghc-boot/GHC/Platform/ArchOS.hs index 26a319ba13..4aa42baa3b 100644 --- a/libraries/ghc-boot/GHC/Platform/ArchOS.hs +++ b/libraries/ghc-boot/GHC/Platform/ArchOS.hs @@ -98,6 +98,7 @@ data OS | OSAIX | OSHurd | OSWasi + | OSGhcjs deriving (Read, Show, Eq, Ord) @@ -157,3 +158,4 @@ stringEncodeOS = \case OSAIX -> "aix" OSHurd -> "hurd" OSWasi -> "wasi" + OSGhcjs -> "ghcjs" diff --git a/m4/fptools_set_haskell_platform_vars.m4 b/m4/fptools_set_haskell_platform_vars.m4 index 2afb21e247..9c0c5e052b 100644 --- a/m4/fptools_set_haskell_platform_vars.m4 +++ b/m4/fptools_set_haskell_platform_vars.m4 @@ -119,7 +119,7 @@ AC_DEFUN([FPTOOLS_SET_HASKELL_PLATFORM_VARS_SHELL_FUNCTIONS], test -z "[$]2" || eval "[$]2=OSHurd" ;; ghcjs|js) - test -z "[$]2" || eval "[$]2=OSUnknown" + test -z "[$]2" || eval "[$]2=OSGhcjs" ;; *) echo "Unknown OS '[$]1'" diff --git a/testsuite/tests/javascript/T23346.hs b/testsuite/tests/javascript/T23346.hs new file mode 100644 index 0000000000..60fb2b8847 --- /dev/null +++ b/testsuite/tests/javascript/T23346.hs @@ -0,0 +1,18 @@ +{-# LANGUAGE CPP #-} + +module Main where + +main :: IO () +main = print (correct_host && correct_arch) + +#ifdef ghcjs_HOST_OS +correct_host = True +#else +correct_host = False +#endif + +#ifdef javascript_HOST_ARCH +correct_arch = True +#else +correct_arch = False +#endif diff --git a/testsuite/tests/javascript/T23346.stdout b/testsuite/tests/javascript/T23346.stdout new file mode 100644 index 0000000000..0ca95142bb --- /dev/null +++ b/testsuite/tests/javascript/T23346.stdout @@ -0,0 +1 @@ +True diff --git a/testsuite/tests/javascript/all.T b/testsuite/tests/javascript/all.T index 3da7759da5..ff6b57a076 100644 --- a/testsuite/tests/javascript/all.T +++ b/testsuite/tests/javascript/all.T @@ -15,3 +15,5 @@ test('js-callback02', normal, compile_and_run, ['']) test('js-callback03', normal, compile_and_run, ['']) test('js-callback04', js_skip, compile_and_run, ['']) test('js-callback05', js_skip, compile_and_run, ['']) + +test('T23346', normal, compile_and_run, ['']) |