$ c2hs external/c2hs_repo/Baz.chs -o out//Baz.hs --cpp /usr/bin/cpp -C-includeghcplatform.h -C-includeghcversion.h -C-iquote
clang: error: no input files
Seems Darwin's cpp is behaving similar to the "openbsd" variant regarding the -xc vs. -x c flags:
bash-3.2$ which cpp
/usr/bin/cpp
bash-3.2$ cpp --version
Apple clang version 13.1.6 (clang-1316.0.21.2.5)
Target: arm64-apple-darwin21.4.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
bash-3.2$ cpp -x c foo.c
clang: error: no input files
I guess the cppopts function could use a little update?
|
-- | C preprocessor options |
|
-- |
|
-- * `-x c' forces CPP to regard the input as C code; this option seems to be |
|
-- understood at least on Linux, FreeBSD, and Solaris and seems to make a |
|
-- difference over the default language setting on FreeBSD |
|
-- |
|
-- * @-P@ would suppress @#line@ directives |
|
-- |
|
cppopts :: [String] |
|
cppopts = case (os,cpp) of |
|
-- why is gcc different between all these platforms? |
|
("openbsd","cpp") -> ["-xc"] |
|
(_,"cpp") -> ["-x", "c"] |
|
(_,"gcc") -> ["-E", "-x", "c"] |
|
_ -> [] |
Seems Darwin's
cppis behaving similar to the "openbsd" variant regarding the-xcvs.-x cflags:I guess the
cppoptsfunction could use a little update?c2hs/src/C2HS/Config.hs
Lines 53 to 67 in e05db30