From 50e94902ca6bb84c33982db858b74322eefd9af8 Mon Sep 17 00:00:00 2001 From: Mark Shinwell Date: Thu, 23 Jan 2020 10:02:29 +0000 Subject: [PATCH] Replace %raise by %reraise (rebased version of this patch from 4.09) --- stdlib/stdlib.ml | 2 +- stdlib/stdlib.mli | 2 +- .../tests/backtrace/backtrace2.byte.reference | 48 +++++++++++++++++-- .../tests/backtrace/backtrace2.opt.reference | 48 +++++++++++++++++-- .../tests/backtrace/backtrace3.byte.reference | 9 +++- .../tests/backtrace/backtrace3.opt.reference | 9 +++- .../backtrace_or_exception.byte.reference | 4 +- .../backtrace_or_exception.opt.reference | 4 +- 8 files changed, 114 insertions(+), 12 deletions(-) diff --git a/stdlib/stdlib.ml b/stdlib/stdlib.ml index 5cef512c8408..f9af9e330f13 100644 --- a/stdlib/stdlib.ml +++ b/stdlib/stdlib.ml @@ -23,7 +23,7 @@ let () = register_named_value "Pervasives.array_bound_error" (Invalid_argument "index out of bounds") -external raise : exn -> 'a = "%raise" +external raise : exn -> 'a = "%reraise" external raise_notrace : exn -> 'a = "%raise_notrace" let failwith s = raise(Failure s) diff --git a/stdlib/stdlib.mli b/stdlib/stdlib.mli index 7087901a81ba..3aed23be0f39 100644 --- a/stdlib/stdlib.mli +++ b/stdlib/stdlib.mli @@ -27,7 +27,7 @@ (** {1 Exceptions} *) -external raise : exn -> 'a = "%raise" +external raise : exn -> 'a = "%reraise" (** Raise the given exception value *) external raise_notrace : exn -> 'a = "%raise_notrace" diff --git a/testsuite/tests/backtrace/backtrace2.byte.reference b/testsuite/tests/backtrace/backtrace2.byte.reference index 635eb09a75d2..257ce19f78fc 100644 --- a/testsuite/tests/backtrace/backtrace2.byte.reference +++ b/testsuite/tests/backtrace/backtrace2.byte.reference @@ -35,12 +35,32 @@ Uncaught exception Invalid_argument("index out of bounds") Raised by primitive operation at file "backtrace2.ml", line 67, characters 14-22 test_Not_found Uncaught exception Not_found -Raised at file "hashtbl.ml", line 537, characters 19-28 +Raised at file "backtrace2.ml", line 41, characters 24-33 +Called from file "backtrace2.ml", line 41, characters 43-52 +Called from file "backtrace2.ml", line 41, characters 43-52 +Called from file "backtrace2.ml", line 41, characters 43-52 +Called from file "backtrace2.ml", line 41, characters 43-52 +Called from file "backtrace2.ml", line 41, characters 43-52 +Called from file "backtrace2.ml", line 43, characters 6-11 +Re-raised at file "hashtbl.ml", line 537, characters 19-28 Called from file "backtrace2.ml", line 48, characters 9-42 Re-raised at file "backtrace2.ml", line 48, characters 67-70 Called from file "backtrace2.ml", line 67, characters 11-23 Uncaught exception Not_found -Raised at file "backtrace2.ml", line 52, characters 24-33 +Raised at file "backtrace2.ml", line 41, characters 24-33 +Called from file "backtrace2.ml", line 41, characters 43-52 +Called from file "backtrace2.ml", line 41, characters 43-52 +Called from file "backtrace2.ml", line 41, characters 43-52 +Called from file "backtrace2.ml", line 41, characters 43-52 +Called from file "backtrace2.ml", line 41, characters 43-52 +Called from file "backtrace2.ml", line 43, characters 6-11 +Re-raised at file "hashtbl.ml", line 537, characters 19-28 +Called from file "backtrace2.ml", line 48, characters 9-42 +Re-raised at file "backtrace2.ml", line 48, characters 67-70 +Called from file "backtrace2.ml", line 67, characters 11-23 +Re-raised at file "hashtbl.ml", line 537, characters 19-28 +Called from file "backtrace2.ml", line 55, characters 8-41 +Re-raised at file "backtrace2.ml", line 52, characters 24-33 Called from file "backtrace2.ml", line 52, characters 43-52 Called from file "backtrace2.ml", line 52, characters 43-52 Called from file "backtrace2.ml", line 52, characters 43-52 @@ -50,7 +70,29 @@ Called from file "camlinternalLazy.ml", line 31, characters 17-27 Re-raised at file "camlinternalLazy.ml", line 36, characters 10-11 Called from file "backtrace2.ml", line 67, characters 11-23 Uncaught exception Not_found -Raised at file "hashtbl.ml", line 537, characters 19-28 +Raised at file "backtrace2.ml", line 41, characters 24-33 +Called from file "backtrace2.ml", line 41, characters 43-52 +Called from file "backtrace2.ml", line 41, characters 43-52 +Called from file "backtrace2.ml", line 41, characters 43-52 +Called from file "backtrace2.ml", line 41, characters 43-52 +Called from file "backtrace2.ml", line 41, characters 43-52 +Called from file "backtrace2.ml", line 43, characters 6-11 +Re-raised at file "hashtbl.ml", line 537, characters 19-28 +Called from file "backtrace2.ml", line 48, characters 9-42 +Re-raised at file "backtrace2.ml", line 48, characters 67-70 +Called from file "backtrace2.ml", line 67, characters 11-23 +Re-raised at file "hashtbl.ml", line 537, characters 19-28 +Called from file "backtrace2.ml", line 55, characters 8-41 +Re-raised at file "backtrace2.ml", line 52, characters 24-33 +Called from file "backtrace2.ml", line 52, characters 43-52 +Called from file "backtrace2.ml", line 52, characters 43-52 +Called from file "backtrace2.ml", line 52, characters 43-52 +Called from file "backtrace2.ml", line 52, characters 43-52 +Called from file "backtrace2.ml", line 52, characters 43-52 +Called from file "camlinternalLazy.ml", line 31, characters 17-27 +Re-raised at file "camlinternalLazy.ml", line 36, characters 10-11 +Called from file "backtrace2.ml", line 67, characters 11-23 +Re-raised at file "hashtbl.ml", line 537, characters 19-28 Called from file "backtrace2.ml", line 55, characters 8-41 Re-raised at file "camlinternalLazy.ml", line 35, characters 62-63 Called from file "camlinternalLazy.ml", line 31, characters 17-27 diff --git a/testsuite/tests/backtrace/backtrace2.opt.reference b/testsuite/tests/backtrace/backtrace2.opt.reference index e81e28075a41..4871b0aeec7e 100644 --- a/testsuite/tests/backtrace/backtrace2.opt.reference +++ b/testsuite/tests/backtrace/backtrace2.opt.reference @@ -35,12 +35,32 @@ Uncaught exception Invalid_argument("index out of bounds") Raised by primitive operation at file "backtrace2.ml", line 67, characters 14-22 test_Not_found Uncaught exception Not_found -Raised at file "hashtbl.ml", line 537, characters 13-28 +Raised at file "backtrace2.ml", line 41, characters 18-33 +Called from file "backtrace2.ml", line 41, characters 43-52 +Called from file "backtrace2.ml", line 41, characters 43-52 +Called from file "backtrace2.ml", line 41, characters 43-52 +Called from file "backtrace2.ml", line 41, characters 43-52 +Called from file "backtrace2.ml", line 41, characters 43-52 +Called from file "backtrace2.ml", line 43, characters 6-11 +Re-raised at file "hashtbl.ml", line 537, characters 13-28 Called from file "backtrace2.ml", line 48, characters 9-42 Re-raised at file "backtrace2.ml", line 48, characters 61-70 Called from file "backtrace2.ml", line 67, characters 11-23 Uncaught exception Not_found -Raised at file "backtrace2.ml", line 52, characters 18-33 +Raised at file "backtrace2.ml", line 41, characters 18-33 +Called from file "backtrace2.ml", line 41, characters 43-52 +Called from file "backtrace2.ml", line 41, characters 43-52 +Called from file "backtrace2.ml", line 41, characters 43-52 +Called from file "backtrace2.ml", line 41, characters 43-52 +Called from file "backtrace2.ml", line 41, characters 43-52 +Called from file "backtrace2.ml", line 43, characters 6-11 +Re-raised at file "hashtbl.ml", line 537, characters 13-28 +Called from file "backtrace2.ml", line 48, characters 9-42 +Re-raised at file "backtrace2.ml", line 48, characters 61-70 +Called from file "backtrace2.ml", line 67, characters 11-23 +Re-raised at file "hashtbl.ml", line 537, characters 13-28 +Called from file "backtrace2.ml", line 55, characters 8-41 +Re-raised at file "backtrace2.ml", line 52, characters 18-33 Called from file "backtrace2.ml", line 52, characters 43-52 Called from file "backtrace2.ml", line 52, characters 43-52 Called from file "backtrace2.ml", line 52, characters 43-52 @@ -50,7 +70,29 @@ Called from file "camlinternalLazy.ml", line 31, characters 17-27 Re-raised at file "camlinternalLazy.ml", line 36, characters 4-11 Called from file "backtrace2.ml", line 67, characters 11-23 Uncaught exception Not_found -Raised at file "hashtbl.ml", line 537, characters 13-28 +Raised at file "backtrace2.ml", line 41, characters 18-33 +Called from file "backtrace2.ml", line 41, characters 43-52 +Called from file "backtrace2.ml", line 41, characters 43-52 +Called from file "backtrace2.ml", line 41, characters 43-52 +Called from file "backtrace2.ml", line 41, characters 43-52 +Called from file "backtrace2.ml", line 41, characters 43-52 +Called from file "backtrace2.ml", line 43, characters 6-11 +Re-raised at file "hashtbl.ml", line 537, characters 13-28 +Called from file "backtrace2.ml", line 48, characters 9-42 +Re-raised at file "backtrace2.ml", line 48, characters 61-70 +Called from file "backtrace2.ml", line 67, characters 11-23 +Re-raised at file "hashtbl.ml", line 537, characters 13-28 +Called from file "backtrace2.ml", line 55, characters 8-41 +Re-raised at file "backtrace2.ml", line 52, characters 18-33 +Called from file "backtrace2.ml", line 52, characters 43-52 +Called from file "backtrace2.ml", line 52, characters 43-52 +Called from file "backtrace2.ml", line 52, characters 43-52 +Called from file "backtrace2.ml", line 52, characters 43-52 +Called from file "backtrace2.ml", line 52, characters 43-52 +Called from file "camlinternalLazy.ml", line 31, characters 17-27 +Re-raised at file "camlinternalLazy.ml", line 36, characters 4-11 +Called from file "backtrace2.ml", line 67, characters 11-23 +Re-raised at file "hashtbl.ml", line 537, characters 13-28 Called from file "backtrace2.ml", line 55, characters 8-41 Re-raised at file "camlinternalLazy.ml", line 35, characters 56-63 Called from file "camlinternalLazy.ml", line 31, characters 17-27 diff --git a/testsuite/tests/backtrace/backtrace3.byte.reference b/testsuite/tests/backtrace/backtrace3.byte.reference index c667cacbb2e1..66509e082e82 100644 --- a/testsuite/tests/backtrace/backtrace3.byte.reference +++ b/testsuite/tests/backtrace/backtrace3.byte.reference @@ -60,7 +60,14 @@ Called from file "backtrace3.ml", line 20, characters 4-11 Re-raised at file "backtrace3.ml", line 47, characters 51-55 Called from file "backtrace3.ml", line 54, characters 11-23 Uncaught exception Backtrace3.Error("h") -Raised at file "backtrace3.ml", line 50, characters 16-17 +Raised at file "backtrace3.ml", line 16, characters 21-32 +Called from file "backtrace3.ml", line 16, characters 42-53 +Called from file "backtrace3.ml", line 16, characters 42-53 +Called from file "backtrace3.ml", line 16, characters 42-53 +Called from file "backtrace3.ml", line 16, characters 42-53 +Called from file "backtrace3.ml", line 16, characters 42-53 +Called from file "backtrace3.ml", line 20, characters 4-11 +Re-raised at file "backtrace3.ml", line 50, characters 16-17 Called from file "backtrace3.ml", line 54, characters 11-23 Uncaught exception Invalid_argument("index out of bounds") Raised by primitive operation at file "backtrace3.ml", line 54, characters 14-22 diff --git a/testsuite/tests/backtrace/backtrace3.opt.reference b/testsuite/tests/backtrace/backtrace3.opt.reference index 87740918e863..88d6913130bf 100644 --- a/testsuite/tests/backtrace/backtrace3.opt.reference +++ b/testsuite/tests/backtrace/backtrace3.opt.reference @@ -60,7 +60,14 @@ Called from file "backtrace3.ml", line 20, characters 4-11 Re-raised at file "backtrace3.ml", line 47, characters 45-55 Called from file "backtrace3.ml", line 54, characters 11-23 Uncaught exception Backtrace3.Error("h") -Raised at file "backtrace3.ml", line 50, characters 10-17 +Raised at file "backtrace3.ml", line 16, characters 16-32 +Called from file "backtrace3.ml", line 16, characters 42-53 +Called from file "backtrace3.ml", line 16, characters 42-53 +Called from file "backtrace3.ml", line 16, characters 42-53 +Called from file "backtrace3.ml", line 16, characters 42-53 +Called from file "backtrace3.ml", line 16, characters 42-53 +Called from file "backtrace3.ml", line 20, characters 4-11 +Re-raised at file "backtrace3.ml", line 50, characters 10-17 Called from file "backtrace3.ml", line 54, characters 11-23 Uncaught exception Invalid_argument("index out of bounds") Raised by primitive operation at file "backtrace3.ml", line 54, characters 14-22 diff --git a/testsuite/tests/backtrace/backtrace_or_exception.byte.reference b/testsuite/tests/backtrace/backtrace_or_exception.byte.reference index 81ff030cbc7a..d3879f5cf57d 100644 --- a/testsuite/tests/backtrace/backtrace_or_exception.byte.reference +++ b/testsuite/tests/backtrace/backtrace_or_exception.byte.reference @@ -3,7 +3,9 @@ Raised at file "backtrace_or_exception.ml", line 24, characters 10-13 Called from file "backtrace_or_exception.ml", line 44, characters 6-10 --------------------------- exception Backtrace_or_exception.Exn -Raised at file "backtrace_or_exception.ml", line 15, characters 10-13 +Raised at file "backtrace_or_exception.ml", line 24, characters 10-13 +Called from file "backtrace_or_exception.ml", line 44, characters 6-10 +Re-raised at file "backtrace_or_exception.ml", line 15, characters 10-13 Called from file "backtrace_or_exception.ml", line 28, characters 8-44 Re-raised at file "backtrace_or_exception.ml", line 31, characters 10-13 Called from file "backtrace_or_exception.ml", line 44, characters 6-10 diff --git a/testsuite/tests/backtrace/backtrace_or_exception.opt.reference b/testsuite/tests/backtrace/backtrace_or_exception.opt.reference index d3f8b6664d40..9aa8cda71040 100644 --- a/testsuite/tests/backtrace/backtrace_or_exception.opt.reference +++ b/testsuite/tests/backtrace/backtrace_or_exception.opt.reference @@ -3,7 +3,9 @@ Raised at file "backtrace_or_exception.ml", line 24, characters 4-13 Called from file "backtrace_or_exception.ml", line 44, characters 6-10 --------------------------- exception Backtrace_or_exception.Exn -Raised at file "backtrace_or_exception.ml", line 15, characters 4-13 +Raised at file "backtrace_or_exception.ml", line 24, characters 4-13 +Called from file "backtrace_or_exception.ml", line 44, characters 6-10 +Re-raised at file "backtrace_or_exception.ml", line 15, characters 4-13 Called from file "backtrace_or_exception.ml", line 28, characters 8-44 Re-raised at file "backtrace_or_exception.ml", line 31, characters 4-13 Called from file "backtrace_or_exception.ml", line 44, characters 6-10