[Git][ghc/ghc][wip/supersven/correctly_propagate_host-build-target] Only add flags if they are new
Sven Tennie pushed to branch wip/supersven/correctly_propagate_host-build-target at Glasgow Haskell Compiler / GHC Commits: b9784bd6 by Sven Tennie at 2026-03-25T14:54:14+01:00 Only add flags if they are new This prevents duplicated when the user already set the arguments in CXXFLAGS or CFLAGS. - - - - - 2 changed files: - utils/ghc-toolchain/src/GHC/Toolchain/Tools/Cpp.hs - utils/ghc-toolchain/src/GHC/Toolchain/Tools/Link.hs Changes: ===================================== utils/ghc-toolchain/src/GHC/Toolchain/Tools/Cpp.hs ===================================== @@ -61,7 +61,7 @@ findHsCpp progOpt cc = checking "for Haskell C preprocessor" $ do let rawHsCppProgram = addFlagIfNew "-E" foundHsCppProg -- Always try to add the Haskell-specific CPP flags, regardless of the user options hppArgs <- findHsCppArgs rawHsCppProgram - let hsCppProgram = over _prgFlags (++hppArgs) rawHsCppProgram + let hsCppProgram = foldr addFlagIfNew rawHsCppProgram (reverse hppArgs) return HsCpp{hsCppProgram} -- | Given a C preprocessor, figure out how it should be invoked to preprocess ===================================== utils/ghc-toolchain/src/GHC/Toolchain/Tools/Link.hs ===================================== @@ -383,7 +383,7 @@ addOSMinGW32CcFlags archOs cc link -- See Note [Windows stack allocations]. checkFStackCheck :: Cc -> Program -> M Program checkFStackCheck cc link = checking "that -fstack-check works" $ do - let link' = link & _prgFlags %++ "-fstack-check" + let link' = addFlagIfNew "-fstack-check" link checkLinkWorks cc link' return link' @@ -393,7 +393,7 @@ addNoAsNeeded archOs cc ccLink | os <- archOS_OS archOs , osElfTarget os = checking "that --no-as-needed works" $ do - let ccLink' = over _prgFlags (++["-Wl,--no-as-needed"]) ccLink + let ccLink' = addFlagIfNew "-Wl,--no-as-needed" ccLink checkLinkWorks cc ccLink' return ccLink' | otherwise = return ccLink View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/b9784bd6dd7f13982ddcbbaa477d17ae... -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/b9784bd6dd7f13982ddcbbaa477d17ae... You're receiving this email because of your account on gitlab.haskell.org.
participants (1)
-
Sven Tennie (@supersven)