X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=ghc%2Fcompiler%2Fmain%2FDriverUtil.hs;h=264be5cee5baa62c64a99a4ba78994768de3e5ed;hb=174e46d5173abe64a5a05e26864d1339f3bcbe61;hp=77c0f4c637c1a70be67df16ec8861b23ef2a1d58;hpb=16d5d1c75c999677783c9c1bda519540fa9a6e58;p=ghc-hetmet.git diff --git a/ghc/compiler/main/DriverUtil.hs b/ghc/compiler/main/DriverUtil.hs index 77c0f4c..264be5c 100644 --- a/ghc/compiler/main/DriverUtil.hs +++ b/ghc/compiler/main/DriverUtil.hs @@ -1,5 +1,5 @@ ----------------------------------------------------------------------------- --- $Id: DriverUtil.hs,v 1.24 2001/06/14 12:50:06 simonpj Exp $ +-- $Id: DriverUtil.hs,v 1.27 2001/08/16 11:06:10 simonmar 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 @@ -60,12 +61,19 @@ optionRegex = mkRegex "\\{-#[ \t]+OPTIONS[ \t]+(.*)#-\\}" -- -} softGetDirectoryContents d = IO.catch (getDirectoryContents d) - (\_ -> do hPutStr stderr + (\_ -> do hPutStrLn stderr ("WARNING: error while reading directory " ++ d) return [] ) ----------------------------------------------------------------------------- +-- Prefixing underscore to linker-level names +prefixUnderscore :: String -> String +prefixUnderscore + | cLeadingUnderscore == "YES" = ('_':) + | otherwise = id + +----------------------------------------------------------------------------- -- Utils unknownFlagErr :: String -> a