[project @ 2003-07-21 15:14:18 by ross]
[ghc-hetmet.git] / ghc / compiler / main / BinIface.hs
index c993257..e489fb2 100644 (file)
@@ -5,7 +5,7 @@
 -- 
 -- Binary interface file support.
 
-module BinIface ( writeBinIface, readBinIface ) where
+module BinIface ( writeBinIface, readBinIface, v_IgnoreHiVersion ) where
 
 #include "HsVersions.h"
 
@@ -32,8 +32,9 @@ import CmdLineOpts    ( opt_IgnoreIfacePragmas, opt_HiVersion )
 import Panic
 import SrcLoc
 import Binary
+import Util
 
-import DATA_IOREF      ( readIORef )
+import DATA_IOREF
 import EXCEPTION       ( throwDyn )
 import Monad           ( when )
 
@@ -354,9 +355,10 @@ instance Binary ParsedIface where
        lazyPut bh deprecs
    get bh = do
        check_ver   <- get bh
+        ignore_ver <- readIORef v_IgnoreHiVersion
        build_tag <- readIORef v_Build_tag
        let our_ver = show opt_HiVersion ++ build_tag
-        when (check_ver /= our_ver) $
+        when (check_ver /= our_ver && not ignore_ver) $
           -- use userError because this will be caught by readIface
           -- which will emit an error msg containing the iface module name.
           throwDyn (ProgramError (
@@ -388,11 +390,23 @@ instance Binary ParsedIface where
                 pi_rules = rules,
                 pi_deprecs = deprecs })
 
+GLOBAL_VAR(v_IgnoreHiVersion, False, Bool)
+
 -- ----------------------------------------------------------------------------
 {-* Generated by DrIFT-v1.0 : Look, but Don't Touch. *-}
 
 --  Imported from other files :-
 
+instance Binary Dependencies where
+    put_ bh deps = do put_ bh (dep_mods deps)
+                     put_ bh (dep_pkgs deps)
+                     put_ bh (dep_orphs deps)
+
+    get bh = do ms <- get bh 
+               ps <- get bh
+               os <- get bh
+               return (Deps { dep_mods = ms, dep_pkgs = ps, dep_orphs = os })
+
 instance (Binary name) => Binary (GenAvailInfo name) where
     put_ bh (Avail aa) = do
            putByte bh 0
@@ -926,6 +940,9 @@ instance (Binary name) => Binary (UfNote name) where
            putByte bh 2
     put_ bh UfInlineMe = do
            putByte bh 3
+    put_ bh (UfCoreNote s) = do
+            putByte bh 4
+            put_ bh s
     get bh = do
            h <- getByte bh
            case h of
@@ -934,7 +951,9 @@ instance (Binary name) => Binary (UfNote name) where
              1 -> do ab <- get bh
                      return (UfCoerce ab)
              2 -> do return UfInlineCall
-             _ -> do return UfInlineMe
+             3 -> do return UfInlineMe
+              _ -> do ac <- get bh
+                      return (UfCoreNote ac)
 
 instance (Binary name) => Binary (BangType name) where
     put_ bh (BangType aa ab) = do