Using stringize and string concatenation in ghc preprocessing

Harendra Kumar harendra.kumar at gmail.com
Sat Aug 20 18:27:56 UTC 2016


Hi,

To reduce boilerplate code in an FFI implementation file I am trying to use
the stringizing and string concatenation features of the C
preprocessor. Since ghc passes '-traditional' to the preprocessor which
disables these features I thought I can pass my own flags to the
preprocessor like this:

{-# OPTIONS_GHC -optP -E -optP -undef #-}

But "-optP" seems to only append to the flags that GHC already passes and
gcc has no "-no-traditional" option to undo the effect of the
"-traditional" that GHC has already passed. I think "-optP" should override
the flags passed by ghc rather than appending to them. Is there a reason
not to do that?

Is there any other better way to achieve this? What is the standard way of
doing this if any?

-harendra
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-devs/attachments/20160820/fdb48dba/attachment.html>


More information about the ghc-devs mailing list