From: Ed Schonberg Date: Wed, 30 May 2018 08:56:49 +0000 (+0000) Subject: [Ada] Unnesting: look for specification of main unit X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=8ed508fe7fce89d1798a3cabf227d3e1c1d5cf85;p=gcc.git [Ada] Unnesting: look for specification of main unit 2018-05-30 Ed Schonberg gcc/ada/ * exp_unst.adb: Search specification of main unit as well, for unnesting. From-SVN: r260928 --- diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index b9830e47d04..729caee2f59 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,8 @@ +2018-05-30 Ed Schonberg + + * exp_unst.adb: Search specification of main unit as well, for + unnesting. + 2018-05-30 Ed Schonberg * exp_ch7.adb (Check_Unnesting_Elaboration_Code): The statement part of diff --git a/gcc/ada/exp_unst.adb b/gcc/ada/exp_unst.adb index c65f5ca3861..98f6dffc9f2 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;