aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/sem_util.ads
diff options
context:
space:
mode:
authorSteve Baird <baird@adacore.com>2020-08-06 11:09:50 -0700
committerPierre-Marie de Rodat <derodat@adacore.com>2020-10-22 08:11:26 -0400
commit7b3bda2ce269e858b2a7defa904bc748bc0b5854 (patch)
treeec0d6059aeaa428ddbe569bf418f38d6da40da41 /gcc/ada/sem_util.ads
parent944fed738c3f300b4e3cf5f89a4d2b40c85e0a75 (diff)
downloadgcc-7b3bda2ce269e858b2a7defa904bc748bc0b5854.zip
gcc-7b3bda2ce269e858b2a7defa904bc748bc0b5854.tar.gz
gcc-7b3bda2ce269e858b2a7defa904bc748bc0b5854.tar.bz2
[Ada] AI12-0211: Consistency of inherited nonoverridable aspects
gcc/ada/ * aspects.ads: Introduce the subtype Nonoverridable_Aspect_Id, whose Static_Predicate reflects the list of nonoverridable aspects given in Ada RM 13.1.1(18.7). * sem_util.ads, sem_util.adb: Add two new visible subprograms, Check_Inherited_Nonoverridable_Aspects and Is_Confirming. The former is used to check the consistency of inherited nonoverridable aspects from multiple sources. The latter indicates whether two aspect specifications for a nonoverridable aspect are confirming. Because of compatibility concerns in compiling QGen, Is_Confirming always returns True if Relaxed_RM_Semantics (i.e., -gnatd.M) is specified. * sem_ch3.adb (Derived_Type_Declaration): Call new Check_Inherited_Nonoverridable_Aspects procedure if interface list is non-empty. * sem_ch9.adb (Check_Interfaces): Call new Check_Inherited_Nonoverridable_Aspects procedure if interface list is non-empty. * sem_ch13.adb (Analyze_Aspect_Specifications): When an explicit aspect specification overrides an inherited nonoverridable aspect, check that the explicit specification is confirming.
Diffstat (limited to 'gcc/ada/sem_util.ads')
-rw-r--r--gcc/ada/sem_util.ads18
1 files changed, 18 insertions, 0 deletions
diff --git a/gcc/ada/sem_util.ads b/gcc/ada/sem_util.ads
index bcc7fd7..2b49a44 100644
--- a/gcc/ada/sem_util.ads
+++ b/gcc/ada/sem_util.ads
@@ -25,6 +25,7 @@
-- Package containing utility procedures used throughout the semantics
+with Aspects; use Aspects;
with Atree; use Atree;
with Einfo; use Einfo;
with Exp_Tss; use Exp_Tss;
@@ -413,6 +414,17 @@ package Sem_Util is
-- Determine whether object or state Id introduces a hidden state. If this
-- is the case, emit an error.
+ procedure Check_Inherited_Nonoverridable_Aspects
+ (Inheritor : Entity_Id;
+ Interface_List : List_Id;
+ Parent_Type : Entity_Id);
+ -- Verify consistency of inherited nonoverridable aspects
+ -- when aspects are inherited from more than one source.
+ -- Parent_Type may be void (e.g., for a tagged task/protected type
+ -- whose declaration includes a non-empty interface list).
+ -- In the error case, error message is associate with Inheritor;
+ -- Inheritor parameter is otherwise unused.
+
procedure Check_Nonvolatile_Function_Profile (Func_Id : Entity_Id);
-- Verify that the profile of nonvolatile function Func_Id does not contain
-- effectively volatile parameters or return type for reading.
@@ -1685,6 +1697,12 @@ package Sem_Util is
-- Determine whether entity Id denotes a procedure with synchronization
-- kind By_Protected_Procedure.
+ function Is_Confirming (Aspect : Nonoverridable_Aspect_Id;
+ Aspect_Spec_1, Aspect_Spec_2 : Node_Id)
+ return Boolean;
+ -- Returns true if the two specifications of the given
+ -- nonoverridable aspect are compatible.
+
function Is_Constant_Bound (Exp : Node_Id) return Boolean;
-- Exp is the expression for an array bound. Determines whether the
-- bound is a compile-time known value, or a constant entity, or an