hsc2hs icon indicating copy to clipboard operation
hsc2hs copied to clipboard

`--cross-safe` seems not to preprocess (CPP) the `.hsc` file.

Open angerman opened this issue 6 years ago • 0 comments

I've run into a case where --cross-safe was issuing fatal warnings, because let was used. However that was guarded by an #if. And the relevant define was given via the --cflags parameter. As such preprocessing the file with the provided CC via --cc together with the --cflags should have resulted in output that was actually --cross-safe.

It appears as if hsc2hs does not preprocess the file, and as such trips over those.

The package in question is network. And the file is Network/Socket/Types.hsc

The offending lines are:

#if __GLASGOW_HASKELL__ < 800
#let alignment t = "%lu", (unsigned long)offsetof(struct {char x__; t (y__); }, y__)
#endif

Where hsc2hs was invoked with --cc=/path/to/clang --cflags=-D__GLASGOW_HASKELL__=803 --cross-safe

angerman avatar Nov 26 '17 08:11 angerman