diff options
author | Ben Gamari <ben@smart-cactus.org> | 2021-11-01 21:18:04 -0400 |
---|---|---|
committer | Ben Gamari <ben@smart-cactus.org> | 2021-12-10 17:47:43 -0500 |
commit | 6eb314b2c4a1ea929be1aacfa2892203813fe373 (patch) | |
tree | 9d61bdd26a1ae900d40d031a29de6ffa4ef9ba95 | |
parent | 8b4b9006cab688c05527a89fe4a24497bfa3f670 (diff) | |
download | haskell-wip/T20601.tar.gz |
Introduce -dlint flagwip/T20601
As suggested in #20601, this is a short-hand for enabling the usual
GHC-internal sanity checks one typically leans on when debugging runtime
crashes.
-rw-r--r-- | compiler/GHC/Driver/Session.hs | 18 | ||||
-rw-r--r-- | docs/users_guide/debugging.rst | 12 |
2 files changed, 30 insertions, 0 deletions
diff --git a/compiler/GHC/Driver/Session.hs b/compiler/GHC/Driver/Session.hs index ce08fa49be..6834893b4b 100644 --- a/compiler/GHC/Driver/Session.hs +++ b/compiler/GHC/Driver/Session.hs @@ -2530,6 +2530,8 @@ dynamic_flags_deps = [ (setDumpFlag Opt_D_dump_hi_diffs) , make_ord_flag defGhcFlag "ddump-rtti" (setDumpFlag Opt_D_dump_rtti) + , make_ord_flag defGhcFlag "dlint" + (NoArg enableDLint) , make_ord_flag defGhcFlag "dcore-lint" (NoArg (setGeneralFlag Opt_DoCoreLinting)) , make_ord_flag defGhcFlag "dlinear-core-lint" @@ -3917,6 +3919,22 @@ enableUnusedBinds = mapM_ setWarningFlag unusedBindsFlags disableUnusedBinds :: DynP () disableUnusedBinds = mapM_ unSetWarningFlag unusedBindsFlags +-- | Things you get with `-dlint`. +enableDLint :: DynP () +enableDLint = do + mapM_ setGeneralFlag dLintFlags + addWayDynP WayDebug + where + dLintFlags :: [GeneralFlag] + dLintFlags = + [ Opt_DoCoreLinting + , Opt_DoStgLinting + , Opt_DoCmmLinting + , Opt_DoAsmLinting + , Opt_CatchNonexhaustiveCases + , Opt_LlvmFillUndefWithGarbage + ] + enableGlasgowExts :: DynP () enableGlasgowExts = do setGeneralFlag Opt_PrintExplicitForalls mapM_ setExtensionFlag glasgowExtsFlags diff --git a/docs/users_guide/debugging.rst b/docs/users_guide/debugging.rst index 50a6c279a4..f0a929df5e 100644 --- a/docs/users_guide/debugging.rst +++ b/docs/users_guide/debugging.rst @@ -920,6 +920,18 @@ Checking for consistency single: consistency checks single: lint +.. ghc-flag:: -dlint + :shortdesc: Enable several common internal sanity checkers + :type: dynamic + + :implies: -dcore-lint, -dstg-lint, -dcmm-lint, -dasm-lint, -fllvm-fill-undef-with-garbage, -debug + :since: 9.4.1 + + Turn on various heavy-weight intra-pass sanity-checking measures within GHC + and its runtime system. Notably, this does not include + :ghc-flag:`-falignment-sanitisation` as it incurs a rather hefty runtime + cost. + .. ghc-flag:: -dcore-lint :shortdesc: Turn on internal sanity checking :type: dynamic |