diff options
Diffstat (limited to 'gcc/ada/sem_util.adb')
-rw-r--r-- | gcc/ada/sem_util.adb | 890 |
1 files changed, 422 insertions, 468 deletions
diff --git a/gcc/ada/sem_util.adb b/gcc/ada/sem_util.adb index b2f41de..9175382 100644 --- a/gcc/ada/sem_util.adb +++ b/gcc/ada/sem_util.adb @@ -195,8 +195,7 @@ package body Sem_Util is Nod := Declaration_Node (Base_Type (Typ)); - if Nkind_In (Nod, N_Full_Type_Declaration, - N_Private_Type_Declaration) + if Nkind (Nod) in N_Full_Type_Declaration | N_Private_Type_Declaration then return Empty_List; end if; @@ -1024,11 +1023,13 @@ package body Sem_Util is HSS : Node_Id; begin - pragma Assert (Nkind_In (N, N_Block_Statement, - N_Entry_Body, - N_Package_Body, - N_Subprogram_Body, - N_Task_Body)); + pragma Assert + (Nkind (N) in + N_Block_Statement | + N_Entry_Body | + N_Package_Body | + N_Subprogram_Body | + N_Task_Body); HSS := Handled_Statement_Sequence (N); @@ -2570,10 +2571,8 @@ package body Sem_Util is -- Don't collect identifiers of packages, called functions, etc - elsif Ekind_In (Entity (N), E_Package, - E_Function, - E_Procedure, - E_Entry) + elsif Ekind (Entity (N)) in + E_Package | E_Function | E_Procedure | E_Entry then return Skip; @@ -2593,9 +2592,8 @@ package body Sem_Util is -- to identify a corner case??? elsif Nkind (Parent (N)) = N_Component_Association - and then Nkind_In (Parent (Parent (N)), - N_Aggregate, - N_Extension_Aggregate) + and then Nkind (Parent (Parent (N))) in + N_Aggregate | N_Extension_Aggregate then declare Choice : constant Node_Id := First (Choices (Parent (N))); @@ -2629,15 +2627,15 @@ package body Sem_Util is return Abandon; end if; - if Ekind_In (Id, E_Function, E_Generic_Function) + if Ekind (Id) in E_Function | E_Generic_Function and then Has_Out_Or_In_Out_Parameter (Id) then Formal := First_Formal (Id); Actual := First_Actual (Call); while Present (Actual) and then Present (Formal) loop if Actual = N then - if Ekind_In (Formal, E_Out_Parameter, - E_In_Out_Parameter) + if Ekind (Formal) in E_Out_Parameter + | E_In_Out_Parameter then Is_Writable_Actual := True; end if; @@ -2788,15 +2786,15 @@ package body Sem_Util is if Ada_Version < Ada_2012 or else not Check_Actuals (N) - or else (not (Nkind (N) in N_Op) - and then not (Nkind (N) in N_Membership_Test) - and then not Nkind_In (N, N_Range, - N_Aggregate, - N_Extension_Aggregate, - N_Full_Type_Declaration, - N_Function_Call, - N_Procedure_Call_Statement, - N_Entry_Call_Statement)) + or else Nkind (N) not in N_Op + | N_Membership_Test + | N_Range + | N_Aggregate + | N_Extension_Aggregate + | N_Full_Type_Declaration + | N_Function_Call + | N_Procedure_Call_Statement + | N_Entry_Call_Statement or else (Nkind (N) = N_Full_Type_Declaration and then not Is_Record_Type (Defining_Identifier (N))) @@ -2836,7 +2834,7 @@ package body Sem_Util is Collect_Identifiers (Right_Opnd (N)); end if; - if Nkind_In (N, N_In, N_Not_In) + if Nkind (N) in N_In | N_Not_In and then Present (Alternatives (N)) then Expr := First (Alternatives (N)); @@ -2914,8 +2912,7 @@ package body Sem_Util is Formal := First_Formal (Id); Actual := First_Actual (N); while Present (Actual) and then Present (Formal) loop - if Ekind_In (Formal, E_Out_Parameter, - E_In_Out_Parameter) + if Ekind (Formal) in E_Out_Parameter | E_In_Out_Parameter then Collect_Identifiers (Actual); end if; @@ -2982,8 +2979,8 @@ package body Sem_Util is -- Count several components - elsif Nkind_In (Choice, N_Range, - N_Subtype_Indication) + elsif Nkind (Choice) in + N_Range | N_Subtype_Indication or else (Is_Entity_Name (Choice) and then Is_Type (Entity (Choice))) then @@ -3085,8 +3082,8 @@ package body Sem_Util is while Present (Assoc) loop Choice := First (Choices (Assoc)); while Present (Choice) loop - if Nkind_In (Choice, N_Range, - N_Subtype_Indication) + if Nkind (Choice) in + N_Range | N_Subtype_Indication or else (Is_Entity_Name (Choice) and then Is_Type (Entity (Choice))) then @@ -3446,8 +3443,8 @@ package body Sem_Util is elsif Nkind (P) = N_Parameter_Specification and then Scope (Current_Scope) = Scope (Nam) - and then Nkind_In (Parent (P), N_Entry_Declaration, - N_Subprogram_Declaration) + and then Nkind (Parent (P)) in + N_Entry_Declaration | N_Subprogram_Declaration then Error_Msg_N ("internal call cannot appear in default for formal of " @@ -3516,7 +3513,8 @@ package body Sem_Util is -- Loop through sequence of basic declarative items Outer : while Present (Decl) loop - if not Nkind_In (Decl, N_Subprogram_Body, N_Package_Body, N_Task_Body) + if Nkind (Decl) not in + N_Subprogram_Body | N_Package_Body | N_Task_Body and then Nkind (Decl) not in N_Body_Stub then Next (Decl); @@ -3554,7 +3552,7 @@ package body Sem_Util is Scop : Entity_Id; begin - pragma Assert (Ekind_In (Id, E_Abstract_State, E_Variable)); + pragma Assert (Ekind (Id) in E_Abstract_State | E_Variable); -- Nothing to do for internally-generated abstract states and variables -- because they do not represent the hidden state of the source unit. @@ -3585,7 +3583,7 @@ package body Sem_Util is -- or a task. elsif Is_Subprogram_Or_Entry (Context) - or else Ekind_In (Context, E_Block, E_Task_Type) + or else Ekind (Context) in E_Block | E_Task_Type then return; end if; @@ -3803,7 +3801,7 @@ package body Sem_Util is -- Initial_Condition and Initializes as this is part of the -- elaboration checks for the constituent (SPARK RM 9(3)). - if Nam_In (Prag_Nam, Name_Initial_Condition, Name_Initializes) then + if Prag_Nam in Name_Initial_Condition | Name_Initializes then return; -- When the reference appears within pragma Depends or Global, @@ -3811,7 +3809,7 @@ package body Sem_Util is -- that the pragma may not encapsulated by the type definition, -- but this is still a valid context. - elsif Nam_In (Prag_Nam, Name_Depends, Name_Global) + elsif Prag_Nam in Name_Depends | Name_Global and then Is_Single_Task_Pragma (Par, Conc_Obj) then return; @@ -3820,8 +3818,8 @@ package body Sem_Util is -- The reference appears somewhere in the definition of a single -- concurrent type (SPARK RM 9(3)). - elsif Nkind_In (Par, N_Single_Protected_Declaration, - N_Single_Task_Declaration) + elsif Nkind (Par) in + N_Single_Protected_Declaration | N_Single_Task_Declaration and then Defining_Entity (Par) = Conc_Obj then return; @@ -3829,10 +3827,10 @@ package body Sem_Util is -- The reference appears within the declaration or body of a single -- concurrent type (SPARK RM 9(3)). - elsif Nkind_In (Par, N_Protected_Body, - N_Protected_Type_Declaration, - N_Task_Body, - N_Task_Type_Declaration) + elsif Nkind (Par) in N_Protected_Body + | N_Protected_Type_Declaration + | N_Task_Body + | N_Task_Type_Declaration and then Is_Single_Declaration_Or_Body (Par, Conc_Obj) then return; @@ -3851,10 +3849,10 @@ package body Sem_Util is -- real check was already performed in the original context of the -- reference. - elsif Nkind_In (Par, N_Package_Body, - N_Package_Declaration, - N_Subprogram_Body, - N_Subprogram_Declaration) + elsif Nkind (Par) in N_Package_Body + | N_Package_Declaration + | N_Subprogram_Body + | N_Subprogram_Declaration and then Is_Internal_Declaration_Or_Body (Par) then return; @@ -4064,10 +4062,10 @@ package body Sem_Util is -- Empty list (no global items) or single global item -- declaration (only input items). - if Nkind_In (List, N_Null, - N_Expanded_Name, - N_Identifier, - N_Selected_Component) + if Nkind (List) in N_Null + | N_Expanded_Name + | N_Identifier + | N_Selected_Component then return False; @@ -4118,7 +4116,7 @@ package body Sem_Util is Param := First_Formal (Subp); while Present (Param) loop - if Ekind_In (Param, E_Out_Parameter, E_In_Out_Parameter) then + if Ekind (Param) in E_Out_Parameter | E_In_Out_Parameter then return False; end if; @@ -4183,7 +4181,7 @@ package body Sem_Util is procedure Check_Conjuncts (Expr : Node_Id) is begin - if Nkind_In (Expr, N_Op_And, N_And_Then) then + if Nkind (Expr) in N_Op_And | N_And_Then then Check_Conjuncts (Left_Opnd (Expr)); Check_Conjuncts (Right_Opnd (Expr)); else @@ -4265,11 +4263,11 @@ package body Sem_Util is Ent : Entity_Id; begin - if Nkind_In (N, N_Explicit_Dereference, N_Function_Call) then + if Nkind (N) in N_Explicit_Dereference | N_Function_Call then Post_State_Seen := True; return Abandon; - elsif Nkind_In (N, N_Expanded_Name, N_Identifier) then + elsif Nkind (N) in N_Expanded_Name | N_Identifier then Ent := Entity (N); -- Treat an undecorated reference as OK @@ -4279,10 +4277,10 @@ package body Sem_Util is -- A reference to an assignable entity is considered a -- change in the post-state of a subprogram. - or else Ekind_In (Ent, E_Generic_In_Out_Parameter, - E_In_Out_Parameter, - E_Out_Parameter, - E_Variable) + or else Ekind (Ent) in E_Generic_In_Out_Parameter + | E_In_Out_Parameter + | E_Out_Parameter + | E_Variable -- The reference may be modified through a dereference @@ -4340,8 +4338,7 @@ package body Sem_Util is -- Examine the expression of a postcondition - else pragma Assert (Nam_In (Nam, Name_Postcondition, - Name_Refined_Post)); + else pragma Assert (Nam in Name_Postcondition | Name_Refined_Post); Check_Expression (Expr); end if; end Check_Result_And_Post_State_In_Pragma; @@ -4415,8 +4412,8 @@ package body Sem_Util is Prag := Pre_Post_Conditions (Items); while Present (Prag) loop - if Nam_In (Pragma_Name_Unmapped (Prag), - Name_Postcondition, Name_Refined_Post) + if Pragma_Name_Unmapped (Prag) + in Name_Postcondition | Name_Refined_Post and then not Error_Posted (Prag) then Post_Prag := Prag; @@ -4443,7 +4440,7 @@ package body Sem_Util is -- Do not emit any errors if the subprogram is not a function - if not Ekind_In (Spec_Id, E_Function, E_Generic_Function) then + if Ekind (Spec_Id) not in E_Function | E_Generic_Function then null; -- Regardless of whether the function has postconditions or contract @@ -4576,8 +4573,8 @@ package body Sem_Util is if Present (Decls) then Decl := First (Decls); while Present (Decl) loop - if Nkind_In (Decl, N_Generic_Package_Declaration, - N_Package_Declaration) + if Nkind (Decl) in N_Generic_Package_Declaration + | N_Package_Declaration then Check_Package (Decl); end if; @@ -4620,10 +4617,10 @@ package body Sem_Util is -- An entry, protected, subprogram, or task body may declare a nested -- package. - elsif Nkind_In (Context, N_Entry_Body, - N_Protected_Body, - N_Subprogram_Body, - N_Task_Body) + elsif Nkind (Context) in N_Entry_Body + | N_Protected_Body + | N_Subprogram_Body + | N_Task_Body then -- Do not verify proper state refinement when the body is subject to -- pragma SPARK_Mode Off because this disables the requirement for @@ -4648,8 +4645,8 @@ package body Sem_Util is -- A library level [generic] package may declare a nested package - elsif Nkind_In (Context, N_Generic_Package_Declaration, - N_Package_Declaration) + elsif Nkind (Context) in + N_Generic_Package_Declaration | N_Package_Declaration and then Is_Main_Unit then Check_Package (Context); @@ -4702,7 +4699,7 @@ package body Sem_Util is -- For indexed and selected components, recursively check the prefix - if Nkind_In (Obj, N_Indexed_Component, N_Selected_Component) then + if Nkind (Obj) in N_Indexed_Component | N_Selected_Component then return Enclosing_Protected_Type (Prefix (Obj)); -- The object does not denote a protected component @@ -4806,9 +4803,8 @@ package body Sem_Util is Constit_Id := Entity_Of (Constit); if Present (Constit_Id) - and then Ekind_In (Constit_Id, E_Abstract_State, - E_Constant, - E_Variable) + and then Ekind (Constit_Id) in + E_Abstract_State | E_Constant | E_Variable then Remove (States, Constit_Id); end if; @@ -5080,7 +5076,7 @@ package body Sem_Util is elsif Ekind (Item_Id) = E_Abstract_State then Append_New_Elmt (Item_Id, States); - elsif Ekind_In (Item_Id, E_Constant, E_Variable) + elsif Ekind (Item_Id) in E_Constant | E_Variable and then Is_Visible_Object (Item_Id) then Append_New_Elmt (Item_Id, States); @@ -6670,7 +6666,7 @@ package body Sem_Util is function Denotes_Same_Prefix (A1, A2 : Node_Id) return Boolean is begin if Is_Entity_Name (A1) then - if Nkind_In (A2, N_Selected_Component, N_Indexed_Component) + if Nkind (A2) in N_Selected_Component | N_Indexed_Component and then not Is_Access_Type (Etype (A1)) then return Denotes_Same_Object (A1, Prefix (A2)) @@ -6682,9 +6678,9 @@ package body Sem_Util is elsif Is_Entity_Name (A2) then return Denotes_Same_Prefix (A1 => A2, A2 => A1); - elsif Nkind_In (A1, N_Selected_Component, N_Indexed_Component, N_Slice) + elsif Nkind (A1) in N_Selected_Component | N_Indexed_Component | N_Slice and then - Nkind_In (A2, N_Selected_Component, N_Indexed_Component, N_Slice) + Nkind (A2) in N_Selected_Component | N_Indexed_Component | N_Slice then declare Root1, Root2 : Node_Id; @@ -6693,8 +6689,8 @@ package body Sem_Util is begin Root1 := Prefix (A1); while not Is_Entity_Name (Root1) loop - if not Nkind_In - (Root1, N_Selected_Component, N_Indexed_Component) + if Nkind (Root1) not in + N_Selected_Component | N_Indexed_Component then return False; else @@ -6706,8 +6702,8 @@ package body Sem_Util is Root2 := Prefix (A2); while not Is_Entity_Name (Root2) loop - if not Nkind_In (Root2, N_Selected_Component, - N_Indexed_Component) + if Nkind (Root2) not in + N_Selected_Component | N_Indexed_Component then return False; else @@ -6817,19 +6813,19 @@ package body Sem_Util is -- Start of processing for Designate_Same_Unit begin - if Nkind_In (K1, N_Identifier, N_Defining_Identifier) + if K1 in N_Identifier | N_Defining_Identifier and then - Nkind_In (K2, N_Identifier, N_Defining_Identifier) + K2 in N_Identifier | N_Defining_Identifier then return Chars (Name1) = Chars (Name2); - elsif Nkind_In (K1, N_Expanded_Name, - N_Selected_Component, - N_Defining_Program_Unit_Name) - and then - Nkind_In (K2, N_Expanded_Name, - N_Selected_Component, - N_Defining_Program_Unit_Name) + elsif K1 in N_Expanded_Name + | N_Selected_Component + | N_Defining_Program_Unit_Name + and then + K2 in N_Expanded_Name + | N_Selected_Component + | N_Defining_Program_Unit_Name then return (Chars (Select_Node (Name1)) = Chars (Select_Node (Name2))) @@ -6925,7 +6921,7 @@ package body Sem_Util is end if; if (Is_Formal (E) - or else Ekind_In (E, E_Variable, E_Constant)) + or else Ekind (E) in E_Variable | E_Constant) and then Present (Get_Accessibility (E)) then return New_Occurrence_Of (Get_Accessibility (E), Loc); @@ -6935,7 +6931,7 @@ package body Sem_Util is -- Handle a constant-folded conditional expression by avoiding use of -- the original node. - if Nkind_In (Expr, N_Case_Expression, N_If_Expression) then + if Nkind (Expr) in N_Case_Expression | N_If_Expression then Expr := N; end if; @@ -7254,13 +7250,13 @@ package body Sem_Util is begin Par := Parent (N); while Present (Par) loop - if Nkind_In (Par, N_Package_Body, N_Subprogram_Body) then + if Nkind (Par) in N_Package_Body | N_Subprogram_Body then Spec_Id := Corresponding_Spec (Par); if Present (Spec_Id) - and then Nkind_In (Unit_Declaration_Node (Spec_Id), - N_Generic_Package_Declaration, - N_Generic_Subprogram_Declaration) + and then Nkind (Unit_Declaration_Node (Spec_Id)) in + N_Generic_Package_Declaration | + N_Generic_Subprogram_Declaration then return Par; end if; @@ -7284,19 +7280,19 @@ package body Sem_Util is begin Par := Parent (N); while Present (Par) loop - if Nkind_In (Par, N_Generic_Package_Declaration, - N_Generic_Subprogram_Declaration) + if Nkind (Par) in N_Generic_Package_Declaration + | N_Generic_Subprogram_Declaration then return Par; - elsif Nkind_In (Par, N_Package_Body, N_Subprogram_Body) then + elsif Nkind (Par) in N_Package_Body | N_Subprogram_Body then Spec_Id := Corresponding_Spec (Par); if Present (Spec_Id) then Spec_Decl := Unit_Declaration_Node (Spec_Id); - if Nkind_In (Spec_Decl, N_Generic_Package_Declaration, - N_Generic_Subprogram_Declaration) + if Nkind (Spec_Decl) in N_Generic_Package_Declaration + | N_Generic_Subprogram_Declaration then return Spec_Decl; end if; @@ -7366,9 +7362,8 @@ package body Sem_Util is elsif Dynamic_Scope = Empty then return Empty; - elsif Ekind_In (Dynamic_Scope, E_Generic_Package, - E_Package, - E_Package_Body) + elsif Ekind (Dynamic_Scope) in + E_Generic_Package | E_Package | E_Package_Body then return Dynamic_Scope; @@ -7417,10 +7412,10 @@ package body Sem_Util is elsif Ekind (Dyn_Scop) = E_Subprogram_Body then return Corresponding_Spec (Parent (Parent (Dyn_Scop))); - elsif Ekind_In (Dyn_Scop, E_Block, E_Loop, E_Return_Statement) then + elsif Ekind (Dyn_Scop) in E_Block | E_Loop | E_Return_Statement then return Enclosing_Subprogram (Dyn_Scop); - elsif Ekind_In (Dyn_Scop, E_Entry, E_Entry_Family) then + elsif Ekind (Dyn_Scop) in E_Entry | E_Entry_Family then -- For a task entry or entry family, return the enclosing subprogram -- of the task itself. @@ -7442,10 +7437,10 @@ package body Sem_Util is -- The scope may appear as a private type or as a private extension -- whose completion is a task or protected type. - elsif Ekind_In (Dyn_Scop, E_Limited_Private_Type, - E_Record_Type_With_Private) + elsif Ekind (Dyn_Scop) in + E_Limited_Private_Type | E_Record_Type_With_Private and then Present (Full_View (Dyn_Scop)) - and then Ekind_In (Full_View (Dyn_Scop), E_Task_Type, E_Protected_Type) + and then Ekind (Full_View (Dyn_Scop)) in E_Task_Type | E_Protected_Type then return Get_Task_Body_Procedure (Full_View (Dyn_Scop)); @@ -7503,11 +7498,11 @@ package body Sem_Util is -- Start of processing for End_Keyword_Location begin - if Nkind_In (N, N_Block_Statement, - N_Entry_Body, - N_Package_Body, - N_Subprogram_Body, - N_Task_Body) + if Nkind (N) in N_Block_Statement + | N_Entry_Body + | N_Package_Body + | N_Subprogram_Body + | N_Task_Body then Owner := Handled_Statement_Sequence (N); @@ -7517,13 +7512,12 @@ package body Sem_Util is elsif Nkind (N) = N_Protected_Body then Owner := N; - elsif Nkind_In (N, N_Protected_Type_Declaration, - N_Single_Protected_Declaration) + elsif Nkind (N) in N_Protected_Type_Declaration + | N_Single_Protected_Declaration then Owner := Protected_Definition (N); - elsif Nkind_In (N, N_Single_Task_Declaration, - N_Task_Type_Declaration) + elsif Nkind (N) in N_Single_Task_Declaration | N_Task_Type_Declaration then Owner := Task_Definition (N); @@ -7779,7 +7773,7 @@ package body Sem_Util is -- Avoid cascaded messages with duplicate components in -- derived types. - if Ekind_In (E, E_Component, E_Discriminant) then + if Ekind (E) in E_Component | E_Discriminant then return; end if; end if; @@ -7814,7 +7808,7 @@ package body Sem_Util is -- of inheriting components in a derived record definition. Preserve -- their Ekind and Etype. - if Ekind_In (Def_Id, E_Discriminant, E_Component) then + if Ekind (Def_Id) in E_Discriminant | E_Component then null; -- If a type is already set, leave it alone (happens when a type @@ -7837,7 +7831,7 @@ package body Sem_Util is -- Unless the Itype is for a record type with a corresponding remote -- type (what is that about, it was not commented ???) - if Ekind_In (Def_Id, E_Discriminant, E_Component) + if Ekind (Def_Id) in E_Discriminant | E_Component or else ((not Is_Record_Type (Def_Id) or else No (Corresponding_Remote_Type (Def_Id))) @@ -8189,8 +8183,7 @@ package body Sem_Util is elsif Comes_From_Source (Decl) or else - (Nkind_In (Decl, N_Subprogram_Body, - N_Subprogram_Declaration) + (Nkind (Decl) in N_Subprogram_Body | N_Subprogram_Declaration and then Is_Expression_Function (Defining_Entity (Decl))) then exit; @@ -8262,7 +8255,7 @@ package body Sem_Util is Call_Nam : Node_Id; begin - if Nkind_In (Context, N_Indexed_Component, N_Selected_Component) + if Nkind (Context) in N_Indexed_Component | N_Selected_Component and then N = Prefix (Context) then Find_Actual (Context, Formal, Call); @@ -8273,9 +8266,9 @@ package body Sem_Util is then Call := Parent (Context); - elsif Nkind_In (Context, N_Entry_Call_Statement, - N_Function_Call, - N_Procedure_Call_Statement) + elsif Nkind (Context) in N_Entry_Call_Statement + | N_Function_Call + | N_Procedure_Call_Statement then Call := Context; @@ -8289,9 +8282,9 @@ package body Sem_Util is -- we exclude overloaded calls, since we don't know enough to be sure -- of giving the right answer in this case. - if Nkind_In (Call, N_Entry_Call_Statement, - N_Function_Call, - N_Procedure_Call_Statement) + if Nkind (Call) in N_Entry_Call_Statement + | N_Function_Call + | N_Procedure_Call_Statement then Call_Nam := Name (Call); @@ -8717,8 +8710,7 @@ package body Sem_Util is -- Check for components - elsif - Nkind_In (Expr, N_Selected_Component, N_Indexed_Component) + elsif Nkind (Expr) in N_Selected_Component | N_Indexed_Component then Expr := Prefix (Expr); Off := True; @@ -9069,7 +9061,7 @@ package body Sem_Util is -- Single global item declaration (only input items) - elsif Nkind_In (List, N_Expanded_Name, N_Identifier) then + elsif Nkind (List) in N_Expanded_Name | N_Identifier then if Global_Mode = Name_Input then return List; else @@ -9123,10 +9115,10 @@ package body Sem_Util is -- Start of processing for First_Global begin - pragma Assert (Nam_In (Global_Mode, Name_In_Out, - Name_Input, - Name_Output, - Name_Proof_In)); + pragma Assert (Global_Mode in Name_In_Out + | Name_Input + | Name_Output + | Name_Proof_In); -- Retrieve the suitable pragma Global or Refined_Global. In the second -- case, it can only be located on the body entity. @@ -9175,7 +9167,7 @@ package body Sem_Util is function Fix_Msg (Id : Entity_Id; Msg : String) return String is Is_Task : constant Boolean := - Ekind_In (Id, E_Task_Body, E_Task_Type) + Ekind (Id) in E_Task_Body | E_Task_Type or else Is_Single_Task_Object (Id); Msg_Last : constant Natural := Msg'Last; Msg_Index : Natural; @@ -10218,12 +10210,12 @@ package body Sem_Util is pragma Assert (Is_Type (Typ) and then - Nam_In (Nam, Name_Element, - Name_First, - Name_Has_Element, - Name_Last, - Name_Next, - Name_Previous)); + Nam in Name_Element + | Name_First + | Name_Has_Element + | Name_Last + | Name_Next + | Name_Previous); Funcs : constant Node_Id := Find_Value_Of_Aspect (Typ, Aspect_Iterable); Assoc : Node_Id; @@ -10526,14 +10518,14 @@ package body Sem_Util is -- Strip the subprogram call loop - if Nkind_In (Subp, N_Explicit_Dereference, - N_Indexed_Component, - N_Selected_Component) + if Nkind (Subp) in N_Explicit_Dereference + | N_Indexed_Component + | N_Selected_Component then Subp := Prefix (Subp); - elsif Nkind_In (Subp, N_Type_Conversion, - N_Unchecked_Type_Conversion) + elsif Nkind (Subp) in N_Type_Conversion + | N_Unchecked_Type_Conversion then Subp := Expression (Subp); @@ -10667,14 +10659,14 @@ package body Sem_Util is UFull_Typ := Underlying_Full_View (Full_Typ); if Present (UFull_Typ) - and then Ekind_In (UFull_Typ, E_Protected_Type, E_Task_Type) + and then Ekind (UFull_Typ) in E_Protected_Type | E_Task_Type then CRec_Typ := Corresponding_Record_Type (UFull_Typ); end if; else if Present (Full_Typ) - and then Ekind_In (Full_Typ, E_Protected_Type, E_Task_Type) + and then Ekind (Full_Typ) in E_Protected_Type | E_Task_Type then CRec_Typ := Corresponding_Record_Type (Full_Typ); end if; @@ -11069,15 +11061,15 @@ package body Sem_Util is function Has_Declarations (N : Node_Id) return Boolean is begin - return Nkind_In (Nkind (N), N_Accept_Statement, - N_Block_Statement, - N_Compilation_Unit_Aux, - N_Entry_Body, - N_Package_Body, - N_Protected_Body, - N_Subprogram_Body, - N_Task_Body, - N_Package_Specification); + return Nkind (N) in N_Accept_Statement + | N_Block_Statement + | N_Compilation_Unit_Aux + | N_Entry_Body + | N_Package_Body + | N_Protected_Body + | N_Subprogram_Body + | N_Task_Body + | N_Package_Specification; end Has_Declarations; --------------------------------- @@ -11179,7 +11171,7 @@ package body Sem_Util is -- Inspect the return type of functions - if Ekind_In (Subp_Id, E_Function, E_Generic_Function) + if Ekind (Subp_Id) in E_Function | E_Generic_Function and then Is_Effectively_Volatile (Etype (Subp_Id)) then return True; @@ -11406,7 +11398,7 @@ package body Sem_Util is -- Synchronous (SPARK RM 7.1.4(9)). elsif Has_Synchronous then - return Nam_In (Property, Name_Async_Readers, Name_Async_Writers); + return Property in Name_Async_Readers | Name_Async_Writers; end if; return False; @@ -11828,12 +11820,10 @@ package body Sem_Util is elsif Nkind (N) in N_Has_Entity then return Present (Entity (N)) - and then Ekind_In (Entity (N), E_Variable, - E_Constant, - E_Enumeration_Literal, - E_In_Parameter, - E_Out_Parameter, - E_In_Out_Parameter) + and then + Ekind (Entity (N)) in + E_Variable | E_Constant | E_Enumeration_Literal | + E_In_Parameter | E_Out_Parameter | E_In_Out_Parameter and then not Is_Volatile (Entity (N)); else @@ -11872,7 +11862,7 @@ package body Sem_Util is Node := First (L); loop - if not Nkind_In (Node, N_Null_Statement, N_Call_Marker) then + if Nkind (Node) not in N_Null_Statement | N_Call_Marker then return True; end if; @@ -12420,14 +12410,10 @@ package body Sem_Util is function Has_Prefix (N : Node_Id) return Boolean is begin - return - Nkind_In (N, N_Attribute_Reference, - N_Expanded_Name, - N_Explicit_Dereference, - N_Indexed_Component, - N_Reference, - N_Selected_Component, - N_Slice); + return Nkind (N) in + N_Attribute_Reference | N_Expanded_Name | N_Explicit_Dereference | + N_Indexed_Component | N_Reference | N_Selected_Component | + N_Slice; end Has_Prefix; --------------------------- @@ -12510,11 +12496,9 @@ package body Sem_Util is function Denotes_Relaxed_Parameter (Expr : Node_Id; - Param : Entity_Id) - return Boolean - is + Param : Entity_Id) return Boolean is begin - if Nkind_In (Expr, N_Identifier, N_Expanded_Name) then + if Nkind (Expr) in N_Identifier | N_Expanded_Name then return Entity (Expr) = Param; else pragma Assert (Is_Attribute_Result (Expr)); @@ -12805,13 +12789,9 @@ package body Sem_Util is begin pragma Assert (Relaxed_RM_Semantics); - pragma Assert (Nkind_In (N, N_Null, - N_Op_Eq, - N_Op_Ge, - N_Op_Gt, - N_Op_Le, - N_Op_Lt, - N_Op_Ne)); + pragma Assert + (Nkind (N) in + N_Null | N_Op_Eq | N_Op_Ge | N_Op_Gt | N_Op_Le | N_Op_Lt | N_Op_Ne); if Nkind (N) = N_Null then Rewrite (N, New_Occurrence_Of (RTE (RE_Null_Address), Sloc (N))); @@ -13159,7 +13139,7 @@ package body Sem_Util is begin S := Current_Scope; while Present (S) and then S /= Standard_Standard loop - if Ekind_In (S, E_Function, E_Procedure) + if Ekind (S) in E_Function | E_Procedure and then Is_Generic_Instance (S) then return True; @@ -13187,7 +13167,7 @@ package body Sem_Util is begin S := Current_Scope; while Present (S) and then S /= Standard_Standard loop - if Ekind_In (S, E_Function, E_Procedure) + if Ekind (S) in E_Function | E_Procedure and then Is_Generic_Instance (S) then return True; @@ -13391,15 +13371,15 @@ package body Sem_Util is if Nod = Cont then return True; - elsif Nkind_In (Nod, N_Accept_Statement, - N_Block_Statement, - N_Compilation_Unit, - N_Entry_Body, - N_Package_Body, - N_Package_Declaration, - N_Protected_Body, - N_Subprogram_Body, - N_Task_Body) + elsif Nkind (Nod) in N_Accept_Statement + | N_Block_Statement + | N_Compilation_Unit + | N_Entry_Body + | N_Package_Body + | N_Package_Declaration + | N_Protected_Body + | N_Subprogram_Body + | N_Task_Body then return False; @@ -13564,9 +13544,9 @@ package body Sem_Util is -- declaration hold the partial view and the full view is an -- itype. - elsif Nkind_In (Decl, N_Full_Type_Declaration, - N_Private_Extension_Declaration, - N_Private_Type_Declaration) + elsif Nkind (Decl) in N_Full_Type_Declaration + | N_Private_Extension_Declaration + | N_Private_Type_Declaration then Match := Defining_Identifier (Decl); end if; @@ -13983,13 +13963,12 @@ package body Sem_Util is -- For a retrieval of a subcomponent of some composite object, -- retrieve the ultimate entity if there is one. - elsif Nkind_In (New_Prefix, N_Selected_Component, - N_Indexed_Component) + elsif Nkind (New_Prefix) in N_Selected_Component | N_Indexed_Component then Pref := Prefix (New_Prefix); while Present (Pref) - and then Nkind_In (Pref, N_Selected_Component, - N_Indexed_Component) + and then Nkind (Pref) in + N_Selected_Component | N_Indexed_Component loop Pref := Prefix (Pref); end loop; @@ -14276,9 +14255,9 @@ package body Sem_Util is Par := Parent (N); while Present (Par) - and then Nkind_In (Par, N_Case_Expression, - N_If_Expression, - N_Parameter_Association) + and then Nkind (Par) in N_Case_Expression + | N_If_Expression + | N_Parameter_Association loop Par := Parent (Par); end loop; @@ -14382,7 +14361,7 @@ package body Sem_Util is and then Has_Aliased_Components (Designated_Type (Etype (Prefix (Obj))))); - elsif Nkind_In (Obj, N_Unchecked_Type_Conversion, N_Type_Conversion) then + elsif Nkind (Obj) in N_Unchecked_Type_Conversion | N_Type_Conversion then return Is_Tagged_Type (Etype (Obj)) and then Is_Aliased_View (Expression (Obj)); @@ -14585,21 +14564,17 @@ package body Sem_Util is Context_Id : Entity_Id) return Boolean is begin - pragma Assert (Ekind_In (Ref_Id, E_Protected_Type, E_Task_Type)); + pragma Assert (Ekind (Ref_Id) in E_Protected_Type | E_Task_Type); if Is_Single_Task_Object (Context_Id) then return Scope_Within_Or_Same (Etype (Context_Id), Ref_Id); else - pragma Assert (Ekind_In (Context_Id, E_Entry, - E_Entry_Family, - E_Function, - E_Package, - E_Procedure, - E_Protected_Type, - E_Task_Type) - or else - Is_Record_Type (Context_Id)); + pragma Assert + (Ekind (Context_Id) in + E_Entry | E_Entry_Family | E_Function | E_Package | + E_Procedure | E_Protected_Type | E_Task_Type + or else Is_Record_Type (Context_Id)); return Scope_Within_Or_Same (Context_Id, Ref_Id); end if; end Is_CCT_Instance; @@ -14913,10 +14888,10 @@ package body Sem_Util is elsif Nkind (Parent (Par)) = N_Object_Renaming_Declaration then return False; - elsif Nkind_In - (Nkind (Parent (Par)), N_Function_Call, - N_Procedure_Call_Statement, - N_Entry_Call_Statement) + elsif Nkind (Parent (Par)) in + N_Function_Call | + N_Procedure_Call_Statement | + N_Entry_Call_Statement then -- Check that the element is not part of an actual for an -- in-out parameter. @@ -15076,9 +15051,9 @@ package body Sem_Util is P := Parent (N); while Present (P) loop - if Nkind_In (P, N_Full_Type_Declaration, - N_Private_Type_Declaration, - N_Subtype_Declaration) + if Nkind (P) in N_Full_Type_Declaration + | N_Private_Type_Declaration + | N_Subtype_Declaration and then Comes_From_Source (P) and then Defining_Entity (P) = Typ then @@ -15129,7 +15104,7 @@ package body Sem_Util is if Is_Entity_Name (N) then return Present (Entity (N)) and then Ekind (Entity (N)) = E_In_Parameter - and then Ekind_In (Scope (Entity (N)), E_Function, E_Procedure) + and then Ekind (Scope (Entity (N))) in E_Function | E_Procedure and then (Is_Predicate_Function (Scope (Entity (N))) or else Is_Predicate_Function_M (Scope (Entity (N))) @@ -15306,9 +15281,8 @@ package body Sem_Util is begin -- Find the dereference node if any - while Nkind_In (Deref, N_Indexed_Component, - N_Selected_Component, - N_Slice) + while Nkind (Deref) in + N_Indexed_Component | N_Selected_Component | N_Slice loop Deref := Prefix (Deref); end loop; @@ -15344,8 +15318,8 @@ package body Sem_Util is -- False (it could be a function selector in a prefix form call -- occurring in an iterator specification). - if not Ekind_In (Entity (Selector_Name (Object)), E_Component, - E_Discriminant) + if Ekind (Entity (Selector_Name (Object))) not in + E_Component | E_Discriminant then return False; end if; @@ -15511,10 +15485,10 @@ package body Sem_Util is function Is_Dereferenced (N : Node_Id) return Boolean is P : constant Node_Id := Parent (N); begin - return Nkind_In (P, N_Selected_Component, - N_Explicit_Dereference, - N_Indexed_Component, - N_Slice) + return Nkind (P) in N_Selected_Component + | N_Explicit_Dereference + | N_Indexed_Component + | N_Slice and then Prefix (P) = N; end Is_Dereferenced; @@ -15707,7 +15681,7 @@ package body Sem_Util is return Is_Object (Entity (N)) and then Is_Effectively_Volatile (Entity (N)); - elsif Nkind_In (N, N_Indexed_Component, N_Slice) then + elsif Nkind (N) in N_Indexed_Component | N_Slice then return Is_Effectively_Volatile_Object (Prefix (N)); elsif Nkind (N) = N_Selected_Component then @@ -15716,9 +15690,9 @@ package body Sem_Util is or else Is_Effectively_Volatile_Object (Selector_Name (N)); - elsif Nkind_In (N, N_Qualified_Expression, - N_Unchecked_Type_Conversion, - N_Type_Conversion) + elsif Nkind (N) in N_Qualified_Expression + | N_Unchecked_Type_Conversion + | N_Type_Conversion then return Is_Effectively_Volatile_Object (Expression (N)); @@ -15769,7 +15743,7 @@ package body Sem_Util is function Is_Expression_Function (Subp : Entity_Id) return Boolean is begin - if Ekind_In (Subp, E_Function, E_Subprogram_Body) then + if Ekind (Subp) in E_Function | E_Subprogram_Body then return Nkind (Original_Node (Unit_Declaration_Node (Subp))) = N_Expression_Function; @@ -15864,9 +15838,9 @@ package body Sem_Util is -- A qualified expression or a type conversion is an EVF expression when -- its operand is an EVF expression. - elsif Nkind_In (N, N_Qualified_Expression, - N_Unchecked_Type_Conversion, - N_Type_Conversion) + elsif Nkind (N) in N_Qualified_Expression + | N_Unchecked_Type_Conversion + | N_Type_Conversion then return Is_EVF_Expression (Expression (N)); @@ -15874,9 +15848,9 @@ package body Sem_Util is -- their prefix denotes an EVF expression. elsif Nkind (N) = N_Attribute_Reference - and then Nam_In (Attribute_Name (N), Name_Loop_Entry, - Name_Old, - Name_Update) + and then Attribute_Name (N) in Name_Loop_Entry + | Name_Old + | Name_Update then return Is_EVF_Expression (Prefix (N)); end if; @@ -16202,14 +16176,14 @@ package body Sem_Util is begin -- Package/subprogram body - if Nkind_In (Decl, N_Package_Body, N_Subprogram_Body) + if Nkind (Decl) in N_Package_Body | N_Subprogram_Body and then Present (Corresponding_Spec (Decl)) then Spec_Decl := Unit_Declaration_Node (Corresponding_Spec (Decl)); -- Package/subprogram body stub - elsif Nkind_In (Decl, N_Package_Body_Stub, N_Subprogram_Body_Stub) + elsif Nkind (Decl) in N_Package_Body_Stub | N_Subprogram_Body_Stub and then Present (Corresponding_Spec_Of_Stub (Decl)) then Spec_Decl := @@ -16227,8 +16201,8 @@ package body Sem_Util is -- calls. return - Nkind_In (Spec_Decl, N_Generic_Package_Declaration, - N_Generic_Subprogram_Declaration); + Nkind (Spec_Decl) in N_Generic_Package_Declaration + | N_Generic_Subprogram_Declaration; end Is_Generic_Declaration_Or_Body; --------------------------- @@ -16387,8 +16361,7 @@ package body Sem_Util is -- a predefined unit, i.e the one that declares iterator interfaces. return - Nam_In (Chars (Iter_Typ), Name_Forward_Iterator, - Name_Reversible_Iterator) + Chars (Iter_Typ) in Name_Forward_Iterator | Name_Reversible_Iterator and then In_Predefined_Unit (Root_Type (Iter_Typ)); end Denotes_Iterator; @@ -16464,7 +16437,7 @@ package body Sem_Util is -- Case of prefix of indexed or selected component or slice - elsif Nkind_In (P, N_Indexed_Component, N_Selected_Component, N_Slice) + elsif Nkind (P) in N_Indexed_Component | N_Selected_Component | N_Slice and then N = Prefix (P) then -- Here we have the case where the parent P is N.Q or N(Q .. R). @@ -16542,7 +16515,7 @@ package body Sem_Util is Ent : constant Entity_Id := Entity (Expr); Sub : constant Entity_Id := Enclosing_Subprogram (Ent); begin - if not Ekind_In (Ent, E_Variable, E_In_Out_Parameter) then + if Ekind (Ent) not in E_Variable | E_In_Out_Parameter then return False; else return Present (Sub) and then Sub = Current_Subprogram; @@ -16572,8 +16545,7 @@ package body Sem_Util is -- Attributes 'Input, 'Old and 'Result produce objects when N_Attribute_Reference => - return - Nam_In (Attribute_Name (N), Name_Input, Name_Old, Name_Result); + return Attribute_Name (N) in Name_Input | Name_Old | Name_Result; when N_Selected_Component => return @@ -17022,7 +16994,7 @@ package body Sem_Util is if Ekind (Id) = E_Discriminant then null; - elsif Ekind_In (Id, E_Constant, E_In_Parameter) + elsif Ekind (Id) in E_Constant | E_In_Parameter and then Present (Discriminal_Link (Id)) then null; @@ -17161,10 +17133,10 @@ package body Sem_Util is when N_Attribute_Reference => return - Nam_In (Attribute_Name (N), Name_Loop_Entry, - Name_Old, - Name_Priority, - Name_Result) + Attribute_Name (N) in Name_Loop_Entry + | Name_Old + | Name_Priority + | Name_Result or else Is_Function_Attribute_Name (Attribute_Name (N)); when N_Selected_Component => @@ -17180,8 +17152,8 @@ package body Sem_Util is -- names. when N_Explicit_Dereference => - return not Nkind_In (Original_Node (N), N_Case_Expression, - N_If_Expression); + return Nkind (Original_Node (N)) not in + N_Case_Expression | N_If_Expression; -- A view conversion of a tagged object is an object reference @@ -17280,7 +17252,7 @@ package body Sem_Util is -- expansion of a packed array aggregate). elsif Nkind (AV) = N_Unchecked_Type_Conversion then - if Nkind_In (Original_Node (AV), N_Function_Call, N_Aggregate) then + if Nkind (Original_Node (AV)) in N_Function_Call | N_Aggregate then return False; elsif Comes_From_Source (AV) @@ -17376,10 +17348,8 @@ package body Sem_Util is and then Is_Protected_Type (Etype (Pref)) and then Is_Entity_Name (Subp) and then Present (Entity (Subp)) - and then Ekind_In (Entity (Subp), E_Entry, - E_Entry_Family, - E_Function, - E_Procedure); + and then Ekind (Entity (Subp)) in + E_Entry | E_Entry_Family | E_Function | E_Procedure; else return False; end if; @@ -17424,7 +17394,7 @@ package body Sem_Util is Func_Id := Id; while Present (Func_Id) and then Func_Id /= Standard_Standard loop - if Ekind_In (Func_Id, E_Function, E_Generic_Function) then + if Ekind (Func_Id) in E_Function | E_Generic_Function then return Is_Volatile_Function (Func_Id); end if; @@ -17504,11 +17474,12 @@ package body Sem_Util is -- The volatile object appears as the prefix of a name occurring in a -- non-interfering context. - elsif Nkind_In (Context, N_Attribute_Reference, - N_Explicit_Dereference, - N_Indexed_Component, - N_Selected_Component, - N_Slice) + elsif Nkind (Context) in + N_Attribute_Reference | + N_Explicit_Dereference | + N_Indexed_Component | + N_Selected_Component | + N_Slice and then Prefix (Context) = Obj_Ref and then Is_OK_Volatile_Context (Context => Parent (Context), @@ -17522,26 +17493,26 @@ package body Sem_Util is elsif Nkind (Context) = N_Attribute_Reference and then Prefix (Context) = Obj_Ref - and then Nam_In (Attribute_Name (Context), Name_Address, - Name_Alignment, - Name_Component_Size, - Name_First, - Name_First_Bit, - Name_Last, - Name_Last_Bit, - Name_Length, - Name_Position, - Name_Size, - Name_Storage_Size) + and then Attribute_Name (Context) in Name_Address + | Name_Alignment + | Name_Component_Size + | Name_First + | Name_First_Bit + | Name_Last + | Name_Last_Bit + | Name_Length + | Name_Position + | Name_Size + | Name_Storage_Size then return True; -- The volatile object appears as the expression of a type conversion -- occurring in a non-interfering context. - elsif Nkind_In (Context, N_Qualified_Expression, - N_Type_Conversion, - N_Unchecked_Type_Conversion) + elsif Nkind (Context) in N_Qualified_Expression + | N_Type_Conversion + | N_Unchecked_Type_Conversion and then Expression (Context) = Obj_Ref and then Is_OK_Volatile_Context (Context => Parent (Context), @@ -17857,10 +17828,10 @@ package body Sem_Util is elsif Nkind (Par) = N_Case_Expression then return Expr /= Expression (Par); - elsif Nkind_In (Par, N_And_Then, N_Or_Else) then + elsif Nkind (Par) in N_And_Then | N_Or_Else then return Expr = Right_Opnd (Par); - elsif Nkind_In (Par, N_In, N_Not_In) then + elsif Nkind (Par) in N_In | N_Not_In then -- If the membership includes several alternatives, only the first -- is definitely evaluated. @@ -18056,7 +18027,7 @@ package body Sem_Util is TSS_Name_Type (Name_Buffer (Name_Len - TSS_Name'Length + 1 .. Name_Len)); - if Nam_In (Chars (E), Name_uAssign, Name_uSize) + if Chars (E) in Name_uAssign | Name_uSize or else (Chars (E) = Name_Op_Eq and then Etype (First_Formal (E)) = Etype (Last_Formal (E))) @@ -18087,12 +18058,12 @@ package body Sem_Util is -- these primitives. return (Ada_Version >= Ada_2005 or else not Tagged_Type_Expansion) - and then Nam_In (Chars (E), Name_uDisp_Asynchronous_Select, - Name_uDisp_Conditional_Select, - Name_uDisp_Get_Prim_Op_Kind, - Name_uDisp_Get_Task_Id, - Name_uDisp_Requeue, - Name_uDisp_Timed_Select); + and then Chars (E) in Name_uDisp_Asynchronous_Select + | Name_uDisp_Conditional_Select + | Name_uDisp_Get_Prim_Op_Kind + | Name_uDisp_Get_Task_Id + | Name_uDisp_Requeue + | Name_uDisp_Timed_Select; end Is_Predefined_Interface_Primitive; --------------------------------------- @@ -18120,7 +18091,7 @@ package body Sem_Util is TSS_Name_Type (Name_Buffer (Name_Len - TSS_Name'Length + 1 .. Name_Len)); - if Nam_In (Chars (E), Name_uSize, Name_uAssign) + if Chars (E) in Name_uSize | Name_uAssign or else (Chars (E) = Name_Op_Eq and then Etype (First_Formal (E)) = Etype (Last_Formal (E))) @@ -18250,7 +18221,7 @@ package body Sem_Util is begin -- Aggregates - if Nkind_In (N, N_Aggregate, N_Extension_Aggregate) then + if Nkind (N) in N_Aggregate | N_Extension_Aggregate then return Is_Preelaborable_Aggregate (N); -- Attributes are allowed in general, even if their prefix is a formal @@ -18275,7 +18246,7 @@ package body Sem_Util is and then Present (Entity (N)) and then (Ekind (Entity (N)) = E_Discriminant - or else (Ekind_In (Entity (N), E_Constant, E_In_Parameter) + or else (Ekind (Entity (N)) in E_Constant | E_In_Parameter and then Present (Discriminal_Link (Entity (N))))) then return True; @@ -18609,12 +18580,12 @@ package body Sem_Util is begin if not Is_List_Member (N) then declare - P : constant Node_Id := Parent (N); + P : constant Node_Id := Parent (N); begin - return Nkind_In (P, N_Expanded_Name, - N_Generic_Association, - N_Parameter_Association, - N_Selected_Component) + return Nkind (P) in N_Expanded_Name + | N_Generic_Association + | N_Parameter_Association + | N_Selected_Component and then Selector_Name (P) = N; end; @@ -18649,7 +18620,7 @@ package body Sem_Util is function Is_Single_Concurrent_Type (Id : Entity_Id) return Boolean is begin return - Ekind_In (Id, E_Protected_Type, E_Task_Type) + Ekind (Id) in E_Protected_Type | E_Task_Type and then Is_Single_Concurrent_Type_Declaration (Declaration_Node (Id)); end Is_Single_Concurrent_Type; @@ -18662,8 +18633,8 @@ package body Sem_Util is (N : Node_Id) return Boolean is begin - return Nkind_In (Original_Node (N), N_Single_Protected_Declaration, - N_Single_Task_Declaration); + return Nkind (Original_Node (N)) in + N_Single_Protected_Declaration | N_Single_Task_Declaration; end Is_Single_Concurrent_Type_Declaration; --------------------------------------------- @@ -18735,9 +18706,8 @@ package body Sem_Util is and then Is_Aliased (Entity (P_Ult)) and then Is_Formal (Entity (P_Ult)) and then Scope (Entity (P_Ult)) = Scop - and then Ekind_In (Scop, E_Function, - E_Operator, - E_Subprogram_Type) + and then Ekind (Scop) in + E_Function | E_Operator | E_Subprogram_Type and then Needs_Result_Accessibility_Level (Scop); end; end Is_Special_Aliased_Formal_Access; @@ -18852,7 +18822,7 @@ package body Sem_Util is begin R := Get_Referenced_Object (N); - while Nkind_In (R, N_Indexed_Component, N_Selected_Component, N_Slice) + while Nkind (R) in N_Indexed_Component | N_Selected_Component | N_Slice loop R := Get_Referenced_Object (Prefix (R)); @@ -19551,7 +19521,7 @@ package body Sem_Util is function Is_Volatile_Function (Func_Id : Entity_Id) return Boolean is begin - pragma Assert (Ekind_In (Func_Id, E_Function, E_Generic_Function)); + pragma Assert (Ekind (Func_Id) in E_Function | E_Generic_Function); -- A function declared within a protected type is volatile @@ -19682,8 +19652,8 @@ package body Sem_Util is begin pragma Assert (Is_Itype (Id)); return Present (Parent (Id)) - and then Nkind_In (Parent (Id), N_Full_Type_Declaration, - N_Subtype_Declaration) + and then Nkind (Parent (Id)) in + N_Full_Type_Declaration | N_Subtype_Declaration and then Defining_Entity (Parent (Id)) = Id; end Itype_Has_Declaration; @@ -20094,9 +20064,8 @@ package body Sem_Util is -- Obj := new ...'(new Coextension ...); if Nkind (Context_Nod) = N_Assignment_Statement then - Is_Dynamic := - Nkind_In (Expression (Context_Nod), N_Allocator, - N_Qualified_Expression); + Is_Dynamic := Nkind (Expression (Context_Nod)) in + N_Allocator | N_Qualified_Expression; -- An allocator that appears within the expression of a simple return -- statement is treated as a potentially dynamic coextension when the @@ -20106,10 +20075,8 @@ package body Sem_Util is -- return new ...'(new Coextension ...); elsif Nkind (Context_Nod) = N_Simple_Return_Statement then - Is_Dynamic := - Nkind_In (Expression (Context_Nod), N_Aggregate, - N_Allocator, - N_Qualified_Expression); + Is_Dynamic := Nkind (Expression (Context_Nod)) in + N_Aggregate | N_Allocator | N_Qualified_Expression; -- An alloctor that appears within the initialization expression of an -- object declaration is considered a potentially dynamic coextension @@ -20125,10 +20092,8 @@ package body Sem_Util is -- return Obj : ... := (new Coextension ...); elsif Nkind (Context_Nod) = N_Object_Declaration then - Is_Dynamic := - Nkind_In (Root_Nod, N_Allocator, N_Qualified_Expression) - or else - Nkind (Parent (Context_Nod)) = N_Extended_Return_Statement; + Is_Dynamic := Nkind (Root_Nod) in N_Allocator | N_Qualified_Expression + or else Nkind (Parent (Context_Nod)) = N_Extended_Return_Statement; -- This routine should not be called with constructs that cannot contain -- coextensions. @@ -20294,12 +20259,12 @@ package body Sem_Util is -- suppressed. As a result the elaboration checks of the call must -- be disabled in order to preserve this dependency. - if Nkind_In (N, N_Entry_Call_Statement, - N_Function_Call, - N_Function_Instantiation, - N_Package_Instantiation, - N_Procedure_Call_Statement, - N_Procedure_Instantiation) + if Nkind (N) in N_Entry_Call_Statement + | N_Function_Call + | N_Function_Instantiation + | N_Package_Instantiation + | N_Procedure_Call_Statement + | N_Procedure_Instantiation then Nam := Extract_Name (N); @@ -20378,16 +20343,16 @@ package body Sem_Util is -- Obtain the complimentary unit of the main unit - if Nkind_In (Main_Unit, N_Generic_Package_Declaration, - N_Generic_Subprogram_Declaration, - N_Package_Declaration, - N_Subprogram_Declaration) + if Nkind (Main_Unit) in N_Generic_Package_Declaration + | N_Generic_Subprogram_Declaration + | N_Package_Declaration + | N_Subprogram_Declaration then Aux_Id := Corresponding_Body (Main_Unit); - elsif Nkind_In (Main_Unit, N_Package_Body, - N_Subprogram_Body, - N_Subprogram_Renaming_Declaration) + elsif Nkind (Main_Unit) in N_Package_Body + | N_Subprogram_Body + | N_Subprogram_Renaming_Declaration then Aux_Id := Corresponding_Spec (Main_Unit); end if; @@ -20718,12 +20683,10 @@ package body Sem_Util is function Process (N : Node_Id) return Traverse_Result is begin - if Nkind_In (N, N_Procedure_Call_Statement, - N_Function_Call, - N_Raise_Statement, - N_Raise_Constraint_Error, - N_Raise_Program_Error, - N_Raise_Storage_Error) + if Nkind (N) in N_Procedure_Call_Statement + | N_Function_Call + | N_Raise_Statement + | N_Raise_xxx_Error then Result := True; return Abandon; @@ -21152,9 +21115,9 @@ package body Sem_Util is -- subprogram call, and the caller requests this behavior. elsif not Calls_OK - and then Nkind_In (Par, N_Entry_Call_Statement, - N_Function_Call, - N_Procedure_Call_Statement) + and then Nkind (Par) in N_Entry_Call_Statement + | N_Function_Call + | N_Procedure_Call_Statement then return False; @@ -21193,7 +21156,7 @@ package body Sem_Util is -- Only references warrant a marker - elsif not Nkind_In (N, N_Expanded_Name, N_Identifier) then + elsif Nkind (N) not in N_Expanded_Name | N_Identifier then return False; -- Only source references warrant a marker @@ -21349,17 +21312,17 @@ package body Sem_Util is Decl := Specification (Decl); end if; - if Nkind_In (Decl, N_Function_Instantiation, - N_Function_Specification, - N_Generic_Function_Renaming_Declaration, - N_Generic_Package_Renaming_Declaration, - N_Generic_Procedure_Renaming_Declaration, - N_Package_Body, - N_Package_Instantiation, - N_Package_Renaming_Declaration, - N_Package_Specification, - N_Procedure_Instantiation, - N_Procedure_Specification) + if Nkind (Decl) in N_Function_Instantiation + | N_Function_Specification + | N_Generic_Function_Renaming_Declaration + | N_Generic_Package_Renaming_Declaration + | N_Generic_Procedure_Renaming_Declaration + | N_Package_Body + | N_Package_Instantiation + | N_Package_Renaming_Declaration + | N_Package_Specification + | N_Procedure_Instantiation + | N_Procedure_Specification then Set_Chars (New_E, Chars (Defining_Unit_Name (Decl))); Set_Defining_Unit_Name (Decl, New_E); @@ -21816,15 +21779,15 @@ package body Sem_Util is function Has_More_Ids (N : Node_Id) return Boolean is begin - if Nkind_In (N, N_Component_Declaration, - N_Discriminant_Specification, - N_Exception_Declaration, - N_Formal_Object_Declaration, - N_Number_Declaration, - N_Object_Declaration, - N_Parameter_Specification, - N_Use_Package_Clause, - N_Use_Type_Clause) + if Nkind (N) in N_Component_Declaration + | N_Discriminant_Specification + | N_Exception_Declaration + | N_Formal_Object_Declaration + | N_Number_Declaration + | N_Object_Declaration + | N_Parameter_Specification + | N_Use_Package_Clause + | N_Use_Type_Clause then return More_Ids (N); else @@ -22065,9 +22028,9 @@ package body Sem_Util is -- Update the First/Next_Named_Association chain for a replicated -- call. - if Nkind_In (N, N_Entry_Call_Statement, - N_Function_Call, - N_Procedure_Call_Statement) + if Nkind (N) in N_Entry_Call_Statement + | N_Function_Call + | N_Procedure_Call_Statement then Update_Named_Associations (Old_Call => N, @@ -22489,12 +22452,9 @@ package body Sem_Util is -- an entity declaration that must be replaced when the expander is -- active if the expression has been preanalyzed or analyzed. - elsif not Ekind_In (Id, E_Block, - E_Constant, - E_Label, - E_Loop_Parameter, - E_Procedure, - E_Variable) + elsif Ekind (Id) not in + E_Block | E_Constant | E_Label | E_Loop_Parameter | + E_Procedure | E_Variable and then not Is_Type (Id) then return; @@ -22699,7 +22659,7 @@ package body Sem_Util is -- shared. Thus cloned_Subtype must be set to indicate the sharing. -- ??? What does this do? - if Ekind_In (Itype, E_Class_Wide_Subtype, E_Record_Subtype) then + if Ekind (Itype) in E_Class_Wide_Subtype | E_Record_Subtype then Set_Cloned_Subtype (New_Itype, Itype); end if; @@ -22787,9 +22747,9 @@ package body Sem_Util is EWA_Level := EWA_Level + 1; elsif EWA_Level > 0 - and then Nkind_In (N, N_Block_Statement, - N_Subprogram_Body, - N_Subprogram_Declaration) + and then Nkind (N) in N_Block_Statement + | N_Subprogram_Body + | N_Subprogram_Declaration then EWA_Inner_Scope_Level := EWA_Inner_Scope_Level + 1; end if; @@ -22815,9 +22775,9 @@ package body Sem_Util is Par_Nod => N); if EWA_Level > 0 - and then Nkind_In (N, N_Block_Statement, - N_Subprogram_Body, - N_Subprogram_Declaration) + and then Nkind (N) in N_Block_Statement + | N_Subprogram_Body + | N_Subprogram_Declaration then EWA_Inner_Scope_Level := EWA_Inner_Scope_Level - 1; @@ -23084,9 +23044,9 @@ package body Sem_Util is -- In case of a build-in-place call, the call will no longer be a -- call; it will have been rewritten. - if Nkind_In (Par, N_Entry_Call_Statement, - N_Function_Call, - N_Procedure_Call_Statement) + if Nkind (Par) in N_Entry_Call_Statement + | N_Function_Call + | N_Procedure_Call_Statement then return First_Named_Actual (Par); @@ -23399,7 +23359,7 @@ package body Sem_Util is function No_Heap_Finalization (Typ : Entity_Id) return Boolean is begin - if Ekind_In (Typ, E_Access_Type, E_General_Access_Type) + if Ekind (Typ) in E_Access_Type | E_General_Access_Type and then Is_Library_Level_Entity (Typ) then -- A global No_Heap_Finalization pragma applies to all library-level @@ -23629,9 +23589,9 @@ package body Sem_Util is then if No (Actuals) and then - Nkind_In (Parent (N), N_Procedure_Call_Statement, - N_Function_Call, - N_Parameter_Association) + Nkind (Parent (N)) in N_Procedure_Call_Statement + | N_Function_Call + | N_Parameter_Association and then Ekind (S) /= E_Function then Set_Etype (N, Etype (S)); @@ -23783,15 +23743,13 @@ package body Sem_Util is end if; end; - elsif Nkind_In (Exp, N_Type_Conversion, - N_Unchecked_Type_Conversion) + elsif Nkind (Exp) in N_Type_Conversion | N_Unchecked_Type_Conversion then Exp := Expression (Exp); goto Continue; - elsif Nkind_In (Exp, N_Slice, - N_Indexed_Component, - N_Selected_Component) + elsif Nkind (Exp) in + N_Slice | N_Indexed_Component | N_Selected_Component then -- Special check, if the prefix is an access type, then return -- since we are modifying the thing pointed to, not the prefix. @@ -23852,7 +23810,7 @@ package body Sem_Util is -- Follow renaming chain - if Ekind_In (Ent, E_Variable, E_Constant) + if Ekind (Ent) in E_Variable | E_Constant and then Present (Renamed_Object (Ent)) then Exp := Renamed_Object (Ent); @@ -23875,8 +23833,8 @@ package body Sem_Util is -- a modification of the container. elsif Comes_From_Source (Original_Node (Exp)) - and then Nkind_In (Original_Node (Exp), N_Selected_Component, - N_Indexed_Component) + and then Nkind (Original_Node (Exp)) in + N_Selected_Component | N_Indexed_Component then Exp := Prefix (Original_Node (Exp)); goto Continue; @@ -23969,13 +23927,12 @@ package body Sem_Util is function Is_Null_Excluding_Def (Def : Node_Id) return Boolean is begin - return - Nkind_In (Def, N_Access_Definition, - N_Access_Function_Definition, - N_Access_Procedure_Definition, - N_Access_To_Object_Definition, - N_Component_Definition, - N_Derived_Type_Definition) + return Nkind (Def) in N_Access_Definition + | N_Access_Function_Definition + | N_Access_Procedure_Definition + | N_Access_To_Object_Definition + | N_Component_Definition + | N_Derived_Type_Definition and then Null_Exclusion_Present (Def); end Is_Null_Excluding_Def; @@ -23997,12 +23954,12 @@ package body Sem_Util is if Is_Imported (Id) or else Is_Exported (Id) then return Unknown; - elsif Nkind_In (Decl, N_Component_Declaration, - N_Discriminant_Specification, - N_Formal_Object_Declaration, - N_Object_Declaration, - N_Object_Renaming_Declaration, - N_Parameter_Specification) + elsif Nkind (Decl) in N_Component_Declaration + | N_Discriminant_Specification + | N_Formal_Object_Declaration + | N_Object_Declaration + | N_Object_Renaming_Declaration + | N_Parameter_Specification then -- A component declaration yields a non-null value when either -- its component definition or access definition carries a null @@ -24123,9 +24080,9 @@ package body Sem_Util is -- Taking the 'Access of something yields a non-null value elsif Nkind (N) = N_Attribute_Reference - and then Nam_In (Attribute_Name (N), Name_Access, - Name_Unchecked_Access, - Name_Unrestricted_Access) + and then Attribute_Name (N) in Name_Access + | Name_Unchecked_Access + | Name_Unrestricted_Access then return Is_Non_Null; @@ -24169,7 +24126,8 @@ package body Sem_Util is if Nkind (N) = N_Null then return Present (Typ) and then Is_Descendant_Of_Address (Typ); - elsif Nkind_In (N, N_Op_Eq, N_Op_Ge, N_Op_Gt, N_Op_Le, N_Op_Lt, N_Op_Ne) + elsif Nkind (N) in + N_Op_Eq | N_Op_Ge | N_Op_Gt | N_Op_Le | N_Op_Lt | N_Op_Ne then declare L : constant Node_Id := Left_Opnd (N); @@ -24357,7 +24315,7 @@ package body Sem_Util is return Scope_Depth (Enclosing_Dynamic_Scope (E)); end if; - elsif Nkind_In (Orig_Obj, N_Indexed_Component, N_Selected_Component) then + elsif Nkind (Orig_Obj) in N_Indexed_Component | N_Selected_Component then Orig_Pre := Original_Node (Prefix (Orig_Obj)); if Is_Access_Type (Etype (Orig_Pre)) then @@ -24415,8 +24373,7 @@ package body Sem_Util is return Type_Access_Level (Etype (Prefix (Orig_Obj))); end if; - elsif Nkind_In (Orig_Obj, N_Type_Conversion, - N_Unchecked_Type_Conversion) + elsif Nkind (Orig_Obj) in N_Type_Conversion | N_Unchecked_Type_Conversion then return Object_Access_Level (Expression (Orig_Obj)); @@ -24559,18 +24516,16 @@ package body Sem_Util is -- we are trying to implement here. elsif Nkind (Orig_Obj) = N_Attribute_Reference - and then Nam_In (Attribute_Name (Orig_Obj), - Name_Old, - Name_Loop_Entry) + and then Attribute_Name (Orig_Obj) in Name_Old | Name_Loop_Entry then return Object_Access_Level (Current_Scope); -- Move up the attribute reference when we encounter a 'Access variation elsif Nkind (Orig_Obj) = N_Attribute_Reference - and then Nam_In (Attribute_Name (Orig_Obj), Name_Access, - Name_Unchecked_Access, - Name_Unrestricted_Access) + and then Attribute_Name (Orig_Obj) in Name_Access + | Name_Unchecked_Access + | Name_Unrestricted_Access then return Object_Access_Level (Prefix (Orig_Obj)); @@ -24691,7 +24646,7 @@ package body Sem_Util is Item_Nam : Name_Id; begin - pragma Assert (Nkind_In (N, N_Aspect_Specification, N_Pragma)); + pragma Assert (Nkind (N) in N_Aspect_Specification | N_Pragma); Item := N; @@ -24730,8 +24685,7 @@ package body Sem_Util is elsif Item_Nam = Name_Pre then Item_Nam := Name_uPre; - elsif Nam_In (Item_Nam, Name_Type_Invariant, - Name_Type_Invariant_Class) + elsif Item_Nam in Name_Type_Invariant | Name_Type_Invariant_Class then Item_Nam := Name_uType_Invariant; @@ -24839,7 +24793,7 @@ package body Sem_Util is -- The current Check_Policy pragma matches the requested policy or -- appears in the single argument form (Assertion, policy_id). - if Nam_In (Chars (Arg1), Name_Assertion, Policy) then + if Chars (Arg1) in Name_Assertion | Policy then return Chars (Arg2); end if; @@ -24886,7 +24840,7 @@ package body Sem_Util is -- assertions, unless they are disabled. Force Name_Check on -- ignored assertions. - if Nam_In (Kind, Name_Ignore, Name_Off) + if Kind in Name_Ignore | Name_Off and then (CodePeer_Mode or GNATprove_Mode) then Kind := Name_Check; @@ -25615,7 +25569,7 @@ package body Sem_Util is -- The entity denotes a primitive subprogram. Remove it from the list of -- primitives of the associated controlling type. - if Ekind_In (Id, E_Function, E_Procedure) and then Is_Primitive (Id) then + if Ekind (Id) in E_Function | E_Procedure and then Is_Primitive (Id) then Formal := First_Formal (Id); while Present (Formal) loop if Is_Controlling_Formal (Formal) then @@ -25910,7 +25864,7 @@ package body Sem_Util is while R_Scope /= Standard_Standard loop exit when R_Scope = E_Scope; - if not Ekind_In (R_Scope, E_Package, E_Block, E_Loop) then + if Ekind (R_Scope) not in E_Package | E_Block | E_Loop then return False; else R_Scope := Scope (R_Scope); @@ -26024,7 +25978,7 @@ package body Sem_Util is EN2 : constant Entity_Id := Entity (N2); begin if Present (EN1) and then Present (EN2) - and then (Ekind_In (EN1, E_Variable, E_Constant) + and then (Ekind (EN1) in E_Variable | E_Constant or else Is_Formal (EN1)) and then EN1 = EN2 then @@ -26314,8 +26268,8 @@ package body Sem_Util is Typ : constant Entity_Id := Etype (E); begin - if Ekind_In (Typ, E_Anonymous_Access_Type, - E_Anonymous_Access_Subprogram_Type) + if Ekind (Typ) in E_Anonymous_Access_Type + | E_Anonymous_Access_Subprogram_Type and then not Has_Convention_Pragma (Typ) then Basic_Set_Convention (Typ, Val); @@ -26783,8 +26737,8 @@ package body Sem_Util is if No (N) then return False; - elsif Nkind_In (N, N_Handled_Sequence_Of_Statements, - N_If_Statement) + elsif Nkind (N) in + N_Handled_Sequence_Of_Statements | N_If_Statement then return True; end if; @@ -26810,8 +26764,8 @@ package body Sem_Util is -- never needs to be made public and furthermore, making it public can -- cause back end problems. - elsif Nkind_In (Parent (Id), N_Object_Declaration, - N_Function_Specification) + elsif Nkind (Parent (Id)) in + N_Object_Declaration | N_Function_Specification and then Within_HSS_Or_If (Id) then return; @@ -26843,7 +26797,7 @@ package body Sem_Util is begin -- Deal with indexed or selected component where prefix is modified - if Nkind_In (N, N_Indexed_Component, N_Selected_Component) then + if Nkind (N) in N_Indexed_Component | N_Selected_Component then Pref := Prefix (N); -- If prefix is access type, then it is the designated object that is @@ -27122,8 +27076,8 @@ package body Sem_Util is return False; end if; - if not Ekind_In (Entity (Selector_Name (N)), E_Component, - E_Discriminant) + if Ekind (Entity (Selector_Name (N))) not in + E_Component | E_Discriminant then return False; end if; @@ -27221,7 +27175,7 @@ package body Sem_Util is -- 'Loop_Entry attribute into a conditional block. Infinite loops lack -- the conditional part. - if Nkind_In (Stmt, N_Block_Statement, N_If_Statement) + if Nkind (Stmt) in N_Block_Statement | N_If_Statement and then Nkind (Original_Node (N)) = N_Loop_Statement then Stmt := Original_Node (N); @@ -27883,10 +27837,10 @@ package body Sem_Util is begin Pref := N; - while Nkind_In (Pref, N_Explicit_Dereference, - N_Indexed_Component, - N_Selected_Component, - N_Slice) + while Nkind (Pref) in N_Explicit_Dereference + | N_Indexed_Component + | N_Selected_Component + | N_Slice loop Pref := Prefix (Pref); end loop; @@ -28357,9 +28311,9 @@ package body Sem_Util is -- Recurse to handle unlikely case of multiple levels of qualification -- and/or conversion. - if Nkind_In (Expr, N_Qualified_Expression, - N_Type_Conversion, - N_Unchecked_Type_Conversion) + if Nkind (Expr) in N_Qualified_Expression + | N_Type_Conversion + | N_Unchecked_Type_Conversion then return Unqual_Conv (Expression (Expr)); @@ -28513,9 +28467,9 @@ package body Sem_Util is Par := N; while Present (Par) loop - if Nkind_In (Par, N_Entry_Call_Statement, - N_Function_Call, - N_Procedure_Call_Statement) + if Nkind (Par) in N_Entry_Call_Statement + | N_Function_Call + | N_Procedure_Call_Statement then return True; @@ -28589,8 +28543,8 @@ package body Sem_Util is if No (E) then return False; - elsif not Ekind_In (E, E_Discriminant, E_Component) - or else Nam_In (Chars (E), Name_uTag, Name_uParent) + elsif Ekind (E) not in E_Discriminant | E_Component + or else Chars (E) in Name_uTag | Name_uParent then Next_Entity (E); @@ -28744,7 +28698,7 @@ package body Sem_Util is elsif Is_Integer_Type (Expec_Type) and then Is_RTE (Found_Type, RE_Address) - and then Nkind_In (Parent (Expr), N_Op_Add, N_Op_Subtract) + and then Nkind (Parent (Expr)) in N_Op_Add | N_Op_Subtract and then Expr = Left_Opnd (Parent (Expr)) and then Is_Integer_Type (Etype (Right_Opnd (Parent (Expr)))) then @@ -28834,7 +28788,7 @@ package body Sem_Util is Error_Msg_N ("\\found package name!", Expr); elsif Is_Entity_Name (Expr) - and then Ekind_In (Entity (Expr), E_Procedure, E_Generic_Procedure) + and then Ekind (Entity (Expr)) in E_Procedure | E_Generic_Procedure then if Ekind (Expec_Type) = E_Access_Subprogram_Type then Error_Msg_N @@ -28882,7 +28836,7 @@ package body Sem_Util is if Expec_Type = Standard_Boolean and then Is_Modular_Integer_Type (Found_Type) - and then Nkind_In (Parent (Expr), N_Op_And, N_Op_Or, N_Op_Xor) + and then Nkind (Parent (Expr)) in N_Op_And | N_Op_Or | N_Op_Xor and then Nkind (Right_Opnd (Parent (Expr))) in N_Op_Compare then declare @@ -29021,7 +28975,7 @@ package body Sem_Util is begin -- Integer and real literals are of a universal type - if Nkind_In (N, N_Integer_Literal, N_Real_Literal) then + if Nkind (N) in N_Integer_Literal | N_Real_Literal then return True; -- The values of certain attributes are of a universal type |