diff options
author | Ben Gamari <ben@smart-cactus.org> | 2022-03-26 19:58:13 -0400 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2022-04-06 13:03:16 -0400 |
commit | c41c478eb9003eaa9fc8081a0039652448124f5d (patch) | |
tree | 82a962e73d37b5c3d9b705ad211aeb69cfd2c265 | |
parent | 018453751b10cf26506d5076f08fc3a537973d9e (diff) | |
download | haskell-c41c478eb9003eaa9fc8081a0039652448124f5d.tar.gz |
Fix a few new warnings when booting with GHC 9.2.2
-Wuni-incomplete-patterns and apparent improvements in the pattern match
checker surfaced these.
-rw-r--r-- | compiler/GHC/Linker/Loader.hs | 11 | ||||
-rw-r--r-- | hadrian/src/Rules/SourceDist.hs | 5 | ||||
-rw-r--r-- | utils/deriveConstants/Main.hs | 2 | ||||
-rw-r--r-- | utils/genprimopcode/Main.hs | 6 |
4 files changed, 18 insertions, 6 deletions
diff --git a/compiler/GHC/Linker/Loader.hs b/compiler/GHC/Linker/Loader.hs index 8db50f0180..440780f544 100644 --- a/compiler/GHC/Linker/Loader.hs +++ b/compiler/GHC/Linker/Loader.hs @@ -622,12 +622,16 @@ dieWith dflags span msg = throwGhcExceptionIO (ProgramError (showSDoc dflags (mk checkNonStdWay :: DynFlags -> Interp -> SrcSpan -> IO (Maybe FilePath) -checkNonStdWay dflags interp srcspan +checkNonStdWay _dflags interp _srcspan | ExternalInterp {} <- interpInstance interp = return Nothing -- with -fexternal-interpreter we load the .o files, whatever way -- they were built. If they were built for a non-std way, then -- we will use the appropriate variant of the iserv binary to load them. +-- #if-guard the following equations otherwise the pattern match checker will +-- complain that they are redundant. +#if defined(HAVE_INTERNAL_INTERPRETER) +checkNonStdWay dflags InternalInterp srcspan | hostFullWays == targetFullWays = return Nothing -- Only if we are compiling with the same ways as GHC is built -- with, can we dynamically load those object files. (see #3604) @@ -642,8 +646,8 @@ checkNonStdWay dflags interp srcspan "" -> "" tag -> tag ++ "_" -normalObjectSuffix :: String -normalObjectSuffix = phaseInputExt StopLn + normalObjectSuffix :: String + normalObjectSuffix = phaseInputExt StopLn data Way' = Normal | Prof | Dyn @@ -677,6 +681,7 @@ failNonStd dflags srcspan = dieWith dflags srcspan $ Normal -> "the normal way" Prof -> "with -prof" Dyn -> "with -dynamic" +#endif getLinkDeps :: HscEnv -> LoaderState diff --git a/hadrian/src/Rules/SourceDist.hs b/hadrian/src/Rules/SourceDist.hs index f37e26ade8..69941d5d5f 100644 --- a/hadrian/src/Rules/SourceDist.hs +++ b/hadrian/src/Rules/SourceDist.hs @@ -135,7 +135,10 @@ prepareTree dest = do let ctx = Context stg pkg vanilla srcInputFile = dest -/- pkgPath pkg -/- inp generatedFile = dest -/- pkgPath pkg -/- out - Just builder = determineBuilder stg inp + builder = + case determineBuilder stg inp of + Just builder -> builder + Nothing -> error $ "Failed to determine builder for " ++ inp -- We first make sure that the generated file is... generated. build $ target ctx builder [srcInputFile] [generatedFile] diff --git a/utils/deriveConstants/Main.hs b/utils/deriveConstants/Main.hs index 4832ccfc89..9a57ecf682 100644 --- a/utils/deriveConstants/Main.hs +++ b/utils/deriveConstants/Main.hs @@ -814,7 +814,7 @@ getWanted verbose os tmpdir gccProgram gccFlags nmProgram mobjdumpProgram , Just sym <- stripPrefix prefix sym0 = Just (sym, read n) | otherwise = Nothing where - [sym0, _] = take 2 (reverse $ words l1) + sym0 = head $ reverse $ words l1 -- If an Int value is larger than 2^28 or smaller -- than -2^28, then fail. diff --git a/utils/genprimopcode/Main.hs b/utils/genprimopcode/Main.hs index c4261e1e00..2bd12e117b 100644 --- a/utils/genprimopcode/Main.hs +++ b/utils/genprimopcode/Main.hs @@ -673,7 +673,11 @@ gen_primop_list (Info _ entries) map (\p -> " , " ++ cons p) rest ++ [ " ]" ] - ) where (first:rest) = concatMap desugarVectorSpec (filter is_primop entries) + ) where + (first,rest) = + case concatMap desugarVectorSpec (filter is_primop entries) of + x:xs -> (x,xs) + [] -> error "gen_primop_list: no primops" mIN_VECTOR_UNIQUE :: Int mIN_VECTOR_UNIQUE = 300 |