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.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,e14364d52e5cbe8d X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII Path: g2news1.google.com!postnews.google.com!m35g2000prn.googlegroups.com!not-for-mail From: Adam Beneschan Newsgroups: comp.lang.ada Subject: Re: Elaboration query Date: Thu, 22 Jul 2010 19:10:33 -0700 (PDT) Organization: http://groups.google.com Message-ID: References: NNTP-Posting-Host: 66.126.103.122 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: posting.google.com 1279851033 11681 127.0.0.1 (23 Jul 2010 02:10:33 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Fri, 23 Jul 2010 02:10:33 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: m35g2000prn.googlegroups.com; posting-host=66.126.103.122; posting-account=duW0ogkAAABjRdnxgLGXDfna0Gc6XqmQ User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0; WOW64; SLCC1; .NET CLR 2.0.50727; Media Center PC 5.0; .NET CLR 3.5.21022; .NET CLR 3.5.30729; .NET CLR 3.0.30618; .NET4.0C),gzip(gfe) Xref: g2news1.google.com comp.lang.ada:12493 Date: 2010-07-22T19:10:33-07:00 List-Id: On Jul 22, 5:17=A0pm, "(see below)" wrote: > I have a package which is a grandchild, and GNAT issues elaboration warni= ngs > on its body, thus: > > > > > > > with IOC.shift; pragma Elaborate_All(IOC.shift); > > package body IOC.shift.TR is > > ... > > =A0 =A0overriding > > =A0 =A0procedure Initialize (the_reader : in out IOC.shift.TR.device) i= s > > =A0 =A0begin > > =A0 =A0 =A0 ... > > =A0 =A0 =A0 open(...); > > =A0 =A0 =A0 | > >>>> info: call to "open" during elaboration > >>>> info: implicit pragma Elaborate_All for "IO" generated > >>>> warning: "Initialize" called at line 31 > >>>> warning: call to "open" in elaboration code requires pragma Elaborat= e_All > >>>> on "IO" > > =A0 =A0... > > =A0 =A0end Initialize; ... > > end IOC.shift.TR; > > The "open" operation it is complaining about is in the the IO package. > > The ancestors of IOC.shift.TR begin thus: > > > with IOC; pragma Elaborate_All(IOC); > > package IOC.shift is ... > > and: > > > with IO; pragma Elaborate_All(IO); > > package IOC is ... > > How do I get rid of the warning? > > I cannot put an explicit "pragma Elaborate_All(IO)" in IOC.shift.TR, beca= use > it does not "with" IO. > > Surely I should not have to "with" IO all the way down the parent/child > hierarchy? What am I doing wrong? If you want to reference "IO" in a pragma in the context clause, then yes, you do have to WITH it in the same context clause. This is because the visibility rules are different in context clauses. See 10.1.6, especially 10.1.6(3). I can understand why you think you "shouldn't have to" do this, because you don't have to do it when referencing IO inside the child package body. But the rules are different here. Sorry. -- Adam