From b0c9f34aa3da914524ef37294bba78afefc3ada7 Mon Sep 17 00:00:00 2001 From: Ben Gamari Date: Tue, 11 Jul 2017 11:54:59 -0400 Subject: 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 --- 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 5935a771a7..4706672e55 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 0045092696..119e72cd28 100644 --- a/testsuite/tests/warnings/should_compile/MissingMod.stderr +++ b/testsuite/tests/warnings/should_compile/MissingMod.stderr @@ -1,5 +1,5 @@ : 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 64ad6d2895..c77fbc4300 100644 --- a/testsuite/tests/warnings/should_compile/T13727/T13727a.stderr +++ b/testsuite/tests/warnings/should_compile/T13727/T13727a.stderr @@ -1,6 +1,6 @@ : 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 64ad6d2895..c77fbc4300 100644 --- a/testsuite/tests/warnings/should_compile/T13727/T13727b.stderr +++ b/testsuite/tests/warnings/should_compile/T13727/T13727b.stderr @@ -1,6 +1,6 @@ : 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 35bfae84a7..20a42baeb9 100644 --- a/testsuite/tests/warnings/should_compile/T13727/T13727f.stderr +++ b/testsuite/tests/warnings/should_compile/T13727/T13727f.stderr @@ -1,6 +1,7 @@ : 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 35bfae84a7..20a42baeb9 100644 --- a/testsuite/tests/warnings/should_compile/T13727/T13727g.stderr +++ b/testsuite/tests/warnings/should_compile/T13727/T13727g.stderr @@ -1,6 +1,7 @@ : 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 1832b38432..a29f764a47 100644 --- a/testsuite/tests/warnings/should_compile/T13727/T13727h.stderr +++ b/testsuite/tests/warnings/should_compile/T13727/T13727h.stderr @@ -1,6 +1,6 @@ : 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 1832b38432..a29f764a47 100644 --- a/testsuite/tests/warnings/should_compile/T13727/T13727i.stderr +++ b/testsuite/tests/warnings/should_compile/T13727/T13727i.stderr @@ -1,6 +1,6 @@ : 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 f6d3197f01..e85f778a56 100644 --- a/testsuite/tests/warnings/should_compile/T13727/T13727j.stderr +++ b/testsuite/tests/warnings/should_compile/T13727/T13727j.stderr @@ -1,6 +1,6 @@ : 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 ) -- cgit v1.2.1