From 131774367f941bf26b2bacab921389fb5c24abf8 Mon Sep 17 00:00:00 2001 From: simonmar Date: Tue, 11 Jan 2005 15:59:39 +0000 Subject: [PATCH] [project @ 2005-01-11 15:59:39 by simonmar] Make GHC accept OPTIONS_GHC. OPTIONS is also accepted, for now. --- ghc/compiler/main/DriverUtil.hs | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/ghc/compiler/main/DriverUtil.hs b/ghc/compiler/main/DriverUtil.hs index 2cee71d..8893c56 100644 --- a/ghc/compiler/main/DriverUtil.hs +++ b/ghc/compiler/main/DriverUtil.hs @@ -1,5 +1,5 @@ ----------------------------------------------------------------------------- --- $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 -- @@ -64,14 +64,22 @@ getOptionsFromSource file return (words opts ++ rest) | otherwise -> return [] +-- detect {-# OPTIONS_GHC ... #-}. For the time being, we accept OPTIONS +-- instead of OPTIONS_GHC, but that is deprecated. matchOptions s - | 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) | otherwise = Nothing + 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 -- 1.7.10.4