diff options
Diffstat (limited to 'src/Haddock')
-rw-r--r-- | src/Haddock/Interface.hs | 3 | ||||
-rw-r--r-- | src/Haddock/Interface/Rename.hs | 12 | ||||
-rw-r--r-- | src/Haddock/Options.hs | 4 |
3 files changed, 11 insertions, 8 deletions
diff --git a/src/Haddock/Interface.hs b/src/Haddock/Interface.hs index 51d8de2c..8b8d703d 100644 --- a/src/Haddock/Interface.hs +++ b/src/Haddock/Interface.hs @@ -50,7 +50,8 @@ createInterfaces modules externalLinks flags = (interfaces, homeLinks, messages) let interfaces' = attachInstances interfaces allNames -- part 3, rename the interfaces - interfaces'' <- mapM (renameInterface links) interfaces' + let warnings = Flag_NoWarnings `notElem` flags + interfaces'' <- mapM (renameInterface links warnings) interfaces' return (interfaces'', homeLinks) diff --git a/src/Haddock/Interface/Rename.hs b/src/Haddock/Interface/Rename.hs index 11a0a14c..5ce6aa24 100644 --- a/src/Haddock/Interface/Rename.hs +++ b/src/Haddock/Interface/Rename.hs @@ -29,8 +29,8 @@ import Control.Arrow import Control.Monad hiding (mapM) -renameInterface :: LinkEnv -> Interface -> ErrMsgM Interface -renameInterface renamingEnv mod = +renameInterface :: LinkEnv -> Bool -> Interface -> ErrMsgM Interface +renameInterface renamingEnv warnings mod = -- first create the local env, where every name exported by this module -- is mapped to itself, and everything else comes from the global renaming @@ -66,10 +66,10 @@ renameInterface renamingEnv mod = in do -- report things that we couldn't link to. Only do this for non-hidden -- modules. - when (OptHide `notElem` ifaceOptions mod && not (null strings)) $ - tell ["Warning: " ++ show (ppr (ifaceMod mod) defaultUserStyle) ++ - ": could not find link destinations for:\n"++ - " " ++ concat (map (' ':) strings) ] + unless (OptHide `elem` ifaceOptions mod || null strings || not warnings) $ + tell ["Warning: " ++ show (ppr (ifaceMod mod) defaultUserStyle) ++ + ": could not find link destinations for:\n"++ + " " ++ concat (map (' ':) strings) ] return $ mod { ifaceRnDoc = finalModuleDoc, ifaceRnDocMap = rnDocMap, diff --git a/src/Haddock/Options.hs b/src/Haddock/Options.hs index 31976ae0..6e5514cf 100644 --- a/src/Haddock/Options.hs +++ b/src/Haddock/Options.hs @@ -83,6 +83,7 @@ data Flag | Flag_OptGhc String | Flag_GhcLibDir String | Flag_GhcVersion + | Flag_NoWarnings deriving (Eq) @@ -149,5 +150,6 @@ options backwardsCompat = Option [] ["optghc"] (ReqArg Flag_OptGhc "OPTION") "Forward option to GHC", Option [] ["ghc-version"] (NoArg Flag_GhcVersion) - "output GHC version in numeric format" + "output GHC version in numeric format", + Option ['w'] ["no-warnings"] (NoArg Flag_NoWarnings) "turn off all warnings" ] |