Version 1.1 of ai05s/ai05-0272-1.txt
!standard 13.12.1(6/2) 11-11-13 AI05-0272-1/01
!standard 13.12.1(7/2)
!class Amendment 11-11-13
!status work item 11-11-13
!status received 11-09-11
!priority Low
!difficulty Easy
!subject Pragma and Attribute restrictions
!summary
Two new restrictions are defined:
pragma Restrictions(No_Use_Of_Attribute => <attribute-identifier>);
pragma Restrictions(No_Use_Of_Pragma => <pragma-identifier>);
!problem
Restrictions can be useful, but it is burdensome to create distinct restrictions
for every attribute or pragma that might want to be restricted. Would it make
sense to define general restrictions, analogous to No_Dependence and
No_Specification_Of_Aspect, which allow individual attributes or pragmas
to be restricted?
!proposal
(See wording.)
!wording
Add after 13.12.1(6/2):
No_Use_Of_Attribute
Identifies an attribute for which no attribute_reference
or attribute_definition_clause is given.
No_Use_Of_Pragma
Identifies a pragma which is not to be used.
Add after 13.12.1(7/2):
The restriction_parameter_argument of a No_Use_Of_Attribute restriction
shall be an identifier or one of the reserved words Access, Delta, Digits
or Range.
The restriction_parameter_argument of a No_Use_Of_Pragma restriction
shall be an identifier.
AARM note:
Ramification: The restriction_parameter_argument is not resolved for these
Restrictions.
As for No_Dependence, there is no check that the attribute or pragma identifier is
meaningful; it might refer to an implementation-defined attribute or pragma on one
implementation, but nothing at all on another implementation. Of course,
a good implementation will warn if the identifier is unknown to it.
!discussion
Note that No_Use_Of_Attribute and No_Use_Of_Pragma can be used for both
language-defined and implementation-defined attributes and pragmas.
!example
pragma Restrictions(No_Use_Of_Attribute => Unrestricted_Access);
pragma Restrictions(No_Use_Of_Pragma => Import);
!appendix
From: Robert Dewar
Sent: Sunday, September 11, 2011 9:29 AM
I am thinking of implementing restrictions No_Use_Of_Attribute and No_Use_Of_Pragma
(analogous to the newly defined No_Specification_Of_Aspect), since it seems quite useful
to be able to enforce coding restrictions that disallow certain pragmas and attributes.
Thoughts? Are these the right names?
Of course I know that we can do this anyway, but it seems worth getting ARG input in case
there is agreement that this makes sense, for possible inclusion in the standard later.
****************************************************************
Questions? Ask the ACAA Technical Agent