diff options
author | simonmar <unknown> | 2003-02-19 11:51:35 +0000 |
---|---|---|
committer | simonmar <unknown> | 2003-02-19 11:51:35 +0000 |
commit | 5c9bcb9bf34b8f1dff3d78e8f89e98eaa09a51b5 (patch) | |
tree | 2c4bc95fd77a957bb7f1fdd1be36a7a840a803ee /ghc/compiler/compMan | |
parent | cdb01ba27de9a4aeb7cff6a3682a38c482ca6ae2 (diff) | |
download | haskell-5c9bcb9bf34b8f1dff3d78e8f89e98eaa09a51b5.tar.gz |
[project @ 2003-02-19 11:51:35 by simonmar]
If -no-hs-main is specified in --make mode, attempt linking even when
there's no Main module.
Fixes bug #686620
MERGE TO STABLE
Diffstat (limited to 'ghc/compiler/compMan')
-rw-r--r-- | ghc/compiler/compMan/CompManager.lhs | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/ghc/compiler/compMan/CompManager.lhs b/ghc/compiler/compMan/CompManager.lhs index 1f5aa9a48c..84ff5aed59 100644 --- a/ghc/compiler/compMan/CompManager.lhs +++ b/ghc/compiler/compMan/CompManager.lhs @@ -57,7 +57,7 @@ where #include "HsVersions.h" import DriverPipeline ( CompResult(..), preprocess, compile, link ) -import DriverState ( v_Output_file ) +import DriverState ( v_Output_file, v_NoHsMain ) import DriverPhases import DriverUtil import Finder @@ -638,15 +638,22 @@ cmLoadModules cmstate1 dflags mg2unsorted -- clean up after ourselves cleanTempFilesExcept verb (ppFilesFromSummaries modsDone) - -- issue a warning for the confusing case where the user said '-o foo' - -- but we're not going to do any linking. ofile <- readIORef v_Output_file - when (ghci_mode == Batch && isJust ofile && not a_root_is_Main + no_hs_main <- readIORef v_NoHsMain + + -- Issue a warning for the confusing case where the user + -- said '-o foo' but we're not going to do any linking. + -- We attempt linking if either (a) one of the modules is + -- called Main, or (b) the user said -no-hs-main, indicating + -- that main() is going to come from somewhere else. + -- + let do_linking = a_root_is_Main || no_hs_main + when (ghci_mode == Batch && isJust ofile && not do_linking && verb > 0) $ hPutStrLn stderr "Warning: output was redirected with -o, but no output will be generated\nbecause there is no Main module." -- link everything together - linkresult <- link ghci_mode dflags a_root_is_Main hpt3 + linkresult <- link ghci_mode dflags do_linking hpt3 cmLoadFinish Succeeded linkresult hpt3 modsDone ghci_mode pcs3 |