Building GHC head with clang on Mavericks

Kazu Yamamoto (=?iso-2022-jp?B?GyRCOzNLXE9CSScbKEI=?=) kazu at
Fri Nov 22 04:48:53 UTC 2013

Hi SimonM,

>> But this patch effects templates only. When a template is included
>> into an HS file (genearted from a '.x' file), the position is
>> shifted. So, I'm not sure that line markers are important as you
>> think.
> Isn't this why the line pragmas are important?  If GHC reports an
> error in the template code, we want the error message to point to the
> template source (GenericTemplate.hs), not the generated source file.
> This works right now, it'd be a shame to lose it.

This is what I did not understand. Thank you for this explanation.

I was wondering why you are talking about line pragmas while I'm
talking about line markers. And I noticed the real problem.

It is the format change of clang's line markers. GCC's line marker is
as follows:

# 1 "<built-in>"

But clang's one is as follows:

# 1 "<built-in>" 1

Since this kind of line markers consist of four tokens, Setup of
alex/happy cannot convert to GHC's line pragmas. So, line markers are
left in templates as is, resulting compile errors with
GHC/clang-wrapper later.

I sent pull requests to fix this:

I confirmed that I can build GHC head with this patched alex/happy.

The patches are redundant. SimonM may want to simplify them by
defining local functions.


More information about the ghc-devs mailing list