Skip to content

Commit

Permalink
Don't pas -this-unit-id for everything unless > 9.2
Browse files Browse the repository at this point in the history
  • Loading branch information
mpickering committed Feb 9, 2023
1 parent f793e54 commit d58a1f6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
3 changes: 3 additions & 0 deletions Cabal/src/Distribution/Simple/GHC/ImplInfo.hs
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ data GhcImplInfo = GhcImplInfo
, supportsDebugLevels :: Bool -- ^ supports numeric @-g@ levels
, supportsPkgEnvFiles :: Bool -- ^ picks up @.ghc.environment@ files
, flagWarnMissingHomeModules :: Bool -- ^ -Wmissing-home-modules is supported
, unitIdForExes :: Bool
}

getImplInfo :: Compiler -> GhcImplInfo
Expand Down Expand Up @@ -74,6 +75,7 @@ ghcVersionImplInfo ver = GhcImplInfo
, supportsDebugLevels = v >= [8,0]
, supportsPkgEnvFiles = v >= [8,0,1,20160901] -- broken in 8.0.1, fixed in 8.0.2
, flagWarnMissingHomeModules = v >= [8,2]
, unitIdForExes = v >= [9,2]
}
where
v = versionNumbers ver
Expand All @@ -94,6 +96,7 @@ ghcjsVersionImplInfo _ghcjsver ghcver = GhcImplInfo
, supportsDebugLevels = ghcv >= [8,0]
, supportsPkgEnvFiles = ghcv >= [8,0,2] --TODO: check this works in ghcjs
, flagWarnMissingHomeModules = ghcv >= [8,2]
, unitIdForExes = ghcv >= [9,2]
}
where
ghcv = versionNumbers ghcver
1 change: 1 addition & 0 deletions Cabal/src/Distribution/Simple/GHC/Internal.hs
Original file line number Diff line number Diff line change
Expand Up @@ -424,6 +424,7 @@ componentGhcOptions verbosity implInfo lbi bi clbi odir =
ghcOptThisUnitId = case clbi of
LibComponentLocalBuildInfo { componentCompatPackageKey = pk }
-> toFlag pk
_ | not (unitIdForExes implInfo) -> mempty
ExeComponentLocalBuildInfo { componentUnitId = uid }
-> toFlag (unUnitId uid)
TestComponentLocalBuildInfo { componentUnitId = uid }
Expand Down

0 comments on commit d58a1f6

Please sign in to comment.