Skip to content

Commit a147f1b

Browse files
mergify[bot]MangoIVgeekosaur
authored
add the applicable new (version 9.10) GHC flags to normaliseGhcArgs (backport #10014) (#10106)
* add the applicable new (version 9.10) GHC flags to normaliseGhcArgs (#10014) * add the applicable new (versions 9.2 - 9.10) GHC flags to normaliseGhcArgs Actionable flags are: - fdiagnostics-as-json (changes the format GHC outputs its diagnostics) - fprint-error-index-lists (changes the way GHC displays compile time) - fbreak-points (enables/disables break-points in GHCi) - dipe-stats (dumps information about which info tables have IPE information) - ffamily-application-cache (only changes the speed of the compiler) - fprint-redundant-promotion-ticks - show-error-context - unoptimized-core-for-interpreter (only applies to GHCi) * [chore] correct the flag names and add a FUTUREWORK (cherry picked from commit be10be8) # Conflicts: # Cabal/src/Distribution/Simple/Program.hs * fixup! add the applicable new (version 9.10) GHC flags to normaliseGhcArgs (#10014) --------- Co-authored-by: Mango The Fourth <[email protected]> Co-authored-by: brandon s allbery kf8nh <[email protected]>
1 parent d873282 commit a147f1b

File tree

2 files changed

+38
-4
lines changed

2 files changed

+38
-4
lines changed

Cabal/src/Distribution/Simple/Program/GHC.hs

+27-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{-# LANGUAGE DeriveGeneric #-}
22
{-# LANGUAGE FlexibleContexts #-}
3+
{-# LANGUAGE MultiWayIf #-}
34
{-# LANGUAGE RankNTypes #-}
45
{-# LANGUAGE RecordWildCards #-}
56
{-# LANGUAGE ScopedTypeVariables #-}
@@ -223,8 +224,27 @@ normaliseGhcArgs (Just ghcVersion) PackageDescription{..} ghcArgs
223224
, "keep-going" -- try harder, the build will still fail if it's erroneous
224225
, "print-axiom-incomps" -- print more debug info for closed type families
225226
]
227+
, from
228+
[9, 2]
229+
[ "family-application-cache"
230+
]
231+
, from
232+
[9, 6]
233+
[ "print-redundant-promotion-ticks"
234+
, "show-error-context"
235+
]
236+
, from
237+
[9, 8]
238+
[ "unoptimized-core-for-interpreter"
239+
]
240+
, from
241+
[9, 10]
242+
[ "diagnostics-as-json"
243+
, "print-error-index-links"
244+
, "break-points"
245+
]
226246
]
227-
, flagIn . invertibleFlagSet "-d" $ ["ppr-case-as-let", "ppr-ticks"]
247+
, flagIn $ invertibleFlagSet "-d" ["ppr-case-as-let", "ppr-ticks"]
228248
, isOptIntFlag
229249
, isIntFlag
230250
, if safeToFilterWarnings
@@ -285,6 +305,7 @@ normaliseGhcArgs (Just ghcVersion) PackageDescription{..} ghcArgs
285305
, from [8, 6] ["-dhex-word-literals"]
286306
, from [8, 8] ["-fshow-docs-of-hole-fits", "-fno-show-docs-of-hole-fits"]
287307
, from [9, 0] ["-dlinear-core-lint"]
308+
, from [9, 10] ["-dipe-stats"]
288309
]
289310

290311
isOptIntFlag :: String -> Any
@@ -694,7 +715,10 @@ renderGhcOptions comp _platform@(Platform _arch os) opts
694715
| flagProfAuto implInfo -> ["-fprof-auto-exported"]
695716
| otherwise -> ["-auto"]
696717
, ["-split-sections" | flagBool ghcOptSplitSections]
697-
, ["-split-objs" | flagBool ghcOptSplitObjs]
718+
, case compilerCompatVersion GHC comp of
719+
-- the -split-objs flag was removed in GHC 9.8
720+
Just ver | ver >= mkVersion [9, 8] -> []
721+
_ -> ["-split-objs" | flagBool ghcOptSplitObjs]
698722
, case flagToMaybe (ghcOptHPCDir opts) of
699723
Nothing -> []
700724
Just hpcdir -> ["-fhpc", "-hpcdir", hpcdir]
@@ -784,8 +808,7 @@ renderGhcOptions comp _platform@(Platform _arch os) opts
784808
-- Packages
785809

786810
concat
787-
[ [ case () of
788-
_
811+
[ [ if
789812
| unitIdSupported comp -> "-this-unit-id"
790813
| packageKeySupported comp -> "-this-package-key"
791814
| otherwise -> "-package-name"

changelog.d/pr-10014

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
synopsis: Update ghc args normalization and ghc option rendering
2+
packages: Cabal
3+
issues: #9729
4+
prs: #10014
5+
6+
description: {
7+
8+
The flags -fdiagnostics-as-json, -fprint-error-index-lists, -fbreak-points, -dipe-stats, -ffamily-application-cache, -fprint-redundant-promotion-ticks, -fshow-error-context and -funoptimized-core-for-interpreter have been added to the flags that do not cause recompilation.
9+
10+
--{enable,disable}-split-objs is not shown on in the helper for GHC >= 9.8
11+
}

0 commit comments

Comments
 (0)