[Haskell-cafe] cpphs and #pragma

Malcolm Wallace Malcolm.Wallace at cs.york.ac.uk
Wed Dec 13 12:46:35 EST 2006


"Dimitry Golubovsky" <golubovsky at gmail.com> wrote:

> Is this  a bug or a feature that cpphs does not pass the #pragma cpp
> directive (they disappear in the output)?

A feature I suppose.  At least, it was a deliberate design choice.  The
purpose of cpphs is to remove all # directives from the file, leaving
only Haskell (or plain text if you prefer).  Now I realise that this is
not entirely true, since cpphs _does_ leave #line droppings unless you
specify the --noline option.  But although most Haskell implementations
do read and use #line hints, I was not aware of any tools that make
further use of #pragma, and indeed quite the opposite - many tools break
if they see the latter.

> In version 0.6 of cpphs:
>     *  Recognise and ignore the #pragma cpp directive.
> 
> Or what command line options could be used to preserve #pragma's in
> cpphs output?

I am happy to add an option (--pragmas maybe?) to preserve #pragma if
there is user demand.  Check the cpphs darcs repository at
    http://www.cs.york.ac.uk/fp/darcs/cpphs
for new patches.

Regards,
    Malcolm


More information about the Haskell-Cafe mailing list