Cheng Shao pushed to branch wip/validate-fix-werror at Glasgow Haskell Compiler / GHC

Commits:

16 changed files:

Changes:

  • compiler/GHC/Tc/Types/Origin.hs
    ... ... @@ -83,7 +83,6 @@ import qualified Data.Kind as Hs
    83 83
     import Data.List.NonEmpty (NonEmpty (..))
    
    84 84
     import Data.Maybe (isNothing)
    
    85 85
     import qualified Data.Semigroup as Semi
    
    86
    -import GHC.Generics
    
    87 86
     
    
    88 87
     {- *********************************************************************
    
    89 88
     *                                                                      *
    

  • hadrian/src/Settings/Flavours/Validate.hs
    ... ... @@ -8,7 +8,7 @@ import {-# SOURCE #-} Settings.Default
    8 8
     
    
    9 9
     -- Please update doc/flavours.md when changing this file.
    
    10 10
     validateFlavour :: Flavour
    
    11
    -validateFlavour = enableLinting $ quickValidateFlavour
    
    11
    +validateFlavour = enableLinting $ werror $ quickValidateFlavour
    
    12 12
         { name = "validate"
    
    13 13
         , extraArgs = validateArgs <> defaultHaddockExtraArgs
    
    14 14
         , ghcDebugAssertions = (<= Stage1)
    

  • libraries/ghc-internal/src/GHC/Internal/Conc/IO.hs
    ... ... @@ -58,7 +58,7 @@ module GHC.Internal.Conc.IO
    58 58
     #endif
    
    59 59
             ) where
    
    60 60
     
    
    61
    -import GHC.Internal.Base (otherwise, pure, return, ($))
    
    61
    +import GHC.Internal.Base (otherwise, return, ($))
    
    62 62
     import GHC.Internal.Conc.Sync as Sync
    
    63 63
     import GHC.Internal.Err (errorWithoutStackTrace)
    
    64 64
     import GHC.Internal.STM as STM
    
    ... ... @@ -82,6 +82,10 @@ import qualified GHC.Internal.Wasm.Prim.Conc as Wasm
    82 82
     import qualified GHC.Internal.Wasm.Prim.Flag as Wasm
    
    83 83
     #endif
    
    84 84
     
    
    85
    +#if defined(javascript_HOST_ARCH)
    
    86
    +import GHC.Internal.Base (pure)
    
    87
    +#endif
    
    88
    +
    
    85 89
     ensureIOManagerIsRunning :: IO ()
    
    86 90
     #if defined(javascript_HOST_ARCH)
    
    87 91
     ensureIOManagerIsRunning = pure ()
    

  • libraries/ghc-internal/src/GHC/Internal/Event/Control.hs
    ... ... @@ -29,7 +29,7 @@ module GHC.Internal.Event.Control
    29 29
     #include <ghcplatform.h>
    
    30 30
     #include "EventConfig.h"
    
    31 31
     
    
    32
    -import GHC.Internal.Base (fmap, otherwise, pure, return, when, ($), (.))
    
    32
    +import GHC.Internal.Base (fmap, otherwise, return, when, ($), (.))
    
    33 33
     import GHC.Internal.Classes (Eq(..), (&&))
    
    34 34
     import GHC.Internal.IORef
    
    35 35
     import GHC.Internal.Conc.Signal (Signal)
    
    ... ... @@ -56,6 +56,10 @@ import GHC.Internal.Foreign.C.Types (CULLong(..))
    56 56
     import GHC.Internal.Foreign.C.Error (eAGAIN, eWOULDBLOCK, eBADF)
    
    57 57
     #endif
    
    58 58
     
    
    59
    +#if defined(wasm32_HOST_ARCH)
    
    60
    +import GHC.Internal.Base (pure)
    
    61
    +#endif
    
    62
    +
    
    59 63
     data ControlMessage = CMsgWakeup
    
    60 64
                         | CMsgDie
    
    61 65
                         | CMsgSignal {-# UNPACK #-} !(ForeignPtr Word8)
    

  • libraries/ghc-internal/src/GHC/Internal/Event/KQueue.hsc
    ... ... @@ -33,7 +33,7 @@ import GHC.Internal.Data.Bits (Bits(..), FiniteBits(..))
    33 33
     import GHC.Internal.Err (errorWithoutStackTrace, undefined)
    
    34 34
     import GHC.Internal.Int
    
    35 35
     import GHC.Internal.Data.Maybe (Maybe(..), catMaybes)
    
    36
    -import GHC.Internal.Types (Bool(..), Int, IO)
    
    36
    +import GHC.Internal.Types (Bool(..), IO)
    
    37 37
     import GHC.Internal.Word (Word16, Word32)
    
    38 38
     import GHC.Internal.Foreign.C.Error (throwErrnoIfMinus1, eINTR, eINVAL,
    
    39 39
                             eNOTSUP, getErrno, throwErrno)
    

  • libraries/ghc-internal/src/GHC/Internal/Float.hs
    ... ... @@ -185,12 +185,12 @@ import GHC.Internal.Prim (
    185 185
         decodeFloat_Int#, divideFloat#, double2Float#, eqWord#, expDouble#,
    
    186 186
         expFloat#, expm1Double#, expm1Float#, fabsDouble#, fabsFloat#,
    
    187 187
         float2Double#, geFloat#, gtFloat#, gtWord#, int2Float#, int2Double#,
    
    188
    -    int2Word#, int64ToInt#, leFloat#, log1pDouble#, log1pFloat#, logDouble#,
    
    188
    +    int2Word#, leFloat#, log1pDouble#, log1pFloat#, logDouble#,
    
    189 189
         logFloat#, ltFloat#, ltWord#, minusFloat#, minusWord#, negateDouble#,
    
    190 190
         negateFloat#, negateInt#, plusFloat#, powerFloat#, sinDouble#, sinFloat#,
    
    191 191
         sinhDouble#, sinhFloat#, sqrtDouble#, sqrtFloat#, tanDouble#, tanFloat#,
    
    192 192
         tanhDouble#, tanhFloat#, timesFloat#, uncheckedIShiftRA#, uncheckedShiftL#,
    
    193
    -    word2Float#, word2Double#, word2Int#, word64ToWord#,
    
    193
    +    word2Float#, word2Double#, word2Int#,
    
    194 194
         (+#), (+##), (-#), (-##), (*##), (**##), (/##), (<#), (<##), (<=#), (<=##),
    
    195 195
         (>#), (>##), (>=#), (>=##),
    
    196 196
       )
    
    ... ... @@ -206,6 +206,13 @@ import GHC.Internal.Float.RealFracMethods
    206 206
     import GHC.Internal.Float.ConversionUtils
    
    207 207
     import GHC.Internal.Bignum.BigNat
    
    208 208
     
    
    209
    +#if WORD_SIZE_IN_BITS == 64
    
    210
    +import GHC.Internal.Prim (
    
    211
    +    int64ToInt#,
    
    212
    +    word64ToWord#,
    
    213
    +  )
    
    214
    +#endif
    
    215
    +
    
    209 216
     infixr 8  **
    
    210 217
     
    
    211 218
     -- $setup
    

  • libraries/ghc-internal/src/GHC/Internal/Float/RealFracMethods.hs
    ... ... @@ -66,7 +66,7 @@ import GHC.Internal.Classes (Ord(..))
    66 66
     import GHC.Internal.Num () -- instance Num Integer
    
    67 67
                                -- (We could remove uses with a little effort)
    
    68 68
     import GHC.Internal.Prim (
    
    69
    -    Int#, eqFloat#, decodeFloat_Int#, double2Int#, float2Int#, int2Float#,
    
    69
    +    eqFloat#, decodeFloat_Int#, double2Int#, float2Int#, int2Float#,
    
    70 70
         int2Double#, int2Word#, ltFloat#, minusFloat#, negateFloat#, negateDouble#,
    
    71 71
         negateInt#, uncheckedIShiftL#, uncheckedIShiftRA#, uncheckedIShiftRL#,
    
    72 72
         (+#), (-#), (<#), (>#), (-##), (==##), (<##),
    
    ... ... @@ -86,6 +86,10 @@ import GHC.Internal.Prim (
    86 86
     
    
    87 87
     #else
    
    88 88
     
    
    89
    +import GHC.Internal.Prim (
    
    90
    +    Int#,
    
    91
    +  )
    
    92
    +
    
    89 93
     #define TO64 integerToInt#
    
    90 94
     #define FROM64 IS
    
    91 95
     #define MINUS64 ( -# )
    
    ... ... @@ -355,4 +359,3 @@ foreign import ccall unsafe "rintDouble"
    355 359
     
    
    356 360
     foreign import ccall unsafe "rintFloat"
    
    357 361
         c_rintFloat :: Float -> Float
    358
    -

  • libraries/ghc-internal/src/GHC/Internal/IO/FD.hs
    ... ... @@ -30,7 +30,7 @@ module GHC.Internal.IO.FD (
    30 30
         ) where
    
    31 31
     
    
    32 32
     import GHC.Internal.Base (
    
    33
    -    String, fmap, id, otherwise, pure, return, when, ($), (.), (++), (>>=),
    
    33
    +    String, fmap, otherwise, pure, return, when, ($), (.), (++), (>>=),
    
    34 34
       )
    
    35 35
     import GHC.Internal.Bits
    
    36 36
     import GHC.Internal.Classes (Eq(..), Ord(..), not, (&&), (||))
    
    ... ... @@ -58,6 +58,10 @@ import GHC.Internal.Err (error)
    58 58
     import GHC.Internal.Windows
    
    59 59
     import GHC.Internal.IO.SubSystem ((<!>))
    
    60 60
     import GHC.Internal.Foreign.Storable
    
    61
    +#else
    
    62
    +import GHC.Internal.Base (
    
    63
    +    id,
    
    64
    +  )
    
    61 65
     #endif
    
    62 66
     
    
    63 67
     import GHC.Internal.Foreign.C.Types
    

  • libraries/ghc-internal/src/GHC/Internal/Int.hs
    ... ... @@ -51,7 +51,7 @@ import GHC.Internal.Classes (
    51 51
         Eq(..), Ord(..),
    
    52 52
         eqInt, neInt, gtInt, geInt, ltInt, leInt,
    
    53 53
         divInt8#, divInt16#, divInt32#,
    
    54
    -    divModInt8#, divModInt16#, divModInt32#, divModInt#,
    
    54
    +    divModInt8#, divModInt16#, divModInt32#,
    
    55 55
         modInt8#, modInt16#, modInt32#,
    
    56 56
         (&&), (||),
    
    57 57
       )
    
    ... ... @@ -63,6 +63,12 @@ import GHC.Internal.Arr
    63 63
     import GHC.Internal.Show
    
    64 64
     import GHC.Internal.Types (Bool(..), Float, Double, Int(..), isTrue#)
    
    65 65
     
    
    66
    +#if WORD_SIZE_IN_BITS == 64
    
    67
    +import GHC.Internal.Classes (
    
    68
    +    divModInt#,
    
    69
    +  )
    
    70
    +#endif
    
    71
    +
    
    66 72
     ------------------------------------------------------------------------
    
    67 73
     -- type Int8
    
    68 74
     ------------------------------------------------------------------------
    

  • libraries/ghc-internal/src/GHC/Internal/RTS/Flags.hsc
    ... ... @@ -66,7 +66,7 @@ import GHC.Internal.Ptr
    66 66
     import GHC.Internal.Types (Bool(..), Double, Int)
    
    67 67
     import GHC.Internal.Word
    
    68 68
     import GHC.Internal.Base (
    
    69
    -    String, otherwise, pure, return, (.), (++), (<*>), (=<<),
    
    69
    +    String, otherwise, return, (.), (++), (<*>), (=<<),
    
    70 70
       )
    
    71 71
     import GHC.Internal.Enum
    
    72 72
     import GHC.Internal.Generics (Generic)
    
    ... ... @@ -74,6 +74,10 @@ import GHC.Internal.IO
    74 74
     import GHC.Internal.Real
    
    75 75
     import GHC.Internal.Show
    
    76 76
     
    
    77
    +#if defined(javascript_HOST_ARCH)
    
    78
    +import GHC.Internal.Base (pure)
    
    79
    +#endif
    
    80
    +
    
    77 81
     -- | 'RtsTime' is defined as a @StgWord64@ in @stg/Types.h@
    
    78 82
     --
    
    79 83
     -- @since base-4.8.2.0
    

  • libraries/ghc-internal/src/GHC/Internal/RTS/Flags/Test.hsc
    ... ... @@ -8,16 +8,20 @@ module GHC.Internal.RTS.Flags.Test
    8 8
       )
    
    9 9
     where
    
    10 10
     
    
    11
    -import GHC.Internal.Base (pure)
    
    12 11
     import GHC.Internal.Ptr
    
    13
    -import GHC.Internal.Foreign.C.Types
    
    14
    -import GHC.Internal.Foreign.Marshal.Utils
    
    15 12
     import GHC.Internal.Foreign.Storable
    
    16 13
     import GHC.Internal.Data.Functor ((<$>))
    
    17 14
     import GHC.Internal.Types (Bool(..), Int, IO)
    
    18 15
     import GHC.Internal.Word (Word32)
    
    19 16
     import GHC.Internal.Real (fromIntegral)
    
    20 17
     
    
    18
    +#if defined(javascript_HOST_ARCH)
    
    19
    +import GHC.Internal.Base (pure)
    
    20
    +#else
    
    21
    +import GHC.Internal.Foreign.C.Types
    
    22
    +import GHC.Internal.Foreign.Marshal.Utils
    
    23
    +#endif
    
    24
    +
    
    21 25
     #include "Rts.h"
    
    22 26
     #include "rts/Flags.h"
    
    23 27
     
    

  • libraries/ghc-internal/src/GHC/Internal/System/Environment.hs
    ... ... @@ -49,9 +49,13 @@ import GHC.Internal.Base (fmap)
    49 49
     import GHC.Internal.Classes (Ord(..))
    
    50 50
     import GHC.Internal.Control.Exception.Base (bracket)
    
    51 51
     import GHC.Internal.Err (undefined)
    
    52
    +#else
    
    53
    +import GHC.Internal.Base (
    
    54
    +    map, (++),
    
    55
    +  )
    
    52 56
     #endif
    
    53 57
     import GHC.Internal.Base (
    
    54
    -    String, liftM, map, mapM, otherwise, return, ($), (.), (++), (>>=),
    
    58
    +    String, liftM, mapM, otherwise, return, ($), (.), (>>=),
    
    55 59
       )
    
    56 60
     import GHC.Internal.List (null, elem, takeWhile, break)
    
    57 61
     import GHC.Internal.Maybe (Maybe(..))
    

  • libraries/ghc-internal/src/GHC/Internal/System/Environment/Blank.hsc
    ... ... @@ -43,7 +43,7 @@ import GHC.Internal.Classes (Eq(..))
    43 43
     import GHC.Internal.Data.Functor
    
    44 44
     import GHC.Internal.Data.List (elem, null, takeWhile)
    
    45 45
     import GHC.Internal.Foreign.C.String
    
    46
    -import GHC.Internal.Base (String, otherwise, return, ($))
    
    46
    +import GHC.Internal.Base (String, otherwise, ($))
    
    47 47
     #if defined(mingw32_HOST_OS)
    
    48 48
     import GHC.Internal.Base ((.))
    
    49 49
     import GHC.Internal.Foreign.Ptr
    
    ... ... @@ -51,6 +51,7 @@ import GHC.Internal.Windows
    51 51
     import GHC.Internal.Control.Monad
    
    52 52
     import GHC.Internal.Data.List (lookup)
    
    53 53
     #else
    
    54
    +import GHC.Internal.Base (return)
    
    54 55
     import GHC.Internal.Foreign.C.Error
    
    55 56
     import GHC.Internal.Foreign.C.Types
    
    56 57
     import GHC.Internal.Real (fromIntegral)
    

  • libraries/ghc-internal/src/GHC/Internal/System/IO.hs
    ... ... @@ -249,6 +249,7 @@ import GHC.Internal.Base (String, failIO, otherwise, return, ($), (.), (>>=))
    249 249
     import GHC.Internal.List
    
    250 250
     #if !defined(mingw32_HOST_OS)
    
    251 251
     import GHC.Internal.IORef
    
    252
    +import GHC.Internal.Types (Int)
    
    252 253
     #endif
    
    253 254
     import GHC.Internal.Num
    
    254 255
     import GHC.Internal.IO hiding ( bracket, onException )
    
    ... ... @@ -262,7 +263,7 @@ import GHC.Internal.IO.Encoding
    262 263
     import GHC.Internal.Text.Read
    
    263 264
     import GHC.Internal.IO.StdHandles
    
    264 265
     import GHC.Internal.Show
    
    265
    -import GHC.Internal.Types (Bool(..), Char, Int)
    
    266
    +import GHC.Internal.Types (Bool(..), Char)
    
    266 267
     -----------------------------------------------------------------------------
    
    267 268
     -- Standard IO
    
    268 269
     
    

  • libraries/ghc-internal/src/GHC/Internal/System/Posix/Internals.hs
    ... ... @@ -46,19 +46,20 @@ import GHC.Internal.Data.Maybe
    46 46
     
    
    47 47
     #if !defined(HTYPE_TCFLAG_T)
    
    48 48
     import GHC.Internal.System.IO.Error
    
    49
    +#if !defined(mingw32_HOST_OS)
    
    50
    +import GHC.Internal.Err (errorWithoutStackTrace)
    
    51
    +#endif
    
    49 52
     #endif
    
    50 53
     
    
    51 54
     import GHC.Internal.Base (
    
    52 55
         String, otherwise, pure, return, when, ($), (++), (>>=),
    
    53 56
       )
    
    54 57
     import GHC.Internal.Bits
    
    55
    -import GHC.Internal.Classes (Eq(..), Ord(..), not, (&&), (||))
    
    56
    -import GHC.Internal.CString (cstringLength#)
    
    57
    -import GHC.Internal.Err (errorWithoutStackTrace)
    
    58
    +import GHC.Internal.Classes (Eq(..), not, (&&), (||))
    
    58 59
     import GHC.Internal.Num
    
    59 60
     import GHC.Internal.Prim (yield#)
    
    60 61
     import GHC.Internal.Real
    
    61
    -import GHC.Internal.Types (Bool(..), Int(..))
    
    62
    +import GHC.Internal.Types (Bool(..))
    
    62 63
     import GHC.Internal.Word
    
    63 64
     import GHC.Internal.IO
    
    64 65
     import GHC.Internal.IO.IOMode
    
    ... ... @@ -71,10 +72,13 @@ import GHC.Internal.Int (Int64)
    71 72
     #endif
    
    72 73
     
    
    73 74
     #if !defined(mingw32_HOST_OS)
    
    75
    +import GHC.Internal.CString (cstringLength#)
    
    76
    +import GHC.Internal.Classes (Ord(..))
    
    74 77
     import {-# SOURCE #-} GHC.Internal.IO.Encoding (getFileSystemEncoding)
    
    75 78
     import GHC.Internal.Foreign.Marshal.Utils
    
    76 79
     import GHC.Internal.Foreign.Storable
    
    77 80
     import qualified GHC.Internal.Foreign.C.String.Encoding as GHC
    
    81
    +import GHC.Internal.Types (Int(..))
    
    78 82
     #else
    
    79 83
     import GHC.Internal.Int
    
    80 84
     import GHC.Internal.Data.OldList (elem)
    

  • libraries/ghc-internal/src/GHC/Internal/TopHandler.hs
    ... ... @@ -39,12 +39,12 @@ module GHC.Internal.TopHandler (
    39 39
     import GHC.Internal.Control.Exception
    
    40 40
     import GHC.Internal.Data.Maybe
    
    41 41
     
    
    42
    -import GHC.Internal.Classes (Eq(..), Ord(..), (&&))
    
    42
    +import GHC.Internal.Classes (Eq(..))
    
    43 43
     import GHC.Internal.Foreign.C.Error
    
    44 44
     import GHC.Internal.Foreign.C.Types
    
    45 45
     import GHC.Internal.Foreign.C.String
    
    46 46
     import GHC.Internal.Base (
    
    47
    -    String, const, failIO, otherwise, pure, return, ($), (++), (>>),
    
    47
    +    String, failIO, return, ($), (++), (>>),
    
    48 48
       )
    
    49 49
     import GHC.Internal.Conc.Sync hiding (throwTo)
    
    50 50
     import GHC.Internal.Prim (Weak#, seq)
    
    ... ... @@ -67,6 +67,17 @@ import GHC.Internal.Conc.Signal
    67 67
     import GHC.Internal.Data.Dynamic (toDyn)
    
    68 68
     #endif
    
    69 69
     
    
    70
    +#if !defined(HAVE_SIGNAL_H)
    
    71
    +import GHC.Internal.Base (pure)
    
    72
    +#endif
    
    73
    +
    
    74
    +#if !defined(mingw32_HOST_OS) && !defined(javascript_HOST_ARCH)
    
    75
    +import GHC.Internal.Base (
    
    76
    +    const, otherwise,
    
    77
    +  )
    
    78
    +import GHC.Internal.Classes (Ord(..), (&&))
    
    79
    +#endif
    
    80
    +
    
    70 81
     -- Note [rts_setMainThread must be called unsafely]
    
    71 82
     -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    72 83
     -- rts_setMainThread must be called as unsafe, because it