[project @ 2003-01-09 11:39:20 by simonmar]
[ghc-hetmet.git] / ghc / compiler / main / BinIface.hs
index c993257..2e582bb 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