[project @ 2003-02-20 13:01:20 by simonpj]
authorsimonpj <unknown>
Thu, 20 Feb 2003 13:01:21 +0000 (13:01 +0000)
committersimonpj <unknown>
Thu, 20 Feb 2003 13:01:21 +0000 (13:01 +0000)
Eliminate brain-dead outputC pattern-match failure

ghc/compiler/deSugar/DsForeign.lhs
ghc/compiler/main/CodeOutput.lhs

index 4074d04..b2ad06b 100644 (file)
@@ -66,6 +66,8 @@ type Binding = (Id, CoreExpr) -- No rec/nonrec structure;
 
 dsForeigns :: [TypecheckedForeignDecl] 
           -> DsM (ForeignStubs, [Binding])
+dsForeigns [] 
+  = returnDs (NoStubs, [])
 dsForeigns fos
   = foldlDs combine (ForeignStubs empty empty [] [], []) fos
  where
index 1a08ded..fcad129 100644 (file)
@@ -104,7 +104,7 @@ doOutput filenm io_action = bracket (openFile filenm WriteMode) hClose io_action
 
 \begin{code}
 outputC dflags filenm flat_absC 
-       (stub_h_exists, _) dependencies (ForeignStubs _ _ ffi_decl_headers _ ) 
+       (stub_h_exists, _) dependencies foreign_stubs
   = do dumpIfSet_dyn dflags Opt_D_dump_realC "Real C" (dumpRealC flat_absC)
 
        -- figure out which header files to #include in the generated .hc file:
@@ -120,6 +120,10 @@ 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 
+
            all_headers =  c_includes
                       ++ reverse cmdline_includes
                       ++ reverse (map unpackFS ffi_decl_headers)