Ticket #5265: 5265-fix.patch

File 5265-fix.patch, 3.8 KB (added by SamAnklesaria, 4 years ago)

fixed mistake in previous patch

  • compiler/main/StaticFlagParser.hs

    From 5bde604cc8ca3a8d3124cea48b6f1cde89a24783 Mon Sep 17 00:00:00 2001
    From: Sam Anklesaria <[email protected]>
    Date: Wed, 6 Jul 2011 11:01:53 -0500
    Subject: [PATCH] support for trac #5265 fixed
    
    ---
     compiler/main/StaticFlagParser.hs |    4 ++++
     compiler/main/StaticFlags.hs      |   27 ++++++++++++++++++---------
     ghc/InteractiveUI.hs              |    3 ++-
     3 files changed, 24 insertions(+), 10 deletions(-)
    
    diff --git a/compiler/main/StaticFlagParser.hs b/compiler/main/StaticFlagParser.hs
    index c63f070..358ef86 100644
    a b static_flags = [ 
    106106        ------- GHCi -------------------------------------------------------
    107107    flagC "ignore-dot-ghci" (PassFlag addOpt)
    108108  , flagC "read-dot-ghci"   (NoArg (removeOpt "-ignore-dot-ghci"))
     109  , flagC "ghci-script"     (HasArg addGhciScript)
    109110
    110111        ------- ways --------------------------------------------------------
    111112  , flagC "prof"           (NoArg (addWay WayProf))
    type StaticP = EwM IO 
    233234addOpt :: String -> StaticP ()
    234235addOpt = liftEwM . SF.addOpt
    235236
     237addGhciScript :: String -> StaticP ()
     238addGhciScript = liftEwM . SF.addGhciScript
     239
    236240addWay :: WayName -> StaticP ()
    237241addWay = liftEwM . SF.addWay
    238242
  • compiler/main/StaticFlags.hs

    diff --git a/compiler/main/StaticFlags.hs b/compiler/main/StaticFlags.hs
    index d8e63ab..635f959 100644
    a b module StaticFlags ( 
    6969        -- Related to linking
    7070        opt_PIC,
    7171        opt_Static,
     72       
     73        -- Ghci Script opts
     74        v_Scripts,
     75        addGhciScript,
     76        opt_GhciScripts,
    7277
    7378        -- misc opts
    7479        opt_IgnoreDotGhci,
    import System.IO.Unsafe ( unsafePerformIO ) 
    102107import Data.List
    103108
    104109-----------------------------------------------------------------------------
     110-- Ghci Scripts
     111
     112GLOBAL_VAR(v_Scripts, [] ,[String])
     113
     114addGhciScript :: String -> IO ()
     115addGhciScript = consIORef v_Scripts
     116
     117opt_GhciScripts :: IO [String]
     118opt_GhciScripts = readIORef v_Scripts
     119
     120
     121-----------------------------------------------------------------------------
    105122-- Static flags
    106123
    107124initStaticOpts :: IO ()
    lookUp :: FastString -> Bool 
    122139lookup_def_int   :: String -> Int -> Int
    123140lookup_def_float :: String -> Float -> Float
    124141lookup_str       :: String -> Maybe String
    125 lookup_all_str   :: String -> [String]
    126142
    127143-- holds the static opts while they're being collected, before
    128144-- being unsafely read by unpacked_static_opts below.
    lookup_str sw 
    151167   = case firstJusts (map (stripPrefix sw) staticFlags) of
    152168        Just ('=' : str) -> Just str
    153169        Just str         -> Just str
    154         Nothing          -> Nothing     
    155 
    156 lookup_all_str sw = map f $ catMaybes (map (stripPrefix sw) staticFlags) where
    157    f ('=' : str) = str
    158    f str = str
     170        Nothing          -> Nothing
    159171
    160172lookup_def_int sw def = case (lookup_str sw) of
    161173                            Nothing -> def              -- Use default
    unpacked_opts = 
    195207
    196208opt_IgnoreDotGhci :: Bool
    197209opt_IgnoreDotGhci               = lookUp (fsLit "-ignore-dot-ghci")
    198  
    199 opt_GhciScripts :: [String]
    200 opt_GhciScripts = lookup_all_str "-ghci-script"
    201210
    202211-- debugging options
    203212-- | Suppress all that is suppressable in core dumps.
  • ghc/InteractiveUI.hs

    diff --git a/ghc/InteractiveUI.hs b/ghc/InteractiveUI.hs
    index 981abdf..e2ba2ba 100644
    a b runGHCi paths maybe_exprs = do 
    426426      getDirectory f = case takeDirectory f of "" -> "."; d -> d
    427427
    428428  when (read_dot_files) $ do
     429    scripts <- liftIO opt_GhciScripts
    429430    mcfgs0 <- sequence $ [ current_dir, app_user_dir, home_dir ]
    430                          ++ map (return . Just) opt_GhciScripts
     431                         ++ map (return . Just) scripts
    431432    mcfgs <- liftIO $ mapM canonicalizePath' (catMaybes mcfgs0)
    432433    mapM_ sourceConfigFile $ nub $ catMaybes mcfgs
    433434        -- nub, because we don't want to read .ghci twice if the