comp.lang.ada
 help / color / mirror / Atom feed
From: Frode Tenneboe <ft@edh.ericsson.se>
Subject: Re: Elaboration in GNAT
Date: 4 Jan 2002 13:21:34 GMT
Date: 2002-01-04T13:21:34+00:00	[thread overview]
Message-ID: <1010151875.216658@edh3> (raw)
In-Reply-To: 5ee5b646.0111281125.7e9fbca3@posting.google.com

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=ISO, Size: 2651 bytes --]

Robert Dewar <dewar@gnat.com> wrote:
> Frode Tenneboe wrote:

>> Using -gnatwa I get some elaboration issues with some legacy code in GNAT.
>> One of these are:
>>
>> foo.adb:69:04: warning: instantiation of "Client" may raise Program_Error
>> foo.adb:69:04: warning: missing pragma Elaborate_All for "bar"

> If this message is not intelligible, I recommend reading
> the entire chapter on elaboration issues in the users
> guide. Elaboration is certainly a tricky issue, and 
> generally you should not turn on -gnatwl unless you know
> what you are doing.

I like to _think_ I know what I'm doing. :) However, elaboration is 
tricky and I have read the relevant chapter several times. Every time
I read it I discover new neuances. I can only recomend everybody to 
read this chapter several times.

The code is legacy code with complex dependencies and need some time 
to grow..... The warning is removed by
adding (in the above example):

pragma Elaborate_Body(bar) 

in bar.ads.

However, I'm still not totatlly sure if this is the "correct"
approach. But at least it makes more sense than adding
pragma Elaborate_All in all clients using package bar.

> We certainly find that helping customers work through
> elaboration issues is a significant part of our support
> effort, which is why we implemented the static model
> of elaboration to try to ameliorate this in the future.

I think the elaboration performed by GNAT is very good,
especially considered when I tried to hand-elaborate a 
particular nasty piece of software it simply stops working. 
Even removing certain childs from packages which were not 
used there breaks the implementation.

However, I find the above warning a bit misplaced in my
case. I would have preferred:

bar.adb:69:04: warning: instantiation of "Client" may raise Program_Error
bar.adb:69:04: warning: missing pragma Elaborate_Body in spec

or:

bar.adb:69:04: warning: call to "Client" may raise Program_Error
bar.adb:69:04: warning: missing pragma Elaborate_Body in spec

I don't know if the compiler is able to detect this, but it would
be nicer. I'm also unsure if this is always true, but alternatively:

foo.adb:69:04: warning: instantiation of "Client" may raise Program_Error
foo.adb:69:04: warning: missing pragma Elaborate_All for "bar" or
foo.adb:69:04: warning:  missing pragma Elaborate_Body in "bar"

 -Frode
-- 
^ Frode Tenneb�                    | email: ft@edh.ericsson.se      ^
| Ericsson Radar AS. N-1788 Halden |                                |
| Phone: +47 69 21 41 47           | Frode@IRC                      |
| with Standard.Disclaimer; use Standard.Disclaimer;                |



  reply	other threads:[~2002-01-04 13:21 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-11-28 12:34 Elaboration in GNAT Frode Tenneboe
2001-11-28 18:13 ` Mark Johnson
2001-11-29  3:44   ` Robert Dewar
2001-11-29 13:30     ` Stephen Leake
2001-11-28 19:25 ` Robert Dewar
2002-01-04 13:21   ` Frode Tenneboe [this message]
2002-01-04 15:07     ` Matthew Heaney
2002-01-05  0:43       ` Robert Dewar
2002-01-05  0:50       ` Robert Dewar
2002-01-07 17:22         ` Mark Johnson
2002-01-08  0:00           ` Robert Dewar
2002-01-10 21:54         ` Robert A Duff
2002-01-11  4:49           ` Robert Dewar
2002-01-11 13:35             ` Robert A Duff
2002-01-11 19:18               ` Robert Dewar
2002-01-16 11:48           ` Arnaud Charlet
2002-01-05  0:40     ` Robert Dewar
2002-01-07 13:28       ` Frode Tenneboe
2002-01-11 19:25         ` Robert Dewar
2001-11-29 13:13 ` Stephen Leake
2001-11-29 13:17 ` Stephen Leake
2001-11-30 12:44   ` Simon Wright
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox