From 173bc379a93dd7de950557782bcc9f2b0a137ca9 Mon Sep 17 00:00:00 2001 From: Tristan Gingold Date: Sun, 6 Oct 2019 16:21:47 +0200 Subject: ghdlsynth: fix crash when using libghdl. --- src/errorout.adb | 4 +++- src/ghdldrv/ghdlsynth.adb | 2 ++ src/synth/synthesis.adb | 2 -- 3 files changed, 5 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/errorout.adb b/src/errorout.adb index d3eea84c3..ab05c956a 100644 --- a/src/errorout.adb +++ b/src/errorout.adb @@ -229,7 +229,9 @@ package body Errorout is procedure Register_Earg_Handler (Kind : Earg_Kind; Handler : Earg_Handler) is begin - if Lang_Handlers (Kind) /= null then + if Lang_Handlers (Kind) /= null + and then Lang_Handlers (Kind) /= Handler + then -- Cannot change handler. raise Internal_Error; end if; diff --git a/src/ghdldrv/ghdlsynth.adb b/src/ghdldrv/ghdlsynth.adb index 27af66d97..27694e26e 100644 --- a/src/ghdldrv/ghdlsynth.adb +++ b/src/ghdldrv/ghdlsynth.adb @@ -42,6 +42,7 @@ with Vhdl.Utils; with Netlists.Dump; with Netlists.Disp_Vhdl; +with Netlists.Errors; with Synthesis; with Synth.Disp_Vhdl; @@ -350,5 +351,6 @@ package body Ghdlsynth is Ghdlsynth.Register_Commands; Options.Initialize; Errorout.Console.Install_Handler; + Netlists.Errors.Initialize; end Init_For_Ghdl_Synth; end Ghdlsynth; diff --git a/src/synth/synthesis.adb b/src/synth/synthesis.adb index d5dcf61fd..5d41ad70f 100644 --- a/src/synth/synthesis.adb +++ b/src/synth/synthesis.adb @@ -20,7 +20,6 @@ with Vhdl.Utils; use Vhdl.Utils; -with Netlists.Errors; with Synth.Values; use Synth.Values; with Synth.Decls; use Synth.Decls; with Synth.Insts; use Synth.Insts; @@ -128,7 +127,6 @@ package body Synthesis is Top_Instance := Make_Base_Instance; - Netlists.Errors.Initialize; Synth.Values.Init; Synth.Insts.Init; -- cgit v1.2.3