Commit c8386581 authored by dterei's avatar dterei

SafeHaskell: Fix validation errors when unsafe base used

parent 4f9675b2
......@@ -66,7 +66,7 @@ import Data.List
import qualified Data.Sequence as Seq
import Data.Monoid
import Data.Sequence (viewl, ViewL(..))
import Foreign
import Foreign.Safe
import System.IO.Unsafe
---------------------------------------------
......
......@@ -47,6 +47,7 @@ simpleImportDecl mn = ImportDecl {
ideclName = noLoc mn,
ideclPkgQual = Nothing,
ideclSource = False,
ideclSafe = True,
ideclQualified = False,
ideclAs = Nothing,
ideclHiding = Nothing
......
......@@ -75,7 +75,11 @@ import System.Directory
import Data.Dynamic
import Data.List (find)
import Control.Monad
import Foreign
#if __GLASGOW_HASKELL__ >= 701
import Foreign.Safe
#else
import Foreign hiding (unsafePerformIO)
#endif
import Foreign.C
import GHC.Exts
import Data.Array
......
......@@ -26,9 +26,11 @@ module FastMutInt(
#endif
import GHC.Base
import GHC.Ptr
#if __GLASGOW_HASKELL__ >= 701
import GHC.Ptr.Safe
import GHC.Ptr.Unsafe
#else
import GHC.Ptr
#endif
#else /* ! __GLASGOW_HASKELL__ */
......
......@@ -55,7 +55,7 @@ import System.IO.Unsafe ( unsafePerformIO )
import GHC.Exts
#if __GLASGOW_HASKELL__ >= 701
import Foreign
import Foreign.Safe
#else
import Foreign hiding ( unsafePerformIO )
#endif
......
......@@ -88,7 +88,7 @@ import Data.Char
import Data.Array
import Control.Monad as Monad
import Text.Printf
import Foreign
import Foreign.Safe
import GHC.Exts ( unsafeCoerce# )
import GHC.IO.Exception ( IOErrorType(InvalidArgument) )
......@@ -1336,7 +1336,10 @@ isSafeCmd m =
-- recently-added module occurs last, it seems.
case (as,bs) of
(as@(_:_), _) -> isSafeModule $ last as
([], bs@(_:_)) -> isSafeModule $ fst (last bs)
([], bs@(_:_)) -> do
let i = last bs
m <- GHC.findModule (unLoc (ideclName i)) (ideclPkgQual i)
isSafeModule m
([], []) -> ghcError (CmdLineError ":issafe: no current module")
_ -> ghcError (CmdLineError "syntax: :issafe <module>")
......
......@@ -7,6 +7,9 @@ HADDOCK_DOCS = YES
SRC_CC_OPTS += -Wall $(WERROR)
SRC_HC_OPTS += -Wall $(WERROR) -H64m -O0
# Safe by default
#SRC_HC_OPTS += -Dsh_SAFE_DEFAULT
GhcStage1HcOpts += -O
GhcStage2HcOpts += -O
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment