diff options
author | Arnaud Charlet <charlet@gcc.gnu.org> | 2011-11-07 17:22:28 +0100 |
---|---|---|
committer | Arnaud Charlet <charlet@gcc.gnu.org> | 2011-11-07 17:22:28 +0100 |
commit | 7b7a0c2bdd174e11693cbe425e2a6e9e86817d93 (patch) | |
tree | da922a9e993691859131da7d8676ce000c6209da | |
parent | cc570be69335a3d3c36c14eabc99bf0049e7f9be (diff) | |
download | gcc-7b7a0c2bdd174e11693cbe425e2a6e9e86817d93.zip gcc-7b7a0c2bdd174e11693cbe425e2a6e9e86817d93.tar.gz gcc-7b7a0c2bdd174e11693cbe425e2a6e9e86817d93.tar.bz2 |
[multiple changes]
2011-11-07 Yannick Moy <moy@adacore.com>
* sem_util.adb (Unique_Entity): For a parameter on a subprogram
body that has a corresponding parameter on the subprogram
declaration, define the unique entity as being the declaration
one.
2011-11-07 Ed Schonberg <schonberg@adacore.com>
* sem_ch6.adb (Analyze_Return_Type): In Ada 2012 mode, if the
return type of a function is the class-wide type of an incomplete
type T, T can be a Taft-amendment type and does not have to be
completed in the current private part.
2011-11-07 Ed Schonberg <schonberg@adacore.com>
* aspects.ads (Inherited_Aspect): Map that indicates type aspects
that are inherited by default, and apply to the class-wide type
as well.
* aspects.adb (Find_Aspect): If the entity is class-wide and the
aspect is inherited, use the aspect of the specific type.
From-SVN: r181092
-rw-r--r-- | gcc/ada/ChangeLog | 22 | ||||
-rwxr-xr-x | gcc/ada/aspects.adb | 14 | ||||
-rwxr-xr-x | gcc/ada/aspects.ads | 12 | ||||
-rw-r--r-- | gcc/ada/sem_ch6.adb | 5 | ||||
-rw-r--r-- | gcc/ada/sem_util.adb | 5 |
5 files changed, 56 insertions, 2 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index dce0797..f0f5bf9 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,25 @@ +2011-11-07 Yannick Moy <moy@adacore.com> + + * sem_util.adb (Unique_Entity): For a parameter on a subprogram + body that has a corresponding parameter on the subprogram + declaration, define the unique entity as being the declaration + one. + +2011-11-07 Ed Schonberg <schonberg@adacore.com> + + * sem_ch6.adb (Analyze_Return_Type): In Ada 2012 mode, if the + return type of a function is the class-wide type of an incomplete + type T, T can be a Taft-amendment type and does not have to be + completed in the current private part. + +2011-11-07 Ed Schonberg <schonberg@adacore.com> + + * aspects.ads (Inherited_Aspect): Map that indicates type aspects + that are inherited by default, and apply to the class-wide type + as well. + * aspects.adb (Find_Aspect): If the entity is class-wide and the + aspect is inherited, use the aspect of the specific type. + 2011-11-07 Hristian Kirtchev <kirtchev@adacore.com> * exp_alfa.adb: Remove with and use clause for diff --git a/gcc/ada/aspects.adb b/gcc/ada/aspects.adb index 48a1c89..9b70773 100755 --- a/gcc/ada/aspects.adb +++ b/gcc/ada/aspects.adb @@ -127,7 +127,19 @@ package body Aspects is Ritem : Node_Id; begin - Ritem := First_Rep_Item (Ent); + + -- If the aspect is an inherited one and the entity is a class-wide + -- type, use the aspect of the specific type. + + if Is_Type (Ent) + and then Is_Class_Wide_Type (Ent) + and then Inherited_Aspect (A) + then + Ritem := First_Rep_Item (Etype (Ent)); + else + Ritem := First_Rep_Item (Ent); + end if; + while Present (Ritem) loop if Nkind (Ritem) = N_Aspect_Specification and then Get_Aspect_Id (Chars (Identifier (Ritem))) = A diff --git a/gcc/ada/aspects.ads b/gcc/ada/aspects.ads index dfca9b1..a281d9c 100755 --- a/gcc/ada/aspects.ads +++ b/gcc/ada/aspects.ads @@ -176,6 +176,18 @@ package Aspects is (Aspect_Test_Case => False, others => True); + -- The following array indicates type aspects that are inherited and apply + -- to the class-wide type as well. + + Inherited_Aspect : constant array (Aspect_Id) of Boolean := + (Aspect_Constant_Indexing => True, + Aspect_Default_Iterator => True, + Aspect_Implicit_Dereference => True, + Aspect_Iterator_Element => True, + Aspect_Remote_Types => True, + Aspect_Variable_Indexing => True, + others => False); + -- The following subtype defines aspects corresponding to library unit -- pragmas, these can only validly appear as aspects for library units, -- and result in a corresponding pragma being inserted immediately after diff --git a/gcc/ada/sem_ch6.adb b/gcc/ada/sem_ch6.adb index 5d30faa4..a9f84d3 100644 --- a/gcc/ada/sem_ch6.adb +++ b/gcc/ada/sem_ch6.adb @@ -1641,10 +1641,13 @@ package body Sem_Ch6 is -- The type must be completed in the current package. This -- is checked at the end of the package declaraton, when - -- Taft amemdment types are identified. + -- Taft-amendment types are identified. If the return type + -- is class-wide, there is no required check, the type can + -- be a bona fide TAT. if Ekind (Scope (Current_Scope)) = E_Package and then In_Private_Part (Scope (Current_Scope)) + and then not Is_Class_Wide_Type (Typ) then Append_Elmt (Designator, Private_Dependents (Typ)); end if; diff --git a/gcc/ada/sem_util.adb b/gcc/ada/sem_util.adb index 9dfecd3..6fbe399 100644 --- a/gcc/ada/sem_util.adb +++ b/gcc/ada/sem_util.adb @@ -12835,6 +12835,11 @@ package body Sem_Util is U := Corresponding_Spec (P); end if; + when Formal_Kind => + if Present (Spec_Entity (E)) then + U := Spec_Entity (E); + end if; + when others => null; end case; |