Skip to content

Commit ab80360

Browse files
MangoIVerikd
authored andcommitted
add the applicable new (version 9.10) GHC flags to normaliseGhcArgs (haskell#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
1 parent 9cdc9f6 commit ab80360

File tree

3 files changed

+45
-4
lines changed

3 files changed

+45
-4
lines changed

Cabal/src/Distribution/Simple/Program.hs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
{- FUTUREWORK:
2+
-
3+
- Currently the logic in this module is not tested.
4+
-
5+
- Ideally, a set of unit tests that check whether certain
6+
- flags trigger recompilation should be added.
7+
- -}
18
{-# LANGUAGE DataKinds #-}
29
{-# LANGUAGE FlexibleContexts #-}
310
{-# LANGUAGE RankNTypes #-}

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

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{-# LANGUAGE DataKinds #-}
22
{-# LANGUAGE DeriveGeneric #-}
33
{-# LANGUAGE FlexibleContexts #-}
4+
{-# LANGUAGE MultiWayIf #-}
45
{-# LANGUAGE RankNTypes #-}
56
{-# LANGUAGE RecordWildCards #-}
67
{-# LANGUAGE ScopedTypeVariables #-}
@@ -227,8 +228,27 @@ normaliseGhcArgs (Just ghcVersion) PackageDescription{..} ghcArgs
227228
, "keep-going" -- try harder, the build will still fail if it's erroneous
228229
, "print-axiom-incomps" -- print more debug info for closed type families
229230
]
231+
, from
232+
[9, 2]
233+
[ "family-application-cache"
234+
]
235+
, from
236+
[9, 6]
237+
[ "print-redundant-promotion-ticks"
238+
, "show-error-context"
239+
]
240+
, from
241+
[9, 8]
242+
[ "unoptimized-core-for-interpreter"
243+
]
244+
, from
245+
[9, 10]
246+
[ "diagnostics-as-json"
247+
, "print-error-index-links"
248+
, "break-points"
249+
]
230250
]
231-
, flagIn . invertibleFlagSet "-d" $ ["ppr-case-as-let", "ppr-ticks"]
251+
, flagIn $ invertibleFlagSet "-d" ["ppr-case-as-let", "ppr-ticks"]
232252
, isOptIntFlag
233253
, isIntFlag
234254
, if safeToFilterWarnings
@@ -289,6 +309,7 @@ normaliseGhcArgs (Just ghcVersion) PackageDescription{..} ghcArgs
289309
, from [8, 6] ["-dhex-word-literals"]
290310
, from [8, 8] ["-fshow-docs-of-hole-fits", "-fno-show-docs-of-hole-fits"]
291311
, from [9, 0] ["-dlinear-core-lint"]
312+
, from [9, 10] ["-dipe-stats"]
292313
]
293314

294315
isOptIntFlag :: String -> Any
@@ -709,7 +730,10 @@ renderGhcOptions comp _platform@(Platform _arch os) opts
709730
| flagProfAuto implInfo -> ["-fprof-auto-exported"]
710731
| otherwise -> ["-auto"]
711732
, ["-split-sections" | flagBool ghcOptSplitSections]
712-
, ["-split-objs" | flagBool ghcOptSplitObjs]
733+
, case compilerCompatVersion GHC comp of
734+
-- the -split-objs flag was removed in GHC 9.8
735+
Just ver | ver >= mkVersion [9, 8] -> []
736+
_ -> ["-split-objs" | flagBool ghcOptSplitObjs]
713737
, case flagToMaybe (ghcOptHPCDir opts) of
714738
Nothing -> []
715739
Just hpcdir -> ["-fhpc", "-hpcdir", u hpcdir]
@@ -799,8 +823,7 @@ renderGhcOptions comp _platform@(Platform _arch os) opts
799823
-- Packages
800824

801825
concat
802-
[ [ case () of
803-
_
826+
[ [ if
804827
| unitIdSupported comp -> "-this-unit-id"
805828
| packageKeySupported comp -> "-this-package-key"
806829
| otherwise -> "-package-name"

changelog.d/pr-10014

Lines changed: 11 additions & 0 deletions
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)