[Git][ghc/ghc][master] Remove JavaScriptFFI from --supported-extensions for non-JS targets (#11214)

Marge Bot (@marge-bot) gitlab at gitlab.haskell.org
Tue May 30 21:07:24 UTC 2023



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


Commits:
0350b186 by Josh Meredith at 2023-05-29T12:46:27+00:00
Remove JavaScriptFFI from --supported-extensions for non-JS targets (#11214)

- - - - -


3 changed files:

- compiler/GHC/Driver/Session.hs
- testsuite/tests/th/TH_foreignCallingConventions.hs
- testsuite/tests/th/TH_foreignCallingConventions.stderr


Changes:

=====================================
compiler/GHC/Driver/Session.hs
=====================================
@@ -2524,7 +2524,7 @@ supportedLanguageOverlays :: [String]
 supportedLanguageOverlays = map (flagSpecName . snd) safeHaskellFlagsDeps
 
 supportedExtensions :: ArchOS -> [String]
-supportedExtensions (ArchOS _ os) = concatMap toFlagSpecNamePair xFlags
+supportedExtensions (ArchOS arch os) = concatMap toFlagSpecNamePair xFlags
   where
     toFlagSpecNamePair flg
       -- IMPORTANT! Make sure that `ghc --supported-extensions` omits
@@ -2533,9 +2533,12 @@ supportedExtensions (ArchOS _ os) = concatMap toFlagSpecNamePair xFlags
       -- the rationale
       | isAIX, flagSpecFlag flg == LangExt.TemplateHaskell  = [noName]
       | isAIX, flagSpecFlag flg == LangExt.QuasiQuotes      = [noName]
+      -- "JavaScriptFFI" is only supported on the JavaScript backend
+      | notJS, flagSpecFlag flg == LangExt.JavaScriptFFI    = [noName]
       | otherwise = [name, noName]
       where
         isAIX = os == OSAIX
+        notJS = arch /= ArchJavaScript
         noName = "No" ++ name
         name = flagSpecName flg
 


=====================================
testsuite/tests/th/TH_foreignCallingConventions.hs
=====================================
@@ -1,6 +1,9 @@
 {-# LANGUAGE ForeignFunctionInterface, CApiFFI, GHCForeignImportPrim,
-             QuasiQuotes, TemplateHaskell, JavaScriptFFI, MagicHash,
-             UnliftedFFITypes #-}
+             QuasiQuotes, TemplateHaskell, MagicHash,
+             UnliftedFFITypes, CPP #-}
+#if defined(javascript_HOST_ARCH)
+{-# LANGUAGE JavaScriptFFI #-}
+#endif
 
 module TH_foreignCallingConventions where
 


=====================================
testsuite/tests/th/TH_foreignCallingConventions.stderr
=====================================
@@ -8,7 +8,7 @@ foreign import stdcall safe "bay" bay :: (GHC.Types.Int ->
                                          GHC.Types.IO GHC.Types.Int
 foreign import javascript unsafe "bax" bax :: GHC.Ptr.Ptr GHC.Types.Int ->
                                               GHC.Types.IO GHC.Base.String
-TH_foreignCallingConventions.hs:(13,2)-(24,2): Splicing declarations
+TH_foreignCallingConventions.hs:(16,2)-(27,2): Splicing declarations
     do let fi cconv safety lbl name ty
              = ForeignD (ImportF cconv safety lbl name ty)
        dec1 <- fi CCall Interruptible "&" (mkName "foo") <$> [t| Ptr () |]



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/0350b1865f392cf9590c82b5194b62e63770aa44

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/0350b1865f392cf9590c82b5194b62e63770aa44
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/20230530/bcd9d900/attachment-0001.html>


More information about the ghc-commits mailing list