Cheng Shao pushed to branch wip/validate-fix-werror at Glasgow Haskell Compiler / GHC
Commits:
e4b9a189 by Cheng Shao at 2026-03-21T00:31:34+01:00
ghc-internal: fix unused imports
This commit fixes unused imports in `ghc-internal` which should have
been caught by the `validate` flavour but was warnings in CI due to
the recent `+werror` regression. Fixes #26987 #27059.
- - - - -
6d1798de by Cheng Shao at 2026-03-21T00:31:40+01:00
compiler: fix unused imports in GHC.Tc.Types.Origin
This commit fixes unused imports in `GHC.Tc.Types.Origin` which should
have been caught by the `validate` flavour but was warnings in CI due
to the recent `+werror` regression. Fixes #27059.
- - - - -
c2130e19 by Cheng Shao at 2026-03-21T00:31:40+01:00
hadrian: fix missing +werror in validate flavour
This patch fixes missing `+werror` in validate flavour, which was an
oversight in bb3a2ba1eefadf0b2ef4f39b31337a23eec67f29. Fixes #27066.
- - - - -
16 changed files:
- compiler/GHC/Tc/Types/Origin.hs
- hadrian/src/Settings/Flavours/Validate.hs
- libraries/ghc-internal/src/GHC/Internal/Conc/IO.hs
- libraries/ghc-internal/src/GHC/Internal/Event/Control.hs
- libraries/ghc-internal/src/GHC/Internal/Event/KQueue.hsc
- libraries/ghc-internal/src/GHC/Internal/Float.hs
- libraries/ghc-internal/src/GHC/Internal/Float/RealFracMethods.hs
- libraries/ghc-internal/src/GHC/Internal/IO/FD.hs
- libraries/ghc-internal/src/GHC/Internal/Int.hs
- libraries/ghc-internal/src/GHC/Internal/RTS/Flags.hsc
- libraries/ghc-internal/src/GHC/Internal/RTS/Flags/Test.hsc
- libraries/ghc-internal/src/GHC/Internal/System/Environment.hs
- libraries/ghc-internal/src/GHC/Internal/System/Environment/Blank.hsc
- libraries/ghc-internal/src/GHC/Internal/System/IO.hs
- libraries/ghc-internal/src/GHC/Internal/System/Posix/Internals.hs
- libraries/ghc-internal/src/GHC/Internal/TopHandler.hs
Changes:
=====================================
compiler/GHC/Tc/Types/Origin.hs
=====================================
@@ -83,7 +83,6 @@ import qualified Data.Kind as Hs
import Data.List.NonEmpty (NonEmpty (..))
import Data.Maybe (isNothing)
import qualified Data.Semigroup as Semi
-import GHC.Generics
{- *********************************************************************
* *
=====================================
hadrian/src/Settings/Flavours/Validate.hs
=====================================
@@ -8,7 +8,7 @@ import {-# SOURCE #-} Settings.Default
-- Please update doc/flavours.md when changing this file.
validateFlavour :: Flavour
-validateFlavour = enableLinting $ quickValidateFlavour
+validateFlavour = enableLinting $ werror $ quickValidateFlavour
{ name = "validate"
, extraArgs = validateArgs <> defaultHaddockExtraArgs
, ghcDebugAssertions = (<= Stage1)
=====================================
libraries/ghc-internal/src/GHC/Internal/Conc/IO.hs
=====================================
@@ -58,7 +58,7 @@ module GHC.Internal.Conc.IO
#endif
) where
-import GHC.Internal.Base (otherwise, pure, return, ($))
+import GHC.Internal.Base (otherwise, return, ($))
import GHC.Internal.Conc.Sync as Sync
import GHC.Internal.Err (errorWithoutStackTrace)
import GHC.Internal.STM as STM
@@ -82,6 +82,10 @@ import qualified GHC.Internal.Wasm.Prim.Conc as Wasm
import qualified GHC.Internal.Wasm.Prim.Flag as Wasm
#endif
+#if defined(javascript_HOST_ARCH)
+import GHC.Internal.Base (pure)
+#endif
+
ensureIOManagerIsRunning :: IO ()
#if defined(javascript_HOST_ARCH)
ensureIOManagerIsRunning = pure ()
=====================================
libraries/ghc-internal/src/GHC/Internal/Event/Control.hs
=====================================
@@ -29,7 +29,7 @@ module GHC.Internal.Event.Control
#include
#include "EventConfig.h"
-import GHC.Internal.Base (fmap, otherwise, pure, return, when, ($), (.))
+import GHC.Internal.Base (fmap, otherwise, return, when, ($), (.))
import GHC.Internal.Classes (Eq(..), (&&))
import GHC.Internal.IORef
import GHC.Internal.Conc.Signal (Signal)
@@ -56,6 +56,10 @@ import GHC.Internal.Foreign.C.Types (CULLong(..))
import GHC.Internal.Foreign.C.Error (eAGAIN, eWOULDBLOCK, eBADF)
#endif
+#if defined(wasm32_HOST_ARCH)
+import GHC.Internal.Base (pure)
+#endif
+
data ControlMessage = CMsgWakeup
| CMsgDie
| CMsgSignal {-# UNPACK #-} !(ForeignPtr Word8)
=====================================
libraries/ghc-internal/src/GHC/Internal/Event/KQueue.hsc
=====================================
@@ -33,7 +33,7 @@ import GHC.Internal.Data.Bits (Bits(..), FiniteBits(..))
import GHC.Internal.Err (errorWithoutStackTrace, undefined)
import GHC.Internal.Int
import GHC.Internal.Data.Maybe (Maybe(..), catMaybes)
-import GHC.Internal.Types (Bool(..), Int, IO)
+import GHC.Internal.Types (Bool(..), IO)
import GHC.Internal.Word (Word16, Word32)
import GHC.Internal.Foreign.C.Error (throwErrnoIfMinus1, eINTR, eINVAL,
eNOTSUP, getErrno, throwErrno)
=====================================
libraries/ghc-internal/src/GHC/Internal/Float.hs
=====================================
@@ -185,12 +185,12 @@ import GHC.Internal.Prim (
decodeFloat_Int#, divideFloat#, double2Float#, eqWord#, expDouble#,
expFloat#, expm1Double#, expm1Float#, fabsDouble#, fabsFloat#,
float2Double#, geFloat#, gtFloat#, gtWord#, int2Float#, int2Double#,
- int2Word#, int64ToInt#, leFloat#, log1pDouble#, log1pFloat#, logDouble#,
+ int2Word#, leFloat#, log1pDouble#, log1pFloat#, logDouble#,
logFloat#, ltFloat#, ltWord#, minusFloat#, minusWord#, negateDouble#,
negateFloat#, negateInt#, plusFloat#, powerFloat#, sinDouble#, sinFloat#,
sinhDouble#, sinhFloat#, sqrtDouble#, sqrtFloat#, tanDouble#, tanFloat#,
tanhDouble#, tanhFloat#, timesFloat#, uncheckedIShiftRA#, uncheckedShiftL#,
- word2Float#, word2Double#, word2Int#, word64ToWord#,
+ word2Float#, word2Double#, word2Int#,
(+#), (+##), (-#), (-##), (*##), (**##), (/##), (<#), (<##), (<=#), (<=##),
(>#), (>##), (>=#), (>=##),
)
@@ -206,6 +206,13 @@ import GHC.Internal.Float.RealFracMethods
import GHC.Internal.Float.ConversionUtils
import GHC.Internal.Bignum.BigNat
+#if WORD_SIZE_IN_BITS == 64
+import GHC.Internal.Prim (
+ int64ToInt#,
+ word64ToWord#,
+ )
+#endif
+
infixr 8 **
-- $setup
=====================================
libraries/ghc-internal/src/GHC/Internal/Float/RealFracMethods.hs
=====================================
@@ -66,7 +66,7 @@ import GHC.Internal.Classes (Ord(..))
import GHC.Internal.Num () -- instance Num Integer
-- (We could remove uses with a little effort)
import GHC.Internal.Prim (
- Int#, eqFloat#, decodeFloat_Int#, double2Int#, float2Int#, int2Float#,
+ eqFloat#, decodeFloat_Int#, double2Int#, float2Int#, int2Float#,
int2Double#, int2Word#, ltFloat#, minusFloat#, negateFloat#, negateDouble#,
negateInt#, uncheckedIShiftL#, uncheckedIShiftRA#, uncheckedIShiftRL#,
(+#), (-#), (<#), (>#), (-##), (==##), (<##),
@@ -86,6 +86,10 @@ import GHC.Internal.Prim (
#else
+import GHC.Internal.Prim (
+ Int#,
+ )
+
#define TO64 integerToInt#
#define FROM64 IS
#define MINUS64 ( -# )
@@ -355,4 +359,3 @@ foreign import ccall unsafe "rintDouble"
foreign import ccall unsafe "rintFloat"
c_rintFloat :: Float -> Float
-
=====================================
libraries/ghc-internal/src/GHC/Internal/IO/FD.hs
=====================================
@@ -30,7 +30,7 @@ module GHC.Internal.IO.FD (
) where
import GHC.Internal.Base (
- String, fmap, id, otherwise, pure, return, when, ($), (.), (++), (>>=),
+ String, fmap, otherwise, pure, return, when, ($), (.), (++), (>>=),
)
import GHC.Internal.Bits
import GHC.Internal.Classes (Eq(..), Ord(..), not, (&&), (||))
@@ -58,6 +58,10 @@ import GHC.Internal.Err (error)
import GHC.Internal.Windows
import GHC.Internal.IO.SubSystem (())
import GHC.Internal.Foreign.Storable
+#else
+import GHC.Internal.Base (
+ id,
+ )
#endif
import GHC.Internal.Foreign.C.Types
=====================================
libraries/ghc-internal/src/GHC/Internal/Int.hs
=====================================
@@ -51,7 +51,7 @@ import GHC.Internal.Classes (
Eq(..), Ord(..),
eqInt, neInt, gtInt, geInt, ltInt, leInt,
divInt8#, divInt16#, divInt32#,
- divModInt8#, divModInt16#, divModInt32#, divModInt#,
+ divModInt8#, divModInt16#, divModInt32#,
modInt8#, modInt16#, modInt32#,
(&&), (||),
)
@@ -63,6 +63,12 @@ import GHC.Internal.Arr
import GHC.Internal.Show
import GHC.Internal.Types (Bool(..), Float, Double, Int(..), isTrue#)
+#if WORD_SIZE_IN_BITS == 64
+import GHC.Internal.Classes (
+ divModInt#,
+ )
+#endif
+
------------------------------------------------------------------------
-- type Int8
------------------------------------------------------------------------
=====================================
libraries/ghc-internal/src/GHC/Internal/RTS/Flags.hsc
=====================================
@@ -66,7 +66,7 @@ import GHC.Internal.Ptr
import GHC.Internal.Types (Bool(..), Double, Int)
import GHC.Internal.Word
import GHC.Internal.Base (
- String, otherwise, pure, return, (.), (++), (<*>), (=<<),
+ String, otherwise, return, (.), (++), (<*>), (=<<),
)
import GHC.Internal.Enum
import GHC.Internal.Generics (Generic)
@@ -74,6 +74,10 @@ import GHC.Internal.IO
import GHC.Internal.Real
import GHC.Internal.Show
+#if defined(javascript_HOST_ARCH)
+import GHC.Internal.Base (pure)
+#endif
+
-- | 'RtsTime' is defined as a @StgWord64@ in @stg/Types.h@
--
-- @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
)
where
-import GHC.Internal.Base (pure)
import GHC.Internal.Ptr
-import GHC.Internal.Foreign.C.Types
-import GHC.Internal.Foreign.Marshal.Utils
import GHC.Internal.Foreign.Storable
import GHC.Internal.Data.Functor ((<$>))
import GHC.Internal.Types (Bool(..), Int, IO)
import GHC.Internal.Word (Word32)
import GHC.Internal.Real (fromIntegral)
+#if defined(javascript_HOST_ARCH)
+import GHC.Internal.Base (pure)
+#else
+import GHC.Internal.Foreign.C.Types
+import GHC.Internal.Foreign.Marshal.Utils
+#endif
+
#include "Rts.h"
#include "rts/Flags.h"
=====================================
libraries/ghc-internal/src/GHC/Internal/System/Environment.hs
=====================================
@@ -49,9 +49,13 @@ import GHC.Internal.Base (fmap)
import GHC.Internal.Classes (Ord(..))
import GHC.Internal.Control.Exception.Base (bracket)
import GHC.Internal.Err (undefined)
+#else
+import GHC.Internal.Base (
+ map, (++),
+ )
#endif
import GHC.Internal.Base (
- String, liftM, map, mapM, otherwise, return, ($), (.), (++), (>>=),
+ String, liftM, mapM, otherwise, return, ($), (.), (>>=),
)
import GHC.Internal.List (null, elem, takeWhile, break)
import GHC.Internal.Maybe (Maybe(..))
=====================================
libraries/ghc-internal/src/GHC/Internal/System/Environment/Blank.hsc
=====================================
@@ -43,7 +43,7 @@ import GHC.Internal.Classes (Eq(..))
import GHC.Internal.Data.Functor
import GHC.Internal.Data.List (elem, null, takeWhile)
import GHC.Internal.Foreign.C.String
-import GHC.Internal.Base (String, otherwise, return, ($))
+import GHC.Internal.Base (String, otherwise, ($))
#if defined(mingw32_HOST_OS)
import GHC.Internal.Base ((.))
import GHC.Internal.Foreign.Ptr
@@ -51,6 +51,7 @@ import GHC.Internal.Windows
import GHC.Internal.Control.Monad
import GHC.Internal.Data.List (lookup)
#else
+import GHC.Internal.Base (return)
import GHC.Internal.Foreign.C.Error
import GHC.Internal.Foreign.C.Types
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, ($), (.), (>>=))
import GHC.Internal.List
#if !defined(mingw32_HOST_OS)
import GHC.Internal.IORef
+import GHC.Internal.Types (Int)
#endif
import GHC.Internal.Num
import GHC.Internal.IO hiding ( bracket, onException )
@@ -262,7 +263,7 @@ import GHC.Internal.IO.Encoding
import GHC.Internal.Text.Read
import GHC.Internal.IO.StdHandles
import GHC.Internal.Show
-import GHC.Internal.Types (Bool(..), Char, Int)
+import GHC.Internal.Types (Bool(..), Char)
-----------------------------------------------------------------------------
-- Standard IO
=====================================
libraries/ghc-internal/src/GHC/Internal/System/Posix/Internals.hs
=====================================
@@ -46,19 +46,20 @@ import GHC.Internal.Data.Maybe
#if !defined(HTYPE_TCFLAG_T)
import GHC.Internal.System.IO.Error
+#if !defined(mingw32_HOST_OS)
+import GHC.Internal.Err (errorWithoutStackTrace)
+#endif
#endif
import GHC.Internal.Base (
String, otherwise, pure, return, when, ($), (++), (>>=),
)
import GHC.Internal.Bits
-import GHC.Internal.Classes (Eq(..), Ord(..), not, (&&), (||))
-import GHC.Internal.CString (cstringLength#)
-import GHC.Internal.Err (errorWithoutStackTrace)
+import GHC.Internal.Classes (Eq(..), not, (&&), (||))
import GHC.Internal.Num
import GHC.Internal.Prim (yield#)
import GHC.Internal.Real
-import GHC.Internal.Types (Bool(..), Int(..))
+import GHC.Internal.Types (Bool(..))
import GHC.Internal.Word
import GHC.Internal.IO
import GHC.Internal.IO.IOMode
@@ -71,10 +72,13 @@ import GHC.Internal.Int (Int64)
#endif
#if !defined(mingw32_HOST_OS)
+import GHC.Internal.CString (cstringLength#)
+import GHC.Internal.Classes (Ord(..))
import {-# SOURCE #-} GHC.Internal.IO.Encoding (getFileSystemEncoding)
import GHC.Internal.Foreign.Marshal.Utils
import GHC.Internal.Foreign.Storable
import qualified GHC.Internal.Foreign.C.String.Encoding as GHC
+import GHC.Internal.Types (Int(..))
#else
import GHC.Internal.Int
import GHC.Internal.Data.OldList (elem)
=====================================
libraries/ghc-internal/src/GHC/Internal/TopHandler.hs
=====================================
@@ -39,12 +39,12 @@ module GHC.Internal.TopHandler (
import GHC.Internal.Control.Exception
import GHC.Internal.Data.Maybe
-import GHC.Internal.Classes (Eq(..), Ord(..), (&&))
+import GHC.Internal.Classes (Eq(..))
import GHC.Internal.Foreign.C.Error
import GHC.Internal.Foreign.C.Types
import GHC.Internal.Foreign.C.String
import GHC.Internal.Base (
- String, const, failIO, otherwise, pure, return, ($), (++), (>>),
+ String, failIO, return, ($), (++), (>>),
)
import GHC.Internal.Conc.Sync hiding (throwTo)
import GHC.Internal.Prim (Weak#, seq)
@@ -67,6 +67,17 @@ import GHC.Internal.Conc.Signal
import GHC.Internal.Data.Dynamic (toDyn)
#endif
+#if !defined(HAVE_SIGNAL_H)
+import GHC.Internal.Base (pure)
+#endif
+
+#if !defined(mingw32_HOST_OS) && !defined(javascript_HOST_ARCH)
+import GHC.Internal.Base (
+ const, otherwise,
+ )
+import GHC.Internal.Classes (Ord(..), (&&))
+#endif
+
-- Note [rts_setMainThread must be called unsafely]
-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-- rts_setMainThread must be called as unsafe, because it
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/d9d15deeb76375e87e3567f9b7437cf...
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/d9d15deeb76375e87e3567f9b7437cf...
You're receiving this email because of your account on gitlab.haskell.org.