This patch adds another suggestion to the elaboration order diagnostics. An elaboration circularity involving a task activation may be resolved through pragma Restrictions (No_Entry_Calls_In_Elaboration_Code). ------------ -- Source -- ------------ -- no_entry_calls.txt pragma Restrictions (No_Entry_Calls_In_Elaboration_Code); -- a.ads package A is task type Task_Typ is entry Start; end Task_Typ; procedure Proc; end A; -- a.adb with B; package body A is task body Task_Typ is begin accept Start; B.Proc; end Task_Typ; Elab : Task_Typ; procedure Proc is null; end A; -- b.ads package B is procedure Proc; end B; -- b.adb with A; package body B is procedure Proc is begin A.Proc; end Proc; end B; -- main.adb with A; -- +--> A spec B spec -- | ^ ^ ^ -- | | with | | -- | sbb | +----------------+ | sbb -- | | | | -- | | | Invocation | -- | A body ------------> B body -- | ^ | | -- | | Invocation | | -- | +------------------+ | -- | | -- | Invocation | -- +---------------------------+ -- -- The cycle is: -- -- A body --> A body procedure Main is begin null; end Main; ---------------------------- -- Compilation and output -- ---------------------------- $ gnatmake -f -q main.adb -gnatd_F $ gnatmake -f -q main.adb -gnatec=no_entry_calls.txt error: Elaboration circularity detected info: info: Reason: info: info: unit "a (body)" depends on its own elaboration info: info: Circularity: info: info: unit "a (body)" invokes a construct of unit "a (body)" at elaboration time info: path 1: info: elaboration of unit "a (body)" info: activation of local task declared at "a.ads":2:14 info: call to subprogram "proc" declared at "b.ads":2:14 info: call to subprogram "proc" declared at "a.ads":6:14 info: info: Suggestions: info: info: use pragma Restrictions (No_Entry_Calls_In_Elaboration_Code) info: use the dynamic elaboration model (compiler switch -gnatE) info: gnatmake: *** bind failed. 2019-07-09 Hristian Kirtchev <kirtchev@adacore.com> gcc/ada/ * bindo.ads: Move type Precedence_Kind from the private to the visible part of the unit. * bindo-augmentors.adb: Remove the use of global data as it is bad practice. (Augment_Library_Graph): Update the parameter profile. (Is_Visited, Set_Is_Visited): Remove. (Visit_Elaboration_Root, Visit_Elaboration_Roots): Update the parameter profile and comment on usage. (Visit_Vertex): Likewise. Also keep track of which invocation edge activates a task. * bindo-augmentors.ads (Augment_Library_Graph): Update the parameter profile and comment on usage. * bindo-builders.adb (Create_Forced_Edge, Create_Spec_And_Body_Edge, Create_With_Edge): Update the call to Add_Edge. * bindo-diagnostics.adb: Add with end use clauses for Restrict and Rident. (Output_Dynamic_Model_Suggestions): Remove. (Output_Invocation_Related_Suggestions): New routine. (Output_Suggestions): Output all invocation-related suggestions together. * bindo-elaborators.adb: Remove types Comparator_Ptr and Predicate_Ptr. (Find_Best_Vertex): Update the parameter profile. * bindo-graphs.adb (Activates_Task): New routine. (Add_Body_Before_Spec_Edge): Update the call to Add_Edge_With_Return. (Add_Edge): Update the parameter profile and the call to Add_Edge_With_Return. (Add_Edge_With_Return): Update the parameter profile and comment on usage. (At_Least_One_Edge_Satisfies): New routine. (Contains_Elaborate_All_Edge): Reimplement. (Contains_Static_Successor_Edge, Contains_Task_Activation): New routine. (Contains_Weak_Static_Successor): Remove. (Is_Static_Successor_Edge): New routine. * bindo-graphs.ads: Add types LGE_Predicate_Ptr, LGV_Comparator_Ptr, and LGV_Predicate_Ptr. Update type Library_Graph_Edge_Attributes to capture whether an invocation edge activates a task. Update the value of No_Library_Graph_Edge_Attributes. (Activates_Task): Update the parameter profile and comment on usage. (Contains_Static_Successor_Edge, Contains_Task_Activation): New routines. (Contains_Weak_Static_Successor): Remove. * doc/gnat_ugn/elaboration_order_handling_in_gnat.rst: Update the documentation to reflect the new task-related advice. * gnat_ugn.texi: Regenerate. From-SVN: r273286
Name |
Last commit
|
Last update |
---|---|---|
INSTALL | Loading commit data... | |
config | Loading commit data... | |
contrib | Loading commit data... | |
fixincludes | Loading commit data... | |
gcc | Loading commit data... | |
gnattools | Loading commit data... | |
gotools | Loading commit data... | |
include | Loading commit data... | |
intl | Loading commit data... | |
libada | Loading commit data... | |
libatomic | Loading commit data... | |
libbacktrace | Loading commit data... | |
libcc1 | Loading commit data... | |
libcpp | Loading commit data... | |
libdecnumber | Loading commit data... | |
libffi | Loading commit data... | |
libgcc | Loading commit data... | |
libgfortran | Loading commit data... | |
libgo | Loading commit data... | |
libgomp | Loading commit data... | |
libhsail-rt | Loading commit data... | |
libiberty | Loading commit data... | |
libitm | Loading commit data... | |
libobjc | Loading commit data... | |
liboffloadmic | Loading commit data... | |
libphobos | Loading commit data... | |
libquadmath | Loading commit data... | |
libsanitizer | Loading commit data... | |
libssp | Loading commit data... | |
libstdc++-v3 | Loading commit data... | |
libvtv | Loading commit data... | |
lto-plugin | Loading commit data... | |
maintainer-scripts | Loading commit data... | |
zlib | Loading commit data... | |
.dir-locals.el | Loading commit data... | |
.gitattributes | Loading commit data... | |
.gitignore | Loading commit data... | |
ABOUT-NLS | Loading commit data... | |
COPYING | Loading commit data... | |
COPYING.LIB | Loading commit data... | |
COPYING.RUNTIME | Loading commit data... | |
COPYING3 | Loading commit data... | |
COPYING3.LIB | Loading commit data... | |
ChangeLog | Loading commit data... | |
ChangeLog.jit | Loading commit data... | |
ChangeLog.tree-ssa | Loading commit data... | |
MAINTAINERS | Loading commit data... | |
Makefile.def | Loading commit data... | |
Makefile.in | Loading commit data... | |
Makefile.tpl | Loading commit data... | |
README | Loading commit data... | |
ar-lib | Loading commit data... | |
compile | Loading commit data... | |
config-ml.in | Loading commit data... | |
config.guess | Loading commit data... | |
config.rpath | Loading commit data... | |
config.sub | Loading commit data... | |
configure | Loading commit data... | |
configure.ac | Loading commit data... | |
depcomp | Loading commit data... | |
install-sh | Loading commit data... | |
libtool-ldflags | Loading commit data... | |
libtool.m4 | Loading commit data... | |
ltgcc.m4 | Loading commit data... | |
ltmain.sh | Loading commit data... | |
ltoptions.m4 | Loading commit data... | |
ltsugar.m4 | Loading commit data... | |
ltversion.m4 | Loading commit data... | |
lt~obsolete.m4 | Loading commit data... | |
missing | Loading commit data... | |
mkdep | Loading commit data... | |
mkinstalldirs | Loading commit data... | |
move-if-change | Loading commit data... | |
multilib.am | Loading commit data... | |
symlink-tree | Loading commit data... | |
test-driver | Loading commit data... | |
ylwrap | Loading commit data... |