From 8ea79a16c57a9fcfd091ab7f4aa457e100fa42b5 Mon Sep 17 00:00:00 2001 From: Ben Gamari Date: Mon, 1 Nov 2021 21:12:11 -0400 Subject: Rename -fcatch-bottoms to -fcatch-nonexhaustive-cases As noted in #20601, the previous name was rather misleading. --- compiler/GHC/CoreToStg/Prep.hs | 2 +- compiler/GHC/Driver/Flags.hs | 4 ++-- compiler/GHC/Driver/Session.hs | 2 +- docs/users_guide/debugging.rst | 2 +- testsuite/tests/codeGen/should_compile/Makefile | 11 ++++++----- 5 files changed, 11 insertions(+), 10 deletions(-) diff --git a/compiler/GHC/CoreToStg/Prep.hs b/compiler/GHC/CoreToStg/Prep.hs index bc12ec2b63..918530695f 100644 --- a/compiler/GHC/CoreToStg/Prep.hs +++ b/compiler/GHC/CoreToStg/Prep.hs @@ -855,7 +855,7 @@ cpeRhsE env (Case scrut bndr ty alts) -- enabled we instead produce an 'error' expression to catch -- the case where a function we think should bottom -- unexpectedly returns. - | gopt Opt_CatchBottoms (cpe_dynFlags env) + | gopt Opt_CatchNonexhaustiveCases (cpe_dynFlags env) , not (altsAreExhaustive alts) = addDefault alts (Just err) | otherwise = alts diff --git a/compiler/GHC/Driver/Flags.hs b/compiler/GHC/Driver/Flags.hs index d0d114dba8..ee5144854d 100644 --- a/compiler/GHC/Driver/Flags.hs +++ b/compiler/GHC/Driver/Flags.hs @@ -227,7 +227,7 @@ data GeneralFlag | Opt_WorkerWrapper | Opt_SolveConstantDicts | Opt_AlignmentSanitisation - | Opt_CatchBottoms + | Opt_CatchNonexhaustiveCases | Opt_NumConstantFolding | Opt_CoreConstantFolding | Opt_FastPAPCalls -- #6084 @@ -443,7 +443,7 @@ optimisationFlags = EnumSet.fromList , Opt_CprAnal , Opt_WorkerWrapper , Opt_SolveConstantDicts - , Opt_CatchBottoms + , Opt_CatchNonexhaustiveCases , Opt_IgnoreAsserts ] diff --git a/compiler/GHC/Driver/Session.hs b/compiler/GHC/Driver/Session.hs index 044f2b3d5d..be30e36052 100644 --- a/compiler/GHC/Driver/Session.hs +++ b/compiler/GHC/Driver/Session.hs @@ -3395,7 +3395,7 @@ fFlagsDeps = [ flagSpec "version-macros" Opt_VersionMacros, flagSpec "worker-wrapper" Opt_WorkerWrapper, flagSpec "solve-constant-dicts" Opt_SolveConstantDicts, - flagSpec "catch-bottoms" Opt_CatchBottoms, + flagSpec "catch-nonexhaustive-cases" Opt_CatchNonexhaustiveCases, flagSpec "alignment-sanitisation" Opt_AlignmentSanitisation, flagSpec "check-prim-bounds" Opt_DoBoundsChecking, flagSpec "num-constant-folding" Opt_NumConstantFolding, diff --git a/docs/users_guide/debugging.rst b/docs/users_guide/debugging.rst index 77bb7f0e2c..50a6c279a4 100644 --- a/docs/users_guide/debugging.rst +++ b/docs/users_guide/debugging.rst @@ -982,7 +982,7 @@ Checking for consistency as each function will start at a cache line. However forcing larger alignments in general reduces performance. -.. ghc-flag:: -fcatch-bottoms +.. ghc-flag:: -fcatch-nonexhaustive-cases :shortdesc: Add a default ``error`` alternative to case expressions without a default alternative. :type: dynamic diff --git a/testsuite/tests/codeGen/should_compile/Makefile b/testsuite/tests/codeGen/should_compile/Makefile index 58f3609cc9..2da161c879 100644 --- a/testsuite/tests/codeGen/should_compile/Makefile +++ b/testsuite/tests/codeGen/should_compile/Makefile @@ -58,9 +58,10 @@ T15155l: '$(TEST_HC)' $(TEST_HC_OPTS) -c -O0 -ddump-llvm T15155l.hs 2>/dev/null | \ grep -F "@T15155_b_closure = alias i8, i8* @T15155_a_closure" -# Without -fcatch-bottoms `f` is non-CAFFY. With -fcatch-bottoms it becomes -# CAFFY. Before CafInfo rework (c846618a) this used to cause incorrect CafInfo -# attached to `f` in the interface file. +# Without -fcatch-nonexhaustive-cases `f` is non-CAFFY. With +# -fcatch-nonexhaustive-cases it becomes CAFFY. Before CafInfo rework +# (c846618a) this used to cause incorrect CafInfo attached to `f` in the +# interface file. T17648: # -dno-typeable-binds is to make the iface simpler # -O is necessary as otherwise we don't write interface pragmas (e.g. @@ -69,8 +70,8 @@ T17648: '$(TEST_HC)' --show-iface T17648.hi | tr -d '\n\r' | \ grep -F 'f :: T GHC.Types.Int -> () [HasNoCafRefs, LambdaFormInfo' >/dev/null - # Second compilation with -fcatch-bottoms, f should be CAFFY + # Second compilation with -fcatch-nonexhaustive-cases, f should be CAFFY '$(TEST_HC)' $(TEST_HC_OPTS) -dno-typeable-binds -O \ - -fcatch-bottoms T17648.hs -v0 -fforce-recomp + -fcatch-nonexhaustive-cases T17648.hs -v0 -fforce-recomp '$(TEST_HC)' --show-iface T17648.hi | tr -d '\n\r' | \ grep -F 'f :: T GHC.Types.Int -> () [LambdaFormInfo' >/dev/null -- cgit v1.2.1