diff options
author | Ed Schonberg <schonberg@adacore.com> | 2018-05-30 08:56:49 +0000 |
---|---|---|
committer | Pierre-Marie de Rodat <pmderodat@gcc.gnu.org> | 2018-05-30 08:56:49 +0000 |
commit | 8ed508fe7fce89d1798a3cabf227d3e1c1d5cf85 (patch) | |
tree | 0b767803d8dd387388ad3b0f326cfe8fe50d701a /gcc | |
parent | 86f3285755adabb3556eb35bfce5ec9846c524b6 (diff) | |
download | gcc-8ed508fe7fce89d1798a3cabf227d3e1c1d5cf85.zip gcc-8ed508fe7fce89d1798a3cabf227d3e1c1d5cf85.tar.gz gcc-8ed508fe7fce89d1798a3cabf227d3e1c1d5cf85.tar.bz2 |
[Ada] Unnesting: look for specification of main unit
2018-05-30 Ed Schonberg <schonberg@adacore.com>
gcc/ada/
* exp_unst.adb: Search specification of main unit as well, for
unnesting.
From-SVN: r260928
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ada/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/ada/exp_unst.adb | 11 |
2 files changed, 16 insertions, 0 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index b9830e4..729caee 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,5 +1,10 @@ 2018-05-30 Ed Schonberg <schonberg@adacore.com> + * exp_unst.adb: Search specification of main unit as well, for + unnesting. + +2018-05-30 Ed Schonberg <schonberg@adacore.com> + * exp_ch7.adb (Check_Unnesting_Elaboration_Code): The statement part of a package body that is a compilation unit may contain blocks that declare local subprograms. In Subprogram_Unnesting Mode such diff --git a/gcc/ada/exp_unst.adb b/gcc/ada/exp_unst.adb index c65f5ca..98f6dff 100644 --- a/gcc/ada/exp_unst.adb +++ b/gcc/ada/exp_unst.adb @@ -2037,6 +2037,17 @@ package body Exp_Unst is return; end if; + -- A specification will contain bodies if it contains instantiations + -- so examine package or subprogram declaration of the main unit, + -- when it is present. + + if Nkind (Unit (N)) = N_Package_Body + or else (Nkind (Unit (N)) = N_Subprogram_Body + and then not Acts_As_Spec (N)) + then + Do_Search (Library_Unit (N)); + end if; + Do_Search (N); end Unnest_Subprograms; |