Commit 220dc4b2 by Hristian Kirtchev Committed by Pierre-Marie de Rodat

[Ada] Elaboration order v4.0 and output of dependencies

This patch adds a missing case to the mechanism that outputs the
elaboration order dependencies of units.

------------
-- Source --
------------

--  pack.ads

package Pack is
   procedure Force_Body;
end Pack;

--  pack.adb

package body Pack is
   procedure Force_Body is null;
end Pack;

--  main.adb

with Pack;

procedure Main is begin null; end Main;

----------------------------
-- Compilation and output --
----------------------------

$ gnatmake -q main.adb -bargs -e

ELABORATION ORDER DEPENDENCIES

   unit "pack (spec)" must be elaborated before unit "main (body)"
     reason: unit "main (body)" has with clause for unit "pack (spec)"
   unit "pack (spec)" must be elaborated before unit "pack (body)"
     reason: spec must be elaborated before body

2019-07-11  Hristian Kirtchev  <kirtchev@adacore.com>

gcc/ada/

	* bindo.adb: Remove the documentation of switch -d_N because it
	is no longer in use.
	* bindo-graphs.ads, bindo-graphs.adb (Is_Spec_Before_Body_Edge):
	New routine.
	* bindo-writers.adb (Write_Dependency_Edge): Add the missing
	case of a spec-before-body edge.

From-SVN: r273394
parent d4ba738c
2019-07-11 Hristian Kirtchev <kirtchev@adacore.com>
* bindo.adb: Remove the documentation of switch -d_N because it
is no longer in use.
* bindo-graphs.ads, bindo-graphs.adb (Is_Spec_Before_Body_Edge):
New routine.
* bindo-writers.adb (Write_Dependency_Edge): Add the missing
case of a spec-before-body edge.
2019-07-11 Dmitriy Anisimkov <anisimko@adacore.com>
* libgnat/g-socket.ads (Mode_Type): Add a Socket_Raw enumerator.
......
......@@ -4183,6 +4183,21 @@ package body Bindo.Graphs is
return U_Rec.Utype = Is_Spec or else U_Rec.Utype = Is_Spec_Only;
end Is_Spec;
------------------------------
-- Is_Spec_Before_Body_Edge --
------------------------------
function Is_Spec_Before_Body_Edge
(G : Library_Graph;
Edge : Library_Graph_Edge_Id) return Boolean
is
begin
pragma Assert (Present (G));
pragma Assert (Present (Edge));
return Kind (G, Edge) = Spec_Before_Body_Edge;
end Is_Spec_Before_Body_Edge;
-----------------------
-- Is_Spec_With_Body --
-----------------------
......
......@@ -1166,6 +1166,13 @@ package Bindo.Graphs is
pragma Inline (Is_Spec);
-- Determine whether vertex Vertex of library graph G denotes a spec
function Is_Spec_Before_Body_Edge
(G : Library_Graph;
Edge : Library_Graph_Edge_Id) return Boolean;
pragma Inline (Is_Spec_Before_Body_Edge);
-- Determine whether edge Edge of library graph G links a predecessor
-- spec and a successor body belonging to the same unit.
function Is_Spec_With_Body
(G : Library_Graph;
Vertex : Library_Graph_Vertex_Id) return Boolean;
......
......@@ -610,6 +610,11 @@ package body Bindo.Writers is
& "elaboration time",
Info => True);
elsif Is_Spec_Before_Body_Edge (G, Edge) then
Error_Msg_Output
(Msg => " reason: spec must be elaborated before body",
Info => True);
else
pragma Assert (Is_With_Edge (G, Edge));
......
......@@ -347,13 +347,9 @@ package body Bindo is
-- GNATbind outputs the library graph in textual format to standard
-- output.
--
-- -d_N New bindo order
--
-- GNATbind utilizes the new bindo elaboration order
--
-- -d_P Output cycle paths
--
-- GNATbind output the cycle paths in text format to standard output
-- GNATbind outputs the cycle paths in text format to standard output
--
-- -d_S Output elaboration-order status information
--
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment