-- Aspect Full_Access_Only must be analyzed last so that
-- aspects Volatile and Atomic, if any, are analyzed.
- if A_Id /= Aspect_Export
- and then A_Id /= Aspect_Import
- and then A_Id /= Aspect_Full_Access_Only
+ if A_Id not in Aspect_Export
+ | Aspect_Full_Access_Only
+ | Aspect_Import
then
Make_Pragma_From_Boolean_Aspect (ASN);
end if;
Ent := New_Occurrence_Of (E, Sloc (Id));
- if A_Id = Aspect_Attach_Handler
- or else A_Id = Aspect_Interrupt_Handler
- then
+ if A_Id in Aspect_Attach_Handler | Aspect_Interrupt_Handler then
-- Treat the specification as a reference to the protected
-- operation, which might otherwise appear unreferenced and
-- Check some general restrictions on language defined aspects
if not Implementation_Defined_Aspect (A_Id)
- or else A_Id = Aspect_Async_Readers
- or else A_Id = Aspect_Async_Writers
- or else A_Id = Aspect_Effective_Reads
- or else A_Id = Aspect_Effective_Writes
+ or else A_Id in Aspect_Async_Readers
+ | Aspect_Async_Writers
+ | Aspect_Effective_Reads
+ | Aspect_Effective_Writes
then
Error_Msg_Name_1 := Nam;
("aspect % not allowed for formal type declaration",
Aspect);
- elsif A_Id /= Aspect_Atomic
- and then A_Id /= Aspect_Volatile
- and then A_Id /= Aspect_Independent
- and then A_Id /= Aspect_Atomic_Components
- and then A_Id /= Aspect_Independent_Components
- and then A_Id /= Aspect_Volatile_Components
- and then A_Id /= Aspect_Async_Readers
- and then A_Id /= Aspect_Async_Writers
- and then A_Id /= Aspect_Effective_Reads
- and then A_Id /= Aspect_Effective_Writes
+ elsif A_Id not in Aspect_Atomic
+ | Aspect_Volatile
+ | Aspect_Independent
+ | Aspect_Atomic_Components
+ | Aspect_Independent_Components
+ | Aspect_Volatile_Components
+ | Aspect_Async_Readers
+ | Aspect_Async_Writers
+ | Aspect_Effective_Reads
+ | Aspect_Effective_Writes
then
Error_Msg_N
("aspect % not allowed for formal type declaration",
-- an attribute reference whose prefix is Standard, for
-- example Standard'Maximum_Alignment or Standard'Word_Size.
- elsif (A_Id = Aspect_Alignment
- or else A_Id = Aspect_Component_Size
- or else A_Id = Aspect_Object_Size
- or else A_Id = Aspect_Size
- or else A_Id = Aspect_Value_Size)
+ elsif A_Id in Aspect_Alignment
+ | Aspect_Component_Size
+ | Aspect_Object_Size
+ | Aspect_Size
+ | Aspect_Value_Size
and then Present (Expr)
and then Nkind (Expr) = N_Attribute_Reference
and then Nkind (Prefix (Expr)) = N_Identifier
=>
-- Indexing aspects apply only to tagged type
- if (A_Id = Aspect_Constant_Indexing
- or else
- A_Id = Aspect_Variable_Indexing)
+ if A_Id in Aspect_Constant_Indexing
+ | Aspect_Variable_Indexing
and then not (Is_Type (E)
and then Is_Tagged_Type (E))
then
-- illegal specification of this aspect for a subtype now,
-- to prevent malformed rep_item chains.
- if A_Id = Aspect_Input or else
- A_Id = Aspect_Output or else
- A_Id = Aspect_Read or else
- A_Id = Aspect_Write
+ if A_Id in Aspect_Input
+ | Aspect_Output
+ | Aspect_Read
+ | Aspect_Write
then
if not Is_First_Subtype (E) then
Error_Msg_N
Pname : Name_Id;
begin
- if A_Id = Aspect_Pre or else A_Id = Aspect_Precondition then
+ if A_Id in Aspect_Pre | Aspect_Precondition then
Pname := Name_Precondition;
else
Pname := Name_Postcondition;
goto Continue;
- elsif A_Id = Aspect_Export or else A_Id = Aspect_Import then
+ elsif A_Id in Aspect_Export | Aspect_Import then
Analyze_Aspect_Export_Import;
-- Disable_Controlled
-- Exclude aspects Export and Import because their pragma
-- syntax does not map directly to a Boolean aspect.
- if A_Id /= Aspect_Export
- and then A_Id /= Aspect_Import
- then
+ if A_Id not in Aspect_Export | Aspect_Import then
Aitem := Make_Aitem_Pragma
(Pragma_Argument_Associations => New_List (
Make_Pragma_Argument_Association (Sloc (Ent),
-- name, so we need to verify that one of these interpretations is
-- the one available at at the freeze point.
- elsif A_Id = Aspect_Input or else
- A_Id = Aspect_Output or else
- A_Id = Aspect_Read or else
- A_Id = Aspect_Write or else
- A_Id = Aspect_Put_Image
+ elsif A_Id in Aspect_Input
+ | Aspect_Output
+ | Aspect_Read
+ | Aspect_Write
+ | Aspect_Put_Image
then
Analyze (End_Decl_Expr);
Check_Overloaded_Name;
- elsif A_Id = Aspect_Variable_Indexing or else
- A_Id = Aspect_Constant_Indexing or else
- A_Id = Aspect_Default_Iterator or else
- A_Id = Aspect_Iterator_Element or else
- A_Id = Aspect_Integer_Literal or else
- A_Id = Aspect_Real_Literal or else
- A_Id = Aspect_String_Literal
+ elsif A_Id in Aspect_Variable_Indexing
+ | Aspect_Constant_Indexing
+ | Aspect_Default_Iterator
+ | Aspect_Iterator_Element
+ | Aspect_Integer_Literal
+ | Aspect_Real_Literal
+ | Aspect_String_Literal
then
-- Make type unfrozen before analysis, to prevent spurious errors
-- about late attributes.
-- also make its potential components accessible.
if not Analyzed (Freeze_Expr) and then Inside_A_Generic then
- if A_Id = Aspect_Dynamic_Predicate
- or else A_Id = Aspect_Predicate
- then
+ if A_Id in Aspect_Dynamic_Predicate | Aspect_Predicate then
Push_Type (Ent);
Preanalyze_Spec_Expression (Freeze_Expr, Standard_Boolean);
Pop_Type (Ent);
-- visible for aspects that may reference them.
if Present (Freeze_Expr) and then No (T) then
- if A_Id = Aspect_Dynamic_Predicate
- or else A_Id = Aspect_Predicate
- or else A_Id = Aspect_Priority
+ if A_Id in Aspect_Dynamic_Predicate
+ | Aspect_Predicate
+ | Aspect_Priority
then
Push_Type (Ent);
Check_Aspect_At_Freeze_Point (ASN);
-- partial view is visible. The expression must be scalar, so use
-- the full view to resolve.
- elsif (A_Id = Aspect_Default_Value
- or else
- A_Id = Aspect_Default_Component_Value)
+ elsif A_Id in Aspect_Default_Component_Value | Aspect_Default_Value
and then Is_Private_Type (T)
then
Preanalyze_Spec_Expression (End_Decl_Expr, Full_View (T));
-- The following aspect expressions may contain references to
-- components and discriminants of the type.
- elsif A_Id = Aspect_Dynamic_Predicate
- or else A_Id = Aspect_Predicate
- or else A_Id = Aspect_Priority
- or else A_Id = Aspect_CPU
+ elsif A_Id in Aspect_CPU
+ | Aspect_Dynamic_Predicate
+ | Aspect_Predicate
+ | Aspect_Priority
then
Push_Type (Ent);
Preanalyze_Spec_Expression (End_Decl_Expr, T);
and then Scope (E) = Current_Scope
then
declare
- A_Id : Aspect_Id;
Ritem : Node_Id;
begin
and then Entity (Ritem) = E
and then Is_Delayed_Aspect (Ritem)
then
- A_Id := Get_Aspect_Id (Ritem);
-
- if A_Id = Aspect_Dynamic_Predicate
- or else A_Id = Aspect_Predicate
- or else A_Id = Aspect_Priority
- or else A_Id = Aspect_CPU
+ if Get_Aspect_Id (Ritem) in Aspect_CPU
+ | Aspect_Dynamic_Predicate
+ | Aspect_Predicate
+ | Aspect_Priority
then
-- Retrieve the visibility to components and discriminants
-- in order to properly analyze the aspects.
function Is_Operational_Item (N : Node_Id) return Boolean is
begin
- if Nkind (N) /= N_Attribute_Definition_Clause then
- return False;
-
- else
- declare
- Id : constant Attribute_Id := Get_Attribute_Id (Chars (N));
- begin
-
- -- List of operational items is given in AARM 13.1(8.mm/1).
- -- It is clearly incomplete, as it does not include iterator
- -- aspects, among others.
-
- return Id = Attribute_Constant_Indexing
- or else Id = Attribute_Default_Iterator
- or else Id = Attribute_Implicit_Dereference
- or else Id = Attribute_Input
- or else Id = Attribute_Iterator_Element
- or else Id = Attribute_Iterable
- or else Id = Attribute_Output
- or else Id = Attribute_Read
- or else Id = Attribute_Variable_Indexing
- or else Id = Attribute_Write
- or else Id = Attribute_External_Tag;
- end;
- end if;
+ -- List of operational items is given in AARM 13.1(8.mm/1). It is
+ -- clearly incomplete, as it does not include iterator aspects, among
+ -- others.
+
+ return Nkind (N) = N_Attribute_Definition_Clause
+ and then
+ Get_Attribute_Id (Chars (N)) in Attribute_Constant_Indexing
+ | Attribute_External_Tag
+ | Attribute_Default_Iterator
+ | Attribute_Implicit_Dereference
+ | Attribute_Input
+ | Attribute_Iterable
+ | Attribute_Iterator_Element
+ | Attribute_Output
+ | Attribute_Read
+ | Attribute_Variable_Indexing
+ | Attribute_Write;
end Is_Operational_Item;
-------------------------
begin
case Nkind (N) is
when N_Attribute_Definition_Clause =>
- declare
- Id : constant Attribute_Id := Get_Attribute_Id (Chars (N));
- -- See AARM 13.1(8.f-8.x) list items that end in "clause"
- -- ???: include any GNAT-defined attributes here?
- begin
- return Id = Attribute_Component_Size
- or else Id = Attribute_Bit_Order
- or else Id = Attribute_Storage_Pool
- or else Id = Attribute_Stream_Size
- or else Id = Attribute_Machine_Radix;
- end;
+ -- See AARM 13.1(8.f-8.x) list items that end in "clause"
+ -- ???: include any GNAT-defined attributes here?
+ return Get_Attribute_Id (Chars (N)) in Attribute_Bit_Order
+ | Attribute_Component_Size
+ | Attribute_Machine_Radix
+ | Attribute_Storage_Pool
+ | Attribute_Stream_Size;
when N_Pragma =>
case Get_Pragma_Id (N) is
Ent := Entity (N);
F1 := First_Formal (Ent);
- if Nam = Name_First or else Nam = Name_Last then
+ if Nam in Name_First | Name_Last then
-- First or Last (Container) => Cursor
-- Deal with component case
- if Ekind (E) = E_Discriminant or else Ekind (E) = E_Component then
+ if Ekind (E) in E_Component | E_Discriminant then
if not OK_Component (E) then
No_Independence;
Reason_Bad_Component (E);