[Git][ghc/ghc][wip/romes/12569] Rename pre-processor invocation args
Rodrigo Mesquita (@alt-romes)
gitlab at gitlab.haskell.org
Tue May 7 10:02:17 UTC 2024
Rodrigo Mesquita pushed to branch wip/romes/12569 at Glasgow Haskell Compiler / GHC
Commits:
5edc63d5 by Rodrigo Mesquita at 2024-05-07T11:02:04+01:00
Rename pre-processor invocation args
Small clean up. Uses proper names for the various groups of arguments
that make up the pre-processor invocation.
- - - - -
1 changed file:
- compiler/GHC/SysTools/Tasks.hs
Changes:
=====================================
compiler/GHC/SysTools/Tasks.hs
=====================================
@@ -131,15 +131,15 @@ runSourceCodePreprocessor
runSourceCodePreprocessor logger tmpfs dflags preprocessor args =
traceSystoolCommand logger logger_name $ do
let
- (p, args0) = pgm_getter dflags
- args1 = Option <$> (augmentImports dflags $ getOpts dflags opt_getter)
- args2 = [Option "-Werror" | gopt Opt_WarnIsError dflags]
- ++ [Option "-Wundef" | wopt Opt_WarnCPPUndef dflags]
- all_args = args0 ++ args1 ++ args2 ++ args
+ (program, configured_args) = pgm_getter dflags
+ runtime_args = Option <$> (augmentImports dflags $ getOpts dflags opt_getter)
+ extra_warns = [Option "-Werror" | gopt Opt_WarnIsError dflags]
+ ++ [Option "-Wundef" | wopt Opt_WarnCPPUndef dflags]
+ all_args = configured_args ++ runtime_args ++ extra_warns ++ args
- mb_env <- getGccEnv (args0 ++ args1)
+ mb_env <- getGccEnv (configured_args ++ runtime_args)
- runSomething readable_name p all_args mb_env
+ runSomething readable_name program all_args mb_env
where
toolSettings' = toolSettings dflags
@@ -155,7 +155,8 @@ runSourceCodePreprocessor logger tmpfs dflags preprocessor args =
optCFiltered = filter (`notElem` g3Flags) . opt_c
-- In the wild (and GHC), there is lots of code assuming that -optc gets
-- passed to the C-- preprocessor too. Note that the arguments are
- -- reversed by getOpts.
+ -- reversed by getOpts. That is, in the invocation, first come the runtime
+ -- C opts, then -g0, then the runtime CmmP opts.
cAndCmmOpt dflags = opt_CmmP dflags ++ cmmG0 ++ optCFiltered dflags
(logger_name, pgm_getter, opt_getter, readable_name)
= case preprocessor of
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/5edc63d5a05aebbe96b1771924b2baacc6394cda
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/5edc63d5a05aebbe96b1771924b2baacc6394cda
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/20240507/a23a5b90/attachment-0001.html>
More information about the ghc-commits
mailing list