[GHC] #13553: GHC 8.2.1 preprocesses __GLASGOW_HASKELL__ incorrectly with cpphs

GHC ghc-devs at haskell.org
Sun Apr 9 19:59:35 UTC 2017


#13553: GHC 8.2.1 preprocesses __GLASGOW_HASKELL__ incorrectly with cpphs
-------------------------------------+-------------------------------------
        Reporter:  RyanGlScott       |                Owner:  (none)
            Type:  bug               |               Status:  upstream
        Priority:  normal            |            Milestone:
       Component:  Compiler          |              Version:  8.1
      Resolution:                    |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
                                     |  Unknown/Multiple
 Type of failure:  None/Unknown      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------
Changes (by RyanGlScott):

 * status:  new => upstream


Comment:

 As it turns out, this is more of `cpphs`'s fault than GHC's. The commit
 which started all this is 351dea4a7c07f4e845eac6c2e895f6f41524b40c:

 {{{
 From 351dea4a7c07f4e845eac6c2e895f6f41524b40c Mon Sep 17 00:00:00 2001
 From: Herbert Valerio Riedel <hvr at gnu.org>
 Date: Thu, 31 Dec 2015 16:58:28 +0100
 Subject: [PATCH] Drop redundant `-D__GLASGOW_HASKELL__=...` flag

 In 3549c952b535803270872adaf87262f2df0295a4 a `include/ghcversions.h`
 include
 file was introduced which defines `__GLASGOW_HASKELL__` as well.

 So there's no need to define it twice.
 }}}

 So in theory, `cpphs-1.20.4` should just be reading `__GLASGOW_HASKELL__`
 from `include/ghcversions.h`. But I overlooked the warning that
 `cpphs-1.20.4` was emitting:

 {{{
 Warning: Can't find file
 "/opt/ghc/8.2.1/lib/ghc-8.2.0.20170403/include/ghcversion.h" in
 directories
 }}}

 That's not good. In GHC 8.0.2, even though `cpphs` couldn't find
 `include/ghcversions.h`, it was able to find `__GLASGOW_HASKELL__` anyway
 by dumb luck, as `DriverPipeline` also (re-)defined it. But after
 351dea4a7c07f4e845eac6c2e895f6f41524b40c, that is no longer the case, so
 if `cpphs` can't find `include/ghcversions.h`, we're hosed.

 This `cpphs` issue was reported upstream as
 https://github.com/malcolmwallace/cpphs/issues/11 a while back. There is a
 patch [https://raw.githubusercontent.com/jmitchell/cpphs-blackbox/master
 /avoid-using-findfile_-ghc-7_4-doesn_t-include-it_.dpatch here] which you
 can apply to the `cpphs` repo to fix the issue (I've confirmed that
 applying the patch makes GHC 8.2 work with `cpphs-1.20.4` again). So now
 we wait for a new release of `cpphs` with this fix...

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


More information about the ghc-tickets mailing list