From 270d9354950e917b34c15661aedbc1ef58261b56 Mon Sep 17 00:00:00 2001 From: Tristan Gingold Date: Mon, 12 Sep 2022 21:22:16 +0200 Subject: simul: handle --expect-failure for elaboration --- src/ghdldrv/ghdlcomp.adb | 2 -- src/ghdldrv/ghdlcomp.ads | 3 +++ src/ghdldrv/ghdlsimul.adb | 21 ++++++++++++--------- 3 files changed, 15 insertions(+), 11 deletions(-) diff --git a/src/ghdldrv/ghdlcomp.adb b/src/ghdldrv/ghdlcomp.adb index 4f9644e9b..cf7b8148c 100644 --- a/src/ghdldrv/ghdlcomp.adb +++ b/src/ghdldrv/ghdlcomp.adb @@ -35,8 +35,6 @@ with Libraries; package body Ghdlcomp is - Flag_Expect_Failure : Boolean := False; - -- Commands which use the mcode compiler. type Command_Comp is abstract new Command_Lib with null record; diff --git a/src/ghdldrv/ghdlcomp.ads b/src/ghdldrv/ghdlcomp.ads index 5af54eaad..6c014a302 100644 --- a/src/ghdldrv/ghdlcomp.ads +++ b/src/ghdldrv/ghdlcomp.ads @@ -67,6 +67,9 @@ package Ghdlcomp is -- Output of --disp-config. procedure Disp_Config; + -- Option --expect-failure. + Flag_Expect_Failure : Boolean := False; + -- --time-resolution=X -- Where X corresponds to: -- fs => 'f' diff --git a/src/ghdldrv/ghdlsimul.adb b/src/ghdldrv/ghdlsimul.adb index 44e0d133a..41dac66d2 100644 --- a/src/ghdldrv/ghdlsimul.adb +++ b/src/ghdldrv/ghdlsimul.adb @@ -82,22 +82,25 @@ package body Ghdlsimul is begin Common_Compile_Elab (Cmd_Name, Args, False, Opt_Arg, Config); + for I in Opt_Arg .. Args'Last loop + if Args (I).all = "--expect-failure" then + Flag_Expect_Failure := True; + exit; + end if; + end loop; + Lib_Unit := Get_Library_Unit (Config); pragma Assert (Get_Kind (Lib_Unit) /= Iir_Kind_Foreign_Module); Inst := Elab.Vhdl_Insts.Elab_Top_Unit (Lib_Unit); if Errorout.Nbr_Errors > 0 then - raise Errorout.Compilation_Error; + if Grt.Errors.Expect_Failure then + return; + else + raise Errorout.Compilation_Error; + end if; end if; --- if Inst = null then --- if Cmd.Expect_Failure then --- return; --- else --- raise Errorout.Compilation_Error; --- end if; --- end if; - Simul.Vhdl_Elab.Gather_Processes (Inst); Simul.Vhdl_Elab.Elab_Processes; -- cgit v1.2.3