From: Bob Duff Date: Mon, 20 Jan 2014 13:48:45 +0000 (+0000) Subject: sem_ch10.adb (Expand_With_Clause): Don't recurse on the prefix if the current with... X-Git-Tag: releases/gcc-4.9.0~1556 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=3a5de596b6eba17526176085ef7162bab6e88591;p=thirdparty%2Fgcc.git sem_ch10.adb (Expand_With_Clause): Don't recurse on the prefix if the current with-ed name refers to a package... 2014-01-20 Bob Duff * sem_ch10.adb (Expand_With_Clause): Don't recurse on the prefix if the current with-ed name refers to a package that renames its own parent, eg "package P.Q renames P;". From-SVN: r206807 --- diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index c40e7e7c33af..9b852dbe887e 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,9 @@ +2014-01-20 Bob Duff + + * sem_ch10.adb (Expand_With_Clause): Don't + recurse on the prefix if the current with-ed name refers to a + package that renames its own parent, eg "package P.Q renames P;". + 2014-01-20 Yannick Moy * exp_spark.adb (Expand_SPARK_Call): Remove procedure. diff --git a/gcc/ada/sem_ch10.adb b/gcc/ada/sem_ch10.adb index b83bf12fb329..696294194249 100644 --- a/gcc/ada/sem_ch10.adb +++ b/gcc/ada/sem_ch10.adb @@ -3045,7 +3045,13 @@ package body Sem_Ch10 is Mark_Rewrite_Insertion (Withn); Install_Withed_Unit (Withn); - if Nkind (Nam) = N_Expanded_Name then + -- If we have "with X.Y;", we want to recurse on "X", except in the + -- unusual case where X.Y is a renaming of X. In that case, the scope + -- of X will be null. + + if Nkind (Nam) = N_Expanded_Name + and then Present (Scope (Entity (Prefix (Nam)))) + then Expand_With_Clause (Item, Prefix (Nam), N); end if; end Expand_With_Clause;