<div dir="ltr">Thanks Mathieu. This works pretty well for gcc (<a href="https://gcc.gnu.org/onlinedocs/cpp/Traditional-macros.html">https://gcc.gnu.org/onlinedocs/cpp/Traditional-macros.html</a>) but sadly it does not work for clang cpp as Brandon too pointed out earlier that clang does not have a traditional mode.<div><br></div><div>-harendra<br><div class="gmail_extra"><br><div class="gmail_quote">On 22 August 2016 at 02:01, Boespflug, Mathieu <span dir="ltr"><<a href="mailto:m@tweag.io" target="_blank">m@tweag.io</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div dir="ltr">Hi Harendra,<div><br></div><div>I ran into this very problem recently. Turns out -traditional knows string concatenation too. I seem to remember learning this by browsing the GHC source code, but now I can't find any occurrence of this pattern. But here's an example of how to do string concatenation with CPP in -traditional mode: <a href="https://github.com/tweag/sparkle/blob/a4e481aa5180b6ec93c219f827aefe932b66a953/inline-java/src/Foreign/JNI.hs#L274" target="_blank">https://github.com/<wbr>tweag/sparkle/blob/<wbr>a4e481aa5180b6ec93c219f827aefe<wbr>932b66a953/inline-java/src/<wbr>Foreign/JNI.hs#L274</a>.</div><div><br></div><div>HTH,</div></div><div class="gmail_extra"><br clear="all"><div><div data-smartmail="gmail_signature">--<br>Mathieu Boespflug<br>Founder at <a href="http://tweag.io" target="_blank">http://tweag.io</a>.</div></div>
<br><div class="gmail_quote"><div><div class="h5">On 20 August 2016 at 20:33, Brandon Allbery <span dir="ltr"><<a href="mailto:allbery.b@gmail.com" target="_blank">allbery.b@gmail.com</a>></span> wrote:<br></div></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div><div class="h5"><div dir="ltr"><div class="gmail_extra"><span><div class="gmail_quote">On Sat, Aug 20, 2016 at 2:27 PM, Harendra Kumar <span dir="ltr"><<a href="mailto:harendra.kumar@gmail.com" target="_blank">harendra.kumar@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div dir="ltr">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?<div><br></div><div><div>Is there any other better way to achieve this? What is the standard way of doing this if any?</div></div></div></blockquote></div><br></span>Removing -traditional will break much Haskell source. Go look at the history of clang with ghc (clang doesn't do -traditional) to see what happens. (tl;dr: without -traditional, cpp knows too much about what constitutes valid C, and mangles and/or throws errors on valid Haskell that doesn't lex the way C does.)</div><div class="gmail_extra"><br></div><div class="gmail_extra">You might want to look at cpphs as an alternative preprocessor. There are some ancient K&R-era hacks that could be used if absolutely necessary, but cpphs should be a much simpler and cleaner solution.<span><font color="#888888"><br clear="all"><div><br></div>-- <br><div data-smartmail="gmail_signature"><div dir="ltr"><div>brandon s allbery kf8nh sine nomine associates</div><div><a href="mailto:allbery.b@gmail.com" target="_blank">allbery.b@gmail.com</a> <a href="mailto:ballbery@sinenomine.net" target="_blank">ballbery@sinenomine.net</a></div><div>unix, openafs, kerberos, infrastructure, xmonad <a href="http://sinenomine.net" target="_blank">http://sinenomine.net</a></div></div></div>
</font></span></div></div>
<br></div></div>______________________________<wbr>_________________<br>
ghc-devs mailing list<br>
<a href="mailto:ghc-devs@haskell.org" target="_blank">ghc-devs@haskell.org</a><br>
<a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs" rel="noreferrer" target="_blank">http://mail.haskell.org/cgi-bi<wbr>n/mailman/listinfo/ghc-devs</a><br>
<br></blockquote></div><br></div>
</blockquote></div><br></div></div></div>