Expression => New_Occurrence_Of (R, Loc));
end if;
- if Has_Aspect (Pid, Aspect_Exclusive_Functions)
- and then
- (No (Find_Value_Of_Aspect (Pid, Aspect_Exclusive_Functions))
- or else
- Is_True (Static_Boolean (Find_Value_Of_Aspect
- (Pid, Aspect_Exclusive_Functions))))
- then
+ if Has_Enabled_Aspect (Pid, Aspect_Exclusive_Functions) then
Lock_Kind := RE_Lock;
else
Lock_Kind := RE_Lock_Read_Only;
if (Nkind (Op_Spec) = N_Procedure_Specification
or else
(Nkind (Op_Spec) = N_Function_Specification
- and then Has_Aspect (Conc_Typ, Aspect_Exclusive_Functions)
and then
- (No
- (Find_Value_Of_Aspect (Conc_Typ,
- Aspect_Exclusive_Functions))
- or else
- Is_True
- (Static_Boolean
- (Find_Value_Of_Aspect
- (Conc_Typ, Aspect_Exclusive_Functions))))))
+ Has_Enabled_Aspect
+ (Conc_Typ, Aspect_Exclusive_Functions)))
and then Has_Entries (Conc_Typ)
then
case Corresponding_Runtime_Package (Conc_Typ) is
return False;
end Has_Effectively_Volatile_Component;
+ ------------------------
+ -- Has_Enabled_Aspect --
+ ------------------------
+
+ function Has_Enabled_Aspect
+ (Id : Entity_Id;
+ A : Aspect_Id)
+ return Boolean
+ is
+ Asp : constant Node_Id := Find_Aspect (Id, A);
+ begin
+ if Present (Asp) then
+ if Present (Expression (Asp)) then
+ return Is_True (Static_Boolean (Expression (Asp)));
+ else
+ return True;
+ end if;
+ else
+ return False;
+ end if;
+ end Has_Enabled_Aspect;
+
----------------------------
-- Has_Volatile_Component --
----------------------------
-- for efficiency.
return Ada_Version >= Ada_2022
- and then Has_Aspect (Subp, Aspect_Static)
- and then
- (No (Find_Value_Of_Aspect (Subp, Aspect_Static))
- or else Is_True (Static_Boolean
- (Find_Value_Of_Aspect (Subp, Aspect_Static))));
+ and then Has_Enabled_Aspect (Subp, Aspect_Static);
end Is_Static_Function;
-----------------------------
-- Given arbitrary type Typ, determine whether it contains at least one
-- effectively volatile component.
+ function Has_Enabled_Aspect (Id : Entity_Id; A : Aspect_Id) return Boolean
+ with Pre => A in Boolean_Aspects;
+ -- Returns True if a Boolean-valued aspect is enabled on entity Id; i.e. it
+ -- is present and either has no aspect definition or its aspect definition
+ -- statically evaluates to True.
+
function Has_Volatile_Component (Typ : Entity_Id) return Boolean;
-- Given arbitrary type Typ, determine whether it contains at least one
-- volatile component.