aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@adacore.com>2010-05-30 12:01:55 +0000
committerEric Botcazou <ebotcazou@gcc.gnu.org>2010-05-30 12:01:55 +0000
commite6bdd0396c69b8f08da394aca0687fb46c188b4a (patch)
tree5828204a3c6b0360ef04bfe89a699185c8995230 /gcc
parentc01fe45120921336cd37363f723fbf04e29b28a7 (diff)
downloadgcc-e6bdd0396c69b8f08da394aca0687fb46c188b4a.zip
gcc-e6bdd0396c69b8f08da394aca0687fb46c188b4a.tar.gz
gcc-e6bdd0396c69b8f08da394aca0687fb46c188b4a.tar.bz2
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
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ada/ChangeLog5
-rw-r--r--gcc/ada/gcc-interface/decl.c4
-rw-r--r--gcc/testsuite/ChangeLog6
-rw-r--r--gcc/testsuite/gnat.dg/prot2.adb23
-rw-r--r--gcc/testsuite/gnat.dg/prot2.ads5
-rw-r--r--gcc/testsuite/gnat.dg/prot2_pkg1.ads5
-rw-r--r--gcc/testsuite/gnat.dg/prot2_pkg2.adb23
-rw-r--r--gcc/testsuite/gnat.dg/prot2_pkg2.ads17
8 files changed, 86 insertions, 2 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index 53a4260..7b909f8 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,5 +1,10 @@
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.
Fix nits in comments.
* gcc-interface/misc.c (gnat_init_gcc_eh): Likewise.
diff --git a/gcc/ada/gcc-interface/decl.c b/gcc/ada/gcc-interface/decl.c
index 71679fd..0fd7753 100644
--- a/gcc/ada/gcc-interface/decl.c
+++ b/gcc/ada/gcc-interface/decl.c
@@ -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;
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index f6848fc..43f4478 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,5 +1,11 @@
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.
* gnat.dg/object_overflow.adb: Likewise.
diff --git a/gcc/testsuite/gnat.dg/prot2.adb b/gcc/testsuite/gnat.dg/prot2.adb
new file mode 100644
index 0000000..cc6fcab
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/prot2.adb
@@ -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;
diff --git a/gcc/testsuite/gnat.dg/prot2.ads b/gcc/testsuite/gnat.dg/prot2.ads
new file mode 100644
index 0000000..d388fc7
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/prot2.ads
@@ -0,0 +1,5 @@
+package Prot2 is
+
+ procedure Dummy;
+
+end Prot2;
diff --git a/gcc/testsuite/gnat.dg/prot2_pkg1.ads b/gcc/testsuite/gnat.dg/prot2_pkg1.ads
new file mode 100644
index 0000000..2e71aac
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/prot2_pkg1.ads
@@ -0,0 +1,5 @@
+package Prot2_Pkg1 is
+
+ function Num return Natural;
+
+end Prot2_Pkg1;
diff --git a/gcc/testsuite/gnat.dg/prot2_pkg2.adb b/gcc/testsuite/gnat.dg/prot2_pkg2.adb
new file mode 100644
index 0000000..503cce7
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/prot2_pkg2.adb
@@ -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;
diff --git a/gcc/testsuite/gnat.dg/prot2_pkg2.ads b/gcc/testsuite/gnat.dg/prot2_pkg2.ads
new file mode 100644
index 0000000..cdd436b
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/prot2_pkg2.ads
@@ -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;