[Git][ghc/ghc][master] Fix GHCJS OS platform (fix #23346)

Marge Bot (@marge-bot) gitlab at gitlab.haskell.org
Mon May 15 18:50:26 UTC 2023



Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC


Commits:
2f571afe by Sylvain Henry at 2023-05-15T14:50:07-04:00
Fix GHCJS OS platform (fix #23346)

- - - - -


6 changed files:

- compiler/GHC/Platform.hs
- libraries/ghc-boot/GHC/Platform/ArchOS.hs
- m4/fptools_set_haskell_platform_vars.m4
- + testsuite/tests/javascript/T23346.hs
- + testsuite/tests/javascript/T23346.stdout
- testsuite/tests/javascript/all.T


Changes:

=====================================
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


=====================================
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"


=====================================
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'"


=====================================
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


=====================================
testsuite/tests/javascript/T23346.stdout
=====================================
@@ -0,0 +1 @@
+True


=====================================
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, [''])



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/2f571afe1c2aeb3f4dfca2012bc6b713144fd234

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/2f571afe1c2aeb3f4dfca2012bc6b713144fd234
You're receiving this email because of your account on gitlab.haskell.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20230515/7e700fcd/attachment-0001.html>


More information about the ghc-commits mailing list