aboutsummaryrefslogtreecommitdiffhomepage
path: root/proofs/redexpr.ml
diff options
context:
space:
mode:
authorGravatar Guillaume Melquiond <guillaume.melquiond@inria.fr>2015-04-23 14:55:11 +0200
committerGravatar Guillaume Melquiond <guillaume.melquiond@inria.fr>2015-04-23 16:02:45 +0200
commit16d301bab5b7dec53be4786b3b6815bca54ae539 (patch)
treec595fc1fafd00a08cb91e53002610df867cf5eed /proofs/redexpr.ml
parent915c8f15965fe8e7ee9d02a663fd890ef80539ad (diff)
Remove almost all the uses of string concatenation when building error messages.
Since error messages are ultimately passed to Format, which has its own buffers for concatenating strings, using concatenation for preparing error messages just doubles the workload and increases memory pressure.
Diffstat (limited to 'proofs/redexpr.ml')
-rw-r--r--proofs/redexpr.ml11
1 files changed, 7 insertions, 4 deletions
diff --git a/proofs/redexpr.ml b/proofs/redexpr.ml
index 1383d7556..d25f7e915 100644
--- a/proofs/redexpr.ml
+++ b/proofs/redexpr.ml
@@ -167,18 +167,20 @@ let red_expr_tab = Summary.ref String.Map.empty ~name:"Declare Reduction"
let declare_reduction s f =
if String.Map.mem s !reduction_tab || String.Map.mem s !red_expr_tab
- then error ("There is already a reduction expression of name "^s)
+ then errorlabstrm "Redexpr.declare_reduction"
+ (str "There is already a reduction expression of name " ++ str s)
else reduction_tab := String.Map.add s f !reduction_tab
let check_custom = function
| ExtraRedExpr s ->
if not (String.Map.mem s !reduction_tab || String.Map.mem s !red_expr_tab)
- then error ("Reference to undefined reduction expression "^s)
+ then errorlabstrm "Redexpr.check_custom" (str "Reference to undefined reduction expression " ++ str s)
|_ -> ()
let decl_red_expr s e =
if String.Map.mem s !reduction_tab || String.Map.mem s !red_expr_tab
- then error ("There is already a reduction expression of name "^s)
+ then errorlabstrm "Redexpr.decl_red_expr"
+ (str "There is already a reduction expression of name " ++ str s)
else begin
check_custom e;
red_expr_tab := String.Map.add s e !red_expr_tab
@@ -232,7 +234,8 @@ let reduction_of_red_expr env =
with Not_found ->
(try reduction_of_red_expr (String.Map.find s !red_expr_tab)
with Not_found ->
- error("unknown user-defined reduction \""^s^"\"")))
+ errorlabstrm "Redexpr.reduction_of_red_expr"
+ (str "unknown user-defined reduction \"" ++ str s ++ str "\"")))
| CbvVm o -> (contextualize cbv_vm cbv_vm o, VMcast)
| CbvNative o -> (contextualize cbv_native cbv_native o, NATIVEcast)
in