Unverified Commit e5a3fbd6 authored by Oleg Grenrus's avatar Oleg Grenrus Committed by GitHub
Browse files

Merge pull request #7219 from phadej/paths-no-missing-safe-haskell-mode

Paths no missing safe haskell mode
parents a93c84f8 9ba0509c
......@@ -41,6 +41,7 @@ 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.zAbsolute = absolute
, Z.zRelocatable = relocatable lbi
, Z.zIsWindows = isWindows
......@@ -58,9 +59,10 @@ generatePathsModule pkg_descr lbi clbi = Z.render Z.Z
, Z.zSysconfdir = zSysconfdir
}
where
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_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])
ghc_newer_than minVersion =
case compilerCompatVersion GHC (compiler lbi) of
......
......@@ -6,6 +6,7 @@ data Z
zVersionDigits :: String,
zSupportsCpp :: Bool,
zSupportsNoRebindableSyntax :: Bool,
zSupportsNoMissingSafeHaskellMode :: Bool,
zAbsolute :: Bool,
zRelocatable :: Bool,
zIsWindows :: Bool,
......@@ -42,6 +43,12 @@ 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 ()
tell "module Paths_"
tell (zManglePkgName z_root (zPackageName z_root))
tell " (\n"
......
......@@ -27,6 +27,7 @@ $(capture "decls" [d|
, zVersionDigits :: String
, zSupportsCpp :: Bool
, zSupportsNoRebindableSyntax :: Bool
, zSupportsNoMissingSafeHaskellMode :: Bool
, zAbsolute :: Bool
, zRelocatable :: Bool
, zIsWindows :: Bool
......
cabal-version: 2.2
name: PathsModule
version: 0.1
license: BSD-3-Clause
author: Oleg Grenrus
stability: stable
category: PackageTests
build-type: Simple
description:
Check that the generated paths module compiles.
Library
exposed-modules: Paths_PathsModule
build-depends: base
default-language: Haskell2010
if impl(ghc >= 8.10)
ghc-options: -Winferred-safe-imports -Wmissing-safe-haskell-mode -Werror
# Setup configure
Configuring PathsModule-0.1...
# Setup build
Preprocessing library for PathsModule-0.1..
Building library for PathsModule-0.1..
# Setup configure
Configuring PathsModule-0.1...
# Setup build
Preprocessing library for PathsModule-0.1..
Building library for PathsModule-0.1..
import Test.Cabal.Prelude
-- Test that Paths module is generated and available for libraries.
main = setupAndCabalTest $ setup_build []
......@@ -8,6 +8,9 @@
{-# LANGUAGE ForeignFunctionInterface #-}
{% endif %}
{-# OPTIONS_GHC -fno-warn-missing-import-lists #-}
{% if supportsNoMissingSafeHaskellMode %}
{-# OPTIONS_GHC -Wno-missing-safe-haskell-mode #-}
{% endif %}
module Paths_{{ manglePkgName packageName }} (
version,
getBinDir, getLibDir, getDynLibDir, getDataDir, getLibexecDir,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment