Initially I noticed the error as a c2hs failure on most projects when using c2hs against gcc-11.0.0 (development trunk).
Complete c2hs example:
$ cat a.chs
module M where
$ /usr/bin/c2hs '--cpp=x86_64-pc-linux-gnu-gcc-10.2.0' '--cppopts=-E' a.chs
$ /usr/bin/c2hs '--cpp=x86_64-pc-linux-gnu-gcc-11.0.0' '--cppopts=-E' a.chs
c2hs: C header contains errors:
a.i:1: (column 1) [ERROR] >>> Lexical error !
The character '#' does not fit here.
This seems to happen because gcc-11 slightly renumbered line numbers for synthetic entries:
I think the error is also seen when running language-c directly as:
$ ghci
Prelude> Language.C.parseC (Data.ByteString.Char8.pack "# 1 \"/dev/null\"\n") Language.C.nopos
*** Exception: No match in record selector posOffset
Prelude> Language.C.parseC (Data.ByteString.Char8.pack "# 0 \"/dev/null\"\n") Language.C.nopos
Left <no file>:: [ERROR] >>> Syntax Error !
Lexical error !
The character '#' does not fit here.
Initially I noticed the error as a
c2hs
failure on most projects when usingc2hs
againstgcc-11.0.0
(development trunk).Complete c2hs example:
This seems to happen because
gcc-11
slightly renumbered line numbers for synthetic entries:Note:
# 1 "/dev/null"
changed to# 0 "/dev/null"
.I think the error is also seen when running
language-c
directly as:Thanks!