From 823581816aad42e6547933d9d441ef58b00d232a Mon Sep 17 00:00:00 2001 From: slotThe Date: Sun, 13 Dec 2020 20:57:04 +0100 Subject: [PATCH] Conditionally error on unused imports This turns off the warnings about unused imports _unless_ one is using the oldest supported version of GHC (right now that's 8.4.4 or older); then it turns them into errors! This prevents xmonad from emitting warnings about imports that have to be there due to backwards compatibility, but are obsolete in newer versions (think MFP), while at the same time preventing bitrot. --- xmonad.cabal | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/xmonad.cabal b/xmonad.cabal index 611dff5..53d4ca4 100644 --- a/xmonad.cabal +++ b/xmonad.cabal @@ -84,7 +84,11 @@ library , setlocale , unix , utf8-string >= 0.3 && < 1.1 - ghc-options: -funbox-strict-fields -Wall -fno-warn-unused-do-bind + ghc-options: -funbox-strict-fields -Wall -fno-warn-unused-do-bind -Wno-unused-imports + + -- Keep this in sync with the oldest version in 'tested-with' + if impl(ghc <= 8.4.4) + ghc-options: -Werror=unused-imports if flag(testing) buildable: False @@ -92,7 +96,11 @@ library executable xmonad main-is: Main.hs build-depends: base, X11, mtl, unix, xmonad - ghc-options: -Wall -fno-warn-unused-do-bind + ghc-options: -Wall -fno-warn-unused-do-bind -Wno-unused-imports + + -- Keep this in sync with the oldest version in 'tested-with' + if impl(ghc <= 8.4.4) + ghc-options: -Werror=unused-imports executable generatemanpage main-is: GenerateManpage.hs