Hi Mark,
On Sun, Nov 03, 2013 at 03:01:32PM -0800, Mark Lentczner wrote:
> This does not appear to be the case, at least any more. The way GHC invokes
> gcc
> for c pre-processing only removes /*…*/ style comments, not the later //
> style:
Yes, I can reproduce your behaviour on my system and ghc seems to call cpp with
some options, because the default behaviour removes C++ style comments:
dan@machine ~> cat cpp.test
/* comment */
code
// comment
dan@machine ~> cpp cpp.test
# 1 "cpp.test"
# 1 "<command-line>"
# 1 "cpp.test"
code
I can't recall it exactly, if I had the C++ comment issue only with
cpphs, because cpp had problems with some Haskell code, or if I also
had the issue with cpp itself.
I just tried cpphs and its default behaviour removes the C++ style comments:
dan@machine ~> cat test.hs
(//) :: Double -> Double -> Double
a // b = a / b / b
main = print $ 1 // 2
dan@machine ~> ghci
Prelude> :set -cpp -pgmPcpphs -optP--cpp
Prelude> :l test
[1 of 1] Compiling Main ( test.hs, interpreted )
test.hs:2:1:
parse error (possibly incorrect indentation or mismatched brackets)
Failed, modules loaded: none.
That's a bit unfortunate, that the default behaviour of ghc using cpp and cpphs
differs.
Greetings,
Daniel
_______________________________________________
ghc-devs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/ghc-devs