[commit: ghc] wip/nfs-locking: Fix ghcEnableTablesNextToCode, refactor code. (aecfdda)

git at git.haskell.org git at git.haskell.org
Fri Oct 27 00:08:26 UTC 2017


Repository : ssh://git@git.haskell.org/ghc

On branch  : wip/nfs-locking
Link       : http://ghc.haskell.org/trac/ghc/changeset/aecfddac1536bf6f565df227acff0ab37ce534a8/ghc

>---------------------------------------------------------------

commit aecfddac1536bf6f565df227acff0ab37ce534a8
Author: Andrey Mokhov <andrey.mokhov at gmail.com>
Date:   Thu Sep 24 05:45:34 2015 +0100

    Fix ghcEnableTablesNextToCode, refactor code.


>---------------------------------------------------------------

aecfddac1536bf6f565df227acff0ab37ce534a8
 src/Oracles/Config/Flag.hs    | 35 ++++++++++++++++-------------
 src/Oracles/Config/Setting.hs | 52 ++++++++++++++++++-------------------------
 2 files changed, 42 insertions(+), 45 deletions(-)

diff --git a/src/Oracles/Config/Flag.hs b/src/Oracles/Config/Flag.hs
index d520a85..69d4884 100644
--- a/src/Oracles/Config/Flag.hs
+++ b/src/Oracles/Config/Flag.hs
@@ -1,7 +1,7 @@
 module Oracles.Config.Flag (
     Flag (..), flag, getFlag,
-    crossCompiling, gccIsClang, gccGe46,
-    platformSupportsSharedLibs, ghcWithSMP, ghcWithNativeCodeGen
+    crossCompiling, platformSupportsSharedLibs, ghcWithSMP,
+    ghcWithNativeCodeGen, supportsSplitObjects
     ) where
 
 import Base
@@ -12,6 +12,7 @@ data Flag = CrossCompiling
           | GccIsClang
           | GccLt46
           | GhcUnregisterised
+          | LeadingUnderscore
           | SolarisBrokenShld
           | SplitObjectsBroken
           | SupportsPackageKey
@@ -25,6 +26,7 @@ flag f = do
         GccIsClang         -> "gcc-is-clang"
         GccLt46            -> "gcc-lt-46"
         GhcUnregisterised  -> "ghc-unregisterised"
+        LeadingUnderscore  -> "leading-underscore"
         SolarisBrokenShld  -> "solaris-broken-shld"
         SplitObjectsBroken -> "split-objects-broken"
         SupportsPackageKey -> "supports-package-key"
@@ -41,30 +43,33 @@ getFlag = lift . flag
 crossCompiling :: Action Bool
 crossCompiling = flag CrossCompiling
 
-gccIsClang :: Action Bool
-gccIsClang = flag GccIsClang
-
-gccGe46 :: Action Bool
-gccGe46 = fmap not $ flag GccLt46
-
 platformSupportsSharedLibs :: Action Bool
 platformSupportsSharedLibs = do
-    badPlatform   <- targetPlatforms [ "powerpc-unknown-linux"
-                                     , "x86_64-unknown-mingw32"
-                                     , "i386-unknown-mingw32" ]
-    solaris       <- targetPlatform    "i386-unknown-solaris2"
+    badPlatform   <- anyTargetPlatform [ "powerpc-unknown-linux"
+                                       , "x86_64-unknown-mingw32"
+                                       , "i386-unknown-mingw32" ]
+    solaris       <- anyTargetPlatform [ "i386-unknown-solaris2" ]
     solarisBroken <- flag SolarisBrokenShld
     return $ not (badPlatform || solaris && solarisBroken)
 
 ghcWithSMP :: Action Bool
 ghcWithSMP = do
-    goodArch <- targetArchs ["i386", "x86_64", "sparc", "powerpc", "arm"]
+    goodArch <- anyTargetArch ["i386", "x86_64", "sparc", "powerpc", "arm"]
     ghcUnreg <- flag GhcUnregisterised
     return $ goodArch && not ghcUnreg
 
 ghcWithNativeCodeGen :: Action Bool
 ghcWithNativeCodeGen = do
-    goodArch <- targetArchs ["i386", "x86_64", "sparc", "powerpc"]
-    badOs    <- targetOss ["ios", "aix"]
+    goodArch <- anyTargetArch ["i386", "x86_64", "sparc", "powerpc"]
+    badOs    <- anyTargetOs ["ios", "aix"]
     ghcUnreg <- flag GhcUnregisterised
     return $ goodArch && not badOs && not ghcUnreg
