Don't use the cc-options from packages when compiling .hc files
authorSimon Marlow <marlowsd@gmail.com>
Thu, 21 Aug 2008 15:55:49 +0000 (15:55 +0000)
committerSimon Marlow <marlowsd@gmail.com>
Thu, 21 Aug 2008 15:55:49 +0000 (15:55 +0000)
Now that we don't include any header files in .hc apart from our own,
the cc-options from packages are at best superfluous, so don't pass
them.

We still pass them to .c compilations, although I've just made changes
to Cabal so that cc-options from a .cabal file are not copied into the
InstalledPackageInfo.  Most uses of cc-options in Cabal are clearly
intended to be local to the package, but they were being propagated
everywhere, almost certainly unintentionally.

The way is left open for Cabal to allow packages to specify cc-options
that get propagated in the future, if we find a use case for this.

compiler/main/DriverPipeline.hs

index d6b5e0e..e246b8b 100644 (file)
@@ -852,7 +852,13 @@ runPhase cc_phase _stop hsc_env _basename _suff input_fn get_output_fn maybe_loc
 
         let verb = getVerbFlag dflags
 
-       pkg_extra_cc_opts <- getPackageExtraCcOpts dflags pkgs
+        -- cc-options are not passed when compiling .hc files.  Our
+        -- hc code doesn't not #include any header files anyway, so these
+        -- options aren't necessary.
+       pkg_extra_cc_opts <-
+          if cc_phase `eqPhase` HCc
+             then return []
+             else getPackageExtraCcOpts dflags pkgs
 
 #ifdef darwin_TARGET_OS
         pkg_framework_paths <- getPackageFrameworkPath dflags pkgs