diff options
author | Arnaud Charlet <charlet@gcc.gnu.org> | 2010-06-17 17:41:23 +0200 |
---|---|---|
committer | Arnaud Charlet <charlet@gcc.gnu.org> | 2010-06-17 17:41:23 +0200 |
commit | b53c1b9ce2c05a9c982bcbdb8434ae167f014161 (patch) | |
tree | c9234148fb1bfbf46332ac69fdffbe947d0dcd6b /gcc/ada/sem_elim.adb | |
parent | 7a78fa979e331eb8d04b3b62563c0b8e75706858 (diff) | |
download | gcc-b53c1b9ce2c05a9c982bcbdb8434ae167f014161.tar.gz |
[multiple changes]
2010-06-17 Ed Schonberg <schonberg@adacore.com>
* sem_ch12.adb (Mark_Context): Refine placement of Withed_Body flag, so
that it marks a unit as needed by a spec only if the corresponding
instantiation appears in that spec (and not in the corresponding body).
* sem_elim.adb (Check_Eliminated): If we are within a subunit, the name
in the pragma Eliminate has been parsed as a child unit, but the
current compilation unit is in fact the parent in which the subunit is
embedded.
2010-06-17 Vincent Celier <celier@adacore.com>
* gnat_rm.texi: Fix typo
From-SVN: r160928
Diffstat (limited to 'gcc/ada/sem_elim.adb')
-rw-r--r-- | gcc/ada/sem_elim.adb | 33 |
1 files changed, 32 insertions, 1 deletions
diff --git a/gcc/ada/sem_elim.adb b/gcc/ada/sem_elim.adb index aa2c1901a6d..ecc4ed6e712 100644 --- a/gcc/ada/sem_elim.adb +++ b/gcc/ada/sem_elim.adb @@ -234,6 +234,7 @@ package body Sem_Elim is Elmt : Access_Elim_Data; Scop : Entity_Id; Form : Entity_Id; + Up : Nat; begin if No_Elimination then @@ -292,7 +293,37 @@ package body Sem_Elim is -- Now see if compilation unit matches - for J in reverse Elmt.Unit_Name'Range loop + Up := Elmt.Unit_Name'Last; + + -- If we are within a subunit, the name in the pragma has been + -- parsed as a child unit, but the current compilation unit is + -- in fact the parent in which the subunit is embedded. We must + -- skip the first name which is that of the subunit to match + -- the pragma specification. + + declare + Par : Node_Id; + + begin + Par := Parent (E); + while Present (Par) loop + if Nkind (Par) = N_Subunit then + if Chars (Defining_Unit_Name (Proper_Body (Par))) = + Elmt.Unit_Name (Up) + then + Up := Up - 1; + exit; + + else + goto Continue; + end if; + end if; + + Par := Parent (Par); + end loop; + end; + + for J in reverse Elmt.Unit_Name'First .. Up loop if Elmt.Unit_Name (J) /= Chars (Scop) then goto Continue; end if; |