diff options
author | Hristian Kirtchev <kirtchev@adacore.com> | 2019-07-11 08:02:30 +0000 |
---|---|---|
committer | Pierre-Marie de Rodat <pmderodat@gcc.gnu.org> | 2019-07-11 08:02:30 +0000 |
commit | 220dc4b2825745db538915298d0c79f2f12ce5e0 (patch) | |
tree | e2b01a2e4288ab54e6cb89087a28bd2691dc393f | |
parent | d4ba738c67e5579d5a0dff07f20b36f3df9529d5 (diff) | |
download | gcc-220dc4b2825745db538915298d0c79f2f12ce5e0.zip gcc-220dc4b2825745db538915298d0c79f2f12ce5e0.tar.gz gcc-220dc4b2825745db538915298d0c79f2f12ce5e0.tar.bz2 |
[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
-rw-r--r-- | gcc/ada/ChangeLog | 9 | ||||
-rw-r--r-- | gcc/ada/bindo-graphs.adb | 15 | ||||
-rw-r--r-- | gcc/ada/bindo-graphs.ads | 7 | ||||
-rw-r--r-- | gcc/ada/bindo-writers.adb | 5 | ||||
-rw-r--r-- | gcc/ada/bindo.adb | 6 |
5 files changed, 37 insertions, 5 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index e20d10c..accc3ee 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,12 @@ +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. diff --git a/gcc/ada/bindo-graphs.adb b/gcc/ada/bindo-graphs.adb index 9621bb4..c2f9d6c 100644 --- a/gcc/ada/bindo-graphs.adb +++ b/gcc/ada/bindo-graphs.adb @@ -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 -- ----------------------- diff --git a/gcc/ada/bindo-graphs.ads b/gcc/ada/bindo-graphs.ads index 8323784..f376801 100644 --- a/gcc/ada/bindo-graphs.ads +++ b/gcc/ada/bindo-graphs.ads @@ -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; diff --git a/gcc/ada/bindo-writers.adb b/gcc/ada/bindo-writers.adb index 021d50f..1fcfb11 100644 --- a/gcc/ada/bindo-writers.adb +++ b/gcc/ada/bindo-writers.adb @@ -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)); diff --git a/gcc/ada/bindo.adb b/gcc/ada/bindo.adb index d5830ca..249ce972 100644 --- a/gcc/ada/bindo.adb +++ b/gcc/ada/bindo.adb @@ -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 -- |