]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
sem_ch10.adb (Expand_With_Clause): Don't recurse on the prefix if the current with...
authorBob Duff <duff@adacore.com>
Mon, 20 Jan 2014 13:48:45 +0000 (13:48 +0000)
committerArnaud Charlet <charlet@gcc.gnu.org>
Mon, 20 Jan 2014 13:48:45 +0000 (14:48 +0100)
2014-01-20  Bob Duff  <duff@adacore.com>

* 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

gcc/ada/ChangeLog
gcc/ada/sem_ch10.adb

index c40e7e7c33afc91f6ea3323a2319811c1f49983e..9b852dbe887ed0aa691e94e93dca26d43440e2aa 100644 (file)
@@ -1,3 +1,9 @@
+2014-01-20  Bob Duff  <duff@adacore.com>
+
+       * 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  <moy@adacore.com>
 
        * exp_spark.adb (Expand_SPARK_Call): Remove procedure.
index b83bf12fb329304fcebfdcf45f37ad15d3e579ff..6962941942493d8b1b153f09479193644b6084c5 100644 (file)
@@ -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;