[commit: ghc] master: Improve Wmissing-home-modules warning under Cabal (b0c9f34)

git at git.haskell.org git at git.haskell.org
Tue Jul 11 17:42:31 UTC 2017


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

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

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

commit b0c9f34aa3da914524ef37294bba78afefc3ada7
Author: Ben Gamari <bgamari.foss at gmail.com>
Date:   Tue Jul 11 11:54:59 2017 -0400

    Improve Wmissing-home-modules warning under Cabal
    
    Reviewers: hvr, alanz, austin
    
    Reviewed By: alanz
    
    Subscribers: rwbarton, thomie
    
    GHC Trac Issues: #13899
    
    Differential Revision: https://phabricator.haskell.org/D3686


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

b0c9f34aa3da914524ef37294bba78afefc3ada7
 compiler/main/GhcMake.hs                                      | 7 ++++++-
 testsuite/tests/warnings/should_compile/MissingMod.stderr     | 2 +-
 testsuite/tests/warnings/should_compile/T13727/T13727a.stderr | 2 +-
 testsuite/tests/warnings/should_compile/T13727/T13727b.stderr | 2 +-
 testsuite/tests/warnings/should_compile/T13727/T13727f.stderr | 3 ++-
 testsuite/tests/warnings/should_compile/T13727/T13727g.stderr | 3 ++-
 testsuite/tests/warnings/should_compile/T13727/T13727h.stderr | 2 +-
 testsuite/tests/warnings/should_compile/T13727/T13727i.stderr | 2 +-
 testsuite/tests/warnings/should_compile/T13727/T13727j.stderr | 2 +-
 9 files changed, 16 insertions(+), 9 deletions(-)

diff --git a/compiler/main/GhcMake.hs b/compiler/main/GhcMake.hs
index 5935a77..4706672 100644
--- a/compiler/main/GhcMake.hs
+++ b/compiler/main/GhcMake.hs
@@ -195,7 +195,12 @@ warnMissingHomeModules hsc_env mod_graph =
     missing = map (moduleName . ms_mod) $
       filter (not . is_known_module) mod_graph
 
-    msg = text "Modules are not listed in command line: "
+    msg
+      | gopt Opt_BuildingCabalPackage dflags
+      = text "These modules are needed for compilation but not listed in your .cabal file's other-modules: "
+        <> sep (map ppr missing)
+      | otherwise
+      = text "Modules are not listed in command line but needed for compilation: "
         <> sep (map ppr missing)
     warn = makeIntoWarning
       (Reason Opt_WarnMissingHomeModules)
diff --git a/testsuite/tests/warnings/should_compile/MissingMod.stderr b/testsuite/tests/warnings/should_compile/MissingMod.stderr
index 0045092..119e72c 100644
--- a/testsuite/tests/warnings/should_compile/MissingMod.stderr
+++ b/testsuite/tests/warnings/should_compile/MissingMod.stderr
@@ -1,5 +1,5 @@
 
 <no location info>: warning: [-Wmissing-home-modules]
-    Modules are not listed in command line: MissingMod1
+    Modules are not listed in command line but needed for compilation: MissingMod1
 [1 of 2] Compiling MissingMod1      ( MissingMod1.hs, MissingMod1.o )
 [2 of 2] Compiling MissingMod       ( MissingMod.hs, MissingMod.o )
diff --git a/testsuite/tests/warnings/should_compile/T13727/T13727a.stderr b/testsuite/tests/warnings/should_compile/T13727/T13727a.stderr
index 64ad6d2..c77fbc4 100644
--- a/testsuite/tests/warnings/should_compile/T13727/T13727a.stderr
+++ b/testsuite/tests/warnings/should_compile/T13727/T13727a.stderr
@@ -1,6 +1,6 @@
 
 <no location info>: warning: [-Wmissing-home-modules]
-    Modules are not listed in command line: M1
+    Modules are not listed in command line but needed for compilation: M1
 [1 of 2] Compiling M1               ( src-lib/M1.hs, src-lib/M1.o )
 [2 of 2] Compiling Main             ( src-exe/Main.hs, src-exe/Main.o )
 Linking src-exe/Main ...
diff --git a/testsuite/tests/warnings/should_compile/T13727/T13727b.stderr b/testsuite/tests/warnings/should_compile/T13727/T13727b.stderr
index 64ad6d2..c77fbc4 100644
--- a/testsuite/tests/warnings/should_compile/T13727/T13727b.stderr
+++ b/testsuite/tests/warnings/should_compile/T13727/T13727b.stderr
@@ -1,6 +1,6 @@
 
 <no location info>: warning: [-Wmissing-home-modules]
