[GHC] #11322: Dysfunctional `__GLASGOW_HASKELL_TH` macro

GHC ghc-devs at haskell.org
Thu Dec 31 21:41:51 UTC 2015


#11322: Dysfunctional `__GLASGOW_HASKELL_TH` macro
-------------------------------------+-------------------------------------
        Reporter:  hvr               |                Owner:
            Type:  bug               |               Status:  patch
        Priority:  highest           |            Milestone:  8.0.1
       Component:  Compiler          |              Version:  7.10.1
      Resolution:                    |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
                                     |  Unknown/Multiple
 Type of failure:  None/Unknown      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:  #9734             |  Differential Rev(s):  Phab:D1723
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by Herbert Valerio Riedel <hvr@…>):

 In [changeset:"eae40e16a0933fe3b6cb0ee4dc9cdbe3d21e44ce/ghc" eae40e1/ghc]:
 {{{
 #!CommitTicketReference repository="ghc"
 revision="eae40e16a0933fe3b6cb0ee4dc9cdbe3d21e44ce"
 Use 0/1 instead of YES/NO as `__GLASGOW_HASKELL_TH__` macro value

 Using `YES`/`NO` causes all sorts of problems as CPP doesn't work on
 symbolic tokens but rather on scalar values.

 A use like

    #if __GLASGOW_HASKELL_TH__==YES
    {-# LANGUAGE TemplateHaskell #-}
    #endif

 doesn't do what one may naively expect, and neither does

    #if __GLASGOW_HASKELL_TH__
    {-# LANGUAGE TemplateHaskell #-}
    #endif

 *unless* `YES` happens to evaluate to a non-zero scalar.

 `__GLASGOW_HASKELL_TH__ was originally introduced via D396 / #9734.

 Fixes #11322

 Reviewed By: austin

 Differential Revision: https://phabricator.haskell.org/D1723
 }}}

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/11322#comment:4>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list