GHC driver behaviour switch

With GHC 6.4.x I was able to use a ghc driver to compile .cpp sources. Now, with GHC HEAD I cannot. GHC HEAD now ALWAYS enforces "treat as .c" option. Let's compare "DriverPipeline.hs". GHC 6.4.x: let langopt | hcc = [ SysTools.Option "-x", SysTools.Option "c"] | otherwise = [ ] SysTools.runCc dflags ( -- force the C compiler to interpret this file as C when -- compiling .hc files, by adding the -x c option. -- Also useful for plain .c files, just in case GHC saw a -- -x c option. langopt ++ ... GHC HEAD: SysTools.runCc dflags ( -- force the C compiler to interpret this file as C when -- compiling .hc files, by adding the -x c option. -- Also useful for plain .c files, just in case GHC saw a -- -x c option. [ SysTools.Option "-x", SysTools.Option "c"] ++ ... This completely breaks my build infrastructure. Could it be reversed? Cheers, Kyra

On Thu, 2006-06-22 at 17:54 +0300, kyra wrote:
With GHC 6.4.x I was able to use a ghc driver to compile .cpp sources. Now, with GHC HEAD I cannot. GHC HEAD now ALWAYS enforces "treat as .c" option.
Just wondering, you're using ghc to compile C++ sources? Is there any reason for doing that rather than using the C++ compiler directly? Duncan

Duncan Coutts wrote:
On Thu, 2006-06-22 at 17:54 +0300, kyra wrote:
With GHC 6.4.x I was able to use a ghc driver to compile .cpp sources. Now, with GHC HEAD I cannot. GHC HEAD now ALWAYS enforces "treat as .c" option.
Just wondering, you're using ghc to compile C++ sources? Is there any reason for doing that rather than using the C++ compiler directly?
Duncan The first and foremost reason - Cabal build infrastructure.
I just put all my C++ sources in a "c-sources" section of my project. That's all. Kyra

kyra wrote:
GHC HEAD:
SysTools.runCc dflags ( -- force the C compiler to interpret this file as C when -- compiling .hc files, by adding the -x c option. -- Also useful for plain .c files, just in case GHC saw a -- -x c option. [ SysTools.Option "-x", SysTools.Option "c"] ++ ...
This completely breaks my build infrastructure. Could it be reversed?
The reason for this change is that you can now say $ ghc -x c foo.wibble -c and have foo.wibble treated as a .c file by GHC. To fix this properly we should have a C++ compiler phase in DriverPipeline, it wouldn't be too hard. Care to submit a bug report with this info? Cheers, Simon
participants (3)
-
Duncan Coutts
-
kyra
-
Simon Marlow