[commit: ghc] wip/T16193, wip/fix-json-profiling-report-i386: Add werror function to Flavour.hs (8dcd00c)
git at git.haskell.org
git at git.haskell.org
Tue Feb 5 12:23:29 UTC 2019
Repository : ssh://git@git.haskell.org/ghc
On branches: wip/T16193,wip/fix-json-profiling-report-i386
Link : http://ghc.haskell.org/trac/ghc/changeset/8dcd00cef7782c64b5484b106f4fd77c8c87e40a/ghc
>---------------------------------------------------------------
commit 8dcd00cef7782c64b5484b106f4fd77c8c87e40a
Author: Matthew Pickering <matthewtpickering at gmail.com>
Date: Thu Jan 31 11:01:04 2019 +0000
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.
>---------------------------------------------------------------
8dcd00cef7782c64b5484b106f4fd77c8c87e40a
hadrian/doc/user-settings.md | 11 +++++++++++
hadrian/src/Flavour.hs | 8 +++++++-
hadrian/src/UserSettings.hs | 4 ++++
3 files changed, 22 insertions(+), 1 deletion(-)
diff --git a/hadrian/doc/user-settings.md b/hadrian/doc/user-settings.md
index 49e560c..b997cd9 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 e95e0d7..23e2aa8 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 8e0b4fc..c92dd11 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
More information about the ghc-commits
mailing list