From: Arnaud Charlet Date: Fri, 8 Oct 2010 10:13:14 +0000 (+0200) Subject: [multiple changes] X-Git-Tag: releases/gcc-4.6.0~3754 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=c86ee18adc5f021703d4f5814ebbbfe59395274f;p=thirdparty%2Fgcc.git [multiple changes] 2010-10-08 Robert Dewar * sem_util.adb, sem_prag.adb: Minor reformatting 2010-10-08 Hristian Kirtchev * gnat_rm.texi: Remove the section on pragma Implemented_By_Entry. Add section on pragma Implemented. 2010-10-08 Ed Schonberg * sem_ch3.adb (Derive_Subprogram): If an abstract extension has a concrete parent with a concrete constructor, the inherited constructor is abstract even if the derived type is a null extension. From-SVN: r165155 --- diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 364f268fc4f9..9f90c6e67cfd 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,18 @@ +2010-10-08 Robert Dewar + + * sem_util.adb, sem_prag.adb: Minor reformatting + +2010-10-08 Hristian Kirtchev + + * gnat_rm.texi: Remove the section on pragma Implemented_By_Entry. + Add section on pragma Implemented. + +2010-10-08 Ed Schonberg + + * sem_ch3.adb (Derive_Subprogram): If an abstract extension has a + concrete parent with a concrete constructor, the inherited constructor + is abstract even if the derived type is a null extension. + 2010-10-08 Thomas Quinot * sem_ch4.adb: Minor reformatting. diff --git a/gcc/ada/gnat_rm.texi b/gcc/ada/gnat_rm.texi index c992dcda19bc..77f27c7f62ec 100644 --- a/gcc/ada/gnat_rm.texi +++ b/gcc/ada/gnat_rm.texi @@ -142,7 +142,7 @@ Implementation Defined Pragmas * Pragma Finalize_Storage_Only:: * Pragma Float_Representation:: * Pragma Ident:: -* Pragma Implemented_By_Entry:: +* Pragma Implemented:: * Pragma Implicit_Packing:: * Pragma Import_Exception:: * Pragma Import_Function:: @@ -760,7 +760,7 @@ consideration, the use of these pragmas should be minimized. * Pragma Finalize_Storage_Only:: * Pragma Float_Representation:: * Pragma Ident:: -* Pragma Implemented_By_Entry:: +* Pragma Implemented:: * Pragma Implicit_Packing:: * Pragma Import_Exception:: * Pragma Import_Function:: @@ -2474,41 +2474,51 @@ maximum allowed length is 31 characters, so if it is important to maintain compatibility with this compiler, you should obey this length limit. -@node Pragma Implemented_By_Entry -@unnumberedsec Pragma Implemented_By_Entry -@findex Implemented_By_Entry +@node Pragma Implemented +@unnumberedsec Pragma Implemented +@findex Implemented @noindent Syntax: @smallexample @c ada -pragma Implemented_By_Entry (LOCAL_NAME); +pragma Implemented (procedure_LOCAL_NAME, implementation_kind); + +implementation_kind ::= By_Entry | By_Protected_Procedure | By_Any @end smallexample @noindent -This is a representation pragma which applies to protected, synchronized and -task interface primitives. If the pragma is applied to primitive operation Op -of interface Iface, it is illegal to override Op in a type that implements -Iface, with anything other than an entry. +This is an Ada 2012 representation pragma which applies to protected, task +and synchronized interface primitives. The use of pragma Implemented provides +a way to impose a static requirement on the overriding opreration by adhering +to one of the three implementation kids: entry, protected procedure or any of +the above. @smallexample @c ada -type Iface is protected interface; -procedure Do_Something (Object : in out Iface) is abstract; -pragma Implemented_By_Entry (Do_Something); +type Synch_Iface is synchronized interface; +procedure Prim_Op (Obj : in out Iface) is abstract; +pragma Implemented (Prim_Op, By_Protected_Procedure); -protected type P is new Iface with - procedure Do_Something; -- Illegal -end P; +protected type Prot_1 is new Synch_Iface with + procedure Prim_Op; -- Legal +end Prot_1; -task type T is new Iface with - entry Do_Something; -- Legal -end T; +protected type Prot_2 is new Synch_Iface with + entry Prim_Op; -- Illegal +end Prot_2; + +task type Task_Typ is new Synch_Iface with + entry Prim_Op; -- Illegal +end Task_Typ; @end smallexample @noindent -NOTE: The pragma is still in its design stage by the Ada Rapporteur Group. It -is intended to be used in conjunction with dispatching requeue statements as -described in AI05-0030. Should the ARG decide on an official name and syntax, -this pragma will become language-defined rather than GNAT-specific. +When applied to the procedure_or_entry_NAME of a requeue statement, pragma +Implemented determines the runtime behavior of the requeue. Implementation kind +By_Entry guarantees that the action of requeueing will procede from an entry to +another entry. Implementation kind By_Protected_Procedure transforms the +requeue into a dispatching call, thus eliminating the chance of blocking. Kind +By_Any shares the behavior of By_Entry and By_Protected_Procedure depending on +the target's overriding subprogram kind. @node Pragma Implicit_Packing @unnumberedsec Pragma Implicit_Packing diff --git a/gcc/ada/sem_ch3.adb b/gcc/ada/sem_ch3.adb index 18aced728e38..fcb7f6d2ab15 100644 --- a/gcc/ada/sem_ch3.adb +++ b/gcc/ada/sem_ch3.adb @@ -12601,6 +12601,9 @@ package body Sem_Ch3 is if Ekind (Parent_Subp) = E_Procedure then Set_Is_Valued_Procedure (New_Subp, Is_Valued_Procedure (Parent_Subp)); + else + Set_Has_Controlling_Result + (New_Subp, Has_Controlling_Result (Parent_Subp)); end if; -- No_Return must be inherited properly. If this is overridden in the @@ -12654,6 +12657,15 @@ package body Sem_Ch3 is then Set_Is_Abstract_Subprogram (New_Subp); + -- AI05-0097 : an inherited operation that dispatches on result is + -- abstract if the derived type is abstract, even if the parent type + -- is concrete and the derived type is a null extension. + + elsif Has_Controlling_Result (Alias (New_Subp)) + and then Is_Abstract_Type (Etype (New_Subp)) + then + Set_Is_Abstract_Subprogram (New_Subp); + -- Finally, if the parent type is abstract we must verify that all -- inherited operations are either non-abstract or overridden, or that -- the derived type itself is abstract (this check is performed at the diff --git a/gcc/ada/sem_prag.adb b/gcc/ada/sem_prag.adb index 1ad6c67d7f47..c361161b8ee0 100644 --- a/gcc/ada/sem_prag.adb +++ b/gcc/ada/sem_prag.adb @@ -8074,8 +8074,8 @@ package body Sem_Prag is return; end if; - -- Ada 2012 (AI05-0030): Implementation_kind "By_Protected_ - -- Procedure" cannot be applied to the primitive procedure of a + -- Ada 2012 (AI05-0030): Cannot apply the Implementation_kind + -- "By_Protected_Procedure" to the primitive procedure of a -- task interface. if Chars (Arg2) = Name_By_Protected_Procedure diff --git a/gcc/ada/sem_util.adb b/gcc/ada/sem_util.adb index d9991ce3e589..c1d3fb411d76 100644 --- a/gcc/ada/sem_util.adb +++ b/gcc/ada/sem_util.adb @@ -5243,10 +5243,8 @@ package body Sem_Util is function Implementation_Kind (Subp : Entity_Id) return Name_Id is Impl_Prag : constant Node_Id := Get_Rep_Pragma (Subp, Name_Implemented); - begin pragma Assert (Present (Impl_Prag)); - return Chars (Expression (Last (Pragma_Argument_Associations (Impl_Prag)))); end Implementation_Kind;