summaryrefslogtreecommitdiff
path: root/translate/grt
diff options
context:
space:
mode:
Diffstat (limited to 'translate/grt')
-rw-r--r--translate/grt/grt-main.adb15
-rw-r--r--translate/grt/grt-processes.adb6
-rw-r--r--translate/grt/grt-processes.ads7
3 files changed, 20 insertions, 8 deletions
diff --git a/translate/grt/grt-main.adb b/translate/grt/grt-main.adb
index 995a0d3..3052a95 100644
--- a/translate/grt/grt-main.adb
+++ b/translate/grt/grt-main.adb
@@ -53,6 +53,13 @@ package body Grt.Main is
procedure Ghdl_Elaborate;
pragma Import (C, Ghdl_Elaborate, "__ghdl_ELABORATE");
+ -- Wrapper around elaboration just to return 0.
+ function Ghdl_Elaborate_Wrapper return Integer is
+ begin
+ Ghdl_Elaborate;
+ return 0;
+ end Ghdl_Elaborate_Wrapper;
+
procedure Disp_Stats_Hook (Code : Integer);
pragma Convention (C, Disp_Stats_Hook);
@@ -135,8 +142,12 @@ package body Grt.Main is
Stats.Start_Elaboration;
end if;
- -- Elaboration.
- Ghdl_Elaborate;
+ -- Elaboration. Run through longjump to catch errors.
+ if Grt.Processes.Run_Through_Longjump (Ghdl_Elaborate_Wrapper'Access) < 0
+ then
+ Grt.Errors.Error ("error during elaboration");
+ return;
+ end if;
if Flag_Stats then
Stats.Start_Order;
diff --git a/translate/grt/grt-processes.adb b/translate/grt/grt-processes.adb
index 7e049fc..50d7601 100644
--- a/translate/grt/grt-processes.adb
+++ b/translate/grt/grt-processes.adb
@@ -628,12 +628,6 @@ package body Grt.Processes is
pragma Unreferenced (Disp_All_Processes);
- type Run_Handler is access function return Integer;
- -- pragma Convention (C, Run_Handler);
-
- function Run_Through_Longjump (Hand : Run_Handler) return Integer;
- pragma Import (Ada, Run_Through_Longjump, "__ghdl_run_through_longjump");
-
-- Run resumed processes.
-- If POSTPONED is true, resume postponed processes, else resume
-- non-posponed processes.
diff --git a/translate/grt/grt-processes.ads b/translate/grt/grt-processes.ads
index d75ca49..5566233 100644
--- a/translate/grt/grt-processes.ads
+++ b/translate/grt/grt-processes.ads
@@ -133,6 +133,13 @@ package Grt.Processes is
procedure Ghdl_Protected_Init (Obj : System.Address);
procedure Ghdl_Protected_Fini (Obj : System.Address);
+ type Run_Handler is access function return Integer;
+
+ -- Run HAND through a wrapper that catch some errors (in particular on
+ -- windows). Returns < 0 in case of error.
+ function Run_Through_Longjump (Hand : Run_Handler) return Integer;
+ pragma Import (Ada, Run_Through_Longjump, "__ghdl_run_through_longjump");
+
private
-- State of a process.
type Process_State is