__HADDOCK__ CPP macro isn't defined #1237

Closed
feuerbach opened this Issue Mar 14, 2013 · 5 comments

Comments

Projects
None yet
3 participants
Contributor

feuerbach commented Mar 14, 2013

I noticed that __HADDOCK__ CPP macro doesn't get set during the haddock phase.

From looking at prepareSources (Cabal/Distribution/Simple/Haddock.hs), it seems that preprocessing happens regardless of the Haddock version, but -D__HADDOCK__ is passed only for haddock 0.x.

Possibly related old issue: #231

Member

23Skidoo commented Mar 15, 2013

Also related: #926. Perhaps it's better to just always define __HADDOCK__.

@23Skidoo 23Skidoo added a commit to 23Skidoo/cabal that referenced this issue Mar 15, 2013

@23Skidoo 23Skidoo Make 'cabal haddock' always define __HADDOCK__ CPP macro.
This is useful e.g. for "writing documentation that links to module A without
explicitly qualifying everything, where A is not directly imported." (see the
discussion in #926)

Fixes #1237.
121d4e5

@23Skidoo 23Skidoo added a commit to 23Skidoo/cabal that referenced this issue Mar 15, 2013

@23Skidoo 23Skidoo Make 'cabal haddock' always define __HADDOCK__ when preprocessing.
This is useful e.g. for "writing documentation that links to module A without
explicitly qualifying everything, where A is not directly imported." (see the
discussion in #926)

Fixes #1237.
77814ad
Contributor

feuerbach commented Mar 15, 2013

I did a bit of archaeology. The commits that change the situation described in #231 are cef898e and afc1603 by @Saizan. He doesn't seem to explain, however, why these changes were made.

So, unless someone can remember the rationale behind them, I'd be happy to see your patch applied. (Essentially it reverts afc1603.)

Also, the module header has to be updated. It says:

It has to do pre-processing for haddock 0.x which involves 'unlit'ing and using -DHADDOCK for any source code that uses cpp.

@23Skidoo 23Skidoo added a commit to 23Skidoo/cabal that referenced this issue Mar 15, 2013

@23Skidoo 23Skidoo Make 'cabal haddock' always define __HADDOCK__ when preprocessing.
This is useful e.g. for "writing documentation that links to module A without
explicitly qualifying everything, where A is not directly imported." (see the
discussion in #926)

Fixes #1237.
0f7f80f
Member

23Skidoo commented Mar 15, 2013

@feuerbach

Also, the module header has to be updated.

Updated, thanks.

Member

23Skidoo commented Mar 15, 2013

Actually, we should probably drop support for Haddock < 2 and just pass --optghc=-cpp to Haddock if the package has the CPP extension enabled.

Member

dcoutts commented Mar 15, 2013

Gah, too many tickets about the same thing. See my comments in #926 and #1238.

Summary: I explain why we had afc1603 in the first place and suggest an alternative to using cpp for this problem.

@23Skidoo 23Skidoo added a commit to 23Skidoo/cabal that referenced this issue Mar 19, 2013

@23Skidoo 23Skidoo Make 'cabal haddock' always define __HADDOCK__ when preprocessing.
This is useful e.g. for "writing documentation that links to module A without
explicitly qualifying everything, where A is not directly imported." (see the
discussion in #926)

Fixes #1237.
fae37ad

@23Skidoo 23Skidoo added a commit to 23Skidoo/cabal that referenced this issue Apr 15, 2013

@23Skidoo 23Skidoo Make 'cabal haddock' always define __HADDOCK__ when preprocessing.
This is useful e.g. for "writing documentation that links to module A without
explicitly qualifying everything, where A is not directly imported." (see the
discussion in #926)

Fixes #1237.
690ebee

@23Skidoo 23Skidoo added a commit to 23Skidoo/cabal that referenced this issue Apr 23, 2013

@23Skidoo 23Skidoo Make 'cabal haddock' always define __HADDOCK__ when preprocessing.
This is useful e.g. for "writing documentation that links to module A without
explicitly qualifying everything, where A is not directly imported." (see the
discussion in #926)

Fixes #1237.
8e51a39

@23Skidoo 23Skidoo added a commit to 23Skidoo/cabal that referenced this issue May 2, 2013

@23Skidoo @23Skidoo 23Skidoo + 23Skidoo Make 'cabal haddock' always define __HADDOCK__ when preprocessing.
This is useful e.g. for "writing documentation that links to module A without
explicitly qualifying everything, where A is not directly imported." (see the
discussion in #926)

Fixes #1237.
53cd166

@23Skidoo 23Skidoo added a commit to 23Skidoo/cabal that referenced this issue May 11, 2013

@23Skidoo @23Skidoo 23Skidoo + 23Skidoo Make 'cabal haddock' always define __HADDOCK__ when preprocessing.
This is useful e.g. for "writing documentation that links to module A without
explicitly qualifying everything, where A is not directly imported." (see the
discussion in #926)

Fixes #1237.
8b9c950

@23Skidoo 23Skidoo added a commit to 23Skidoo/cabal that referenced this issue May 13, 2013

@23Skidoo @23Skidoo 23Skidoo + 23Skidoo Make 'cabal haddock' always define __HADDOCK__ when preprocessing.
This is useful e.g. for "writing documentation that links to module A without
explicitly qualifying everything, where A is not directly imported." (see the
discussion in #926)

