[Git][ghc/ghc][wip/T23942] implicit dependencies for string literals

Matthew Craven (@clyring) gitlab at gitlab.haskell.org
Tue Mar 5 18:02:57 UTC 2024



Matthew Craven pushed to branch wip/T23942 at Glasgow Haskell Compiler / GHC


Commits:
5f386def by Matthew Craven at 2024-03-05T13:02:12-05:00
implicit dependencies for string literals

- - - - -


1 changed file:

- compiler/GHC/Driver/MakeFile.hs


Changes:

=====================================
compiler/GHC/Driver/MakeFile.hs
=====================================
@@ -315,10 +315,13 @@ processDeps dflags hsc_env excl_mods root hdl (AcyclicSCC (ModuleNode _ node))
             do_implicit_import gHC_TYPES
 
         -- A module may implicitly depend on GHC.Tuple if ListTuplePuns is set
-        ; when (xopt ListTuplePuns dflags) $
-            -- see Note [Tracking implicit dependencies], wrinkle TID2
-            unless (isHomeUnitInstanceOf (hsc_home_unit hsc_env) primUnitId) $
+        ; unless (isHomeUnitInstanceOf (hsc_home_unit hsc_env) primUnitId) $ do
+          { -- see Note [Tracking implicit dependencies], wrinkle TID2
+            when (xopt ListTuplePuns dflags) $
               do_implicit_import gHC_INTERNAL_TUPLE
+            -- see Note [Tracking implicit dependencies], wrinkle TID4
+          ; do_implicit_import gHC_CSTRING
+          }
         }
 
 {-
@@ -331,6 +334,7 @@ files to look up even if they are not imported.  They include
  * Tuple-related stuff in GHC.Tuple, if the built-in tuple syntax is used
  * TypeRep-related stuff in GHC.Types, unless `-dno-typeable-binds` is set
  * deriving-related stuff mostly elsewhere in ghc-prim
+ * GHC.CString.unpackCString# et al, if string literals are used
 
 In order for GHC's build system to work reliably, we have to track the
 implicit dependencies introduced by GHC's habit of reading these
@@ -366,6 +370,10 @@ is set, with the following wrinkles:
 
   Failing to do this for the Lift class caused #22229, which is sadly
   still open as of March 2024.
+
+(TID4) Likewise, since we don't have a flag to disable string
+  literals, we always add an implicit dependency on GHC.CString for
+  any modules outside of `ghc-prim`.
 -}
 
 findDependency  :: HscEnv



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/5f386def642896cfa0f302fafbc18931d696c344

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/5f386def642896cfa0f302fafbc18931d696c344
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/20240305/f4e1a856/attachment-0001.html>


More information about the ghc-commits mailing list