[Git][ghc/ghc][master] Rename pre-processor invocation args

Marge Bot (@marge-bot) gitlab at gitlab.haskell.org
Fri May 10 05:51:46 UTC 2024



Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC


Commits:
c2b33fc9 by Rodrigo Mesquita at 2024-05-10T01:50:20-04: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/c2b33fc9091c7b30962d88e7144fb8705b881631

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/c2b33fc9091c7b30962d88e7144fb8705b881631
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/20240510/4383f976/attachment-0001.html>


More information about the ghc-commits mailing list