summaryrefslogtreecommitdiff
path: root/ghc/compiler
diff options
context:
space:
mode:
authorsimonmar <unknown>2005-01-11 16:21:53 +0000
committersimonmar <unknown>2005-01-11 16:21:53 +0000
commit2128bf29e735fb34d343868f45ef6e321ce74d72 (patch)
tree0380a9639579b0940ce4ebe562a68165995cf4cf /ghc/compiler
parent55d795e2ca8f0c97e3002d4eb528862dd9d44e55 (diff)
downloadhaskell-2128bf29e735fb34d343868f45ef6e321ce74d72.tar.gz
[project @ 2005-01-11 16:21:53 by simonmar]
ignore OPTIONS_anything_else when looking for OPTIONS_GHC/OPTIONS pragmas.
Diffstat (limited to 'ghc/compiler')
-rw-r--r--ghc/compiler/main/DriverUtil.hs19
1 files changed, 12 insertions, 7 deletions
diff --git a/ghc/compiler/main/DriverUtil.hs b/ghc/compiler/main/DriverUtil.hs
index 8893c56645..8a85670230 100644
--- a/ghc/compiler/main/DriverUtil.hs
+++ b/ghc/compiler/main/DriverUtil.hs
@@ -1,5 +1,5 @@
-----------------------------------------------------------------------------
--- $Id: DriverUtil.hs,v 1.48 2005/01/11 15:59:39 simonmar Exp $
+-- $Id: DriverUtil.hs,v 1.49 2005/01/11 16:21:53 simonmar Exp $
--
-- Utils for the driver
--
@@ -73,13 +73,18 @@ matchOptions s
= Nothing
where
matchOptions1 s
- | Just s2 <- maybePrefixMatch "OPTIONS_GHC" s = matchOptions2 s2
- | Just s2 <- maybePrefixMatch "OPTIONS" s = matchOptions2 s2
- | otherwise = Nothing
+ | Just s2 <- maybePrefixMatch "OPTIONS" s
+ = case () of
+ _ | Just s3 <- maybePrefixMatch "_GHC" s2, not (is_ident (head s3))
+ -> matchOptions2 s3
+ | not (is_ident (head s2))
+ -> matchOptions2 s2
+ | otherwise
+ -> Just [] -- OPTIONS_anything is ignored, not treated as start of source
+ | otherwise = Nothing
matchOptions2 s
- | not (is_ident (head s)),
- Just s3 <- maybePrefixMatch "}-#" (reverse s) = Just (reverse s3)
- | otherwise = Nothing
+ | Just s3 <- maybePrefixMatch "}-#" (reverse s) = Just (reverse s3)
+ | otherwise = Nothing
-----------------------------------------------------------------------------
-- A version of getDirectoryContents that is non-fatal if the