-- Count the number of discrete choices. Start with -1 because
-- the others choice does not count.
- -- Is there some reason we do not use List_Length here ???
-
Nb_Choices := -1;
Assoc := First (Component_Associations (Sub_Aggr));
while Present (Assoc) loop
- Choice := First (Choice_List (Assoc));
- while Present (Choice) loop
- Nb_Choices := Nb_Choices + 1;
- Next (Choice);
- end loop;
-
+ Nb_Choices := Nb_Choices + List_Length (Choice_List (Assoc));
Next (Assoc);
end loop;
-- choice then compute the number or positional elements.
if Need_To_Check and then Present (Expressions (Sub_Aggr)) then
- Expr := First (Expressions (Sub_Aggr));
- Nb_Elements := Uint_0;
- while Present (Expr) loop
- Nb_Elements := Nb_Elements + 1;
- Next (Expr);
- end loop;
+ Nb_Elements := UI_From_Int (List_Length (Expressions (Sub_Aggr)));
-- If the aggregate contains discrete choices and an others choice
-- compute the smallest and largest discrete choice values.
Table : Case_Table_Type (1 .. Nb_Choices);
-- Used to sort all the different choice values
- J : Pos := 1;
+ J : Pos := 1;
begin
Assoc := First (Component_Associations (Sub_Aggr));
(SI : Node_Id;
Check_List : List_Id)
is
- C : constant Node_Id := Constraint (SI);
- Number_Of_Constraints : Nat := 0;
- Index : Node_Id;
- S, T : Entity_Id;
+ C : constant Node_Id := Constraint (SI);
+ Index : Node_Id;
+ S, T : Entity_Id;
procedure Constrain_Index
(Index : Node_Id;
T := Designated_Type (T);
end if;
- S := First (Constraints (C));
- while Present (S) loop
- Number_Of_Constraints := Number_Of_Constraints + 1;
- Next (S);
- end loop;
-
-- In either case, the index constraint must provide a discrete
-- range for each index of the array type and the type of each
-- discrete range must be the same as that of the corresponding
-- Apply constraints to each index type
- for J in 1 .. Number_Of_Constraints loop
+ while Present (S) loop
Constrain_Index (Index, S, Check_List);
Next (Index);
Next (S);
Name_ITable : Name_Id;
Nb_Prim : Nat := 0;
New_Node : Node_Id;
- Num_Ifaces : Nat := 0;
Parent_Typ : Entity_Id;
Predef_Prims : Entity_Id;
Prim : Entity_Id;
Collect_Interfaces (Typ, Typ_Ifaces);
- AI := First_Elmt (Typ_Ifaces);
- while Present (AI) loop
- Num_Ifaces := Num_Ifaces + 1;
- Next_Elmt (AI);
- end loop;
-
- if Num_Ifaces = 0 then
+ if Is_Empty_Elmt_List (Typ_Ifaces) then
Iface_Table_Node := Make_Null (Loc);
-- Generate the Interface_Table object
else
declare
- TSD_Ifaces_List : constant List_Id := New_List;
- Elmt : Elmt_Id;
- Offset_To_Top : Node_Id;
- Sec_DT_Tag : Node_Id;
+ Num_Ifaces : constant Pos := List_Length (Typ_Ifaces);
+ TSD_Ifaces_List : constant List_Id := New_List;
+ Elmt : Elmt_Id;
+ Offset_To_Top : Node_Id;
+ Sec_DT_Tag : Node_Id;
Dummy_Object_Ifaces_List : Elist_Id := No_Elist;
Dummy_Object_Ifaces_Comp_List : Elist_Id := No_Elist;
-----------------------
function Formal_Dimensions return Nat is
- Num : Nat := 0;
- Index : Node_Id;
+ Dims : List_Id;
begin
if Nkind (Def) = N_Constrained_Array_Definition then
- Index := First (Discrete_Subtype_Definitions (Def));
+ Dims := Discrete_Subtype_Definitions (Def);
else
- Index := First (Subtype_Marks (Def));
+ Dims := Subtype_Marks (Def);
end if;
- while Present (Index) loop
- Num := Num + 1;
- Next (Index);
- end loop;
-
- return Num;
+ return List_Length (Dims);
end Formal_Dimensions;
-- Start of processing for Validate_Array_Type_Instance
Get_Attribute_Id (Attribute_Name (Def));
T : constant Entity_Id := Entity (Prefix (Def));
Is_Fun : constant Boolean := (Ekind (Nam) = E_Function);
- F : Entity_Id;
Num_F : Nat;
OK : Boolean;
return;
end if;
- Num_F := 0;
- F := First_Formal (Nam);
- while Present (F) loop
- Num_F := Num_F + 1;
- Next_Formal (F);
- end loop;
+ Num_F := Number_Formals (Nam);
case Attr_Id is
when Attribute_Adjacent
Minimum : constant Nat :=
Convention_Id'Pos (C) -
Convention_Id'Pos (Convention_C_Variadic_0);
-
- Count : Nat;
- Formal : Entity_Id;
-
begin
- Count := 0;
- Formal := First_Formal (Subp);
- while Present (Formal) loop
- Count := Count + 1;
- Next_Formal (Formal);
- end loop;
-
- if Count < Minimum then
+ if Number_Formals (Subp) < Minimum then
Error_Msg_Uint_1 := UI_From_Int (Minimum);
Error_Pragma_Arg
("argument of pragma% must have at least"
Expr_Value (Low_Bound (Aggregate_Bounds (N)))
then
declare
- Count_Components : Uint := Uint_0;
+ Count_Components : Uint;
Num_Components : Uint;
Others_Assoc : Node_Id := Empty;
Others_Choice : Node_Id := Empty;
begin
-- Count positional associations
- if Present (Expressions (N)) then
- Comp_Expr := First (Expressions (N));
- while Present (Comp_Expr) loop
- Count_Components := Count_Components + 1;
- Next (Comp_Expr);
- end loop;
- end if;
+ Count_Components :=
+ UI_From_Int (List_Length (Expressions (N)));
-- Count the rest of elements and locate the N_Others
-- choice (if any)
First_Named : Node_Id := Empty;
Found : Boolean;
- Formals_To_Match : Integer := 0;
- Actuals_To_Match : Integer := 0;
+ Formals_To_Match : Int := 0;
+ Actuals_To_Match : Int := 0;
procedure Chain (A : Node_Id);
-- Add named actual at the proper place in the list, using the
-- The name in the call is a function call that returns an access
-- to subprogram. The designated type has the list of formals.
- Formal := First_Formal (Designated_Type (S));
+ Formals_To_Match := Number_Formals (Designated_Type (S));
else
- Formal := First_Formal (S);
+ Formals_To_Match := Number_Formals (S);
end if;
- while Present (Formal) loop
- Formals_To_Match := Formals_To_Match + 1;
- Next_Formal (Formal);
- end loop;
-
-- Find if there is a named association, and verify that no positional
-- associations appear after named ones.