diff options
author | Tristan Gingold <tgingold@free.fr> | 2020-12-26 14:26:59 +0100 |
---|---|---|
committer | Tristan Gingold <tgingold@free.fr> | 2020-12-26 17:35:10 +0100 |
commit | b9788c0bb2fabdcdd70029cd2ffbdd12706aea1d (patch) | |
tree | eb903a286fca01f9c039f6c69a92e1399a90c84e /src/vhdl/libghdl | |
parent | f60887e70ac8f2b24637b4710f5cb9a18acef6aa (diff) | |
download | ghdl-b9788c0bb2fabdcdd70029cd2ffbdd12706aea1d.tar.gz ghdl-b9788c0bb2fabdcdd70029cd2ffbdd12706aea1d.tar.bz2 ghdl-b9788c0bb2fabdcdd70029cd2ffbdd12706aea1d.zip |
libraries: Load_Std_Library: now return a status.
Propagate this change to libghdl and python binding to avoid abort.
For #1551
Diffstat (limited to 'src/vhdl/libghdl')
-rw-r--r-- | src/vhdl/libghdl/libghdl.adb | 33 | ||||
-rw-r--r-- | src/vhdl/libghdl/libghdl.ads | 3 |
2 files changed, 31 insertions, 5 deletions
diff --git a/src/vhdl/libghdl/libghdl.adb b/src/vhdl/libghdl/libghdl.adb index 67de461cf..bd6d83c5a 100644 --- a/src/vhdl/libghdl/libghdl.adb +++ b/src/vhdl/libghdl/libghdl.adb @@ -39,13 +39,24 @@ package body Libghdl is end if; end Set_Option; - procedure Compile_Init (Analyze_Only : Boolean) is + function Compile_Init_Status (Analyze_Only : Boolean) return Integer is begin if Analyze_Only then - return; + return 0; + end if; + + if not Ghdllocal.Setup_Libraries (True) then + return -1; end if; - Ghdllocal.Setup_Libraries (True); + return 0; + end Compile_Init_Status; + + procedure Compile_Init (Analyze_Only : Boolean) is + begin + if Compile_Init_Status (Analyze_Only) /= 0 then + raise Option_Error; + end if; end Compile_Init; procedure Compile_Elab @@ -87,10 +98,22 @@ package body Libghdl is Disp_Long_Help'Access); end Set_Hooks; - procedure Analyze_Init is + function Analyze_Init_Status return Integer is begin -- Load libraries... - Compile_Init (False); + if Compile_Init_Status (False) /= 0 then + return -1; + end if; + + return 0; + end Analyze_Init_Status; + + procedure Analyze_Init is + begin + -- Deprecated + if Analyze_Init_Status /= 0 then + raise Option_Error; + end if; end Analyze_Init; function Analyze_File (File : Thin_String_Ptr; Len : Natural) return Iir is diff --git a/src/vhdl/libghdl/libghdl.ads b/src/vhdl/libghdl/libghdl.ads index 7d69cde23..5326666b8 100644 --- a/src/vhdl/libghdl/libghdl.ads +++ b/src/vhdl/libghdl/libghdl.ads @@ -34,6 +34,9 @@ package Libghdl is procedure Set_Exec_Prefix (Prefix : Thin_String_Ptr; Len : Natural); -- To be called before Analyze_File to initialize analysis. + function Analyze_Init_Status return Integer; + + -- Deprecated. Raise an exception in case of error. procedure Analyze_Init; -- Analyze one file. |