diff options
author | Matthew Pickering <matthewtpickering@gmail.com> | 2019-01-31 11:01:04 +0000 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2019-02-03 14:20:27 -0500 |
commit | 8dcd00cef7782c64b5484b106f4fd77c8c87e40a (patch) | |
tree | 7e884bfee261296997d6fa2254d311425b5c61bd /hadrian | |
parent | 59516e4bbfc0baaa71c83fcd4493c27c422e5d57 (diff) | |
download | haskell-8dcd00cef7782c64b5484b106f4fd77c8c87e40a.tar.gz |
Add werror function to Flavour.hs
This function makes it easy to turn on `-Werror` in the correct manner
to mimic how CI turns on -Werror.
Diffstat (limited to 'hadrian')
-rw-r--r-- | hadrian/doc/user-settings.md | 11 | ||||
-rw-r--r-- | hadrian/src/Flavour.hs | 8 | ||||
-rw-r--r-- | hadrian/src/UserSettings.hs | 4 |
3 files changed, 22 insertions, 1 deletions
diff --git a/hadrian/doc/user-settings.md b/hadrian/doc/user-settings.md index 49e560cc7e..b997cd977f 100644 --- a/hadrian/doc/user-settings.md +++ b/hadrian/doc/user-settings.md @@ -102,6 +102,17 @@ patterns such as `"//Prelude.*"` can be used when matching input and output file where `//` matches an arbitrary number of path components and `*` matches an entire path component, excluding any separators. +### Enabling -Werror + +It is useful to enable `-Werror` when building GHC as this setting is +used in the CI to ensure a warning free build. The `werror` function can be +used to easily modify a flavour to turn this setting on. + +``` +devel2WerrorFlavour :: Flavour +devel2WerrorFlavour = werror (developmentFlavour Stage2) +``` + ## Packages Users can add and remove packages from particular build stages. As an example, diff --git a/hadrian/src/Flavour.hs b/hadrian/src/Flavour.hs index e95e0d7e1f..23e2aa8a81 100644 --- a/hadrian/src/Flavour.hs +++ b/hadrian/src/Flavour.hs @@ -1,4 +1,4 @@ -module Flavour (Flavour (..)) where +module Flavour (Flavour (..), werror) where import Expression @@ -32,3 +32,9 @@ data Flavour = Flavour { ghcProfiled :: Bool, -- | Build GHC with debug information. ghcDebugged :: Bool } + + +-- | Turn on -Werror for packages built with the stage1 compiler. +-- It mimics the CI settings so is useful to turn on when developing. +werror :: Flavour -> Flavour +werror fl = fl { args = args fl <> (builder Ghc ? notStage0 ? arg "-Werror") } diff --git a/hadrian/src/UserSettings.hs b/hadrian/src/UserSettings.hs index 8e0b4fc769..c92dd11d44 100644 --- a/hadrian/src/UserSettings.hs +++ b/hadrian/src/UserSettings.hs @@ -2,6 +2,10 @@ -- hadrian/src/UserSettings.hs to hadrian/UserSettings.hs and edit your copy. -- If you don't copy the file your changes will be tracked by git and you can -- accidentally commit them. +-- +-- See doc/user-settings.md for instructions, and src/Flavour.hs for auxiliary +-- functions for manipulating flavours. +-- Please update doc/user-settings.md when committing changes to this file. module UserSettings ( userFlavours, userPackages, userDefaultFlavour, verboseCommand, buildProgressColour, successColour, finalStage |