From c2071a58aa07d2a8abe76dbe5f67b3a22ce19d56 Mon Sep 17 00:00:00 2001 From: Matthew Bauer Date: Wed, 7 Apr 2021 17:53:34 -0500 Subject: [PATCH 1/4] Set -Wno-prepositive-qualified-module in Paths_*.hs This is based on / similar to https://github.com/haskell/cabal/pull/7219 We used import qualified M in Paths_*.hs, which might be disallowed in GHC 8.10 when -Wprepositive-qualified-module is set. (cherry picked from commit 80cc2cab42321510b0d152266a4db5da429d6aae) --- Cabal/src/Distribution/Simple/Build/PathsModule.hs | 2 ++ Cabal/src/Distribution/Simple/Build/PathsModule/Z.hs | 7 +++++++ cabal-dev-scripts/src/GenPathsModule.hs | 1 + templates/Paths_pkg.template.hs | 3 +++ 4 files changed, 13 insertions(+) diff --git a/Cabal/src/Distribution/Simple/Build/PathsModule.hs b/Cabal/src/Distribution/Simple/Build/PathsModule.hs index 2ec29689222..d3499b744a4 100644 --- a/Cabal/src/Distribution/Simple/Build/PathsModule.hs +++ b/Cabal/src/Distribution/Simple/Build/PathsModule.hs @@ -42,6 +42,7 @@ generatePathsModule pkg_descr lbi clbi = Z.render Z.Z , Z.zSupportsCpp = supports_cpp , Z.zSupportsNoRebindableSyntax = supports_rebindable_syntax , Z.zSupportsNoMissingSafeHaskellMode = supports_missing_safehaskell + , Z.zSupportsNoPrepositiveQualifiedModule = supports_prepositive_qualified_module , Z.zAbsolute = absolute , Z.zRelocatable = relocatable lbi , Z.zIsWindows = isWindows @@ -63,6 +64,7 @@ generatePathsModule pkg_descr lbi clbi = Z.render Z.Z supports_rebindable_syntax = ghc_newer_than (mkVersion [7,0,1]) supports_language_pragma = ghc_newer_than (mkVersion [6,6,1]) supports_missing_safehaskell = ghc_newer_than (mkVersion [8,10,1]) + supports_prepositive_qualified_module = ghc_newer_than (mkVersion [8,10,1]) ghc_newer_than minVersion = case compilerCompatVersion GHC (compiler lbi) of diff --git a/Cabal/src/Distribution/Simple/Build/PathsModule/Z.hs b/Cabal/src/Distribution/Simple/Build/PathsModule/Z.hs index 928a8b2d964..c3e583658d6 100644 --- a/Cabal/src/Distribution/Simple/Build/PathsModule/Z.hs +++ b/Cabal/src/Distribution/Simple/Build/PathsModule/Z.hs @@ -7,6 +7,7 @@ data Z zSupportsCpp :: Bool, zSupportsNoRebindableSyntax :: Bool, zSupportsNoMissingSafeHaskellMode :: Bool, + zSupportsNoPrepositiveQualifiedModule :: Bool, zAbsolute :: Bool, zRelocatable :: Bool, zIsWindows :: Bool, @@ -49,6 +50,12 @@ render z_root = execWriter $ do return () else do return () + if (supportsNoPrepositiveQualifiedModule z_root) + then do + tell "{-# OPTIONS_GHC -Wno-prepositive-qualified-module #-}\n" + return () + else do + return () tell "module Paths_" tell (zManglePkgName z_root (zPackageName z_root)) tell " (\n" diff --git a/cabal-dev-scripts/src/GenPathsModule.hs b/cabal-dev-scripts/src/GenPathsModule.hs index c3f54082f3b..309a010a14b 100644 --- a/cabal-dev-scripts/src/GenPathsModule.hs +++ b/cabal-dev-scripts/src/GenPathsModule.hs @@ -28,6 +28,7 @@ $(capture "decls" [d| , zSupportsCpp :: Bool , zSupportsNoRebindableSyntax :: Bool , zSupportsNoMissingSafeHaskellMode :: Bool + , zSupportsNoPrepositiveQualifiedModule :: Bool , zAbsolute :: Bool , zRelocatable :: Bool , zIsWindows :: Bool diff --git a/templates/Paths_pkg.template.hs b/templates/Paths_pkg.template.hs index 62807ada572..813e2150b05 100644 --- a/templates/Paths_pkg.template.hs +++ b/templates/Paths_pkg.template.hs @@ -11,6 +11,9 @@ {% if supportsNoMissingSafeHaskellMode %} {-# OPTIONS_GHC -Wno-missing-safe-haskell-mode #-} {% endif %} +{% if supportsNoPrepositiveQualifiedModule %} +{-# OPTIONS_GHC -Wno-prepositive-qualified-module #-} +{% endif %} module Paths_{{ manglePkgName packageName }} ( version, getBinDir, getLibDir, getDynLibDir, getDataDir, getLibexecDir, From d10f9abd5e110a34c3c5c906c994afa252429cab Mon Sep 17 00:00:00 2001 From: Matthew Bauer Date: Thu, 8 Apr 2021 13:46:31 -0500 Subject: [PATCH 2/4] fixup (cherry picked from commit cc05dc643acd6b6d653442af50fdf2a1ecc19042) --- Cabal/src/Distribution/Simple/Build/PathsModule/Z.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cabal/src/Distribution/Simple/Build/PathsModule/Z.hs b/Cabal/src/Distribution/Simple/Build/PathsModule/Z.hs index c3e583658d6..d8c410e2d20 100644 --- a/Cabal/src/Distribution/Simple/Build/PathsModule/Z.hs +++ b/Cabal/src/Distribution/Simple/Build/PathsModule/Z.hs @@ -50,7 +50,7 @@ render z_root = execWriter $ do return () else do return () - if (supportsNoPrepositiveQualifiedModule z_root) + if (zSupportsNoPrepositiveQualifiedModule z_root) then do tell "{-# OPTIONS_GHC -Wno-prepositive-qualified-module #-}\n" return () From 188de37ed5e30e1b88633046ec2e85fd28916098 Mon Sep 17 00:00:00 2001 From: Matthew Bauer Date: Tue, 13 Apr 2021 16:02:09 -0500 Subject: [PATCH 3/4] Set -w in Paths_pkg module (cherry picked from commit fa29073c9583376a8ed9bcc05f08098f1cbc2c52) --- Cabal/src/Distribution/Simple/Build/PathsModule.hs | 2 -- .../src/Distribution/Simple/Build/PathsModule/Z.hs | 13 +------------ cabal-dev-scripts/src/GenPathsModule.hs | 2 -- templates/Paths_pkg.template.hs | 7 +------ 4 files changed, 2 insertions(+), 22 deletions(-) diff --git a/Cabal/src/Distribution/Simple/Build/PathsModule.hs b/Cabal/src/Distribution/Simple/Build/PathsModule.hs index d3499b744a4..91b423bf625 100644 --- a/Cabal/src/Distribution/Simple/Build/PathsModule.hs +++ b/Cabal/src/Distribution/Simple/Build/PathsModule.hs @@ -41,8 +41,6 @@ generatePathsModule pkg_descr lbi clbi = Z.render Z.Z , Z.zVersionDigits = show $ versionNumbers $ packageVersion pkg_descr , Z.zSupportsCpp = supports_cpp , Z.zSupportsNoRebindableSyntax = supports_rebindable_syntax - , Z.zSupportsNoMissingSafeHaskellMode = supports_missing_safehaskell - , Z.zSupportsNoPrepositiveQualifiedModule = supports_prepositive_qualified_module , Z.zAbsolute = absolute , Z.zRelocatable = relocatable lbi , Z.zIsWindows = isWindows diff --git a/Cabal/src/Distribution/Simple/Build/PathsModule/Z.hs b/Cabal/src/Distribution/Simple/Build/PathsModule/Z.hs index d8c410e2d20..d9c521f2fc7 100644 --- a/Cabal/src/Distribution/Simple/Build/PathsModule/Z.hs +++ b/Cabal/src/Distribution/Simple/Build/PathsModule/Z.hs @@ -44,18 +44,7 @@ render z_root = execWriter $ do else do return () tell "{-# OPTIONS_GHC -fno-warn-missing-import-lists #-}\n" - if (zSupportsNoMissingSafeHaskellMode z_root) - then do - tell "{-# OPTIONS_GHC -Wno-missing-safe-haskell-mode #-}\n" - return () - else do - return () - if (zSupportsNoPrepositiveQualifiedModule z_root) - then do - tell "{-# OPTIONS_GHC -Wno-prepositive-qualified-module #-}\n" - return () - else do - return () + tell "{-# OPTIONS_GHC -w #-}\n" tell "module Paths_" tell (zManglePkgName z_root (zPackageName z_root)) tell " (\n" diff --git a/cabal-dev-scripts/src/GenPathsModule.hs b/cabal-dev-scripts/src/GenPathsModule.hs index 309a010a14b..e4b930635c4 100644 --- a/cabal-dev-scripts/src/GenPathsModule.hs +++ b/cabal-dev-scripts/src/GenPathsModule.hs @@ -27,8 +27,6 @@ $(capture "decls" [d| , zVersionDigits :: String , zSupportsCpp :: Bool , zSupportsNoRebindableSyntax :: Bool - , zSupportsNoMissingSafeHaskellMode :: Bool - , zSupportsNoPrepositiveQualifiedModule :: Bool , zAbsolute :: Bool , zRelocatable :: Bool , zIsWindows :: Bool diff --git a/templates/Paths_pkg.template.hs b/templates/Paths_pkg.template.hs index 813e2150b05..a1a3a0471ec 100644 --- a/templates/Paths_pkg.template.hs +++ b/templates/Paths_pkg.template.hs @@ -8,12 +8,7 @@ {-# LANGUAGE ForeignFunctionInterface #-} {% endif %} {-# OPTIONS_GHC -fno-warn-missing-import-lists #-} -{% if supportsNoMissingSafeHaskellMode %} -{-# OPTIONS_GHC -Wno-missing-safe-haskell-mode #-} -{% endif %} -{% if supportsNoPrepositiveQualifiedModule %} -{-# OPTIONS_GHC -Wno-prepositive-qualified-module #-} -{% endif %} +{-# OPTIONS_GHC -w #-} module Paths_{{ manglePkgName packageName }} ( version, getBinDir, getLibDir, getDynLibDir, getDataDir, getLibexecDir, From 5b1faf5c07e6328e867bb43d85194a35786bcfb5 Mon Sep 17 00:00:00 2001 From: Matthew Bauer Date: Mon, 26 Apr 2021 12:10:11 -0500 Subject: [PATCH 4/4] Remove unused fields (cherry picked from commit de378ca64fc4c44400ebbac8d72528e4b6c14d4c) --- Cabal/src/Distribution/Simple/Build/PathsModule.hs | 2 -- Cabal/src/Distribution/Simple/Build/PathsModule/Z.hs | 2 -- 2 files changed, 4 deletions(-) diff --git a/Cabal/src/Distribution/Simple/Build/PathsModule.hs b/Cabal/src/Distribution/Simple/Build/PathsModule.hs index 91b423bf625..b2be7e1a8fc 100644 --- a/Cabal/src/Distribution/Simple/Build/PathsModule.hs +++ b/Cabal/src/Distribution/Simple/Build/PathsModule.hs @@ -61,8 +61,6 @@ generatePathsModule pkg_descr lbi clbi = Z.render Z.Z supports_cpp = supports_language_pragma supports_rebindable_syntax = ghc_newer_than (mkVersion [7,0,1]) supports_language_pragma = ghc_newer_than (mkVersion [6,6,1]) - supports_missing_safehaskell = ghc_newer_than (mkVersion [8,10,1]) - supports_prepositive_qualified_module = ghc_newer_than (mkVersion [8,10,1]) ghc_newer_than minVersion = case compilerCompatVersion GHC (compiler lbi) of diff --git a/Cabal/src/Distribution/Simple/Build/PathsModule/Z.hs b/Cabal/src/Distribution/Simple/Build/PathsModule/Z.hs index d9c521f2fc7..2b7c0eab3f5 100644 --- a/Cabal/src/Distribution/Simple/Build/PathsModule/Z.hs +++ b/Cabal/src/Distribution/Simple/Build/PathsModule/Z.hs @@ -6,8 +6,6 @@ data Z zVersionDigits :: String, zSupportsCpp :: Bool, zSupportsNoRebindableSyntax :: Bool, - zSupportsNoMissingSafeHaskellMode :: Bool, - zSupportsNoPrepositiveQualifiedModule :: Bool, zAbsolute :: Bool, zRelocatable :: Bool, zIsWindows :: Bool,