Commit 8ed508fe by Ed Schonberg Committed by Pierre-Marie de Rodat

[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
parent 86f32857
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
......
......@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment