diff options
Diffstat (limited to 'translate')
-rw-r--r-- | translate/ghdldrv/Makefile | 4 | ||||
-rw-r--r-- | translate/grt/grt-main.adb | 15 | ||||
-rw-r--r-- | translate/grt/grt-processes.adb | 6 | ||||
-rw-r--r-- | translate/grt/grt-processes.ads | 7 |
4 files changed, 24 insertions, 8 deletions
diff --git a/translate/ghdldrv/Makefile b/translate/ghdldrv/Makefile index 51592ae9e..af2e82dcd 100644 --- a/translate/ghdldrv/Makefile +++ b/translate/ghdldrv/Makefile @@ -43,6 +43,7 @@ target=i686-pc-linux-gnu #target=x86_64-pc-linux-gnu #target=i686-apple-darwin #target=x86_64-apple-darwin +#target=i386-pc-mingw32 GRTSRCDIR=../grt include $(GRTSRCDIR)/Makefile.inc @@ -52,6 +53,9 @@ endif ifeq ($(filter-out i%86 darwin%,$(arch) $(osys)),) ORTHO_X86_FLAGS=Flags_Macosx endif +ifeq ($(filter-out i%86 mingw32%,$(arch) $(osys)),) + ORTHO_X86_FLAGS=Flags_Windows +endif ifdef ORTHO_X86_FLAGS ORTHO_DEPS=ortho_code-x86-flags.ads endif diff --git a/translate/grt/grt-main.adb b/translate/grt/grt-main.adb index 995a0d326..3052a958b 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 7e049fced..50d760129 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 d75ca4904..55662335e 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 |