aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArnaud Charlet <charlet@gcc.gnu.org>2013-01-02 11:51:06 +0100
committerArnaud Charlet <charlet@gcc.gnu.org>2013-01-02 11:51:06 +0100
commit2c28c7a7b503ca3b3bb04201d5971b2e55d2dff1 (patch)
tree74a08790f5fdaf424b765723697ac353e95c1a2e
parent9b23b7defd5004f853329253ac96b4aabd7995b1 (diff)
downloadgcc-2c28c7a7b503ca3b3bb04201d5971b2e55d2dff1.zip
gcc-2c28c7a7b503ca3b3bb04201d5971b2e55d2dff1.tar.gz
gcc-2c28c7a7b503ca3b3bb04201d5971b2e55d2dff1.tar.bz2
[multiple changes]
2013-01-02 Thomas Quinot <quinot@adacore.com> * par_sco.adb: Generate X SCOs for default expressions in subprogram body stubs. Do not generate any SCO for package, task, or protected body stubs. 2013-01-02 Ed Schonberg <schonberg@adacore.com> * sem_ch3.adb: Further improvement to ASIS mode for anonymous access to protected subprograms. From-SVN: r194796
-rw-r--r--gcc/ada/ChangeLog11
-rw-r--r--gcc/ada/par_sco.adb16
-rw-r--r--gcc/ada/sem_ch3.adb37
3 files changed, 59 insertions, 5 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index d2c090d..6753ce4 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,3 +1,14 @@
+2013-01-02 Thomas Quinot <quinot@adacore.com>
+
+ * par_sco.adb: Generate X SCOs for default expressions in
+ subprogram body stubs. Do not generate any SCO for package,
+ task, or protected body stubs.
+
+2013-01-02 Ed Schonberg <schonberg@adacore.com>
+
+ * sem_ch3.adb: Further improvement to ASIS mode for anonymous
+ access to protected subprograms.
+
2013-01-02 Robert Dewar <dewar@adacore.com>
* par_sco.adb, vms_data.ads: Minor reformatting.
diff --git a/gcc/ada/par_sco.adb b/gcc/ada/par_sco.adb
index 059103f..e46f242 100644
--- a/gcc/ada/par_sco.adb
+++ b/gcc/ada/par_sco.adb
@@ -1048,10 +1048,15 @@ package body Par_SCO is
Index := Condition_Pragma_Hash_Table.Get (Loc);
- -- The test here for zero is to deal with possible previous errors
+ -- A zero index here indicates that semantic analysis found an
+ -- activated pragma at Loc which does not have a corresponding pragma
+ -- or aspect at the syntax level. This may occur in legitimate cases
+ -- because of expanded code (such are Pre/Post conditions generated for
+ -- formal parameter validity checks), or as a consequence of a previous
+ -- error.
if Index = 0 then
- Check_Error_Detected;
+ return;
else
declare
@@ -1533,7 +1538,7 @@ package body Par_SCO is
-- Subprogram declaration
- when N_Subprogram_Declaration =>
+ when N_Subprogram_Declaration | N_Subprogram_Body_Stub =>
Process_Decisions_Defer
(Parameter_Specifications (Specification (N)), 'X');
@@ -2041,7 +2046,10 @@ package body Par_SCO is
when N_Representation_Clause |
N_Use_Package_Clause |
- N_Use_Type_Clause =>
+ N_Use_Type_Clause |
+ N_Package_Body_Stub |
+ N_Task_Body_Stub |
+ N_Protected_Body_Stub =>
Typ := ASCII.NUL;
when others =>
diff --git a/gcc/ada/sem_ch3.adb b/gcc/ada/sem_ch3.adb
index eb25443..5b67e26 100644
--- a/gcc/ada/sem_ch3.adb
+++ b/gcc/ada/sem_ch3.adb
@@ -5049,10 +5049,45 @@ package body Sem_Ch3 is
Decl :=
Make_Full_Type_Declaration (Loc,
Defining_Identifier => Anon,
- Type_Definition => Relocate_Node (Spec));
+ Type_Definition => Copy_Separate_Tree (Spec));
Mark_Rewrite_Insertion (Decl);
+ -- In ASIS mode, analyze the profile on the original node, because
+ -- the separate copy does not provide enough links to recover the
+ -- original tree. Analysis is limited to type annotations, within
+ -- a temporary scope that serves as an anonnymous subprogram to
+ -- collect otherwise useless temporaries and itypes.
+
+ if ASIS_Mode then
+ declare
+ Typ : constant Entity_Id := Make_Temporary (Loc, 'S');
+
+ begin
+ if Nkind (Spec) = N_Access_Function_Definition then
+ Set_Ekind (Typ, E_Function);
+ else
+ Set_Ekind (Typ, E_Procedure);
+ end if;
+
+ Set_Parent (Typ, N);
+ Set_Scope (Typ, Current_Scope);
+ Push_Scope (Typ);
+
+ Process_Formals (Parameter_Specifications (Spec), Spec);
+
+ if Nkind (Spec) = N_Access_Function_Definition then
+ if Nkind (Result_Definition (Spec)) = N_Access_Definition then
+ Find_Type (Subtype_Mark (Result_Definition (Spec)));
+ else
+ Find_Type (Result_Definition (Spec));
+ end if;
+ end if;
+
+ End_Scope;
+ end;
+ end if;
+
-- Insert the new declaration in the nearest enclosing scope. If the
-- node is a body and N is its return type, the declaration belongs in
-- the enclosing scope.