[commit: ghc] master: Make -fno-write-interface to all modes of GHC, not just -fno-code. (05120ec)

git at git.haskell.org git at git.haskell.org
Fri Jun 27 12:53:55 UTC 2014


Repository : ssh://git@git.haskell.org/ghc

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/05120ecd95b2ebf9b096a95304793cd78be9506e/ghc

>---------------------------------------------------------------

commit 05120ecd95b2ebf9b096a95304793cd78be9506e
Author: Edward Z. Yang <ezyang at cs.stanford.edu>
Date:   Fri Jun 27 13:48:19 2014 +0100

    Make -fno-write-interface to all modes of GHC, not just -fno-code.
    
    Signed-off-by: Edward Z. Yang <ezyang at cs.stanford.edu>


>---------------------------------------------------------------

05120ecd95b2ebf9b096a95304793cd78be9506e
 compiler/main/DriverPipeline.hs | 3 +--
 compiler/main/HscMain.hs        | 9 +++++----
 testsuite/tests/driver/Makefile | 6 ++++++
 testsuite/tests/driver/all.T    | 1 +
 4 files changed, 13 insertions(+), 6 deletions(-)

diff --git a/compiler/main/DriverPipeline.hs b/compiler/main/DriverPipeline.hs
index 11427e2..b7cb412 100644
--- a/compiler/main/DriverPipeline.hs
+++ b/compiler/main/DriverPipeline.hs
@@ -229,8 +229,7 @@ compileOne' m_tc_result mHscMessage
                                                 hm_linkable = Just linkable })
                HscNothing ->
                    do (iface, changed, details) <- hscSimpleIface hsc_env tc_result mb_old_hash
-                      when (gopt Opt_WriteInterface dflags) $
-                         hscWriteIface dflags iface changed summary
+                      hscWriteIface dflags iface changed summary
                       let linkable = if isHsBoot src_flavour
                                      then maybe_old_linkable
                                      else Just (LM (ms_hs_date summary) this_mod [])
diff --git a/compiler/main/HscMain.hs b/compiler/main/HscMain.hs
index aef6007..5d60559 100644
--- a/compiler/main/HscMain.hs
+++ b/compiler/main/HscMain.hs
@@ -624,9 +624,8 @@ hscCompileOneShot' hsc_env mod_summary src_changed
             dflags <- getDynFlags
             case hscTarget dflags of
                 HscNothing -> do
-                    when (gopt Opt_WriteInterface dflags) $ liftIO $ do
-                        (iface, changed, _details) <- hscSimpleIface hsc_env tc_result mb_old_hash
-                        hscWriteIface dflags iface changed mod_summary
+                    (iface, changed, _) <- hscSimpleIface' tc_result mb_old_hash
+                    liftIO $ hscWriteIface dflags iface changed mod_summary
                     return HscNotGeneratingCode
                 _ ->
                     case ms_hsc_src mod_summary of
@@ -1107,7 +1106,9 @@ hscNormalIface' simpl_result mb_old_iface = do
 --------------------------------------------------------------
 
 hscWriteIface :: DynFlags -> ModIface -> Bool -> ModSummary -> IO ()
-hscWriteIface dflags iface no_change mod_summary = do
+hscWriteIface dflags iface no_change mod_summary
+  | not (gopt Opt_WriteInterface dflags) = return ()
+  | otherwise = do
     let ifaceFile = ml_hi_file (ms_location mod_summary)
     unless no_change $
         {-# SCC "writeIface" #-}
diff --git a/testsuite/tests/driver/Makefile b/testsuite/tests/driver/Makefile
index 62aa2f9..06821d8 100644
--- a/testsuite/tests/driver/Makefile
+++ b/testsuite/tests/driver/Makefile
@@ -578,3 +578,9 @@ write_interface_make:
 	$(RM) -rf write_interface_make/A011.hi
 	"$(TEST_HC)" $(TEST_HC_OPTS) -hidir write_interface_make -fno-code -fwrite-interface --make A011.hs
 	test -f write_interface_make/A011.hi
+
+.PHONY: no_write_interface
+no_write_interface:
+	$(RM) -rf no_write_interface/A011.hi
+	"$(TEST_HC)" $(TEST_HC_OPTS) -hidir no_write_interface -fno-write-interface -c A011.hs
+	! test -f no_write_interface/A011.hi
diff --git a/testsuite/tests/driver/all.T b/testsuite/tests/driver/all.T
index 7236ec1..52b6e93 100644
--- a/testsuite/tests/driver/all.T
+++ b/testsuite/tests/driver/all.T
@@ -406,3 +406,4 @@ test('T9050', normal, build_T9050, [])
 
 test('write_interface_oneshot', normal, run_command, ['$MAKE -s --no-print-directory write_interface_oneshot'])
 test('write_interface_make', normal, run_command, ['$MAKE -s --no-print-directory write_interface_make'])
+test('no_write_interface', normal, run_command, ['$MAKE -s --no-print-directory no_write_interface'])



More information about the ghc-commits mailing list