Home > ada error > ada error elaboration circularity detected

Ada Error Elaboration Circularity Detected

detailed diagnostics. For example: error: elaboration circularity detected info: "proc (body)" must be elaborated before "pack (body)" info: reason: Elaborate_All probably needed in unit "pack (body)" info: recompile "pack (body)" with -gnatwl info: for full details info: ada pragma elaborate "proc (body)" info: is needed by its spec: info: "proc (spec)" info: which ada elaboration is withed by: info: "pack (body)" info: "pack (body)" must be elaborated before "proc (body)" info: reason: pragma Elaborate in unit "proc (body)" In this case we have a cycle that the binder cannot break. On the one hand, there is an explicit pragma Elaborate in proc for pack. This means that the body of pack must be elaborated before the body of proc. On the other hand, there is elaboration code in pack that calls a subprogram in proc. This means that for maximum safety, there should really be a pragma Elaborate_All in pack for proc which would require that the body of proc be elaborated before the body of pack. Clearly both requirements cannot be satisfied. Faced with a circularity of this kind, you have three different options. Fix the programThe most desirable option from the point of view of long-term maintenance is to rearrange the program so that the elaboration problems are avoided. One useful technique is to place the elaboration code into separate child packages. Another is to move some of the initialization code to explicitly called subprograms, where the program controls the order of initialization explicitly. Although this is the most desirable option, it may be impractical and involve too much modification, especially in the case of complex legacy code. Perform dynamic checksIf the compilations are done using the -gnatE (dynamic elaboration check) switch, then GNAT behaves in a quite different manner. Dynamic checks are generated for all calls that could possibly result in raising an exception. With this switch, the compiler does not generate implicit Elaborate_All pragmas. The behavior then is exactly as specified in the Ada 95 Reference Manual. The binder will generate an executable program that may or may not raise Program_Error, and then it is the programmer's job to ensure that it does not raise an exception. Note that it is important to compile all units with the switch, it cannot be used selectively. Suppress ch

Controlling Elaboration in GNAT - Internal Calls C.5 Controlling Elaboration in GNAT - External Calls C.6 Default Behavior in GNAT - Ensuring Safety C.7 Treatment of Pragma Elaborate C.8 Elaboration Issues for Library Tasks C.9 Mixing Elaboration Models C.10 What to Do If the Default Elaboration Behavior Fails C.11 Elaboration for Access-to-Subprogram Values C.12 Summary of Procedures for Elaboration Control C.13 Other Elaboration Order Considerations This http://gcc.gnu.org/onlinedocs/gcc-3.4.4/gnat_ugn_unw/What-to-Do-If-the-Default-Elaboration-Behavior-Fails.html chapter describes the handling of elaboration code in Ada 95 and in GNAT, and discusses how the order of elaboration of program units can be controlled in GNAT, either automatically or with explicit programming features. [ < ] [ > ] [ << ] [ Up ] [ >> ] [Top] [Contents] [Index] [ ? http://www.cs.fsu.edu/~baker/ada/gnat/html/gnat_ugn_28.html ] C.1 Elaboration Code in Ada 95 Ada 95 provides rather general mechanisms for executing code at elaboration time, that is to say before the main program starts executing. Such code arises in three contexts: Initializers for variables. Variables declared at the library level, in package specs or bodies, can require initialization that is performed at elaboration time, as in: Sqrt_Half : Float := Sqrt (0.5); Package initialization code Code in a BEGIN-END section at the outer level of a package body is executed as part of the package body elaboration code. Library level task allocators Tasks that are declared using task allocators at the library level start executing immediately and hence can execute at elaboration time. Subprogram calls are possible in any of these contexts, which means that any arbitrary part of the program may be executed as part of the elaboration code. It is even possible to write a program which does all its work at elaboration time, with a null main program, although stylistically this would usually be considered an inappropriate way

with gnat give the following message: gnatbind -x client.ali error: elaboration circularity detected info: "edhipc (body)" must be elaborated before "edhipc (body)" info: reason: Elaborate_All probably http://computer-programming-forum.com/44-ada/efdb86a6b820bb80.htm needed in unit "edhipc (body)" info: recompile "edhipc (body)" with https://groups.google.com/d/topic/comp.lang.ada/X5wlOA7FiWI -gnatwl for full details info: "edhipc (body)" info: is needed by its spec: info: "edhipc (spec)" info: which is withed by: info: "edhipclog (spec)" info: ada error which is withed by: info: "edhipc (body)" gnatmake: *** bind failed. *** Error code 4 make: Fatal error: Command failed for target `client' As you can see edhipc.adb is referring back to itself. So - I have to unroll this mess. Are there any handy tricks when doing this? The exact approach depends of course on the actual software, ada error elaboration but is it generally better to move the code out into new package(s) or remove the circularity? -Frode -- | Ericsson Radar AS. N-1788 Halden | | | with Standard.Disclaimer; use Standard.Disclaimer; | Sun, 21 Jul 2002 03:00:00 GMT Matthew Heane#2 / 7 Elaboration circularity Did you try doing as GNAT suggested? The body of edhipc looks something like this: with edhipclog; package body edhipc is Change that by adding a pragma Elaborate_All: with edhipclog; pragma Elaborate_All (edhipclog); package body edhipc is Make sure the spec of edhipc doesn't have a categorization pragma (in other words, don't force immediate elaboration of the body). I think you want to the elaboration order to be: edhipc (spec) edhipclog (spec) edhipclog (body) edhipc (body) Quote:> I am currently looking into some legacy code which is heavily nested > with cirular dependencies. Compiling with gnat give the following message: > gnatbind -x client.ali > error: elaboration circularity detected > info: "edhipc (body)" must be elaborated before "edhipc (body)" > info: reas

from GoogleSign inHidden fieldsSearch for groups or messages

 

Related content

ada error no selector

Ada Error No Selector p here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack relatedl Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of million programmers just like you helping each other Join them it only takes a minute Sign up Ada compile error- no selector for type

ada error no candidate interpretations match the actuals

Ada Error No Candidate Interpretations Match The Actuals p here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings relatedl and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of million programmers just like you helping each other Join them it only takes a minute Sign up Compilation errors -