Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add the applicable new (version 9.10) GHC flags to normaliseGhcArgs (backport #10014) #10106

Merged
merged 2 commits into from
Jun 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 27 additions & 4 deletions Cabal/src/Distribution/Simple/Program/GHC.hs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE MultiWayIf #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE ScopedTypeVariables #-}
Expand Down Expand Up @@ -223,8 +224,27 @@ normaliseGhcArgs (Just ghcVersion) PackageDescription{..} ghcArgs
, "keep-going" -- try harder, the build will still fail if it's erroneous
, "print-axiom-incomps" -- print more debug info for closed type families
]
, from
[9, 2]
[ "family-application-cache"
]
, from
[9, 6]
[ "print-redundant-promotion-ticks"
, "show-error-context"
]
, from
[9, 8]
[ "unoptimized-core-for-interpreter"
]
, from
[9, 10]
[ "diagnostics-as-json"
, "print-error-index-links"
, "break-points"
]
]
, flagIn . invertibleFlagSet "-d" $ ["ppr-case-as-let", "ppr-ticks"]
, flagIn $ invertibleFlagSet "-d" ["ppr-case-as-let", "ppr-ticks"]
, isOptIntFlag
, isIntFlag
, if safeToFilterWarnings
Expand Down Expand Up @@ -285,6 +305,7 @@ normaliseGhcArgs (Just ghcVersion) PackageDescription{..} ghcArgs
, from [8, 6] ["-dhex-word-literals"]
, from [8, 8] ["-fshow-docs-of-hole-fits", "-fno-show-docs-of-hole-fits"]
, from [9, 0] ["-dlinear-core-lint"]
, from [9, 10] ["-dipe-stats"]
]

isOptIntFlag :: String -> Any
Expand Down Expand Up @@ -694,7 +715,10 @@ renderGhcOptions comp _platform@(Platform _arch os) opts
| flagProfAuto implInfo -> ["-fprof-auto-exported"]
| otherwise -> ["-auto"]
, ["-split-sections" | flagBool ghcOptSplitSections]
, ["-split-objs" | flagBool ghcOptSplitObjs]
, case compilerCompatVersion GHC comp of
-- the -split-objs flag was removed in GHC 9.8
Just ver | ver >= mkVersion [9, 8] -> []
_ -> ["-split-objs" | flagBool ghcOptSplitObjs]
, case flagToMaybe (ghcOptHPCDir opts) of
Nothing -> []
Just hpcdir -> ["-fhpc", "-hpcdir", hpcdir]
Expand Down Expand Up @@ -784,8 +808,7 @@ renderGhcOptions comp _platform@(Platform _arch os) opts
-- Packages

concat
[ [ case () of
_
[ [ if
| unitIdSupported comp -> "-this-unit-id"
| packageKeySupported comp -> "-this-package-key"
| otherwise -> "-package-name"
Expand Down
11 changes: 11 additions & 0 deletions changelog.d/pr-10014
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
synopsis: Update ghc args normalization and ghc option rendering
packages: Cabal
issues: #9729
prs: #10014

description: {

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.

--{enable,disable}-split-objs is not shown on in the helper for GHC >= 9.8
}
Loading