[GHC] #9734: Provide macro __GLASGOW_HASKELL_TH__

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


#9734: Provide macro  __GLASGOW_HASKELL_TH__
-------------------------------------+-------------------------------------
        Reporter:  nomeata           |                Owner:
            Type:  feature request   |               Status:  closed
        Priority:  normal            |            Milestone:  7.10.1
       Component:  Compiler          |              Version:  7.8.3
      Resolution:  fixed             |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
                                     |  Unknown/Multiple
 Type of failure:  None/Unknown      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:  #11322            |  Differential Rev(s):  Phab:D386
       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/9734#comment:6>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list