Skip to content

Commit 7812a9b

Browse files
committed
Replace MIN_GHC_API_VERSION with MIN_VERSION_ghc
1 parent 7931e2f commit 7812a9b

File tree

17 files changed

+89
-89
lines changed

17 files changed

+89
-89
lines changed

ghcide/session-loader/Development/IDE/Session.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -504,7 +504,7 @@ cradleToOptsAndLibDir cradle file = do
504504
emptyHscEnv :: IORef NameCache -> FilePath -> IO HscEnv
505505
emptyHscEnv nc libDir = do
506506
env <- runGhc (Just libDir) getSession
507-
#if !MIN_GHC_API_VERSION(9,0,0)
507+
#if !MIN_VERSION_ghc(9,0,0)
508508
-- This causes ghc9 to crash
509509
initDynLinker env
510510
#endif

ghcide/src/Development/IDE/Core/Compile.hs

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ import LoadIface (loadModuleInterface)
5757

5858
import Lexer
5959
import qualified Parser
60-
#if MIN_GHC_API_VERSION(8,10,0)
60+
#if MIN_VERSION_ghc(8,10,0)
6161
import Control.DeepSeq (force, rnf)
6262
#else
6363
import Control.DeepSeq (rnf)
@@ -81,7 +81,7 @@ import MkIface
8181
import StringBuffer as SB
8282
import TcIface (typecheckIface)
8383
import TcRnMonad hiding (newUnique)
84-
#if MIN_GHC_API_VERSION(9,0,1)
84+
#if MIN_VERSION_ghc(9,0,1)
8585
import GHC.Builtin.Names
8686
import GHC.Iface.Recomp
8787
import GHC.Tc.Gen.Splice
@@ -241,7 +241,7 @@ mkHiFileResultNoCompile session tcm = do
241241
tcGblEnv = tmrTypechecked tcm
242242
details <- makeSimpleDetails hsc_env_tmp tcGblEnv
243243
sf <- finalSafeMode (ms_hspp_opts ms) tcGblEnv
244-
#if MIN_GHC_API_VERSION(8,10,0)
244+
#if MIN_VERSION_ghc(8,10,0)
245245
iface <- mkIfaceTc hsc_env_tmp sf details tcGblEnv
246246
#else
247247
(iface, _) <- mkIfaceTc hsc_env_tmp Nothing sf details tcGblEnv
@@ -275,10 +275,10 @@ mkHiFileResultCompile session' tcm simplified_guts ltype = catchErrs $ do
275275
(guts, details) <- tidyProgram session simplified_guts
276276
(diags, linkable) <- genLinkable session ms guts
277277
pure (linkable, details, diags)
278-
#if MIN_GHC_API_VERSION(9,0,1)
278+
#if MIN_VERSION_ghc(9,0,1)
279279
let !partial_iface = force (mkPartialIface session details simplified_guts)
280280
final_iface <- mkFullIface session partial_iface Nothing
281-
#elif MIN_GHC_API_VERSION(8,10,0)
281+
#elif MIN_VERSION_ghc(8,10,0)
282282
let !partial_iface = force (mkPartialIface session details simplified_guts)
283283
final_iface <- mkFullIface session partial_iface
284284
#else
@@ -340,18 +340,18 @@ generateObjectCode session summary guts = do
340340
(warnings, dot_o_fp) <-
341341
withWarnings "object" $ \_tweak -> do
342342
let summary' = _tweak summary
343-
#if MIN_GHC_API_VERSION(8,10,0)
343+
#if MIN_VERSION_ghc(8,10,0)
344344
target = defaultObjectTarget $ hsc_dflags session
345345
#else
346346
target = defaultObjectTarget $ targetPlatform $ hsc_dflags session
347347
#endif
348348
session' = session { hsc_dflags = updOptLevel 0 $ (ms_hspp_opts summary') { outputFile = Just dot_o , hscTarget = target}}
349-
#if MIN_GHC_API_VERSION(9,0,1)
349+
#if MIN_VERSION_ghc(9,0,1)
350350
(outputFilename, _mStub, _foreign_files, _cinfos) <- hscGenHardCode session' guts
351351
#else
352352
(outputFilename, _mStub, _foreign_files) <- hscGenHardCode session' guts
353353
#endif
354-
#if MIN_GHC_API_VERSION(8,10,0)
354+
#if MIN_VERSION_ghc(8,10,0)
355355
(ms_location summary')
356356
#else
357357
summary'
@@ -374,7 +374,7 @@ generateByteCode hscEnv summary guts = do
374374
let summary' = _tweak summary
375375
session = hscEnv { hsc_dflags = ms_hspp_opts summary' }
376376
hscInteractive session guts
377-
#if MIN_GHC_API_VERSION(8,10,0)
377+
#if MIN_VERSION_ghc(8,10,0)
378378
(ms_location summary')
379379
#else
380380
summary'
@@ -433,7 +433,7 @@ unnecessaryDeprecationWarningFlags
433433
, Opt_WarnUnusedMatches
434434
, Opt_WarnUnusedTypePatterns
435435
, Opt_WarnUnusedForalls
436-
#if MIN_GHC_API_VERSION(8,10,0)
436+
#if MIN_VERSION_ghc(8,10,0)
437437
, Opt_WarnUnusedRecordWildcards
438438
#endif
439439
, Opt_WarnInaccessibleCode
@@ -478,7 +478,7 @@ generateHieAsts hscEnv tcm =
478478
-- don't export an interface which allows for additional information to be added to hie files.
479479
let fake_splice_binds = listToBag (map (mkVarBind unitDataConId) (spliceExpresions $ tmrTopLevelSplices tcm))
480480
real_binds = tcg_binds $ tmrTypechecked tcm
481-
#if MIN_GHC_API_VERSION(9,0,1)
481+
#if MIN_VERSION_ghc(9,0,1)
482482
-- TODO: Use some proper values here!
483483
evBinds = emptyBag @EvBind :: Bag EvBind
484484
clsInsts = [] :: [ClsInst]
@@ -760,7 +760,7 @@ getModSummaryFromImports env fp modTime contents = do
760760
msrModSummary =
761761
ModSummary
762762
{ ms_mod = modl
763-
#if MIN_GHC_API_VERSION(8,8,0)
763+
#if MIN_VERSION_ghc(8,8,0)
764764
, ms_hie_date = Nothing
765765
#endif
766766
, ms_hs_date = modTime
@@ -800,15 +800,15 @@ parseHeader
800800
=> DynFlags -- ^ flags to use
801801
-> FilePath -- ^ the filename (for source locations)
802802
-> SB.StringBuffer -- ^ Haskell module source text (full Unicode is supported)
803-
#if MIN_GHC_API_VERSION(9,0,1)
803+
#if MIN_VERSION_ghc(9,0,1)
804804
-> ExceptT [FileDiagnostic] m ([FileDiagnostic], Located(HsModule))
805805
#else
806806
-> ExceptT [FileDiagnostic] m ([FileDiagnostic], Located(HsModule GhcPs))
807807
#endif
808808
parseHeader dflags filename contents = do
809809
let loc = mkRealSrcLoc (mkFastString filename) 1 1
810810
case unP Parser.parseHeader (mkPState dflags contents loc) of
811-
#if MIN_GHC_API_VERSION(8,10,0)
811+
#if MIN_VERSION_ghc(8,10,0)
812812
PFailed pst ->
813813
throwE $ diagFromErrMsgs "parser" dflags $ getErrorMessages pst dflags
814814
#else
@@ -846,7 +846,7 @@ parseFileContents env customPreprocessor filename ms = do
846846
dflags = ms_hspp_opts ms
847847
contents = fromJust $ ms_hspp_buf ms
848848
case unP Parser.parseModule (mkPState dflags contents loc) of
849-
#if MIN_GHC_API_VERSION(8,10,0)
849+
#if MIN_VERSION_ghc(8,10,0)
850850
PFailed pst -> throwE $ diagFromErrMsgs "parser" dflags $ getErrorMessages pst dflags
851851
#else
852852
PFailed _ locErr msgErr ->
@@ -855,7 +855,7 @@ parseFileContents env customPreprocessor filename ms = do
855855
POk pst rdr_module ->
856856
let hpm_annotations :: ApiAnns
857857
hpm_annotations =
858-
#if MIN_GHC_API_VERSION(9,0,1)
858+
#if MIN_VERSION_ghc(9,0,1)
859859
-- Copied from GHC.Driver.Main
860860
ApiAnns {
861861
apiAnnItems = Map.fromListWith (++) $ annotations pst,

ghcide/src/Development/IDE/GHC/CPP.hs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,12 @@ import FileCleanup
3030
import Packages
3131
import Panic
3232
import SysTools
33-
#if MIN_GHC_API_VERSION(8,8,2)
33+
#if MIN_VERSION_ghc(8,8,2)
3434
import LlvmCodeGen (llvmVersionList)
35-
#elif MIN_GHC_API_VERSION(8,8,0)
35+
#elif MIN_VERSION_ghc(8,8,0)
3636
import LlvmCodeGen (LlvmVersion (..))
3737
#endif
38-
#if MIN_GHC_API_VERSION (8,10,0)
38+
#if MIN_VERSION_ghc (8,10,0)
3939
import Fingerprint
4040
import ToolSettings
4141
#endif
@@ -65,7 +65,7 @@ doCpp dflags raw input_fn output_fn = do
6565
let verbFlags = getVerbFlags dflags
6666

6767
let cpp_prog args | raw = SysTools.runCpp dflags args
68-
#if MIN_GHC_API_VERSION(8,10,0)
68+
#if MIN_VERSION_ghc(8,10,0)
6969
| otherwise = SysTools.runCc Nothing
7070
#else
7171
| otherwise = SysTools.runCc
@@ -149,11 +149,11 @@ getBackendDefs :: DynFlags -> IO [String]
149149
getBackendDefs dflags | hscTarget dflags == HscLlvm = do
150150
llvmVer <- figureLlvmVersion dflags
151151
return $ case llvmVer of
152-
#if MIN_GHC_API_VERSION(8,8,2)
152+
#if MIN_VERSION_ghc(8,8,2)
153153
Just v
154154
| [m] <- llvmVersionList v -> [ "-D__GLASGOW_HASKELL_LLVM__=" ++ format (m, 0) ]
155155
| m:n:_ <- llvmVersionList v -> [ "-D__GLASGOW_HASKELL_LLVM__=" ++ format (m, n) ]
156-
#elif MIN_GHC_API_VERSION(8,8,0)
156+
#elif MIN_VERSION_ghc(8,8,0)
157157
Just (LlvmVersion n) -> [ "-D__GLASGOW_HASKELL_LLVM__=" ++ format (n,0) ]
158158
Just (LlvmVersionOld m n) -> [ "-D__GLASGOW_HASKELL_LLVM__=" ++ format (m,n) ]
159159
#else
@@ -169,7 +169,7 @@ getBackendDefs _ =
169169
return []
170170

171171
addOptP :: String -> DynFlags -> DynFlags
172-
#if MIN_GHC_API_VERSION (8,10,0)
172+
#if MIN_VERSION_ghc (8,10,0)
173173
addOptP f = alterToolSettings $ \s -> s
174174
{ toolSettings_opt_P = f : toolSettings_opt_P s
175175
, toolSettings_opt_P_fingerprint = fingerprintStrings (f : toolSettings_opt_P s)

0 commit comments

Comments
 (0)