diff options
author | Tristan Gingold <tgingold@free.fr> | 2023-04-24 19:29:44 +0200 |
---|---|---|
committer | Tristan Gingold <tgingold@free.fr> | 2023-04-24 19:29:44 +0200 |
commit | 6a7a3cbcf61cb5c2882265a21a8c4b130614786e (patch) | |
tree | 9ebea0f73302160eb1c8ccfd1fa573b00f4d75a6 /src | |
parent | c302870a98bec0fa265cf92cec69e7807b1d09bd (diff) | |
download | ghdl-6a7a3cbcf61cb5c2882265a21a8c4b130614786e.tar.gz ghdl-6a7a3cbcf61cb5c2882265a21a8c4b130614786e.tar.bz2 ghdl-6a7a3cbcf61cb5c2882265a21a8c4b130614786e.zip |
libraries(Get_Library): add parameter Force.
Diffstat (limited to 'src')
-rw-r--r-- | src/libraries.adb | 8 | ||||
-rw-r--r-- | src/libraries.ads | 5 |
2 files changed, 10 insertions, 3 deletions
diff --git a/src/libraries.adb b/src/libraries.adb index 3c10dad97..3a1ba7e1c 100644 --- a/src/libraries.adb +++ b/src/libraries.adb @@ -758,7 +758,9 @@ package body Libraries is end Get_Library_No_Create; -- Get or create a library from an identifier. - function Get_Library (Ident: Name_Id; Loc : Location_Type) + function Get_Library (Ident: Name_Id; + Loc : Location_Type; + Force : Boolean := False) return Iir_Library_Declaration is Library: Iir_Library_Declaration; @@ -777,7 +779,9 @@ package body Libraries is Set_Library_Directory (Library, Null_Identifier); Set_Identifier (Library, Ident); if Load_Library (Library) = False then - Error_Msg_Sem (+Loc, "cannot find resource library %i", +Ident); + if not Force then + Error_Msg_Sem (+Loc, "cannot find resource library %i", +Ident); + end if; end if; Set_Visible_Flag (Library, True); diff --git a/src/libraries.ads b/src/libraries.ads index 1684afaf0..7e6469691 100644 --- a/src/libraries.ads +++ b/src/libraries.ads @@ -114,7 +114,10 @@ package Libraries is -- Get or create a library from an identifier. -- LOC is used only to report errors. - function Get_Library (Ident : Name_Id; Loc : Location_Type) + -- If FORCE is true, then the library is created even if it doesn't exist. + function Get_Library (Ident: Name_Id; + Loc : Location_Type; + Force : Boolean := False) return Iir_Library_Declaration; -- Add or replace an design unit in the work library. |