+2019-07-10 Hristian Kirtchev <kirtchev@adacore.com>
+
+ * bindo-graphs.adb, bindo.adb, debug.adb, exp_ch6.adb,
+ sem_ch10.adb, sem_ch13.adb, sem_ch3.adb, sem_ch4.adb,
+ sem_ch6.adb, sem_ch7.adb, sem_res.adb, sem_spark.adb,
+ sem_util.adb, warnsw.ads: Minor reformatting.
+
2019-07-10 Joffrey Huguet <huguet@adacore.com>
* libgnat/a-strbou.ads, libgnat/a-strfix.ads,
-- * End vertices is the set of vertices that terminate a potential
-- cycle.
--
- -- * Deleted vertices is the set of vertices that have been expended
+ -- * Deleted vertices is the set of vertices that have been expanded
-- during previous depth-first searches and should not be visited
-- for the rest of the algorithm.
--
- -- * Most_Significant_Edge is the current highest precedence edge on
+ -- * Most_Significant_Edge is the current highest-precedence edge on
-- the path of the potential cycle.
--
-- * Invocation_Edge_Count is the number of invocation edges on the
-- * End_Vertices is the set of vertices that terminate a potential
-- cycle.
--
- -- * Deleted_Vertices is the set of vertices that have been expended
+ -- * Deleted_Vertices is the set of vertices that have been expanded
-- during previous depth-first searches and should not be visited
-- for the rest of the algorithm.
--
- -- * Most_Significant_Edge is the current highest precedence edge on
+ -- * Most_Significant_Edge is the current highest-precedence edge on
-- the path of the potential cycle.
--
-- * Invocation_Edge_Count is the number of invocation edges on the
elsif Cycle_Invs > Comp_Invs then
return Lower_Precedence;
- -- Prever a cycle with a higher path precedence
+ -- Prefer a cycle with a higher path precedence
else
return
pragma Assert (Present (G));
-- The cycles of graph G are discovered using Tarjan's enumeration
- -- of the elementary circuits of a directed graph algorithm. Do not
+ -- of the elementary circuits of a directed-graph algorithm. Do not
-- modify this code unless you intimately understand the algorithm.
--
-- The logic of the algorithm is split among the following routines:
--
-- The original algorithm has been significantly modified in order to
--
- -- * Accomodate the semantics of Elaborate_All and Elaborate_Body.
+ -- * Accommodate the semantics of Elaborate_All and Elaborate_Body.
--
-- * Capture cycle paths as edges rather than vertices.
--
-- the "complementary" vertex resulted in a cycle.
Successor_Has_Cycle : Boolean;
- -- This flag is set when visiting at least once successor of the
+ -- This flag is set when visiting at least one successor of the
-- current vertex resulted in a cycle.
begin
Has_Cycle := False;
-- Nothing to do when the limit on the number of saved cycles has
- -- been reached. This protects against a combinatorial explostion
+ -- been reached. This protects against a combinatorial explosion
-- in components with Elaborate_All cycles.
if Cycle_Count >= Cycle_Limit then
-- The vertex closes the circuit, thus resulting in a cycle. Save
-- the cycle for later diagnostics. The initial invocation of the
- -- routine always ignores the starting vertex to prevent a spurious
- -- self cycle.
+ -- routine always ignores the starting vertex, to prevent a spurious
+ -- self-cycle.
elsif not Is_Start_Vertex
and then LGV_Sets.Contains (End_Vertices, Vertex)
Visited_Set : LGV_Sets.Membership_Set := LGV_Sets.Nil;
-- The "mark" array of Tarjan's algorithm. Since the original visits
-- all vertices in increasing ordinal number 1 .. N, the array offers
- -- a one to one mapping between a vertex and its "marked" state. The
+ -- a one-to-one mapping between a vertex and its "marked" state. The
-- modified version however visits vertices within components, where
-- their ordinals are not contiguous. Vertices are added to this set
-- and treated as "marked".
Vertex => Vertex,
Elaborate_All_Active => Elaborate_All_Active);
- -- The modified version maintans two addition attributes while
+ -- The modified version maintains two additional attributes while
-- performing the depth-first search:
--
-- * The most significant edge of the current potential cycle.
-- * The number of invocation edges encountered along the path
-- of the current potential cycle.
--
- -- Both attributes are used in the heuristic which determines the
+ -- Both attributes are used in the heuristic that determines the
-- importance of cycles.
Find_Cycles_From_Vertex
pragma Assert (Present (G));
pragma Assert (Present (Comp));
- -- Nothing to do when switch -d_t (output cycle detection trace
+ -- Nothing to do when switch -d_t (output cycle-detection trace
-- information) is not in effect.
if not Debug_Flag_Underscore_T then
pragma Assert (Present (G));
pragma Assert (Present (Cycle));
- -- Nothing to do when switch -d_t (output cycle detection trace
+ -- Nothing to do when switch -d_t (output cycle-detection trace
-- information) is not in effect.
if not Debug_Flag_Underscore_T then
Succ : constant Library_Graph_Vertex_Id := Successor (G, Edge);
begin
- -- Nothing to do when switch -d_t (output cycle detection trace
+ -- Nothing to do when switch -d_t (output cycle-detection trace
-- information) is not in effect.
if not Debug_Flag_Underscore_T then
pragma Assert (Present (G));
pragma Assert (Present (Vertex));
- -- Nothing to do when switch -d_t (output cycle detection trace
+ -- Nothing to do when switch -d_t (output cycle-detection trace
-- information) is not in effect.
if not Debug_Flag_Underscore_T then
-- In addition, GNATbind does not create an edge to the body of the
-- pragma argument.
--
- -- -d_t Output cycle detection trace information
+ -- -d_t Output cycle-detection trace information
--
- -- GNATbind outputs trace information on cycle detection activities
+ -- GNATbind outputs trace information on cycle-detection activities
-- to standard output.
--
-- -d_A Output ALI invocation tables
-- d_q
-- d_r
-- d_s
- -- d_t Output cycle detection trace information
+ -- d_t Output cycle-detection trace information
-- d_u
-- d_v
-- d_w
-- elaboration order and no longer creates an implicit dependency on
-- the body of the argument.
- -- d_t GNATBIND output trace information of cycle detection activities to
+ -- d_t GNATBIND output trace information of cycle-detection activities to
-- standard output.
-- d_A GNATBIND output the contents of all ALI invocation-related tables
----------------------------------
function Is_Class_Wide_Interface_Type (E : Entity_Id) return Boolean is
- Typ : Entity_Id := E;
DDT : Entity_Id;
+ Typ : Entity_Id := E;
begin
if Has_Non_Limited_View (Typ) then
end;
end if;
- -- The With_Clause may be on a grand-child or one of its further
+ -- The With_Clause may be on a grandchild or one of its further
-- descendants, which makes a child immediately visible. Examine
-- ancestry to determine whether such a child exists. For example,
-- if current unit is A.C, and with_clause is on A.X.Y.Z, then X
-- Scan context of current unit, to check whether there is
-- a with_clause on the same unit as a private with-clause
-- on a parent, in which case child unit is visible. If the
- -- unit is a grand-child, the same applies to its parent.
+ -- unit is a grandchild, the same applies to its parent.
----------------
-- In_Context --
function Has_Generic_Parent (E : Entity_Id) return Boolean;
-- Return True if any ancestor is a generic type
+ ------------------------
+ -- Has_Generic_Parent --
+ ------------------------
+
function Has_Generic_Parent (E : Entity_Id) return Boolean is
Ancestor_Type : Entity_Id := Etype (E);
Ancestor_Type := Etype (Ancestor_Type);
end loop;
- return Present (Ancestor_Type)
- and then Is_Generic_Type (Ancestor_Type);
+ return
+ Present (Ancestor_Type) and then Is_Generic_Type (Ancestor_Type);
end Has_Generic_Parent;
+ -- Start of processing for Rep_Item_Too_Early
+
begin
-- Cannot apply non-operational rep items to generic types
procedure Analyze_Object_Declaration (N : Node_Id) is
Loc : constant Source_Ptr := Sloc (N);
Id : constant Entity_Id := Defining_Identifier (N);
- Next_Decl : constant Node_Id := Next (N);
+ Next_Decl : constant Node_Id := Next (N);
Act_T : Entity_Id;
T : Entity_Id;
declare
Check : constant Node_Id :=
- Make_Predicate_Check (T, New_Occurrence_Of (Id, Loc));
+ Make_Predicate_Check (T, New_Occurrence_Of (Id, Loc));
begin
if No (Next_Decl) then
Append_To (List_Containing (N), Check);
-
else
Insert_Before (Next_Decl, Check);
end if;
and then Ekind (Entity (Name (N))) = E_Function
and then Present (Homonym (Entity (Name (N))))
then
-
- -- A name may appear overloaded if it has a homonym, even if
- -- that homonym is non-overloadable, in which case the overload
- -- list is in fact empty. This specialized case deserves a
- -- special message if the homonym is a child package.
+ -- A name may appear overloaded if it has a homonym, even if that
+ -- homonym is non-overloadable, in which case the overload list is
+ -- in fact empty. This specialized case deserves a special message
+ -- if the homonym is a child package.
declare
Nam : constant Node_Id := Name (N);
H : constant Entity_Id := Homonym (Entity (Nam));
begin
- if Ekind (H) = E_Package
- and then Is_Child_Unit (H)
- then
+ if Ekind (H) = E_Package and then Is_Child_Unit (H) then
Error_Msg_Qual_Level := 2;
Error_Msg_NE ("if an entity in package& is meant, ", Nam, H);
Error_Msg_NE ("\use a fully qualified name", Nam, H);
end if;
end loop;
- -- If all interpretations are procedures, this deserves a
- -- more precise message. Ditto if this appears as the prefix
- -- of a selected component, which may be a lexical error.
+ -- If all interpretations are procedures, this deserves a more
+ -- precise message. Ditto if this appears as the prefix of a
+ -- selected component, which may be a lexical error.
Error_Msg_N
("\context requires function call, found procedure name", Nam);
elsif Nkind (N) = N_Procedure_Call_Statement
and then not Void_Interp_Seen
then
- Error_Msg_N (
- "\function name found in procedure call", Nam);
+ Error_Msg_N ("\function name found in procedure call", Nam);
end if;
All_Errors_Mode := Err_Mode;
goto Continue;
end if;
- -- Protect against malformed parameter types.
+ -- Protect against malformed parameter types
if Nkind (Ptype) not in N_Has_Entity then
Formal_Type := Any_Type;
-- Deactivate expansion inside the body of ignored Ghost entities,
-- as this code will ultimately be ignored. This avoids requiring the
-- presence of run-time units which are not needed. Only do this for
- -- user entities, as internally generated entitities might still need
+ -- user entities, as internally generated entities might still need
-- to be expanded (e.g. those generated for types).
if Present (Ignored_Ghost_Region)
-- to the linker as their Is_Public flag is set to True. This proactive
-- approach is necessary because an inlined or a generic body for which
-- code is generated in other units may need to see these entities. Cut
- -- down the number of global symbols that do not neet public visibility
+ -- down the number of global symbols that do not need public visibility
-- as this has two beneficial effects:
-- (1) It makes the compilation process more efficient.
-- (2) It gives the code generator more leeway to optimize within each
end if;
-- Nested package specs that do not require bodies are not checked for
- -- ineffective use clauses due to the possbility of subunits. This is
+ -- ineffective use clauses due to the possibility of subunits. This is
-- because at this stage it is impossible to tell whether there will be
-- a separate body.
procedure Swap_Private_Dependents (Priv_Deps : Elist_Id);
-- When the full view of a private type is made available, we do the
-- same for its private dependents under proper visibility conditions.
- -- When compiling a grand-chid unit this needs to be done recursively.
+ -- When compiling a grandchild unit this needs to be done recursively.
-----------------------------
-- Swap_Private_Dependents --
E : Entity_Id;
Requires_Body : Boolean := False;
- -- Flag set when the unit has at least one construct that requries
+ -- Flag set when the unit has at least one construct that requires
-- completion in a body.
begin
Get_Next_Interp (I, It);
end loop;
- -- If expansion is active and this is wn inherited operation,
+ -- If expansion is active and this is an inherited operation,
-- replace it with its ancestor. This must not be done during
- -- preanalysis because the type nay not be frozen yet, as when
- -- the context is a pre/post condition.
+ -- preanalysis because the type may not be frozen yet, as when
+ -- the context is a precondition or postcondition.
- if Present (Alias (Entity (N)))
- and then Expander_Active
- then
+ if Present (Alias (Entity (N))) and then Expander_Active then
Set_Entity (N, Alias (Entity (N)));
end if;
end;
begin
-- Only SPARK bodies are analyzed
- if No (Prag)
- or else Get_SPARK_Mode_From_Annotation (Prag) /= Opt.On
- then
+ if No (Prag) or else Get_SPARK_Mode_From_Annotation (Prag) /= Opt.On then
return;
end if;
and then Is_Anonymous_Access_Type (Etype (Spec_Id))
and then not Is_Traversal_Function (Spec_Id)
then
- Error_Msg_N ("anonymous access type for result only allowed for "
- & "traveral functions", Spec_Id);
+ Error_Msg_N
+ ("anonymous access type for result only allowed for traveral "
+ & "functions", Spec_Id);
return;
end if;
if Is_Subprogram_Or_Generic_Subprogram (Subp) then
Body_Id := Subprogram_Body_Entity (Subp);
- elsif Is_Entry (Subp)
- or else Is_Task_Type (Subp)
- then
+ elsif Is_Entry (Subp) or else Is_Task_Type (Subp) then
Body_Id := Corresponding_Body (Parent (Subp));
-- ??? It should be possible to retrieve the Refined_Global on the
Warn_On_Anonymous_Allocators : Boolean := False;
-- Warn when allocators for anonymous access types are present, which,
-- although not illegal in Ada, may be confusing to users due to how
- -- accessibility checks get generated. Off by default, modified by use of
- -- -gnatw_a/_A and set as part of -gnatwa.
+ -- accessibility checks get generated. Off by default, modified by use
+ -- of -gnatw_a/_A and set as part of -gnatwa.
Warn_On_Late_Primitives : Boolean := False;
-- Warn when tagged type public primitives are defined after its private