[gcc(refs/users/guojiufu/heads/personal-branch)] [Ada] AI12-0207 Convention of anonymous access types
Jiu Fu Guo
guojiufu@gcc.gnu.org
Wed Jun 10 03:40:08 GMT 2020
https://gcc.gnu.org/g:a9969d7feb35306ba82bc5d605d9c8c48f1c8271
commit a9969d7feb35306ba82bc5d605d9c8c48f1c8271
Author: Arnaud Charlet <charlet@adacore.com>
Date: Fri Jan 31 15:53:42 2020 -0500
[Ada] AI12-0207 Convention of anonymous access types
2020-06-05 Arnaud Charlet <charlet@adacore.com>
gcc/ada/
* sem_prag.adb (Set_Convention_From_Pragma): Set the convention
of anonymous access array components.
Diff:
---
gcc/ada/sem_prag.adb | 46 +++++++++++++++++++++++++++++-----------------
1 file changed, 29 insertions(+), 17 deletions(-)
diff --git a/gcc/ada/sem_prag.adb b/gcc/ada/sem_prag.adb
index 419538d7c68..0848e1e6979 100644
--- a/gcc/ada/sem_prag.adb
+++ b/gcc/ada/sem_prag.adb
@@ -8020,26 +8020,38 @@ package body Sem_Prag is
-- For the case of a record base type, also set the convention of
-- any anonymous access types declared in the record which do not
-- currently have a specified convention.
+ -- Similarly for an array base type and anonymous access types
+ -- components.
- if Is_Record_Type (E) and then Is_Base_Type (E) then
- declare
- Comp : Node_Id;
+ if Is_Base_Type (E) then
+ if Is_Record_Type (E) then
+ declare
+ Comp : Node_Id;
- begin
- Comp := First_Component (E);
- while Present (Comp) loop
- if Present (Etype (Comp))
- and then Ekind_In (Etype (Comp),
- E_Anonymous_Access_Type,
- E_Anonymous_Access_Subprogram_Type)
- and then not Has_Convention_Pragma (Comp)
- then
- Set_Convention (Comp, C);
- end if;
+ begin
+ Comp := First_Component (E);
+ while Present (Comp) loop
+ if Present (Etype (Comp))
+ and then
+ Ekind_In (Etype (Comp),
+ E_Anonymous_Access_Type,
+ E_Anonymous_Access_Subprogram_Type)
+ and then not Has_Convention_Pragma (Comp)
+ then
+ Set_Convention (Comp, C);
+ end if;
- Next_Component (Comp);
- end loop;
- end;
+ Next_Component (Comp);
+ end loop;
+ end;
+
+ elsif Is_Array_Type (E)
+ and then Ekind_In (Component_Type (E),
+ E_Anonymous_Access_Type,
+ E_Anonymous_Access_Subprogram_Type)
+ then
+ Set_Convention (Designated_Type (Component_Type (E)), C);
+ end if;
end if;
-- Deal with incomplete/private type case, where underlying type
More information about the Gcc-cvs
mailing list