haskell / haskell/c2hs

Cannot deal with non-ASCII preprocessor output

Open
#238 1 comment 3 reactions 0 assignees View on GitHub
Dominant language
Haskell
Stars
211
Forks
52
PR merge metrics
No merged PRs in 30d

Description

Currently the gcc preprocessor output varies depending on the language set. On my system, this is what a short c program's output looks like:
```
⚡ gcc -E test.c
# 1 "test.c"
# 1 ""
# 1 "<命令行>"
# 31 "<命令行>"
# 1 "/usr/include/stdc-predef.h" 1 3 4
# 32 "<命令行>" 2
# 1 "test.c"
int main()
{
return 0;
}
```
and c2hs can't process it due to not being able to handle non-ascii characters in line 3, 4 and 6. See #237 .

if we override the environment variable LANG, we get
```
⚡ LANG=ASCII gcc -E test.c
# 1 "test.c"
# 1 ""
# 1 ""
# 31 ""
# 1 "/usr/include/stdc-predef.h" 1 3 4
# 32 "" 2
# 1 "test.c"
int main()
{
return 0;
}
```
which works correctly.

This bug is breaking every test case and causing more problems downstream (every package that depends on c2hs is failing to build right now).
I suppose it has something to do with takeChar's implementation.

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.