comp.lang.ada
 help / color / mirror / Atom feed
* GNAT requires body of generic unit to be present at build?
@ 2010-01-09 12:23 xorque
  2010-01-10 14:23 ` sjw
  0 siblings, 1 reply; 2+ messages in thread
From: xorque @ 2010-01-09 12:23 UTC (permalink / raw)


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?



^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: GNAT requires body of generic unit to be present at build?
  2010-01-09 12:23 GNAT requires body of generic unit to be present at build? xorque
@ 2010-01-10 14:23 ` sjw
  0 siblings, 0 replies; 2+ messages in thread
From: sjw @ 2010-01-10 14:23 UTC (permalink / raw)


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



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-01-10 14:23 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-01-09 12:23 GNAT requires body of generic unit to be present at build? xorque
2010-01-10 14:23 ` sjw

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