[Git][ghc/ghc][wip/T18672] hadrian: Don't include -fdiagnostics-color in argument hash

Ben Gamari gitlab at gitlab.haskell.org
Wed Sep 9 21:03:18 UTC 2020



Ben Gamari pushed to branch wip/T18672 at Glasgow Haskell Compiler / GHC


Commits:
9b81baca by GHC GitLab CI at 2020-09-09T21:03:09+00:00
hadrian: Don't include -fdiagnostics-color in argument hash

Otherwise the input hash will vary with whether colors are requested,
which changed with `isatty`.

Fixes #18672.

- - - - -


2 changed files:

- hadrian/src/Settings/Builders/Ghc.hs
- hadrian/src/Target.hs


Changes:

=====================================
hadrian/src/Settings/Builders/Ghc.hs
=====================================
@@ -35,6 +35,9 @@ compileAndLinkHs = (builder (Ghc CompileHs) ||^ builder (Ghc LinkHs)) ? do
         hasDynamic = elem dynamic ways
     mconcat [ arg "-Wall"
             , not useColor ? builder (Ghc CompileHs) ?
+              -- N.B. Target.trackArgument ignores this argument from the
+              -- input hash to avoid superfluous recompilation, avoiding
+              -- #18672.
               arg "-fdiagnostics-color=never"
             , (hasVanilla && hasDynamic) ? builder (Ghc CompileHs) ?
               platformSupportsSharedLibs ? way vanilla ?


=====================================
hadrian/src/Target.hs
=====================================
@@ -21,11 +21,12 @@ type Target = H.Target Context Builder
 trackArgument :: Target -> String -> Bool
 trackArgument target arg = case builder target of
     Make _    -> not $ threadArg arg
-    Ghc _ _   -> not $ verbosityArg arg
+    Ghc _ _   -> not $ verbosityArg arg || diagnosticsColorArg arg
     Cabal _ _ -> not $ verbosityArg arg || cabal_configure_ignore arg
     _         -> True
   where
     threadArg s = dropWhileEnd isDigit s `elem` ["-j", "MAKEFLAGS=-j", "THREADS="]
     verbosityArg s = dropWhileEnd isDigit s == "-v"
+    diagnosticsColorArg s = "-fdiagnostics-color=" `isPrefixOf` s -- N.B. #18672
     cabal_configure_ignore s =
       s `elem` [ "--configure-option=--quiet", "--configure-option=--disable-option-checking" ]



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/9b81baca848ea7e5d747e7bbe961caad0a07b3e0

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/9b81baca848ea7e5d747e7bbe961caad0a07b3e0
You're receiving this email because of your account on gitlab.haskell.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20200909/ea8cb256/attachment-0001.html>


More information about the ghc-commits mailing list