+
+supportsSplitObjects :: Action Bool
+supportsSplitObjects = do
+    broken   <- flag SplitObjectsBroken
+    ghcUnreg <- flag GhcUnregisterised
+    goodArch <- anyTargetArch [ "i386", "x86_64", "powerpc", "sparc" ]
+    goodOs   <- anyTargetOs [ "mingw32", "cygwin32", "linux", "darwin", "solaris2"
+                            , "freebsd", "dragonfly", "netbsd", "openbsd" ]
+    return $ not broken && not ghcUnreg && goodArch && goodOs
diff --git a/src/Oracles/Config/Setting.hs b/src/Oracles/Config/Setting.hs
index 8ee4752..e1dfefa 100644
--- a/src/Oracles/Config/Setting.hs
+++ b/src/Oracles/Config/Setting.hs
@@ -1,9 +1,9 @@
 module Oracles.Config.Setting (
     Setting (..), SettingList (..),
     setting, settingList, getSetting, getSettingList,
-    targetPlatform, targetPlatforms, targetOs, targetOss, notTargetOs,
-    targetArchs, windowsHost, notWindowsHost, ghcWithInterpreter,
-    ghcEnableTablesNextToCode, ghcCanonVersion, cmdLineLengthLimit
+    anyTargetPlatform, anyTargetOs, anyTargetArch, anyHostOs, windowsHost,
+    ghcWithInterpreter, ghcEnableTablesNextToCode, useLibFFIForAdjustors,
+    ghcCanonVersion, cmdLineLengthLimit
     ) where
 
 import Base
@@ -83,45 +83,37 @@ getSettingList :: SettingList -> ReaderT a Action [String]
 getSettingList = lift . settingList
 
 matchSetting :: Setting -> [String] -> Action Bool
-matchSetting key values = do
-    value <- setting key
-    return $ value `elem` values
+matchSetting key values = fmap (`elem` values) $ setting key
 
-targetPlatforms :: [String] -> Action Bool
-targetPlatforms = matchSetting TargetPlatformFull
+anyTargetPlatform :: [String] -> Action Bool
+anyTargetPlatform = matchSetting TargetPlatformFull
 
-targetPlatform :: String -> Action Bool
-targetPlatform s = targetPlatforms [s]
+anyTargetOs :: [String] -> Action Bool
+anyTargetOs = matchSetting TargetOs
 
-targetOss :: [String] -> Action Bool
-targetOss = matchSetting TargetOs
+anyTargetArch :: [String] -> Action Bool
+anyTargetArch = matchSetting TargetArch
 
-targetOs :: String -> Action Bool
-targetOs s = targetOss [s]
-
-notTargetOs :: String -> Action Bool
-notTargetOs = fmap not . targetOs
-
-targetArchs :: [String] -> Action Bool
-targetArchs = matchSetting TargetArch
+anyHostOs :: [String] -> Action Bool
+anyHostOs = matchSetting HostOs
 
 windowsHost :: Action Bool
-windowsHost = matchSetting HostOs ["mingw32", "cygwin32"]
-
-notWindowsHost :: Action Bool
-notWindowsHost = fmap not windowsHost
+windowsHost = anyHostOs ["mingw32", "cygwin32"]
 
 ghcWithInterpreter :: Action Bool
 ghcWithInterpreter = do
-    goodOs <- targetOss [ "mingw32", "cygwin32", "linux", "solaris2"
-                        , "freebsd", "dragonfly", "netbsd", "openbsd"
-                        , "darwin", "kfreebsdgnu" ]
-    goodArch <- targetArchs [ "i386", "x86_64", "powerpc", "sparc"
-                            , "sparc64", "arm" ]
+    goodOs <- anyTargetOs [ "mingw32", "cygwin32", "linux", "solaris2"
+                          , "freebsd", "dragonfly", "netbsd", "openbsd"
+                          , "darwin", "kfreebsdgnu" ]
+    goodArch <- anyTargetArch [ "i386", "x86_64", "powerpc", "sparc"
+                              , "sparc64", "arm" ]
     return $ goodOs && goodArch
 
 ghcEnableTablesNextToCode :: Action Bool
-ghcEnableTablesNextToCode = targetArchs ["ia64", "powerpc64"]
+ghcEnableTablesNextToCode = notM $ anyTargetArch ["ia64", "powerpc64", "powerpc64le"]
+
+useLibFFIForAdjustors :: Action Bool
+useLibFFIForAdjustors = notM $ anyTargetArch ["i386", "x86_64"]
 
 -- Canonicalised GHC version number, used for integer version comparisons. We
 -- expand GhcMinorVersion to two digits by adding a leading zero if necessary.



More information about the ghc-commits mailing list