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 ...@@ -66,7 +66,7 @@ import Data.List
import qualified Data.Sequence as Seq import qualified Data.Sequence as Seq
import Data.Monoid import Data.Monoid
import Data.Sequence (viewl, ViewL(..)) import Data.Sequence (viewl, ViewL(..))
import Foreign import Foreign.Safe
import System.IO.Unsafe import System.IO.Unsafe
--------------------------------------------- ---------------------------------------------
......
...@@ -47,6 +47,7 @@ simpleImportDecl mn = ImportDecl { ...@@ -47,6 +47,7 @@ simpleImportDecl mn = ImportDecl {
ideclName = noLoc mn, ideclName = noLoc mn,
ideclPkgQual = Nothing, ideclPkgQual = Nothing,
ideclSource = False, ideclSource = False,
ideclSafe = True,
ideclQualified = False, ideclQualified = False,
ideclAs = Nothing, ideclAs = Nothing,
ideclHiding = Nothing ideclHiding = Nothing
......
...@@ -75,7 +75,11 @@ import System.Directory ...@@ -75,7 +75,11 @@ import System.Directory
import Data.Dynamic import Data.Dynamic
import Data.List (find) import Data.List (find)
import Control.Monad import Control.Monad
import Foreign #if __GLASGOW_HASKELL__ >= 701
import Foreign.Safe
#else
import Foreign hiding (unsafePerformIO)
#endif
import Foreign.C import Foreign.C
import GHC.Exts import GHC.Exts
import Data.Array import Data.Array
......
...@@ -26,9 +26,11 @@ module FastMutInt( ...@@ -26,9 +26,11 @@ module FastMutInt(
#endif #endif
import GHC.Base import GHC.Base
import GHC.Ptr
#if __GLASGOW_HASKELL__ >= 701 #if __GLASGOW_HASKELL__ >= 701
import GHC.Ptr.Safe
import GHC.Ptr.Unsafe import GHC.Ptr.Unsafe
#else
import GHC.Ptr
#endif #endif
#else /* ! __GLASGOW_HASKELL__ */ #else /* ! __GLASGOW_HASKELL__ */
......
...@@ -55,7 +55,7 @@ import System.IO.Unsafe ( unsafePerformIO ) ...@@ -55,7 +55,7 @@ import System.IO.Unsafe ( unsafePerformIO )
import GHC.Exts import GHC.Exts
#if __GLASGOW_HASKELL__ >= 701 #if __GLASGOW_HASKELL__ >= 701
import Foreign import Foreign.Safe
#else #else
import Foreign hiding ( unsafePerformIO ) import Foreign hiding ( unsafePerformIO )
#endif #endif
......
...@@ -88,7 +88,7 @@ import Data.Char ...@@ -88,7 +88,7 @@ import Data.Char
import Data.Array import Data.Array
import Control.Monad as Monad import Control.Monad as Monad
import Text.Printf import Text.Printf
import Foreign import Foreign.Safe
import GHC.Exts ( unsafeCoerce# ) import GHC.Exts ( unsafeCoerce# )
import GHC.IO.Exception ( IOErrorType(InvalidArgument) ) import GHC.IO.Exception ( IOErrorType(InvalidArgument) )
...@@ -1336,7 +1336,10 @@ isSafeCmd m = ...@@ -1336,7 +1336,10 @@ isSafeCmd m =
-- recently-added module occurs last, it seems. -- recently-added module occurs last, it seems.
case (as,bs) of case (as,bs) of
(as@(_:_), _) -> isSafeModule $ last as (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 ":issafe: no current module")
_ -> ghcError (CmdLineError "syntax: :issafe <module>") _ -> ghcError (CmdLineError "syntax: :issafe <module>")
......
...@@ -7,6 +7,9 @@ HADDOCK_DOCS = YES ...@@ -7,6 +7,9 @@ HADDOCK_DOCS = YES
SRC_CC_OPTS += -Wall $(WERROR) SRC_CC_OPTS += -Wall $(WERROR)
SRC_HC_OPTS += -Wall $(WERROR) -H64m -O0 SRC_HC_OPTS += -Wall $(WERROR) -H64m -O0
# Safe by default
#SRC_HC_OPTS += -Dsh_SAFE_DEFAULT
GhcStage1HcOpts += -O GhcStage1HcOpts += -O
GhcStage2HcOpts += -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