diff mbox

[Ada] Task declarations in entry bodies

Message ID 20100909093046.GA13913@adacore.com
State New
Headers show

Commit Message

Arnaud Charlet Sept. 9, 2010, 9:30 a.m. UTC
A scope that declares tasks includes the declaration of an activation chain.
The scope can be any body construct. Previous to this patch, an entry body
was not recognized as such a legal scope.

The following must compile quietly:

    gcc -c -gnatws par.adb

---
package Par is
   protected type Prot is
      Entry E;
   end Prot;
end;
---
package body Par is
  protected body Prot is separate;
end;
---
separate (Par)
protected body Prot is
   entry E when True is
      task Tsk;

      task body Tsk is
      begin
         null;
      end;
   begin
      null;
   end E;
end Prot;

Tested on x86_64-pc-linux-gnu, committed on trunk

2010-09-09  Ed Schonberg  <schonberg@adacore.com>

	* exp_ch9.adb (Build_Activation_Chain_Entity): The construct enclosing
	a task declaration can be an entry body.
diff mbox

Patch

Index: exp_ch9.adb
===================================================================
--- exp_ch9.adb	(revision 164000)
+++ exp_ch9.adb	(working copy)
@@ -829,10 +829,12 @@  package body Exp_Ch9 is
 
    begin
       --  Loop to find enclosing construct containing activation chain variable
+      --  The construct is a body, a block, or an extended return.
 
       P := Parent (N);
 
       while not Nkind_In (P, N_Subprogram_Body,
+                             N_Entry_Body,
                              N_Package_Declaration,
                              N_Package_Body,
                              N_Block_Statement,