great sleuthing! thanks Kazu


On Thu, Nov 21, 2013 at 11:48 PM, Kazu Yamamoto <kazu@iij.ad.jp> wrote:
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:
        https://github.com/simonmar/alex/pull/39
        https://github.com/simonmar/happy/pull/15

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.

--Kazu
_______________________________________________
ghc-devs mailing list
ghc-devs@haskell.org
http://www.haskell.org/mailman/listinfo/ghc-devs