Version 1.1 of acs/ac-00022.txt

Unformatted version of acs/ac-00022.txt version 1.1
Other versions for file acs/ac-00022.txt

!standard B.01(06)          02-01-07 AC95-00022/01
!class confirmation 02-01-07
!status received no action 02-01-07
!subject Query about placement of pragma Export
!summary
!appendix

From: Gary Dismukes
Sent: Thursday, January 3, 2002 2:16 PM

We have a customer that would like us to allow pragma Export
on subprograms in additional contexts beyond what the RM seems
to allow.  In particular, they would like to be able to nest
it inside subprogram bodies.  Actually they would prefer that
Export be allowed to follow library subprogram bodies, but that's
not allowed for program unit pragmas.  They have a large number
of library subprograms and their old Ada 83 compiler had been
extended to support Export and allowed such placement, and they'd
rather not to have to create separate declarations for each
library subprogram.

Now program unit pragmas can normally be nested immediately
within a declaration (e.g., pragma Inline in a subprogram body
without a preceding declaration), but in the case of Export the
name is required to be a local_name, implying that it can't
be nested.  This restriction makes sense in terms of freezing
rules, but it would be convenient to allow it in that context,
and would probably be fairly easy for compilers to support.
We've heard that the Rational compiler allows Export in that
context (can you confirm Pascal?), and it would be interesting
to find out whether other compilers allow it.

What do others in the ARG think about this?  If it seems reasonable
to consider this extension then I'll make a posting to ada-comment.

****************************************************************

From: Pascal Leroy
Sent: Friday, January 4, 2002 4:39 AM

It turns out that we allow Export in a subprogram body, but only if that
subprogram is a library unit.  I definitely view this as a bug, which needs
fixing.  As a matter of fact, if the subprogram body is not a library unit
(e.g. if it is nested within a package) we reject a pragma Export appearing in
its body.  It happens that we go through two different code paths, and one of
them forgets to freeze the subprogram.

I am very reluctant to weaken the freezing rules, as our compiler makes a lot
of decisions when it encounters the freezing point of an entity.  Changing this
would be possible, but certainly not "fairly easy".  And it seems to me that
the user benefits are not worth the change.

****************************************************************

From: Robert Dewar
Sent: Friday, January 4, 2002 6:32 AM

Given Pascal's strong sentiment that this is a bug (that Rational accepts
this construct), I would say let's just agree this should be illegal. The
reason our user would like this to work is that it worked on Rational, so
if Pascal considers this a bug, we are not particularly eager to go down
this road either :-)

Can I suggest that an ACVC test be added to check that a pragma Export
in the body of a subprogram is properly rejected.

****************************************************************

From: Pascal Leroy
Sent: Friday, January 4, 2002  9:22 AM

> Given Pascal's strong sentiment that this is a bug (that Rational accepts
> this construct), I would say let's just agree this should be illegal.

Agreed.  I just fixed it.

> Can I suggest that an ACVC test be added to check that a pragma Export
> in the body of a subprogram is properly rejected.

A thing of wonder and beauty!  Robert is asking for more ACATS tests! ;-)

****************************************************************

From: Robert Dewar
Sent: Friday, January 4, 2002  9:27 AM

:-)

In this particular case, the addition of the ACATS test would have saved us
and our customer quite a bit of extra work :-)

(as you know, I am always more sympathetic to tests that come from real
customer problems, as opposed to imaginary ones :-)

****************************************************************

Questions? Ask the ACAA Technical Agent