king: various warning and -Werror related fixes

This also removes -Werror from racqure due to the sheer number
build failures arising from compiler warnings.
This commit is contained in:
Brendan Hay 2020-10-27 13:22:33 +01:00
parent 74db584ad7
commit de17409fd6
No known key found for this signature in database
GPG Key ID: 80E915C54A7C457D
12 changed files with 30 additions and 27 deletions

View File

@ -9,7 +9,6 @@ library:
- -fwarn-incomplete-patterns
- -fwarn-unused-binds
- -fwarn-unused-imports
- -Werror
- -O2
dependencies:

View File

@ -20,6 +20,8 @@ module Urbit.Arvo.Common
import Urbit.Prelude hiding (Term)
import Control.Monad.Fail (fail)
import qualified Network.HTTP.Types.Method as H
import qualified Urbit.Ob as Ob

View File

@ -12,6 +12,7 @@ module Urbit.Arvo.Effect where
import Urbit.Noun.Time
import Urbit.Prelude
import Control.Monad.Fail (fail)
import Urbit.Arvo.Common (KingId(..), ServId(..))
import Urbit.Arvo.Common (Header, HttpEvent, HttpServerConf, Method, Mime)
import Urbit.Arvo.Common (AmesDest, Turf)

View File

@ -11,6 +11,7 @@ module Urbit.Arvo.Event where
import Urbit.Prelude hiding (Term)
import Control.Monad.Fail (fail)
import Urbit.Arvo.Common (KingId(..), ServId(..))
import Urbit.Arvo.Common (Desk, Mime)
import Urbit.Arvo.Common (Header(..), HttpEvent)

View File

@ -90,11 +90,8 @@ import Urbit.King.App
import Control.Concurrent (myThreadId)
import Control.Exception (AsyncException(UserInterrupt))
import Control.Lens ((&))
import System.Process (system)
import System.IO (hPutStrLn)
import Text.Show.Pretty (pPrint)
import Urbit.Noun.Conversions (cordToUW)
import Urbit.Noun.Time (Wen)
import Urbit.Vere.LockFile (lockFile)

View File

@ -20,10 +20,9 @@ module Urbit.Prelude
import ClassyPrelude
import Urbit.Noun
import Control.Lens hiding (Each, Index, cons, index, snoc, uncons, unsnoc,
(<.>), (<|))
import Control.Arrow ((<<<), (>>>))
import Control.Lens hiding (Each, Index, cons, index, snoc, uncons, unsnoc,
(<.>), (<|))
import Data.Acquire (Acquire, mkAcquire, with)
import Data.RAcquire (RAcquire, mkRAcquire, rwith)
import Data.RAcquire (MonadAcquire(..), MonadRIO(..))

View File

