Commit 8ea6ae88 authored by simonpj's avatar simonpj

[project @ 2003-05-28 08:22:22 by simonpj]

Remove duplicate #includes arising from foreign import decls
parent f98968f0
......@@ -35,6 +35,7 @@ import ErrUtils ( dumpIfSet_dyn, showPass )
import Outputable
import Pretty ( Mode(..), printDoc )
import Module ( Module )
import ListSetOps ( removeDupsEq )
import Monad ( when )
import IO
......@@ -117,14 +118,16 @@ outputC dflags filenm flat_absC
c_includes <- getPackageCIncludes pkg_configs
let cmdline_includes = cmdlineHcIncludes dflags -- -#include options
ffi_decl_headers = case foreign_stubs of
NoStubs -> []
ForeignStubs _ _ fdhs _ -> fdhs
ffi_decl_headers
= case foreign_stubs of
NoStubs -> []
ForeignStubs _ _ fdhs _ -> map unpackFS (fst (removeDupsEq fdhs))
-- Remove duplicates, because distinct foreign import decls
-- may cite the same #include. Order doesn't matter.
all_headers = c_includes
++ reverse cmdline_includes
++ reverse (map unpackFS ffi_decl_headers)
-- reverse correct?
++ ffi_decl_headers
let cc_injects = unlines (map mk_include all_headers)
mk_include h_file =
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment