From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,baa6871d466e5af9 X-Google-Attributes: gid103376,public From: dewar@merv.cs.nyu.edu (Robert Dewar) Subject: Re: AQ&S Guidance on pragma Elaborate_Body Date: 1997/04/24 Message-ID: #1/1 X-Deja-AN: 237091732 References: <528878564wnr@diphi.demon.co.uk> Organization: New York University Newsgroups: comp.lang.ada Date: 1997-04-24T00:00:00+00:00 List-Id: Responding To Bob Duff's example generic package G1 is ... end G1; package body G1 is ... end G1; generic package G2 is ... end G2; with G1; package body G2 is package Inst_1 is new G1; end G2; with G2; pragma Elaborate(G2); package P is package Inst_2 is new G2; end P; Matthew Heaney asks But isn't G2 supposed to elaborate G1? with G1; pragma Elaborate (G1); <<<--- package body G2 is package Inst_1 is new G1; end G2; Isn't G2 supposed to take care of it's own business, and make sure G1 is elaborated? This is analogous to P making sure G2 is elaborated. Robert Dewar replies In general the answer is no. G2 has no elaboration problem (generic packages themselves require nothing to be elaborated). It is the instance of G2 that might need elaboration. If no one ever instantiates G2 in elaboration code, then there is absolutely no need to elaborate the body of G1 before the spec of G2. This requirement comes from the fact that P instantiates G2 at elaboration time. Thus P must take responsibility for the elaboration, and do a pragma Elaborate_All, rather than a pragma Elaborate. Note: This is exactly the kind of automatic Elaborate_All that the new version of GNAT does by default. It will also on request output warnings for missing Elaborate_All pragmas.