Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

back port haddock cpp fixes to 1.18 #2010

Merged
merged 5 commits into from
Jul 23, 2014
Merged

back port haddock cpp fixes to 1.18 #2010

merged 5 commits into from
Jul 23, 2014

Conversation

mzero
Copy link
Member

@mzero mzero commented Jul 23, 2014

These five commits remove support for Haddock pre-2.0, and do so to fix a problem where Cabal, if CPP was listed as an Extension, would pre-process the file before handing to haddock, which would cause ghc to pre-process file as well.

This double pre-processing was clearly wrong (possibly leading to wrong line numbers in haddock messages), but more importantly failed when the system compiler was clang. This is because c preprocessing is not idempotent, and under clang, the changes resulted in syntax errors.

Dropping this support is unlikely to be a problem in practice.  Debian
oldstable is currently on version 2.6.0 of Haddock, for example.

This change enables future code simplification.  Currently we
preprocess both Haskell files requiring the CPP and Literate Haskell
files; newer versions of Haddock can handle these natively.

Fixes issue haskell#1718.

Conflicts:
	Cabal/Distribution/Simple/Haddock.hs
	Cabal/Distribution/Simple/PreProcess.hs
	Cabal/Distribution/Simple/Setup.hs
This is a code simplification on our end.

Thanks to Mikhail Glushenkov for the suggestion.

Conflicts:
	Cabal/Distribution/Simple/Haddock.hs
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 haskell#1808.
@tibbe tibbe merged commit c5e0b33 into haskell:1.18 Jul 23, 2014
@tibbe
Copy link
Member

tibbe commented Jul 23, 2014

I will make a release this afternoon (CET).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants