From: Hristian Kirtchev Date: Thu, 11 Jul 2019 08:02:30 +0000 (+0000) Subject: [Ada] Elaboration order v4.0 and output of dependencies X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=220dc4b2825745db538915298d0c79f2f12ce5e0;p=gcc.git [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 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 --- diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index e20d10cb525..accc3eea959 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,12 @@ +2019-07-11 Hristian Kirtchev + + * 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 * 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 9621bb4b488..c2f9d6cac5c 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 83237844818..f376801cb3c 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 021d50f31d3..1fcfb11becb 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 d5830cab098..249ce972f07 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 --