summaryrefslogtreecommitdiff
path: root/gcc/ada/sem_dist.adb
diff options
context:
space:
mode:
authorcharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2005-03-18 11:49:26 +0000
committercharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2005-03-18 11:49:26 +0000
commitc1b50e6ed6803b02306094b9ce400e4eb9807021 (patch)
tree7cb890101cd69f15c9c050917024b75c2e82a801 /gcc/ada/sem_dist.adb
parentb5f5f125aad8e84812b60b5201e24a8d4964ec4d (diff)
downloadgcc-c1b50e6ed6803b02306094b9ce400e4eb9807021.tar.gz
2005-03-17 Thomas Quinot <quinot@adacore.com>
* exp_dist.adb (Get_PCS_Name): Move from Exp_Dist body to Sem_Dist spec, to make this predicate available to other units. * rtsfind.adb (Check_RPC): Use Sem_Dist.Get_PCS_Name instead of reimplementing it. * sem_ch8.adb: Disable expansion of remote access-to-subprogram types when no distribution runtime library is available. * sem_res.adb, sem_dist.adb: Disable expansion of remote access-to-subprogram types when no distribution runtime library is available. (Get_PCS_Name): Move from Exp_Dist body to Sem_Dist spec, to make this predicate available to other units. * sem_dist.ads (Get_PCS_Name): Move from Exp_Dist body to Sem_Dist spec, to make this predicate available to other units. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@96668 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/sem_dist.adb')
-rw-r--r--gcc/ada/sem_dist.adb71
1 files changed, 44 insertions, 27 deletions
diff --git a/gcc/ada/sem_dist.adb b/gcc/ada/sem_dist.adb
index c0fccfdc92a..188190f05af 100644
--- a/gcc/ada/sem_dist.adb
+++ b/gcc/ada/sem_dist.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2004, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -199,6 +199,18 @@ package body Sem_Dist is
return End_String;
end Full_Qualified_Name;
+ ------------------
+ -- Get_PCS_Name --
+ ------------------
+
+ function Get_PCS_Name return PCS_Names is
+ PCS_Name : constant PCS_Names :=
+ Chars (Entity (Expression
+ (Parent (RTE (RE_DSA_Implementation)))));
+ begin
+ return PCS_Name;
+ end Get_PCS_Name;
+
------------------------
-- Is_All_Remote_Call --
------------------------
@@ -341,7 +353,7 @@ package body Sem_Dist is
Remote_Subp := Entity (Prefix (N));
- if not Expander_Active then
+ if not Expander_Active or else Get_PCS_Name = Name_No_DSA then
return;
end if;
@@ -429,6 +441,33 @@ package body Sem_Dist is
Fat_Type_Decl : Node_Id;
begin
+ Is_Degenerate := False;
+ Parameter := First (Parameter_Specifications (Type_Def));
+ while Present (Parameter) loop
+ if Nkind (Parameter_Type (Parameter)) = N_Access_Definition then
+ Error_Msg_N ("formal parameter& has anonymous access type?",
+ Defining_Identifier (Parameter));
+ Is_Degenerate := True;
+ exit;
+ end if;
+
+ Next (Parameter);
+ end loop;
+
+ if Is_Degenerate then
+ Error_Msg_NE (
+ "remote access-to-subprogram type& can only be null?",
+ Defining_Identifier (Parameter), User_Type);
+ -- The only legal value for a RAS with a formal parameter of an
+ -- anonymous access type is null, because it cannot be
+ -- subtype-Conformant with any legal remote subprogram declaration.
+ -- In this case, we cannot generate a corresponding primitive
+ -- operation.
+ end if;
+
+ if Get_PCS_Name = Name_No_DSA then
+ return;
+ end if;
-- The tagged private type, primitive operation and RACW
-- type associated with a RAS need to all be declared in
@@ -457,29 +496,7 @@ package body Sem_Dist is
Null_Present => True,
Component_List => Empty)));
- Is_Degenerate := False;
- Parameter := First (Parameter_Specifications (Type_Def));
- Parameters : while Present (Parameter) loop
- if Nkind (Parameter_Type (Parameter)) = N_Access_Definition then
- Error_Msg_N ("formal parameter& has anonymous access type?",
- Defining_Identifier (Parameter));
- Is_Degenerate := True;
- exit Parameters;
- end if;
- Next (Parameter);
- end loop Parameters;
-
- if Is_Degenerate then
- Error_Msg_NE (
- "remote access-to-subprogram type& can only be null?",
- Defining_Identifier (Parameter), User_Type);
- -- The only legal value for a RAS with a formal parameter of an
- -- anonymous access type is null, because it cannot be
- -- subtype-Conformant with any legal remote subprogram declaration.
- -- In this case, we cannot generate a corresponding primitive
- -- operation.
-
- else
+ if not Is_Degenerate then
Append_To (Vis_Decls,
Make_Abstract_Subprogram_Declaration (Loc,
Specification => Build_RAS_Primitive_Specification (
@@ -595,7 +612,7 @@ package body Sem_Dist is
return;
end if;
- if not Expander_Active then
+ if not Expander_Active or else Get_PCS_Name = Name_No_DSA then
return;
end if;
@@ -685,7 +702,7 @@ package body Sem_Dist is
Target_Type : Entity_Id;
begin
- if not Expander_Active then
+ if not Expander_Active or else Get_PCS_Name = Name_No_DSA then
return False;
elsif Ekind (Typ) = E_Access_Subprogram_Type