summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
3eacdc7)
I've removed -fno-code from Main to make it work
equally well with --make and -c.
I've also allowed it not to write hi files unless
-fwrite-iface is given.
#else
panic "ILX support not compiled into this ghc";
#endif
#else
panic "ILX support not compiled into this ghc";
#endif
+ HscNothing -> return ();
dflags = dflags0 { includePaths = current_dir : old_paths }
-- Figure out what lang we're generating
dflags = dflags0 { includePaths = current_dir : old_paths }
-- Figure out what lang we're generating
- let hsc_lang = hscMaybeAdjustTarget dflags StopLn src_flavour (hscTarget dflags)
+ let hsc_lang = hscTarget dflags
-- ... and what the next phase should be
let next_phase = hscNextPhase dflags src_flavour hsc_lang
-- ... and what file to generate the output into
-- ... and what the next phase should be
let next_phase = hscNextPhase dflags src_flavour hsc_lang
-- ... and what file to generate the output into
HscInterpreted | not (isHsBoot src_flavour) -- We can't compile boot files to
-- bytecode so don't even try.
-> runCompiler hscCompileInteractive handleInterpreted
HscInterpreted | not (isHsBoot src_flavour) -- We can't compile boot files to
-- bytecode so don't even try.
-> runCompiler hscCompileInteractive handleInterpreted
- HscNothing
- -> runCompiler hscCompileNothing handleBatch
_other
-> runCompiler hscCompileBatch handleBatch
_other
-> runCompiler hscCompileBatch handleBatch
else return False
-- get the DynFlags
else return False
-- get the DynFlags
- let hsc_lang = hscMaybeAdjustTarget dflags stop src_flavour (hscTarget dflags)
+ let hsc_lang = hscTarget dflags
let next_phase = hscNextPhase dflags src_flavour hsc_lang
output_fn <- get_output_fn next_phase (Just location4)
let next_phase = hscNextPhase dflags src_flavour hsc_lang
output_fn <- get_output_fn next_phase (Just location4)
runPhase Cmm stop dflags basename suff input_fn get_output_fn maybe_loc
= do
runPhase Cmm stop dflags basename suff input_fn get_output_fn maybe_loc
= do
- let hsc_lang = hscMaybeAdjustTarget dflags stop HsSrcFile (hscTarget dflags)
+ let hsc_lang = hscTarget dflags
let next_phase = hscNextPhase dflags HsSrcFile hsc_lang
output_fn <- get_output_fn next_phase maybe_loc
let next_phase = hscNextPhase dflags HsSrcFile hsc_lang
output_fn <- get_output_fn next_phase maybe_loc
HscC -> HCc
HscAsm | dopt Opt_SplitObjs dflags -> SplitMangle
| otherwise -> As
HscC -> HCc
HscAsm | dopt Opt_SplitObjs dflags -> SplitMangle
| otherwise -> As
- HscNothing -> StopLn
- HscInterpreted -> StopLn
-
-hscMaybeAdjustTarget :: DynFlags -> Phase -> HscSource -> HscTarget -> HscTarget
-hscMaybeAdjustTarget dflags stop HsBootFile current_hsc_lang
- = HscNothing -- No output (other than Foo.hi-boot) for hs-boot files
-hscMaybeAdjustTarget dflags stop other current_hsc_lang
- = hsc_lang
- where
- keep_hc = dopt Opt_KeepHcFiles dflags
- hsc_lang
- -- don't change the lang if we're interpreting
- | current_hsc_lang == HscInterpreted = current_hsc_lang
-
- -- force -fvia-C if we are being asked for a .hc file
- | HCc <- stop = HscC
- | keep_hc = HscC
- -- otherwise, stick to the plan
- | otherwise = current_hsc_lang
-
GLOBAL_VAR(v_Split_info, ("",0), (String,Int))
-- The split prefix and number of files
GLOBAL_VAR(v_Split_info, ("",0), (String,Int))
-- The split prefix and number of files
| Opt_RecompChecking
| Opt_DryRun
| Opt_DoAsmMangling
| Opt_RecompChecking
| Opt_DryRun
| Opt_DoAsmMangling
| Opt_ExcessPrecision
| Opt_ReadUserPackageConf
| Opt_NoHsMain
| Opt_ExcessPrecision
| Opt_ReadUserPackageConf
| Opt_NoHsMain
-- a good thing anyway, but it seems fragile.
Opt_DoAsmMangling,
-- a good thing anyway, but it seems fragile.
Opt_DoAsmMangling,
-- and the default no-optimisation options:
Opt_IgnoreInterfacePragmas,
-- and the default no-optimisation options:
Opt_IgnoreInterfacePragmas,
, ( "stubdir" , HasArg (upd . setStubDir . Just))
------- Keeping temporary files -------------------------------------
, ( "stubdir" , HasArg (upd . setStubDir . Just))
------- Keeping temporary files -------------------------------------
- , ( "keep-hc-file" , AnySuffix (\_ -> setDynFlag Opt_KeepHcFiles))
- , ( "keep-s-file" , AnySuffix (\_ -> setDynFlag Opt_KeepSFiles))
+ , ( "keep-hc-file" , AnySuffix (\_ -> do setDynFlag Opt_KeepHcFiles
+ setTarget HscC))
+ , ( "keep-s-file" , AnySuffix (\_ -> do setDynFlag Opt_KeepSFiles
+ setTarget HscAsm))
, ( "keep-raw-s-file", AnySuffix (\_ -> setDynFlag Opt_KeepRawSFiles))
, ( "keep-tmp-files" , AnySuffix (\_ -> setDynFlag Opt_KeepTmpFiles))
, ( "keep-raw-s-file", AnySuffix (\_ -> setDynFlag Opt_KeepRawSFiles))
, ( "keep-tmp-files" , AnySuffix (\_ -> setDynFlag Opt_KeepTmpFiles))
------ Compiler flags -----------------------------------------------
------ Compiler flags -----------------------------------------------
- , ( "fno-code", NoArg (setTarget HscNothing))
+ , ( "fno-code", NoArg (do setTarget HscNothing
+ unSetDynFlag Opt_WriteIface))
, ( "fasm", AnySuffix (\_ -> setTarget HscAsm) )
, ( "fvia-c", NoArg (setTarget HscC) )
, ( "fvia-C", NoArg (setTarget HscC) )
, ( "fasm", AnySuffix (\_ -> setTarget HscAsm) )
, ( "fvia-c", NoArg (setTarget HscC) )
, ( "fvia-C", NoArg (setTarget HscC) )
( "case-merge", Opt_CaseMerge ),
( "unbox-strict-fields", Opt_UnboxStrictFields ),
( "excess-precision", Opt_ExcessPrecision ),
( "case-merge", Opt_CaseMerge ),
( "unbox-strict-fields", Opt_UnboxStrictFields ),
( "excess-precision", Opt_ExcessPrecision ),
- ( "asm-mangling", Opt_DoAsmMangling )
+ ( "asm-mangling", Opt_DoAsmMangling ),
+ ( "write-iface", Opt_WriteIface )
hscWriteIface :: (ModIface, Bool, ModDetails, a) -> Comp (ModIface, ModDetails, a)
hscWriteIface (iface, no_change, details, a)
hscWriteIface :: (ModIface, Bool, ModDetails, a) -> Comp (ModIface, ModDetails, a)
hscWriteIface (iface, no_change, details, a)
- = do mod_summary <- gets compModSummary
+ = do hsc_env <- gets compHscEnv
+ mod_summary <- gets compModSummary
+ let writeIface = dopt Opt_WriteIface (hsc_dflags hsc_env)
+ unless (no_change || not writeIface)
$ writeIfaceFile (ms_location mod_summary) iface
return (iface, details, a)
$ writeIfaceFile (ms_location mod_summary) iface
return (iface, details, a)
ShowInterface f -> showIface f
DoMake -> doMake session srcs
DoMkDependHS -> doMkDependHS session (map fst srcs)
ShowInterface f -> showIface f
DoMake -> doMake session srcs
DoMkDependHS -> doMkDependHS session (map fst srcs)
- StopBefore p -> oneShot dflags p srcs
+ StopBefore p
+ -- Stop after compiling Haskell if we aren't
+ -- interested in any further results.
+ | HscNothing <- hscTarget dflags
+ -> oneShot dflags HCc srcs
+ | otherwise
+ -> oneShot dflags p srcs
DoInteractive -> interactiveUI session srcs Nothing
DoEval expr -> interactiveUI session srcs (Just expr)
DoInteractive -> interactiveUI session srcs Nothing
DoEval expr -> interactiveUI session srcs (Just expr)
, ( "-make" , PassFlag (setMode DoMake))
, ( "-interactive" , PassFlag (setMode DoInteractive))
, ( "e" , HasArg (\s -> setMode (DoEval s) "-e"))
, ( "-make" , PassFlag (setMode DoMake))
, ( "-interactive" , PassFlag (setMode DoInteractive))
, ( "e" , HasArg (\s -> setMode (DoEval s) "-e"))
-
- -- -fno-code says to stop after Hsc but don't generate any code.
- , ( "fno-code" , PassFlag (\f -> do setMode (StopBefore HCc) f
- addFlag "-fno-code"
- addFlag "-no-recomp"))
]
setMode :: CmdLineMode -> String -> ModeM ()
]
setMode :: CmdLineMode -> String -> ModeM ()