{-# LINE 100 "Foo.hs #-} vs. # 100 "Foo.hs"

Simon Marlow simonmar@microsoft.com
Mon, 15 Jan 2001 09:03:29 -0800


> What should be the preferred way of marking correspondence to source
> positions after some preprocessing?
> 
> Here is what is currently supported:
> 
>                         | {-# LINE 100 "Foo.hs #-}     | # 
> 100 "Foo.hs"
> ------------------------+------------------------------+------
> ----------
> Released ghc, no   -cpp | understand                   | error
> Released ghc, with -cpp | understand                   | understand
> Developed ghc           | understand                   | understand
> hbc                     | understand (ignore filename) | 
> understand (warning)
> Hugs                    | ignore                       | error
> Released nhc98          | error                        | understand
> Developed nhc98         | ignore                       | understand
> 
> I would choose LINE pragma. In this case nhc98 should be taught
> about it.

CPP generates the '# 100 "Foo.hs"' form, which is why GHC understands
them.  We used to convert these into LINE pragmas automatically before
feeding to the compiler, but this required an extra script and
preprocessing step (hscpp), so we don't do that anymore.

The preferred way should presumably be LINE pragmas.

Cheers,
	Simon