9.12 Summary of Procedures for Elaboration Control ¶
A programmer should first compile the program with the default options, using
none of the binder or compiler switches. If the binder succeeds in finding an
elaboration order, then apart from possible cases involing dispatching calls
and access-to-subprogram types, the program is free of elaboration errors.
If it is important for the program to be portable to compilers other than GNAT,
then the programmer should use compiler switch -gnatel
and consider
the messages about missing or implicitly created Elaborate
and
Elaborate_All
pragmas.
If the binder reports an elaboration circularity, the programmer has several
options:
- Ensure that elaboration warnings are enabled. This will allow the static
model to output trace information of elaboration issues. The trace
information could shed light on previously unforeseen dependencies, as well
as their origins. Elaboration warnings are enabled with compiler switch
-gnatwl
.
- Cosider the tactics given in the suggestions section of the circularity
diagnostic.
- If none of the steps outlined above resolve the circularity, use a more
permissive elaboration model, in the following order:
- Use the pre-20.x legacy elaboration-order model, with binder switch
-H
.
- Use both pre-18.x and pre-20.x legacy elaboration models, with compiler
switch
-gnatH
and binder switch -H
.
- Use the relaxed static elaboration model, with compiler switches
-gnatH
-gnatJ
and binder switch -H
.
- Use the relaxed dynamic elaboration model, with compiler switches
-gnatH
-gnatJ
-gnatE
and binder switch
-H
.