diff options
author | Mateusz Kowalczyk <fuuzetsu@fuuzetsu.co.uk> | 2013-09-05 01:28:15 +0100 |
---|---|---|
committer | Simon Hengel <sol@typeful.net> | 2013-09-18 22:43:35 +0200 |
commit | 183cad171113faf7d44a25116de6586cd4f07578 (patch) | |
tree | 7e07900fbf8c0e2cad90affd8c0d4c29d859e0fa | |
parent | a5bf30f4968e7058e9c2a1f6264def56631d8bdd (diff) |
Fixes #5
-rw-r--r-- | src/Haddock.hs | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/Haddock.hs b/src/Haddock.hs index 398aed4c..a7ac5baf 100644 --- a/src/Haddock.hs +++ b/src/Haddock.hs @@ -34,6 +34,7 @@ import Haddock.GhcUtils hiding (pretty) import Control.Monad hiding (forM_) import Data.Foldable (forM_) +import Data.List (isPrefixOf) import Control.Exception import Data.Maybe import Data.IORef @@ -144,6 +145,10 @@ haddock args = handleTopExceptions $ do Just "YES" -> return $ Flag_OptGhc "-dynamic-too" : flags _ -> return flags + unless (Flag_NoWarnings `elem` flags) $ do + forM_ (warnings args) $ \warning -> do + hPutStrLn stderr warning + withGhc' flags' $ do dflags <- getDynFlags @@ -171,6 +176,12 @@ haddock args = handleTopExceptions $ do -- Render even though there are no input files (usually contents/index). liftIO $ renderStep dflags flags qual packages [] +-- | Create warnings about potential misuse of -optghc +warnings :: [String] -> [String] +warnings = map format . filter (isPrefixOf "-optghc") + where + format arg = concat ["Warning: `", arg, "' means `-o ", drop 2 arg, "', did you mean `-", arg, "'?"] + withGhc' :: [Flag] -> Ghc a -> IO a withGhc' flags action = do |