Fixes #1237.
8c34b0e

@23Skidoo 23Skidoo added a commit to 23Skidoo/cabal that referenced this issue Jul 17, 2013

@23Skidoo @23Skidoo 23Skidoo + 23Skidoo Make 'cabal haddock' always define __HADDOCK__ when preprocessing.
This is useful e.g. for "writing documentation that links to module A without
explicitly qualifying everything, where A is not directly imported." (see the
discussion in #926)

Fixes #1237.
c022a1e

@23Skidoo 23Skidoo added a commit to 23Skidoo/cabal that referenced this issue Jul 17, 2013

@23Skidoo @23Skidoo 23Skidoo + 23Skidoo Make 'cabal haddock' always define __HADDOCK__ when preprocessing.
This is useful e.g. for "writing documentation that links to module A without
explicitly qualifying everything, where A is not directly imported." (see the
discussion in #926)

Fixes #1237.
4cef575

@23Skidoo 23Skidoo added a commit to 23Skidoo/cabal that referenced this issue Jul 19, 2013

@23Skidoo @23Skidoo 23Skidoo + 23Skidoo Make 'cabal haddock' always define __HADDOCK__ when preprocessing.
This is useful e.g. for "writing documentation that links to module A without
explicitly qualifying everything, where A is not directly imported." (see the
discussion in #926)

Fixes #1237.
fba16aa

@23Skidoo 23Skidoo added a commit to 23Skidoo/cabal that referenced this issue Aug 23, 2013

@23Skidoo @23Skidoo 23Skidoo + 23Skidoo Make 'cabal haddock' always define __HADDOCK__ when preprocessing.
This is useful e.g. for "writing documentation that links to module A without
explicitly qualifying everything, where A is not directly imported." (see the
discussion in #926)

Fixes #1237.
500d23e

@23Skidoo 23Skidoo added a commit to 23Skidoo/cabal that referenced this issue Aug 26, 2013

@23Skidoo @23Skidoo 23Skidoo + 23Skidoo Make 'cabal haddock' define __HADDOCK_VERSION__ when preprocessing.
This is useful e.g. for "writing documentation that links to module A without
explicitly qualifying everything, where A is not directly imported." (see the
discussion in #926)

Fixes #1237.
d25489c

@23Skidoo 23Skidoo added a commit to 23Skidoo/cabal that referenced this issue Sep 5, 2013

@23Skidoo @23Skidoo 23Skidoo + 23Skidoo Make 'cabal haddock' define __HADDOCK_VERSION__ when preprocessing.
This is useful e.g. for "writing documentation that links to module A without
explicitly qualifying everything, where A is not directly imported." (see the
discussion in #926)

Fixes #1237.
b9b7a73

@23Skidoo 23Skidoo added a commit to 23Skidoo/cabal that referenced this issue Sep 7, 2013

@23Skidoo @23Skidoo 23Skidoo + 23Skidoo Make 'cabal haddock' define __HADDOCK_VERSION__ when preprocessing.
This is useful e.g. for "writing documentation that links to module A without
explicitly qualifying everything, where A is not directly imported." (see the
discussion in #926)

Fixes #1237.
bb3e04f

@23Skidoo 23Skidoo added a commit to 23Skidoo/cabal that referenced this issue Oct 7, 2013

@23Skidoo @23Skidoo 23Skidoo + 23Skidoo Make 'cabal haddock' define __HADDOCK_VERSION__ when preprocessing.
This is useful e.g. for "writing documentation that links to module A without
explicitly qualifying everything, where A is not directly imported." (see the
discussion in #926)

Fixes #1237.
b2ead31

@23Skidoo 23Skidoo added a commit to 23Skidoo/cabal that referenced this issue Oct 12, 2013

@23Skidoo @23Skidoo 23Skidoo + 23Skidoo Make 'cabal haddock' define __HADDOCK_VERSION__ when preprocessing.
This is useful e.g. for "writing documentation that links to module A without
explicitly qualifying everything, where A is not directly imported." (see the
discussion in #926)

Fixes #1237.
c374ef0

@23Skidoo 23Skidoo added a commit to 23Skidoo/cabal that referenced this issue Oct 14, 2013

@23Skidoo @23Skidoo 23Skidoo + 23Skidoo Make 'cabal haddock' define __HADDOCK_VERSION__ when preprocessing.
This is useful e.g. for "writing documentation that links to module A without
explicitly qualifying everything, where A is not directly imported." (see the
discussion in #926)

Fixes #1237.
8256c1f

@23Skidoo 23Skidoo added a commit to 23Skidoo/cabal that referenced this issue Oct 16, 2013

@23Skidoo @23Skidoo 23Skidoo + 23Skidoo Make 'cabal haddock' define __HADDOCK_VERSION__ when preprocessing.
This is useful e.g. for "writing documentation that links to module A without
explicitly qualifying everything, where A is not directly imported." (see the
discussion in #926)

Fixes #1237.
3c06a62

23Skidoo closed this in #1238 Oct 16, 2013

snoyberg referenced this issue in silkapp/json-schema Jul 8, 2014

Open

Haddock generation error with GHC 7.6.3 #8

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment