aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/bindo-augmentors.adb
diff options
context:
space:
mode:
authorHristian Kirtchev <kirtchev@adacore.com>2019-07-09 07:55:12 +0000
committerPierre-Marie de Rodat <pmderodat@gcc.gnu.org>2019-07-09 07:55:12 +0000
commitf0bfd1f91fdba41a6d9fa7ada6e02ea8121f604c (patch)
tree34211f3c7c46707a6e7281503fb3048a36528195 /gcc/ada/bindo-augmentors.adb
parent64ac53f4c4e1ecbf753ce764bfd9083aa0141323 (diff)
downloadgcc-f0bfd1f91fdba41a6d9fa7ada6e02ea8121f604c.zip
gcc-f0bfd1f91fdba41a6d9fa7ada6e02ea8121f604c.tar.gz
gcc-f0bfd1f91fdba41a6d9fa7ada6e02ea8121f604c.tar.bz2
[Ada] Elaboration order v4.0 and generic instantiations
This patch updates the library graph augmentation mechanism of the elaboration order v4.0 to emulate a particular behavior of the v3.0 scheme involving generic instantiations. If a unit without any elaboration code instantiates a generic without any elaboration code, the invocation edge from the instance to the generic body is not considered for library graph augmentation. ------------ -- Source -- ------------ -- gen_pack1.ads generic type Element_Type is private; package Gen_Pack1 is procedure Read; end Gen_Pack1; -- gen_pack1.adb with Types1; package body Gen_Pack1 is procedure Read is null; end Gen_Pack1; -- types1.ads with Gen_Pack1; package Types1 is procedure Read; package Optional_Numbers is new Gen_Pack1 (Positive); end Types1; -- main1.adb with Types1; procedure Main1 is begin Types1.Optional_Numbers.Read; end Main1; ----------------- -- Compilation -- ----------------- $ gnatmake -q main1.adb 2019-07-09 Hristian Kirtchev <kirtchev@adacore.com> gcc/ada/ * bindo-augmentors.adb (Visit_Elaboration_Root): Do not start a DFS from an elaboration root whose corresponding unit lacks elaboration code. This behavior mimics that of the old elaboration order mechanism. * bindo-graphs.adb (Find_All_Cycles_Through_Vertex): Move the vertex tracing within the functional branches of the routine. This prevents spurious trace output. (Has_No_Elaboration_Code): New routine. (Trace_Cycle, Trace_Edge): Update the various Ids to use the "standard" trace format. * bindo-graphs.ads (Has_No_Elaboration_Code): New routine. * bindo-units.ads, bindo-units.adb (Has_No_Elaboration_Code): New routine. From-SVN: r273288
Diffstat (limited to 'gcc/ada/bindo-augmentors.adb')
-rw-r--r--gcc/ada/bindo-augmentors.adb11
1 files changed, 11 insertions, 0 deletions
diff --git a/gcc/ada/bindo-augmentors.adb b/gcc/ada/bindo-augmentors.adb
index bb68a2e..e0e2338 100644
--- a/gcc/ada/bindo-augmentors.adb
+++ b/gcc/ada/bindo-augmentors.adb
@@ -152,6 +152,17 @@ package body Bindo.Augmentors is
Visited : IGV_Sets.Membership_Set;
begin
+ -- Nothing to do when the unit where the elaboration root resides
+ -- lacks elaboration code. This implies that any invocation edges
+ -- going out of the unit are unwanted. This behavior emulates the
+ -- old elaboration order mechanism.
+
+ if Has_No_Elaboration_Code (Lib_Graph, Root_Vertex) then
+ return;
+ end if;
+
+ -- Prepare the global data
+
Visited := IGV_Sets.Create (Number_Of_Vertices (Inv_Graph));
Visit_Vertex