diff options
author | Tristan Gingold <tgingold@free.fr> | 2016-12-10 06:13:43 +0100 |
---|---|---|
committer | Tristan Gingold <tgingold@free.fr> | 2016-12-11 07:25:09 +0100 |
commit | 4fff959635de496261c74a8c06b794a034fcce98 (patch) | |
tree | 2ae1613975e860685894096425c212c3a7e99682 /src/vhdl/translate | |
parent | b9f0289559e16f788262fb33a29a66253d5bc3ec (diff) | |
download | ghdl-4fff959635de496261c74a8c06b794a034fcce98.tar.gz ghdl-4fff959635de496261c74a8c06b794a034fcce98.tar.bz2 ghdl-4fff959635de496261c74a8c06b794a034fcce98.zip |
Add testcase for #202
Diffstat (limited to 'src/vhdl/translate')
-rw-r--r-- | src/vhdl/translate/trans-chap2.adb | 32 | ||||
-rw-r--r-- | src/vhdl/translate/trans-chap4.adb | 4 |
2 files changed, 8 insertions, 28 deletions
diff --git a/src/vhdl/translate/trans-chap2.adb b/src/vhdl/translate/trans-chap2.adb index 9dd992be3..4f729ddc1 100644 --- a/src/vhdl/translate/trans-chap2.adb +++ b/src/vhdl/translate/trans-chap2.adb @@ -850,7 +850,7 @@ package body Trans.Chap2 is Rtis.Generate_Unit (Decl); end if; - if Global_Storage = O_Storage_Public then + if Global_Storage /= O_Storage_External then -- Create elaboration procedure for the spec Elab_Package (Decl, Header); end if; @@ -876,10 +876,7 @@ package body Trans.Chap2 is end if; end Translate_Package; - procedure Translate_Package_Declaration (Decl : Iir_Package_Declaration) - is - El : Iir; - Bod : Iir; + procedure Translate_Package_Declaration (Decl : Iir_Package_Declaration) is begin -- Skip uninstantiated package that have to be macro-expanded. if Get_Macro_Expanded_Flag (Decl) then @@ -887,24 +884,6 @@ package body Trans.Chap2 is end if; Translate_Package (Decl, Get_Package_Header (Decl)); - - if Global_Storage = O_Storage_Public then - -- If there are package instances declared that were macro-expanded, - -- translate the bodies of the instances. - if Get_Need_Instance_Bodies (Decl) then - El := Get_Declaration_Chain (Decl); - while Is_Valid (El) loop - if Get_Kind (El) = Iir_Kind_Package_Instantiation_Declaration - then - Bod := Get_Package_Body (El); - if Is_Valid (Bod) then - Translate_Package_Body (Bod); - end if; - end if; - El := Get_Chain (El); - end loop; - end if; - end if; end Translate_Package_Declaration; procedure Translate_Package_Body (Bod : Iir_Package_Body) @@ -1387,9 +1366,8 @@ package body Trans.Chap2 is -- Macro-expanded instantiations are translated like a package. Translate_Package (Inst, Inst); - -- For top-level package or nested package not within a package, - -- generate code for the body. - if Global_Storage = O_Storage_Public then + -- Generate code for the body. + if Global_Storage /= O_Storage_External then declare Bod : constant Iir := Get_Package_Body (Inst); begin @@ -1430,7 +1408,7 @@ package body Trans.Chap2 is Finish_Subprogram_Decl (Interface_List, Info.Package_Instance_Elab_Subprg); - if Global_Storage /= O_Storage_Public then + if Global_Storage = O_Storage_External then return; end if; diff --git a/src/vhdl/translate/trans-chap4.adb b/src/vhdl/translate/trans-chap4.adb index 8c44f7c49..e15e06db6 100644 --- a/src/vhdl/translate/trans-chap4.adb +++ b/src/vhdl/translate/trans-chap4.adb @@ -2398,7 +2398,9 @@ package body Trans.Chap4 is begin Push_Identifier_Prefix (Mark, Get_Identifier (El)); Translate_Declaration_Chain_Subprograms (El); - if Is_Valid (Bod) then + if Is_Valid (Bod) + and then Global_Storage /= O_Storage_External + then Translate_Declaration_Chain_Subprograms (Bod); end if; Pop_Identifier_Prefix (Mark); |