summaryrefslogtreecommitdiff
path: root/translate/grt/grt-errors.adb
diff options
context:
space:
mode:
authorTristan Gingold2014-05-07 05:20:35 +0200
committerTristan Gingold2014-05-07 05:20:35 +0200
commit6540ece0232e69fd016b358e03cca46ee7b62097 (patch)
treeb87fc240d3bcc79ba9f2a96551db2a7d90851d8c /translate/grt/grt-errors.adb
parentbf357576fd0a8d7be0620cd0ef1d668b2ffbbdc9 (diff)
downloadghdl-6540ece0232e69fd016b358e03cca46ee7b62097.tar.gz
ghdl-6540ece0232e69fd016b358e03cca46ee7b62097.tar.bz2
ghdl-6540ece0232e69fd016b358e03cca46ee7b62097.zip
grt: remove ghdl_exit_cb*, replaced by an error hook.
Diffstat (limited to 'translate/grt/grt-errors.adb')
-rw-r--r--translate/grt/grt-errors.adb17
1 files changed, 10 insertions, 7 deletions
diff --git a/translate/grt/grt-errors.adb b/translate/grt/grt-errors.adb
index 4933b7f..c4eb30b 100644
--- a/translate/grt/grt-errors.adb
+++ b/translate/grt/grt-errors.adb
@@ -25,6 +25,7 @@
with Grt.Stdio; use Grt.Stdio;
with Grt.Astdio; use Grt.Astdio;
with Grt.Options; use Grt.Options;
+with Grt.Hooks; use Grt.Hooks;
package body Grt.Errors is
procedure Fatal_Error;
@@ -42,13 +43,6 @@ package body Grt.Errors is
pragma Import (C, C_Exit, "exit");
pragma No_Return (C_Exit);
begin
- if Ghdl_Exit_Cb1 /= null then
- Ghdl_Exit_Cb1.all (Code);
- end if;
-
- if Ghdl_Exit_Cb /= null then
- Ghdl_Exit_Cb.all (Code);
- end if;
C_Exit (Code);
end Ghdl_Exit;
@@ -58,6 +52,15 @@ package body Grt.Errors is
procedure Fatal_Error is
begin
+ if Error_Hook /= null then
+ -- Call the hook, but avoid infinite loop by reseting it.
+ declare
+ Current_Hook : constant Proc_Hook_Type := Error_Hook;
+ begin
+ Error_Hook := null;
+ Current_Hook.all;
+ end;
+ end if;
Maybe_Return_Via_Longjump (-1);
if Expect_Failure then
Ghdl_Exit (0);