diff options
author | Ben Gamari <ben@smart-cactus.org> | 2021-07-21 11:47:04 -0400 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2022-05-16 08:30:44 -0400 |
commit | 27b904090182c8667640f3ef24e74584f3864a4c (patch) | |
tree | 75d5138bad6ea69a88724547b76d0169c14fe9e3 /hadrian | |
parent | aed356e1b68b2201fa6e3c5bf14079f3f3366b44 (diff) | |
download | haskell-27b904090182c8667640f3ef24e74584f3864a4c.tar.gz |
hadrian: Introduce linting flavour transformer (+lint)
The linting flavour enables -dlint uniformly across anything build by
the stage1 compiler.
-dcmm-lint is not currently enabled because it fails on i386 (see #21563)
Diffstat (limited to 'hadrian')
-rw-r--r-- | hadrian/doc/flavours.md | 5 | ||||
-rw-r--r-- | hadrian/src/Flavour.hs | 14 |
2 files changed, 19 insertions, 0 deletions
diff --git a/hadrian/doc/flavours.md b/hadrian/doc/flavours.md index 5f406364a8..ad80962dbf 100644 --- a/hadrian/doc/flavours.md +++ b/hadrian/doc/flavours.md @@ -276,6 +276,11 @@ The supported transformers are listed below: <td>Collects timings while building the stage2+ compiler by adding the flags <code>-ddump-to-file -ddump-timings</code>.</td> </tr> + <tr> + <td><code>lint</code></td> + <td>Enable Core, STG, and C-- linting in all compilation with the stage1 + compiler.</td> + </tr> </table> ### Static diff --git a/hadrian/src/Flavour.hs b/hadrian/src/Flavour.hs index 41d2f66f19..9344563ba5 100644 --- a/hadrian/src/Flavour.hs +++ b/hadrian/src/Flavour.hs @@ -52,6 +52,7 @@ flavourTransformers = M.fromList , "assertions" =: enableAssertions , "debug_ghc" =: debugGhc Stage1 , "debug_stage1_ghc" =: debugGhc Stage0 + , "lint" =: enableLinting ] where (=:) = (,) @@ -130,6 +131,19 @@ enableTickyGhc = , arg "-ddump-stg-final" ] +-- | Enable Core, STG, and (not C--) linting in all compilations with the stage1 compiler. +enableLinting :: Flavour -> Flavour +enableLinting = + addArgs $ stage1 ? mconcat + [ builder (Ghc CompileHs) ? lint + ] + where + lint = mconcat + [ arg "-dcore-lint" + , arg "-dstg-lint" + -- Should be -dlint but currently -dcmm-lint fails due to #21563 + ] + -- | Transform the input 'Flavour' so as to build with -- @-split-sections@ whenever appropriate. You can -- select which package gets built with split sections |