Make GHC accept OPTIONS_GHC. OPTIONS is also accepted, for now.
-----------------------------------------------------------------------------
-----------------------------------------------------------------------------
--- $Id: DriverUtil.hs,v 1.47 2005/01/11 15:22:04 simonmar Exp $
+-- $Id: DriverUtil.hs,v 1.48 2005/01/11 15:59:39 simonmar Exp $
--
-- Utils for the driver
--
--
-- Utils for the driver
--
return (words opts ++ rest)
| otherwise -> return []
return (words opts ++ rest)
| otherwise -> return []
+-- detect {-# OPTIONS_GHC ... #-}. For the time being, we accept OPTIONS
+-- instead of OPTIONS_GHC, but that is deprecated.
- | Just s1 <- maybePrefixMatch "{-#" s, -- -}
- Just s2 <- maybePrefixMatch "OPTIONS" (remove_spaces s1),
- not (is_ident (head s2)),
- Just s3 <- maybePrefixMatch "}-#" (reverse s2)
- = Just (reverse s3)
+ | Just s1 <- maybePrefixMatch "{-#" s -- -}
+ = matchOptions1 (remove_spaces s1)
+ where
+ matchOptions1 s
+ | Just s2 <- maybePrefixMatch "OPTIONS_GHC" s = matchOptions2 s2
+ | Just s2 <- maybePrefixMatch "OPTIONS" s = matchOptions2 s2
+ | otherwise = Nothing
+ matchOptions2 s
+ | not (is_ident (head s)),
+ Just s3 <- maybePrefixMatch "}-#" (reverse s) = Just (reverse s3)
+ | otherwise = Nothing
-----------------------------------------------------------------------------
-- A version of getDirectoryContents that is non-fatal if the
-----------------------------------------------------------------------------
-- A version of getDirectoryContents that is non-fatal if the