From 4f31d6dbb8deafd7ab54e70eddfd931b10b3309b Mon Sep 17 00:00:00 2001 From: Gary Dismukes Date: Fri, 24 Jan 2020 14:11:47 -0500 Subject: [Ada] Implement AI12-0275 (Make subtype_mark optional in object renamings) 2020-06-04 Gary Dismukes gcc/ada/ * par-ch3.adb (P_Identifier_Declarations): Add parsing of object renamings that have neither a subtype_mark nor an access_definition. Issue an error if the version is earlier than Ada_2020, and suggest using -gnatX. * sem_ch8.adb (Analyze_Object_Renaming): Handle object_renaming_declarations that don't have an explicit subtype. Errors are issued when the name is inappropriate or ambiguous, and otherwise the Etype of the renaming entity is set from the Etype of the renamed object. * sem_util.adb (Has_Null_Exclusion): Allow for the case of no subtype given in an N_Object_Renaming_Declaration. * sprint.adb (Sprint_Node_Actual): Handle printing of N_Object_Renaming_Declarations that are specified without an explicit subtype. --- gcc/ada/sem_util.adb | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'gcc/ada/sem_util.adb') diff --git a/gcc/ada/sem_util.adb b/gcc/ada/sem_util.adb index dff9f81..49594e4 100644 --- a/gcc/ada/sem_util.adb +++ b/gcc/ada/sem_util.adb @@ -11726,7 +11726,6 @@ package body Sem_Util is when N_Component_Definition | N_Formal_Object_Declaration - | N_Object_Renaming_Declaration => if Present (Subtype_Mark (N)) then return Null_Exclusion_Present (N); @@ -11734,6 +11733,15 @@ package body Sem_Util is return Null_Exclusion_Present (Access_Definition (N)); end if; + when N_Object_Renaming_Declaration => + if Present (Subtype_Mark (N)) then + return Null_Exclusion_Present (N); + elsif Present (Access_Definition (N)) then + return Null_Exclusion_Present (Access_Definition (N)); + else + return False; -- Case of no subtype in renaming (AI12-0275) + end if; + when N_Discriminant_Specification => if Nkind (Discriminant_Type (N)) = N_Access_Definition then return Null_Exclusion_Present (Discriminant_Type (N)); -- cgit v1.1