From 67ad6f6e12a46cbcca4946d80b17381881773efb Mon Sep 17 00:00:00 2001 From: Francesco Ariis Date: Mon, 27 Jun 2022 19:04:46 +0200 Subject: [PATCH] Simplify -Werror warning --- Cabal/src/Distribution/PackageDescription/Check.hs | 12 +----------- .../PackageTests/Check/DifferentGhcOptions/cabal.out | 2 +- 2 files changed, 2 insertions(+), 12 deletions(-) diff --git a/Cabal/src/Distribution/PackageDescription/Check.hs b/Cabal/src/Distribution/PackageDescription/Check.hs index f26075c35d7..b1ac65bc4f1 100644 --- a/Cabal/src/Distribution/PackageDescription/Check.hs +++ b/Cabal/src/Distribution/PackageDescription/Check.hs @@ -1574,14 +1574,7 @@ checkDevelopmentOnlyFlagsOptions :: String -> [String] -> [PackageCheck] checkDevelopmentOnlyFlagsOptions fieldName ghcOptions = catMaybes [ - check has_WerrorWall $ - PackageDistInexcusable $ - "'" ++ fieldName ++ ": -Wall -Werror' makes the package very easy to " - ++ "break with future GHC versions because new GHC versions often " - ++ "add new warnings. Use just '" ++ fieldName ++ ": -Wall' instead." - ++ extraExplanation - - , check (not has_WerrorWall && has_Werror) $ + check (has_Werror) $ PackageDistInexcusable $ "'" ++ fieldName ++ ": -Werror' makes the package easy to " ++ "break with future GHC versions because new GHC versions often " @@ -1627,10 +1620,7 @@ checkDevelopmentOnlyFlagsOptions fieldName ghcOptions = ++ "on a Cabal configuration flag (with 'manual: True' and 'default: " ++ "False') and enable that flag during development." - has_WerrorWall = has_Werror && ( has_Wall || has_W ) has_Werror = "-Werror" `elem` ghcOptions - has_Wall = "-Wall" `elem` ghcOptions - has_W = "-W" `elem` ghcOptions has_J = any (\o -> case o of "-j" -> True diff --git a/cabal-testsuite/PackageTests/Check/DifferentGhcOptions/cabal.out b/cabal-testsuite/PackageTests/Check/DifferentGhcOptions/cabal.out index c3e8a3dbe68..ce673fceeb9 100644 --- a/cabal-testsuite/PackageTests/Check/DifferentGhcOptions/cabal.out +++ b/cabal-testsuite/PackageTests/Check/DifferentGhcOptions/cabal.out @@ -4,5 +4,5 @@ Warning: 'ghc-shared-options: -hide-package' is never needed. Cabal hides all pa Warning: The following errors will cause portability problems on other environments: Warning: 'ghc-options: -fasm' is unnecessary and will not work on CPU architectures other than x86, x86-64, ppc or sparc. Warning: 'ghc-prof-options: -fhpc' is not necessary. Use the configure flag --enable-coverage instead. -Warning: 'ghc-shared-options: -Wall -Werror' makes the package very easy to break with future GHC versions because new GHC versions often add new warnings. Use just 'ghc-shared-options: -Wall' instead. Alternatively, if you want to use this, make it conditional based on a Cabal configuration flag (with 'manual: True' and 'default: False') and enable that flag during development. +Warning: 'ghc-shared-options: -Werror' makes the package easy to break with future GHC versions because new GHC versions often add new warnings. Alternatively, if you want to use this, make it conditional based on a Cabal configuration flag (with 'manual: True' and 'default: False') and enable that flag during development. Warning: Hackage would reject this package.