haskell / haskell/hsc2hs

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

Open
#4 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Haskell
Stars
46
Forks
30
PR merge metrics
No merged PRs in 30d

Description

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`

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.