diff options
author | Matthew Pickering <matthewtpickering@gmail.com> | 2021-09-30 12:16:02 +0100 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2021-10-19 03:30:16 -0400 |
commit | 3d6eb85efcebb5854de880d24f9c8011688fb933 (patch) | |
tree | f29362f694fc1e9743291fc51b4c4ac9b5ed32d6 | |
parent | df419c1abd7daa3aa0231747582333357b8e9b85 (diff) | |
download | haskell-3d6eb85efcebb5854de880d24f9c8011688fb933.tar.gz |
driver: Correct output of -fno-code and -dynamic-too
Before we would print
[1 of 3] Compiling T[boot] ( T.hs-boot, nothing, T.dyn_o )
Which was clearly wrong for two reasons.
1. No dynamic object file was produced for T[boot]
2. The file would be called T.dyn_o-boot if it was produced.
Fixes #20300
-rw-r--r-- | compiler/GHC/Unit/Module/Graph.hs | 21 | ||||
-rw-r--r-- | testsuite/tests/driver/T20300/S.hs | 4 | ||||
-rw-r--r-- | testsuite/tests/driver/T20300/T.hs | 1 | ||||
-rw-r--r-- | testsuite/tests/driver/T20300/T.hs-boot | 1 | ||||
-rw-r--r-- | testsuite/tests/driver/T20300/T20300.stderr | 4 | ||||
-rw-r--r-- | testsuite/tests/driver/T20300/Top.hs | 4 | ||||
-rw-r--r-- | testsuite/tests/driver/T20300/all.T | 6 |
7 files changed, 30 insertions, 11 deletions
diff --git a/compiler/GHC/Unit/Module/Graph.hs b/compiler/GHC/Unit/Module/Graph.hs index bf7abfea99..822f72b88b 100644 --- a/compiler/GHC/Unit/Module/Graph.hs +++ b/compiler/GHC/Unit/Module/Graph.hs @@ -193,20 +193,19 @@ showModMsg dflags recomp (ModuleNode (ExtendedModSummary mod_summary _)) = [ text (mod_str ++ replicate (max 0 (16 - length mod_str)) ' ') , char '(' , text (op $ msHsFilePath mod_summary) <> char ',' - ] ++ - if gopt Opt_BuildDynamicToo dflags - then [ text obj_file <> char ',' - , text dyn_file - , char ')' - ] - else [ text obj_file, char ')' ] + , message, char ')' ] + where op = normalise mod = moduleName (ms_mod mod_summary) mod_str = showPpr dflags mod ++ hscSourceString (ms_hsc_src mod_summary) dyn_file = op $ msDynObjFilePath mod_summary - obj_file = case backend dflags of - Interpreter | recomp -> "interpreted" - NoBackend -> "nothing" - _ -> (op $ msObjFilePath mod_summary) + obj_file = op $ msObjFilePath mod_summary + message = case backend dflags of + Interpreter | recomp -> text "interpreted" + NoBackend -> text "nothing" + _ -> + if gopt Opt_BuildDynamicToo dflags + then text obj_file <> comma <+> text dyn_file + else text obj_file diff --git a/testsuite/tests/driver/T20300/S.hs b/testsuite/tests/driver/T20300/S.hs new file mode 100644 index 0000000000..d1661a904e --- /dev/null +++ b/testsuite/tests/driver/T20300/S.hs @@ -0,0 +1,4 @@ +{-# LANGUAGE TemplateHaskell #-} +module S where + +import {-# SOURCE #-} T diff --git a/testsuite/tests/driver/T20300/T.hs b/testsuite/tests/driver/T20300/T.hs new file mode 100644 index 0000000000..326dbea428 --- /dev/null +++ b/testsuite/tests/driver/T20300/T.hs @@ -0,0 +1 @@ +module T where diff --git a/testsuite/tests/driver/T20300/T.hs-boot b/testsuite/tests/driver/T20300/T.hs-boot new file mode 100644 index 0000000000..326dbea428 --- /dev/null +++ b/testsuite/tests/driver/T20300/T.hs-boot @@ -0,0 +1 @@ +module T where diff --git a/testsuite/tests/driver/T20300/T20300.stderr b/testsuite/tests/driver/T20300/T20300.stderr new file mode 100644 index 0000000000..1a93d8d7ba --- /dev/null +++ b/testsuite/tests/driver/T20300/T20300.stderr @@ -0,0 +1,4 @@ +[1 of 4] Compiling T[boot] ( T.hs-boot, nothing ) +[2 of 4] Compiling S ( S.hs, S.o, S.dyn_o ) +[3 of 4] Compiling T ( T.hs, T.o, T.dyn_o ) +[4 of 4] Compiling Top ( Top.hs, nothing ) diff --git a/testsuite/tests/driver/T20300/Top.hs b/testsuite/tests/driver/T20300/Top.hs new file mode 100644 index 0000000000..72116b0bf6 --- /dev/null +++ b/testsuite/tests/driver/T20300/Top.hs @@ -0,0 +1,4 @@ +module Top where + +import S +import T diff --git a/testsuite/tests/driver/T20300/all.T b/testsuite/tests/driver/T20300/all.T new file mode 100644 index 0000000000..96b592ae9a --- /dev/null +++ b/testsuite/tests/driver/T20300/all.T @@ -0,0 +1,6 @@ +test('T20300' + , [ unless(have_dynamic(), skip) + , extra_files(['S.hs', 'T.hs', 'T.hs-boot', 'Top.hs']) ] + , multimod_compile, ['Top','-fno-code -fwrite-interface']) + + |