-    Modules are not listed in command line: M1
+    Modules are not listed in command line but needed for compilation: M1
 [1 of 2] Compiling M1               ( src-lib/M1.hs, src-lib/M1.o )
 [2 of 2] Compiling Main             ( src-exe/Main.hs, src-exe/Main.o )
 Linking src-exe/Main ...
diff --git a/testsuite/tests/warnings/should_compile/T13727/T13727f.stderr b/testsuite/tests/warnings/should_compile/T13727/T13727f.stderr
index 35bfae8..20a42ba 100644
--- a/testsuite/tests/warnings/should_compile/T13727/T13727f.stderr
+++ b/testsuite/tests/warnings/should_compile/T13727/T13727f.stderr
@@ -1,6 +1,7 @@
 
 <no location info>: warning: [-Wmissing-home-modules]
-    Modules are not listed in command line: M1 Main
+    Modules are not listed in command line but needed for compilation: M1
+                                                                       Main
 [1 of 3] Compiling M1               ( src-lib/M1.hs, src-lib/M1.o )
 [2 of 3] Compiling Main             ( src-exe/Main.hs, src-exe/Main.o )
 [3 of 3] Compiling AltMain          ( src-exe/AltMain.hs, src-exe/AltMain.o )
diff --git a/testsuite/tests/warnings/should_compile/T13727/T13727g.stderr b/testsuite/tests/warnings/should_compile/T13727/T13727g.stderr
index 35bfae8..20a42ba 100644
--- a/testsuite/tests/warnings/should_compile/T13727/T13727g.stderr
+++ b/testsuite/tests/warnings/should_compile/T13727/T13727g.stderr
@@ -1,6 +1,7 @@
 
 <no location info>: warning: [-Wmissing-home-modules]
-    Modules are not listed in command line: M1 Main
+    Modules are not listed in command line but needed for compilation: M1
+                                                                       Main
 [1 of 3] Compiling M1               ( src-lib/M1.hs, src-lib/M1.o )
 [2 of 3] Compiling Main             ( src-exe/Main.hs, src-exe/Main.o )
 [3 of 3] Compiling AltMain          ( src-exe/AltMain.hs, src-exe/AltMain.o )
diff --git a/testsuite/tests/warnings/should_compile/T13727/T13727h.stderr b/testsuite/tests/warnings/should_compile/T13727/T13727h.stderr
index 1832b38..a29f764 100644
--- a/testsuite/tests/warnings/should_compile/T13727/T13727h.stderr
+++ b/testsuite/tests/warnings/should_compile/T13727/T13727h.stderr
@@ -1,6 +1,6 @@
 
 <no location info>: warning: [-Wmissing-home-modules]
-    Modules are not listed in command line: M1
+    Modules are not listed in command line but needed for compilation: M1
 [1 of 3] Compiling M1               ( src-lib/M1.hs, src-lib/M1.o )
 [2 of 3] Compiling Main             ( src-exe/Main.hs, src-exe/Main.o )
 [3 of 3] Compiling AltMain          ( src-exe/AltMain.hs, src-exe/AltMain.o )
diff --git a/testsuite/tests/warnings/should_compile/T13727/T13727i.stderr b/testsuite/tests/warnings/should_compile/T13727/T13727i.stderr
index 1832b38..a29f764 100644
--- a/testsuite/tests/warnings/should_compile/T13727/T13727i.stderr
+++ b/testsuite/tests/warnings/should_compile/T13727/T13727i.stderr
@@ -1,6 +1,6 @@
 
 <no location info>: warning: [-Wmissing-home-modules]
-    Modules are not listed in command line: M1
+    Modules are not listed in command line but needed for compilation: M1
 [1 of 3] Compiling M1               ( src-lib/M1.hs, src-lib/M1.o )
 [2 of 3] Compiling Main             ( src-exe/Main.hs, src-exe/Main.o )
 [3 of 3] Compiling AltMain          ( src-exe/AltMain.hs, src-exe/AltMain.o )
diff --git a/testsuite/tests/warnings/should_compile/T13727/T13727j.stderr b/testsuite/tests/warnings/should_compile/T13727/T13727j.stderr
index f6d3197..e85f778 100644
--- a/testsuite/tests/warnings/should_compile/T13727/T13727j.stderr
+++ b/testsuite/tests/warnings/should_compile/T13727/T13727j.stderr
@@ -1,6 +1,6 @@
 
 <no location info>: warning: [-Wmissing-home-modules]
-    Modules are not listed in command line: Main
+    Modules are not listed in command line but needed for compilation: Main
 [1 of 3] Compiling M1               ( src-lib/M1.hs, src-lib/M1.o )
 [2 of 3] Compiling Main             ( src-exe/Main.hs, src-exe/Main.o )
 [3 of 3] Compiling AltMain          ( src-exe/AltMain.hs, src-exe/AltMain.o )



More information about the ghc-commits mailing list