[Haskell-cafe] RFC: "Native -XCPP" Proposal

Sven Panne svenpanne at gmail.com
Wed May 6 14:32:11 UTC 2015


2015-05-06 16:21 GMT+02:00 Bardur Arantsson <spam at scientician.net>:
> +1, I'll wager that the vast majority of usages are just for version
> range checks.

The OpenGL-related packages used macros to generate some binding magic
(a "foreign import" plus some helper functions for each API entry),
not just range checks. I had serious trouble when Apple switched to
clang, so as a quick fix, the macro-expanded (via GCC's CPP) sources
had been checked in. :-P Nowadays the binding is generated from the
OpenGL XML registry file, so this is not an issue anymore.

> If there are packages that require more, they could just keep using the
> system-cpp or, I, guess cpphs if it gets baked into GHC. Like you, I'd
> want to see real evidence that that's actually worth the
> effort/complication.

Simply relying on the system CPP doesn't work due to the various
differences between GCC's CPP and the one from clang, see e.g.
https://github.com/haskell-opengl/OpenGLRaw/issues/18#issuecomment-31428380.
Ignoring the problem doesn't make it go away... ;-)

Note that we still need CPP to handle the various calling conventions
on the different platforms when the FFI is used, so it's not only
range checks, see e.g.
https://github.com/haskell-opengl/OpenGLRaw/blob/master/OpenGLRaw.cabal#L588.


More information about the ghc-devs mailing list