From: simonmar Date: Tue, 20 Jun 2000 15:26:34 +0000 (+0000) Subject: [project @ 2000-06-20 15:26:34 by simonmar] X-Git-Tag: Approximately_9120_patches~4163 X-Git-Url: http://git.megacz.com/?a=commitdiff_plain;h=74062336cbb3c9eb39ef3704f5fa44873c25171f;p=ghc-hetmet.git [project @ 2000-06-20 15:26:34 by simonmar] remove duplicates from the list of ways, so that eg. ghc -prof -prof is legal. --- diff --git a/ghc/driver/Main.hs b/ghc/driver/Main.hs index ca58366..d065d2d 100644 --- a/ghc/driver/Main.hs +++ b/ghc/driver/Main.hs @@ -1629,13 +1629,13 @@ opts = , ( "no-recomp" , NoArg (writeIORef recomp False) ) ------- ways -------------------------------------------------------- - , ( "prof" , NoArg (add ways WayProf) ) - , ( "unreg" , NoArg (add ways WayUnreg) ) - , ( "ticky" , NoArg (add ways WayTicky) ) - , ( "parallel" , NoArg (add ways WayPar) ) - , ( "gransim" , NoArg (add ways WayGran) ) - , ( "smp" , NoArg (add ways WaySMP) ) - , ( "debug" , NoArg (add ways WayDebug) ) + , ( "prof" , NoArg (addNoDups ways WayProf) ) + , ( "unreg" , NoArg (addNoDups ways WayUnreg) ) + , ( "ticky" , NoArg (addNoDups ways WayTicky) ) + , ( "parallel" , NoArg (addNoDups ways WayPar) ) + , ( "gransim" , NoArg (addNoDups ways WayGran) ) + , ( "smp" , NoArg (addNoDups ways WaySMP) ) + , ( "debug" , NoArg (addNoDups ways WayDebug) ) -- ToDo: user ways ------- Interface files --------------------------------------------- @@ -1947,6 +1947,11 @@ add var x = do xs <- readIORef var writeIORef var (x:xs) +addNoDups :: Eq a => IORef [a] -> a -> IO () +addNoDups var x = do + xs <- readIORef var + if x `elem` xs then return () else writeIORef var (x:xs) + remove_suffix :: String -> Char -> String remove_suffix s c | null pre = reverse suf