Fix: "cabal haddock" uses CPP overzealously
Until recently we supported ancient versions of Haddock, pre v2.0. To support the CPP extension with such versions, cabal had to invoke the CPP before invoking Haddock on the output. For simplicity cabal would invoke the CPP on all Haskell files, if any Haskell file required CPP. However, invoking CPP on a file which does not require it can cause build failures. Haddock v2.0+ supports the CPP via GHC, and even automatically preprocesses any file with the {-# LANGUAGE CPP #-} pragma. Hence we simply need only tell Haddock to enable the CPP when the CPP is a package level default extension. Fixes issue #1808.
Showing
- Cabal/Cabal.cabal 1 addition, 0 deletionsCabal/Cabal.cabal
- Cabal/Distribution/Simple/Haddock.hs 2 additions, 2 deletionsCabal/Distribution/Simple/Haddock.hs
- Cabal/tests/PackageTests/Haddock/Check.hs 1 addition, 1 deletionCabal/tests/PackageTests/Haddock/Check.hs
- Cabal/tests/PackageTests/Haddock/NoCPP.hs 8 additions, 0 deletionsCabal/tests/PackageTests/Haddock/NoCPP.hs
- Cabal/tests/PackageTests/Haddock/my.cabal 1 addition, 1 deletionCabal/tests/PackageTests/Haddock/my.cabal
Loading
Please register or sign in to comment