@ -19,7 +19,6 @@ import Urbit.Arvo.Common
import Urbit.Arvo.Event hiding (Address)
import Urbit.Prelude hiding (Call, rights, to, (.=))
import Data.Bifunctor (bimap)
import Data.Bits (xor)
import Data.List (nub)
import Data.Text (splitOn)
@ -351,10 +350,10 @@ validateShipAndGetSponsor endpoint block (Seed ship life ring oaf) =
-- A comet address is the fingerprint of the keypair
let shipFromPass = cometFingerprint $ ringToPass ring
when (ship /= shipFromPass) $
fail ("comet name doesn't match fingerprint " <> show ship <> " vs " <>
error ("comet name doesn't match fingerprint " <> show ship <> " vs " <>
show shipFromPass)
when (life /= 1) $
fail ("comet can never be re-keyed")
error ("comet can never be re-keyed")
pure (shipSein ship)
validateMoon = do
@ -368,14 +367,14 @@ validateShipAndGetSponsor endpoint block (Seed ship life ring oaf) =
whoP <- retrievePoint endpoint block ship
case epNet whoP of
Nothing -> fail "ship not keyed"
Nothing -> error "ship not keyed"
Just (netLife, pass, contNum, (hasSponsor, who), _) -> do
when (netLife /= life) $
fail ("keyfile life mismatch; keyfile claims life " <>
error ("keyfile life mismatch; keyfile claims life " <>
show life <> ", but Azimuth claims life " <>
show netLife)
when ((ringToPass ring) /= pass) $
fail "keyfile does not match blockchain"
error "keyfile does not match blockchain"
-- TODO: The hoon code does a breach check, but the C code never
-- supplies the data necessary for it to function.
pure who
@ -391,16 +390,16 @@ getSponsorshipChain endpoint block = loop
ethPoint <- retrievePoint endpoint block ship
case (clanFromShip ship, epNet ethPoint) of
(Ob.Comet, _) -> fail "Comets cannot be sponsors"
(Ob.Moon, _) -> fail "Moons cannot be sponsors"
(Ob.Comet, _) -> error "Comets cannot be sponsors"
(Ob.Moon, _) -> error "Moons cannot be sponsors"
(_, Nothing) ->
fail $ unpack ("Ship " <> renderShip ship <> " not booted")
error $ unpack ("Ship " <> renderShip ship <> " not booted")
(Ob.Galaxy, Just _) -> pure [(ship, ethPoint)]
(_, Just (_, _, _, (False, _), _)) ->
fail $ unpack ("Ship " <> renderShip ship <> " has no sponsor")
error $ unpack ("Ship " <> renderShip ship <> " has no sponsor")
(_, Just (_, _, _, (True, sponsor), _)) -> do
chain <- loop sponsor

View File

@ -26,7 +26,7 @@ import Urbit.Vere.Pier.Types
import Control.Monad.STM (retry)
import System.Environment (getExecutablePath)
import System.FilePath (splitFileName, (</>))
import System.FilePath (splitFileName)
import System.Posix.Files (ownerModes, setFileMode)
import Urbit.EventLog.LMDB (EventLog)
import Urbit.King.API (TermConn)

View File

@ -13,6 +13,7 @@ import Urbit.Prelude hiding (trace)
import Urbit.Arvo (Belt, Blit)
import Control.Monad.Fail (fail)
import Urbit.TermSize
-- External Types --------------------------------------------------------------

View File

@ -12,14 +12,15 @@ import ClassyPrelude
import Urbit.Atom
import Urbit.Noun.Core
import Data.Bits (shiftL, shiftR, (.&.), (.|.))
import Data.Function ((&))
import Foreign.Ptr (Ptr, castPtr, plusPtr, ptrToWordPtr)
import Foreign.Storable (peek)
import GHC.Prim (ctz#)
import GHC.Word (Word(..))
import System.IO.Unsafe (unsafePerformIO)
import Text.Printf (printf)
import Control.Monad.Fail (MonadFail (fail))
import Data.Bits (shiftL, shiftR, (.&.), (.|.))
import Data.Function ((&))
import Foreign.Ptr (Ptr, castPtr, plusPtr, ptrToWordPtr)
import Foreign.Storable (peek)
import GHC.Prim (ctz#)
import GHC.Word (Word(..))
import System.IO.Unsafe (unsafePerformIO)
import Text.Printf (printf)
import qualified Data.ByteString.Unsafe as BS
import qualified Data.HashTable.IO as H
@ -136,6 +137,7 @@ instance Monad Get where
runGet (f x') end tbl s'
{-# INLINE (>>=) #-}
instance MonadFail Get where
fail msg = Get $ \end tbl s -> do
badEncoding end s msg
{-# INLINE fail #-}

View File

@ -4,6 +4,7 @@
module Urbit.Noun.TH (deriveNoun, deriveToNoun, deriveFromNoun) where
import ClassyPrelude hiding (fromList)
import Control.Monad.Fail (fail)
import Language.Haskell.TH
import Language.Haskell.TH.Syntax
import Urbit.Noun.Convert

View File

@ -17,6 +17,7 @@ module Urbit.Noun.Conversions
import ClassyPrelude hiding (hash)
import Control.Lens hiding (Each, Index, (<.>))
import Control.Monad.Fail (fail)
import Data.Void
import Data.Word
import Text.Regex.TDFA
@ -33,7 +34,7 @@ import GHC.Types (Char(C#))
import GHC.Word (Word32(W32#))
import Prelude ((!!))
import RIO.FilePath (joinPath, splitDirectories, takeBaseName,
takeDirectory, takeExtension, (<.>))
takeDirectory, takeExtension)
import Urbit.Noun.Cue (cue)
import Urbit.Noun.Jam (jam)