Version 1.1.1.1 of ais/ai-00074.txt

Unformatted version of ais/ai-00074.txt version 1.1.1.1
Other versions for file ais/ai-00074.txt

!standard 06.03.02 (02)          96-07-23 AI95-00074/01
!class confirmation 95-07-27
!status WG9 approved 96-12-07
!status ARG approved 9-0-0 96-06-17
!status work item 96-04-04
!status received 95-07-27
!priority Medium
!difficulty Easy
!subject Pragma Inline Requires an Argument
!summary 95-07-27
A pragma Inline must have at least one argument.
!question 95-07-27
10.1.5(2), "if there are no names given as arguments..." and 10.1.5(5), "if any", are worded to allow program unit pragmas with no arguments. Pragma Inline is a program unit pragma. Does this imply that the argument to pragma Inline is optional? (No.)
!response 95-07-27
A pragma Inline must have at least one pragma_argument_association (consisting of a name). This follows from the syntax rules in 6.3.2(3).
The wording of 10.1.5 allows for the no-argument case, because some program unit pragmas do not require a name (Elaborate_Body, for example).
Note that if an argumentless pragma Inline were allowed, then it would only be allowed immediately within a subprogram_body with no corresponding spec.
!appendix

!section 06.03.02(02)
!subject is the argument to pragma inline optional?
!reference RM95-06.03.02(02)
!reference RM95-06.03.02(03)
!reference RM95-10.01.05(02)
!reference RM95-10.01.05(05)
!from Dan Eilers 95-07-13
!reference as: 95-5221.a Dan Eilers  95-7-13>>
!discussion
RM 10.1.5(2) "if there are no names given as arguments..."
and RM 10.1.5(5) "if any", could be easily interpreted to mean that
the arguments are optional for program unit pragmas.  Is this
intended (particularly for pragma inline)?  (It would seem reasonable).

This interpretation is contradicted by the syntax in RM 6.3.2(3)
which indicates that the argument to pragma inline is not optional.

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

!section 10.01.05(02)
!subject Pragma Inline Requires an Argument
!reference AI95-00074
!reference RM95-10.01.05(02)
!reference RM95-10.01.05(05)
!from Dan Eilers 95-10-28
!keywords program unit pragmas
!reference 95-5368.a Dan Eilers  95-10-28>>
!discussion

I suspect that it isn't a coincidence that all the non-library-unit
program unit pragmas (Inline, Convention, Import and Export) require
an argument.  Instead, I suspect that 10.1.5(5) and the corresponding
"no name given" wording in 10.1.5(2) are intended to apply only to
library-unit pragmas, not all program-unit pragmas.

Otherwise, not only would the non-library-unit program unit pragmas
seem to allow optional arguments, but they would apparently be allowed
to appear within the designated program unit.  And it wouldn't make sense
that the restrictions of 10.1.5(6) regarding what the argument designates
are missing from 10.1.5(5).

> Note that if an argumentless pragma Inline were allowed, then it would
> only be allowed immediately within a subprogram_body with no
> corresponding spec.

This is only true if the rules of 10.1.5(6) are also intended to
apply to 10.1.5(5).

-- Dan Eilers

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

Questions? Ask the ACAA Technical Agent