comp.lang.ada
 help / color / mirror / Atom feed
From: sjw <simon.j.wright@mac.com>
Subject: Re: GNAT requires body of generic unit to be present at build?
Date: Sun, 10 Jan 2010 06:23:43 -0800 (PST)
Date: 2010-01-10T06:23:43-08:00	[thread overview]
Message-ID: <de2ff73f-7d55-4b43-b8f4-18c7fb9969f5@r24g2000yqd.googlegroups.com> (raw)
In-Reply-To: 18c090d0-ab65-45f9-81d3-c4206ee60908@z41g2000yqz.googlegroups.com

On Jan 9, 12:23 pm, xorque <xorquew...@googlemail.com> 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



      reply	other threads:[~2010-01-10 14:23 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-01-09 12:23 GNAT requires body of generic unit to be present at build? xorque
2010-01-10 14:23 ` sjw [this message]
replies disabled

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