aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada
diff options
context:
space:
mode:
authorArnaud Charlet <charlet@gcc.gnu.org>2010-10-08 12:13:14 +0200
committerArnaud Charlet <charlet@gcc.gnu.org>2010-10-08 12:13:14 +0200
commitc86ee18adc5f021703d4f5814ebbbfe59395274f (patch)
tree1b7c4c75726a13e7fbea21124d3e703023630543 /gcc/ada
parentbfae1846ce6fb95a064520e4560fbd191abd2f04 (diff)
downloadgcc-c86ee18adc5f021703d4f5814ebbbfe59395274f.zip
gcc-c86ee18adc5f021703d4f5814ebbbfe59395274f.tar.gz
gcc-c86ee18adc5f021703d4f5814ebbbfe59395274f.tar.bz2
[multiple changes]
2010-10-08 Robert Dewar <dewar@adacore.com> * sem_util.adb, sem_prag.adb: Minor reformatting 2010-10-08 Hristian Kirtchev <kirtchev@adacore.com> * gnat_rm.texi: Remove the section on pragma Implemented_By_Entry. Add section on pragma Implemented. 2010-10-08 Ed Schonberg <schonberg@adacore.com> * 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
Diffstat (limited to 'gcc/ada')
-rw-r--r--gcc/ada/ChangeLog15
-rw-r--r--gcc/ada/gnat_rm.texi56
-rw-r--r--gcc/ada/sem_ch3.adb12
-rw-r--r--gcc/ada/sem_prag.adb4
-rw-r--r--gcc/ada/sem_util.adb2
5 files changed, 62 insertions, 27 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index 364f268..9f90c6e 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,3 +1,18 @@
+2010-10-08 Robert Dewar <dewar@adacore.com>
+
+ * sem_util.adb, sem_prag.adb: Minor reformatting
+
+2010-10-08 Hristian Kirtchev <kirtchev@adacore.com>
+
+ * gnat_rm.texi: Remove the section on pragma Implemented_By_Entry.
+ Add section on pragma Implemented.
+
+2010-10-08 Ed Schonberg <schonberg@adacore.com>
+
+ * 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 <quinot@adacore.com>
* sem_ch4.adb: Minor reformatting.
diff --git a/gcc/ada/gnat_rm.texi b/gcc/ada/gnat_rm.texi
index c992dcd..77f27c7 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 18aced7..fcb7f6d 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 1ad6c67..c361161 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 d9991ce..c1d3fb4 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;