The use of
should generally be avoided in Ada 95 programs.
The reason for this is that there is no guarantee that transitive calls
will be properly handled. Indeed at one point, this pragma was placed
in Annex J (Obsolescent Features), on the grounds that it is never useful.
Now that's a bit restrictive. In practice, the case in which
pragma Elaborate is useful is when the caller knows that there
are no transitive calls, or that the called unit contains all necessary
pragma Elaborate statements, and legacy code often
contains such uses.
Strictly speaking the static mode in GNAT should ignore such pragmas,
since there is no assurance at compile time that the necessary safety
conditions are met. In practice, this would cause GNAT to be incompatible
with correctly written Ada 83 code that had all necessary
pragma Elaborate statements in place. Consequently, we made the
decision that GNAT in its default mode will believe that if it encounters
pragma Elaborate then the programmer knows what they are doing,
and it will trust that no elaboration errors can occur.
The result of this decision is two-fold. First to be safe using the
static mode, you should remove all
pragma Elaborate statements.
Second, when fixing circularities in existing code, you can selectively
pragma Elaborate statements to convince the static mode of
GNAT that it need not generate an implicit
When using the static mode with -gnatwl, any use of
pragma Elaborate will generate a warning about possible