diff options
author | Arnaud Charlet <charlet@gcc.gnu.org> | 2010-10-08 15:08:03 +0200 |
---|---|---|
committer | Arnaud Charlet <charlet@gcc.gnu.org> | 2010-10-08 15:08:03 +0200 |
commit | 40f07b4b4115a45be68ff6032418fa17893785f2 (patch) | |
tree | 8371dc9ed8ece70c4cf74806eae0eace83decc59 /gcc/ada/sem_aux.adb | |
parent | af31bffbb0630674cfc3cacb2fb21aa6bfd1fb26 (diff) | |
download | gcc-40f07b4b4115a45be68ff6032418fa17893785f2.zip gcc-40f07b4b4115a45be68ff6032418fa17893785f2.tar.gz gcc-40f07b4b4115a45be68ff6032418fa17893785f2.tar.bz2 |
[multiple changes]
2010-10-08 Robert Dewar <dewar@adacore.com>
* sem_prag.adb (Check_Duplicate_Pragma): Check for entity match
* gcc-interface/Make-lang.in: Update dependencies.
* einfo.ads: Minor reformatting.
2010-10-08 Ed Schonberg <schonberg@adacore.com>
* exp_ch5.adb, sem_ch3.adb, exp_ch7.adb, exp_util.adb, sem_aux.adb,
sem_aux.ads, exp_ch4.adb, exp_ch6.adb, sem_ch6.adb, exp_aggr.adb,
exp_ch3.adb: Change Is_Inherently_Limited_Type to
Is_Immutably_Limited_Type to accord with new RM terminology.
* sem_aux.adb (Is_Immutably_Limited_Type): A type that is a descendant
of a formal limited private type is not immutably limited in a generic
body.
From-SVN: r165175
Diffstat (limited to 'gcc/ada/sem_aux.adb')
-rwxr-xr-x | gcc/ada/sem_aux.adb | 55 |
1 files changed, 40 insertions, 15 deletions
diff --git a/gcc/ada/sem_aux.adb b/gcc/ada/sem_aux.adb index 99bec9b..c1a41ce 100755 --- a/gcc/ada/sem_aux.adb +++ b/gcc/ada/sem_aux.adb @@ -570,24 +570,49 @@ package body Sem_Aux is end if; end Is_Indefinite_Subtype; - -------------------------------- - -- Is_Inherently_Limited_Type -- - -------------------------------- + ------------------------------- + -- Is_Immutably_Limited_Type -- + ------------------------------- - function Is_Inherently_Limited_Type (Ent : Entity_Id) return Boolean is + function Is_Immutably_Limited_Type (Ent : Entity_Id) return Boolean is Btype : constant Entity_Id := Base_Type (Ent); begin - if Is_Private_Type (Btype) then - declare - Utyp : constant Entity_Id := Underlying_Type (Btype); - begin - if No (Utyp) then + if Ekind (Btype) = E_Limited_Private_Type then + if Nkind (Parent (Btype)) = N_Formal_Type_Declaration then + return not In_Package_Body (Scope ((Btype))); + else + return True; + end if; + + elsif Is_Private_Type (Btype) then + -- AI05-0063 : a type derived from a limited private formal type + -- is not immutably limited in a generic body. + + if Is_Derived_Type (Btype) + and then Is_Generic_Type (Etype (Btype)) + then + if not Is_Limited_Type (Etype (Btype)) then return False; + + elsif Ekind (Scope (Etype (Btype))) = E_Generic_Package then + return not In_Package_Body (Scope (Etype (Btype))); + else - return Is_Inherently_Limited_Type (Utyp); + return False; end if; - end; + + else + declare + Utyp : constant Entity_Id := Underlying_Type (Btype); + begin + if No (Utyp) then + return False; + else + return Is_Immutably_Limited_Type (Utyp); + end if; + end; + end if; elsif Is_Concurrent_Type (Btype) then return True; @@ -605,7 +630,7 @@ package body Sem_Aux is return True; elsif Is_Class_Wide_Type (Btype) then - return Is_Inherently_Limited_Type (Root_Type (Btype)); + return Is_Immutably_Limited_Type (Root_Type (Btype)); else declare @@ -622,7 +647,7 @@ package body Sem_Aux is -- limited intefaces. if not Is_Interface (Etype (C)) - and then Is_Inherently_Limited_Type (Etype (C)) + and then Is_Immutably_Limited_Type (Etype (C)) then return True; end if; @@ -635,12 +660,12 @@ package body Sem_Aux is end if; elsif Is_Array_Type (Btype) then - return Is_Inherently_Limited_Type (Component_Type (Btype)); + return Is_Immutably_Limited_Type (Component_Type (Btype)); else return False; end if; - end Is_Inherently_Limited_Type; + end Is_Immutably_Limited_Type; --------------------- -- Is_Limited_Type -- |