decl.c (gnat_to_gnu_entity): Reuse the TYPE_DECL of the equivalent type instead of building a new one.

* gcc-interface/decl.c (gnat_to_gnu_entity) <E_Task_Type>: Reuse the
	TYPE_DECL of the equivalent type instead of building a new one.

From-SVN: r160049
This commit is contained in:
Eric Botcazou 2010-05-30 12:01:55 +00:00 committed by Eric Botcazou
parent c01fe45120
commit e6bdd0396c
8 changed files with 86 additions and 2 deletions

View File

@ -1,3 +1,8 @@
2010-05-30 Eric Botcazou <ebotcazou@adacore.com>
* gcc-interface/decl.c (gnat_to_gnu_entity) <E_Task_Type>: Reuse the
TYPE_DECL of the equivalent type instead of building a new one.
2010-05-30 Eric Botcazou <ebotcazou@adacore.com>
* gcc-interface/decl.c (gnat_to_gnu_entity): Adjust warning message.

View File

@ -4382,11 +4382,11 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition)
case E_Task_Subtype:
case E_Protected_Type:
case E_Protected_Subtype:
/* Concurrent types are always transformed into their record type. */
if (type_annotate_only && No (gnat_equiv_type))
gnu_type = void_type_node;
else
gnu_type = gnat_to_gnu_type (gnat_equiv_type);
gnu_decl = gnat_to_gnu_entity (gnat_equiv_type, NULL_TREE, 0);
maybe_present = true;
break;

View File

@ -1,3 +1,9 @@
2010-05-30 Eric Botcazou <ebotcazou@adacore.com>
* gnat.dg/prot2.ad[sb]: New test.
* gnat.dg/prot2_pkg1.ads: New helper.
* gnat.dg/prot2_pkg2.ad[sb]: Likewise.
2010-05-30 Eric Botcazou <ebotcazou@adacore.com>
* gnat.dg/array11.adb: Adjust dg-warning directive.

View File

@ -0,0 +1,23 @@
-- { dg-do compile }
with Prot2_Pkg1;
with Prot2_Pkg2;
package body Prot2 is
type A is array (1 .. Prot2_Pkg1.Num) of Integer;
type E is (One, Two);
type Rec (D : E := One) is record
case D is
when One => L : A;
when Two => null;
end case;
end record;
package My_Pkg2 is new Prot2_Pkg2 (Rec);
procedure Dummy is begin null; end;
end Prot2;

View File

@ -0,0 +1,5 @@
package Prot2 is
procedure Dummy;
end Prot2;

View File

@ -0,0 +1,5 @@
package Prot2_Pkg1 is
function Num return Natural;
end Prot2_Pkg1;

View File

@ -0,0 +1,23 @@
with Unchecked_Deallocation;
package body Prot2_Pkg2 is
protected type Rec is
private
M : T;
end Rec;
protected body Rec is end;
procedure Create (B : out Id) is
begin
B := new Rec;
end;
procedure Delete (B : in out Id) is
procedure Free is new Unchecked_Deallocation(Object => Rec, Name => Id);
begin
Free (B);
end;
end Prot2_Pkg2;

View File

@ -0,0 +1,17 @@
generic
type T is private;
package Prot2_Pkg2 is
type Id is private;
procedure Create (B : out Id);
procedure Delete (B : in out Id);
private
type Rec;
type Id is access Rec;
end Prot2_Pkg2;