[project @ 2001-07-24 04:47:06 by ken]
[ghc-hetmet.git] / ghc / compiler / main / DriverUtil.hs
index 77c0f4c..ad067d6 100644 (file)
@@ -1,5 +1,5 @@
 -----------------------------------------------------------------------------
--- $Id: DriverUtil.hs,v 1.24 2001/06/14 12:50:06 simonpj Exp $
+-- $Id: DriverUtil.hs,v 1.26 2001/07/23 20:19:53 sof Exp $
 --
 -- Utils for the driver
 --
@@ -14,6 +14,7 @@ module DriverUtil where
 
 import Util
 import Panic
+import Config          ( cLeadingUnderscore )
 
 import IOExts
 import Exception
@@ -38,7 +39,7 @@ getOptionsFromSource
        -> IO [String]          -- options, if any
 getOptionsFromSource file
   = do h <- openFile file ReadMode
-       catchJust ioErrors (look h)
+       catchJust ioErrors (look h `finally` hClose h)
          (\e -> if isEOFError e then return [] else ioError e)
   where
        look h = do
@@ -66,6 +67,13 @@ softGetDirectoryContents d
          )
 
 -----------------------------------------------------------------------------
+-- Prefixing underscore to linker-level names
+prefixUnderscore :: String -> String
+prefixUnderscore
+ | cLeadingUnderscore == "YES" = ('_':)
+ | otherwise                   = id
+
+-----------------------------------------------------------------------------
 -- Utils
 
 unknownFlagErr :: String -> a