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,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: a07f3367d7,d20141731f5d01e1 X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII Path: g2news1.google.com!postnews.google.com!r24g2000yqd.googlegroups.com!not-for-mail From: sjw Newsgroups: comp.lang.ada Subject: Re: GNAT requires body of generic unit to be present at build? Date: Sun, 10 Jan 2010 06:23:43 -0800 (PST) Organization: http://groups.google.com Message-ID: References: <18c090d0-ab65-45f9-81d3-c4206ee60908@z41g2000yqz.googlegroups.com> NNTP-Posting-Host: 82.30.110.254 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: posting.google.com 1263133424 15974 127.0.0.1 (10 Jan 2010 14:23:44 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Sun, 10 Jan 2010 14:23:44 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: r24g2000yqd.googlegroups.com; posting-host=82.30.110.254; posting-account=_RXWmAoAAADQS3ojtLFDmTNJCT0N2R4U User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_2; en-us) AppleWebKit/531.21.8 (KHTML, like Gecko) Version/4.0.4 Safari/531.21.10,gzip(gfe),gzip(gfe) Xref: g2news1.google.com comp.lang.ada:8694 Date: 2010-01-10T06:23:43-08:00 List-Id: On Jan 9, 12:23=A0pm, xorque wrote: > A discussion arose in #ada on irc.freenode.net about GNAT > requiring the body of a generic unit to be present when > compiling code that uses the generic. > > A quote from the Ada 95 issues: > > {AI95-00077-01} {AI95-00114-01} {extensions to Ada 83} Ada 83 > allowed implementations to require that the body of a generic unit be > available when the instantiation is compiled; that permission is > dropped > in Ada 95. This isn't really an extension (it doesn't allow Ada users > to write > anything that they couldn't in Ada 83), but there isn't a more > appropriate > category, and it does allow users more flexibility when developing > programs. > > How come GNAT still requires this? AI95-00077-01 Issue 6 starts by saying "The NOTE in 10.1.4(10), which says that separate compilation of generic bodies is required, is correct. This implies that an implementation must be capable of detecting legality errors in a compilation unit that instantiates a generic unit, without seeing the generic body. It does not imply that the compiler must generate code without seeing the generic body." So compiling with -gnatc (semantic check only) is OK in the absence of a generic body: -- The generic body is present, code generation OK nidhoggr:tests simon$ gnatmake -I../src -c -u -f collection_test_support.ads gcc -c -I../src collection_test_support.ads -- Move the generic body nidhoggr:tests simon$ mv ../src/bc-containers-collections- unbounded.adb ../src/bc-containers-collections-unbounded.adb-- -- Code generation fails nidhoggr:tests simon$ gnatmake -I../src -c -u -f collection_test_support.ads gcc -c -I../src collection_test_support.ads collection_test_support.ads:24:06: body of generic unit "Unbounded" not found gnatmake: "collection_test_support.ads" compilation error -- Semantic checks OK nidhoggr:tests simon$ gnatmake -I../src -c -u -f collection_test_support.ads -gnatc gcc -c -I../src -gnatc collection_test_support.ads