aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/sem_util.adb
diff options
context:
space:
mode:
authorGary Dismukes <dismukes@adacore.com>2020-01-24 14:11:47 -0500
committerPierre-Marie de Rodat <derodat@adacore.com>2020-06-04 05:11:10 -0400
commit4f31d6dbb8deafd7ab54e70eddfd931b10b3309b (patch)
treefc6f000859ceafe678afb79e961ac60f729e277d /gcc/ada/sem_util.adb
parent96cd8940614e0f87aca7bb6064a45710aca6212f (diff)
downloadgcc-4f31d6dbb8deafd7ab54e70eddfd931b10b3309b.zip
gcc-4f31d6dbb8deafd7ab54e70eddfd931b10b3309b.tar.gz
gcc-4f31d6dbb8deafd7ab54e70eddfd931b10b3309b.tar.bz2
[Ada] Implement AI12-0275 (Make subtype_mark optional in object renamings)
2020-06-04 Gary Dismukes <dismukes@adacore.com> 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.
Diffstat (limited to 'gcc/ada/sem_util.adb')
-rw-r--r--gcc/ada/sem_util.adb10
1 files changed, 9 insertions, 1 deletions
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));