From 47547a132eb132778117ca5c4eb3394df0500898 Mon Sep 17 00:00:00 2001 From: Tristan Gingold Date: Tue, 9 Jun 2020 21:08:55 +0200 Subject: vhdl: allows --work between files for -c. Fix #1362 --- src/ghdldrv/ghdlcomp.adb | 9 ++++++++- src/ghdldrv/ghdldrv.adb | 1 + src/ghdldrv/ghdlsynth.adb | 7 ++++--- 3 files changed, 13 insertions(+), 4 deletions(-) (limited to 'src/ghdldrv') diff --git a/src/ghdldrv/ghdlcomp.adb b/src/ghdldrv/ghdlcomp.adb index a07fe0599..560a5ffd2 100644 --- a/src/ghdldrv/ghdlcomp.adb +++ b/src/ghdldrv/ghdlcomp.adb @@ -155,7 +155,7 @@ package body Ghdlcomp is end Perform_Action; - -- Command -c xx -r + -- Command -c xx -r/-e type Command_Compile is new Command_Comp with null record; function Decode_Command (Cmd : Command_Compile; Name : String) return Boolean; @@ -371,6 +371,13 @@ package body Ghdlcomp is if Arg = "-r" or else Arg = "-e" then Elab_Arg := I + 1; exit; + elsif Arg'Last > 7 and then Arg (1 .. 7) = "--work=" then + Libraries.Work_Library_Name := + Libraries.Decode_Work_Option (Arg); + if Libraries.Work_Library_Name = Null_Identifier then + raise Compilation_Error; + end if; + Libraries.Load_Work_Library (True); else Compile_Load_File (Arg); end if; diff --git a/src/ghdldrv/ghdldrv.adb b/src/ghdldrv/ghdldrv.adb index 90a64dc54..bac182572 100644 --- a/src/ghdldrv/ghdldrv.adb +++ b/src/ghdldrv/ghdldrv.adb @@ -1420,6 +1420,7 @@ package body Ghdldrv is end if; end loop; if Elab_Index < 0 then + -- No elaboration. Analyze_Files (Args, True, Error); if Error then raise Errorout.Compilation_Error; diff --git a/src/ghdldrv/ghdlsynth.adb b/src/ghdldrv/ghdlsynth.adb index 08d980581..8ca51b81e 100644 --- a/src/ghdldrv/ghdlsynth.adb +++ b/src/ghdldrv/ghdlsynth.adb @@ -251,13 +251,14 @@ package body Ghdlsynth is declare Arg : String renames Args (I).all; pragma Assert (Arg'First = 1); + Id : Name_Id; begin if Arg'Last > 7 and then Arg (1 .. 7) = "--work=" then - if Libraries.Decode_Work_Option (Arg) then - Libraries.Load_Work_Library (True); - else + Id := Libraries.Decode_Work_Option (Arg); + if Id = Null_Identifier then return Null_Iir; end if; + Libraries.Load_Work_Library (True); else Ghdlcomp.Compile_Load_File (Arg); end if; -- cgit v1.2.3