Version 1.1 of ai12s/ai12-0241-1.txt

Unformatted version of ai12s/ai12-0241-1.txt version 1.1
Other versions for file ai12s/ai12-0241-1.txt

!standard 9.6.1(2/3)          17-12-14 AI12-0241-1/00
!standard 9.6.1(5/4)
!standard 9.6.1(7/3)
!class Amendment 17-12-14
!status work item 17-12-14
!status received 17-12-14
!priority Low
!difficulty Easy
!subject Specifying Nonblocking for Language-Defined Units
Aspect Nonblocking is specified for language-defined units as needed to keep compatibility with Ada 2012.
AI12-0064-2 defines aspect Nonblocking, and defines language-defined routines with aspect Nonblocking => False as "potentially blocking" (rather a vague English language definition). That means that aspect Nonblocking needs to be specified for many language-defined units and subprograms.
(See Summary.)
** TBD.
This AI was split from the original AI12-0064-2 to keep the size of that AI managable.
These wording changes are just the adding of appropriate aspect clauses, and and in a few cases, the deletion of the English text that says something is potentially blocking.
If a language-defined package needs to add Nonblocking, any pragma will also be changed to the aspect form at the same time. [Author's note: I've discussed this issue with John; he mainly does not want that to happen for an empty package. The only empty language-defined package is Ada, and that is Pure so no change is needed at this time.]
For instance, we'll change
package Ada.Command_Line is pragma Preelaborate(Command_Line);
package Ada.Command_Line with Preelaborate, Nonblocking is
[Lengthy Editor's note:
We intend that language-defined subprograms are nonblocking unless this Standard says otherwise. Specifically, 9.5.1(18) said (before we deleted it above):
Certain language-defined subprograms are potentially blocking. In particular, the subprograms of the language-defined input-output packages that manipulate files (implicitly or explicitly) are potentially blocking. Other potentially blocking subprograms are identified where they are defined. When not specified as potentially blocking, a language-defined subprogram is nonblocking.
Non-generic units that are pure are automatically nonblocking as specified in 9.5 (these are noted below). Other units should explicitly have aspect Nonblocking specified.
We'll handle the containers in AI12-0112-1 (the AI that defines preconditions for the container operations); it probably makes the most sense to add all of the contracts at once for those.
The entire list of non-container units is:
Ada - A.2 - Pure Ada.Assertions 11.4.2 - Pure Ada.Asynchronous_Task_Control D.11 - Nonblocking => True Ada.Calendar 9.6 - Nonblocking => True Ada.Calendar.Arithmetic 9.6.1 - Nonblocking => True Ada.Calendar.Formatting 9.6.1 - Nonblocking => True Ada.Calendar.Time_Zones 9.6.1 - Nonblocking => True Ada.Characters A.3.1 - Pure Ada.Conversions A.3.4 - Pure Ada.Handling A.3.2 - Pure Ada.Latin_1 A.3.3 - Pure Ada.Command_Line A.15 - Nonblocking => True Ada.Complex_Text_IO G.1.3 - Nonblocking => False (** String routines) Ada.Decimal F.2 - Pure Ada.Direct_IO A.8.4 - Nonblocking => False (I/O) Ada.Directories A.16 - Nonblocking => False (I/O) - Full_Name through Compose should have Nonblocking => True (as they are just string manipulation routines). Ada.Directories.Hierarchical_File_Names A.16.1 - Nonblocking => True (these are all string manipulation routines). Ada.Directories.Information A.16 - (**** Impl def) Ada.Dispatching D.2.1 - Nonblocking => False (For Yield by the second sentence of D.2.1(7/3), which should be deleted. There are no other subprograms here.) Ada.Dispatching.EDF D.2.6 - Nonblocking => True - Delay_Until_and_Set_Deadline has Nonblocking => False. -- (This wording is missing from the RM,
-- so we don't have to delete it.) (***** AB.)
Ada.Dispatching.Non_Preemptive D.2.4 - Nonblocking => True -- AARM Note D.2.4(2.b/3) confirms this for Yield_to_Higher.
-- Yield_to_Same_or_Higher is a rename, and gets the value from the original routine.
Ada.Dispatching.Round_Robin D.2.5 - Nonblocking => True (***** AB.) Ada.Dynamic_Priorities D.5.1 - Nonblocking => True (***** AB.) Ada.Environment_Variables A.17 - Nonblocking => True Ada.Exceptions 11.4.1 - Nonblocking => True Ada.Execution_Time D.14 - Nonblocking => True Ada.Execution_Time.Group_Budgets D.14.2 - Nonblocking => True Ada.Execution_Time.Interrupts D.14.3 - Nonblocking => True Ada.Execution_Time.Timers D.14.1 - Nonblocking => True Ada.Finalization 7.6 - Nonblocking => False (*** user overriding) Ada.Float_Text_IO A.10.9 - Nonblocking => False (** String routines) Ada.Float_Wide_Text_IO A.11 - Nonblocking => False (** String routines) Ada.Float_Wide_Wide_Text_IO A.11 - Nonblocking => False (** String routines) Ada.Integer_Text_IO A.10.8 - Nonblocking => False (** String routines) Ada.Integer_Wide_Text_IO A.11 - Nonblocking => False (** String routines) Ada.Integer_Wide_Wide_Text_IO A.11 - Nonblocking => False (** String routines) Ada.Interrupts C.3.2 - Nonblocking => True Ada.Interrupts.Names C.3.2 - (**** Impl def) Ada.IO_Exceptions A.13 - Pure Ada.Iterator_Interfaces 5.5.1 - Nonblocking => False (this declares interfaces used elsewhere, and we have to allow blocking in the
-- implemented routines. This is annoying; we may have to make a separate nonblocking version for the parallel stuff)
Ada.Locales A.19 - Nonblocking => True Ada.Numerics A.5 - Pure Ada.Numerics.Complex_Arrays G.3.2 - Pure Ada.Numerics.Complex_Elementary_Functions G.1.2 - Pure Ada.Numerics.Complex_Types G.1.1 - Pure Ada.Numerics.Discrete_Random A.5.2 - Nonblocking => True Ada.Numerics.Elementary_Functions A.5.1 - Pure Ada.Numerics.Float_Random A.5.2 - Nonblocking => True Ada.Numerics.Generic_Complex_Arrays G.3.2 - Nonblocking => True (generic with a formal package, but all matching instances have to have Nonblocking True) Ada.Numerics.Generic_Complex_Elementary_Functions G.1.2 - Nonblocking => True (generic with a formal package, but all matching instances have to have Nonblocking True) Ada.Numerics.Generic_Complex_Types G.1.1 - Nonblocking => True (Pure but generic) Ada.Numerics.Generic_Elementary_Functions A.5.1 - Nonblocking => True (Pure but generic) Ada.Numerics.Generic_Real_Arrays G.3.1 - Nonblocking => True (Pure but generic) Ada.Numerics.Real_Arrays G.3.1 - Pure Ada.Real_Time D.8 - Nonblocking => True Ada.Real_Time.Timing_Events D.15 - Nonblocking => True (confirmed by note D.15(48/2)). Ada.Sequential_IO A.8.1 - Nonblocking => False (I/O) Ada.Storage_IO A.9 - Nonblocking => False (I/O) Ada.Streams 13.13.1 - Nonblocking => False (*** user overriding) Ada.Streams.Stream_IO A.12.1 - Nonblocking => False (I/O) Ada.Strings A.4.1 - Pure Ada.Strings.Bounded A.4.4 - Nonblocking => True Ada.Strings.Bounded.Equal_Case_Insensitive A.4.10 - Nonblocking => True (generic with a formal package, but all matching instances have to have Nonblocking True) Ada.Strings.Bounded.Hash A.4.9 - Nonblocking => True (generic with a formal package, but all matching instances have to have Nonblocking True) Ada.Strings.Bounded.Hash_Case_Insensitive A.4.9 - Nonblocking => True (generic with a formal package, but all matching instances have to have Nonblocking True) Ada.Strings.Bounded.Less_Case_Insensitive A.4.10 - Nonblocking => True (generic with a formal package, but all matching instances have to have Nonblocking True) Ada.Strings.Fixed A.4.3 - Nonblocking => True Ada.Strings.Fixed.Equal_Case_Insensitive A.4.10 - Pure (from a rename) Ada.Strings.Fixed.Hash A.4.9 - Pure Ada.Strings.Fixed.Hash_Case_Insensitive A.4.9 - Pure Ada.Strings.Fixed.Less_Case_Insensitive A.4.10 - Pure Ada.Strings.Equal_Case_Insensitive A.4.10 - Pure Ada.Strings.Hash A.4.9 - Pure Ada.Strings.Hash_Case_Insensitive A.4.9 - Pure Ada.Strings.Less_Case_Insensitive A.4.10 - Pure Ada.Strings.Maps A.4.2 - Pure Ada.Strings.Maps.Constants A.4.6 - Pure Ada.Strings.Unbounded A.4.5 - Nonblocking => True Ada.Strings.Unbounded.Equal_Case_Insensitive A.4.10 - Nonblocking => True Ada.Strings.Unbounded.Hash A.4.9 - Nonblocking => True Ada.Strings.Unbounded.Hash_Case_Insensitive A.4.9 - Nonblocking => True Ada.Strings.Unbounded.Less_Case_Insensitive A.4.10 - Nonblocking => True Ada.Strings.UTF_Encoding A.4.11 - Pure Ada.Strings.UTF_Encoding.Conversions A.4.11 - Pure Ada.Strings.UTF_Encoding.Strings A.4.11 - Pure Ada.Strings.UTF_Encoding.Wide_Strings A.4.11 - Pure Ada.Strings.UTF_Encoding.Wide_Wide_Strings A.4.11 - Pure Ada.Strings.Wide_Bounded A.4.7 - Nonblocking => True Ada.Strings.Wide_Bounded.Wide_Equal_Case_Insensitive A.4.7 - Nonblocking => True (generic with a formal package, but all matching instances have to have Nonblocking True) Ada.Strings.Wide_Bounded.Wide_Hash A.4.7 - Nonblocking => True (generic with a formal package, but all matching instances have to have Nonblocking True) Ada.Strings.Wide_Bounded.Wide_Hash_Case_Insensitive A.4.7 - Nonblocking => True (generic with a formal package, but all matching instances have to have Nonblocking True) Ada.Strings.Wide_Equal_Case_Insensitive A.4.7 - Pure Ada.Strings.Wide_Fixed A.4.7 - Nonblocking => True Ada.Strings.Wide_Fixed.Wide_Equal_Case_Insensitive A.4.7 - Pure (from a rename) Ada.Strings.Wide_Fixed Wide_Hash A.4.7 - Pure Ada.Strings.Wide_Fixed Wide_Hash_Case_Insensitive A.4.7 - Pure Ada.Strings.Wide_Hash A.4.7 - Pure Ada.Strings.Wide_Hash_Case_Insensitive A.4.7 - Pure Ada.Strings.Wide_Maps A.4.7 - Nonblocking => True Ada.Strings.Wide_Maps.Wide_Constants A.4.7 - Nonblocking => True Ada.Strings.Wide_Unbounded A.4.7- Nonblocking => True Ada.Strings.Wide_Unbounded.Wide_Equal_Case_Insensitive A.4.7- Nonblocking => True Ada.Strings.Wide_Unbounded.Wide_Hash A.4.7- Nonblocking => True Ada.Strings.Wide_Unbounded.Wide_Hash_Case_Insensitive A.4.7- Nonblocking => True Ada.Strings.Wide_Wide_Bounded A.4.8 - Nonblocking => True Ada.Strings.Wide_Wide_Bounded.Wide_Wide_Equal_Case_Insensitive A.4.8 - Nonblocking => True (generic with a formal package, but all matching instances have to have Nonblocking True) Ada.Strings.Wide_Wide_Bounded.Wide_Wide_Hash A.4.8 - Nonblocking => True (generic with a formal package, but all matching instances have to have Nonblocking True) Ada.Strings.Wide_Wide_Bounded.Wide_Wide_Hash_Case_Insensitive A.4.8 - Nonblocking => True (generic with a formal package, but all matching instances have to have Nonblocking True) Ada.Strings.Wide_Wide_Equal_Case_Insensitive A.4.8 - Pure Ada.Strings.Wide_Wide_Fixed A.4.8 - Nonblocking => True Ada.Strings.Wide_Wide_Fixed.Wide_Wide_Equal_Case_Insensitive A.4.8 - Pure (from a renames) Ada.Strings.Wide_Wide_Fixed.Wide_Wide_Hash A.4.8 - Pure Ada.Strings.Wide_Wide_Fixed.Wide_Wide_Hash_Case_Insensitive A.4.8 - Pure Ada.Strings.Wide_Wide_Hash A.4.8 - Pure Ada.Strings.Wide_Wide_Hash_Case_Insensitive - A.4.8 - Pure Ada.Strings.Wide_Wide_Maps A.4.8 - Nonblocking => True Ada.Strings.Wide_Wide_Maps.Wide_Wide_Constants A.4.8 - Nonblocking => True Ada.Strings.Wide_Wide_Unbounded A.4.8 - Nonblocking => True Ada.Strings.Wide_Wide_Unbounded.Wide_Wide_Equal_Case_Insensitive A.4.8 - Nonblocking => True Ada.Strings.Wide_Wide_Unbounded.Wide_Wide_Hash A.4.8 - Nonblocking => True Ada.Strings.Wide_Wide_Unbounded.Wide_Wide_Hash_Case_Insensitive A.4.8 - Nonblocking => True Ada.Synchronous_Barriers D.10.1 - Nonblocking => True (Wait_For_Release has Nonblocking => False by D.10.1(14/3); that paragraph should be deleted). Ada.Synchronous_Task_Control D.10 - Nonblocking => True (Suspend_Until_True has Nonblocking => False by D.10(10), that sentence should be deleted). Ada.Synchronous_Task_Control.EDF D.10 - Nonblocking => False (by D.10(10.1/3), that sentence should be deleted.) Ada.Tags 3.9 - Nonblocking => True Ada.Tags.Generic_Dispatching_Constructor 3.9 - Nonblocking => Constructor'Nonblocking (* generic) Ada.Task_Attributes C.7.2 - Nonblocking => True Ada.Task_Identification C.7.1 - Nonblocking => True (Abort_Task has Nonblocking => False by C.7.1(16); that paragraph should be deleted) Ada.Task_Termination C.7.3 - Nonblocking => True Ada.Text_IO A.10.1 - Nonblocking => False (** String routines) Ada.Text_IO.Bounded_IO A.10.11 - Nonblocking => False -- I/O Ada.Text_IO.Complex_IO G.1.3 - Nonblocking => False -- I/O Ada.Text_IO.Editing F.3.3 - Nonblocking => False (** String routines) Ada.Text_IO.Text_Streams A.12.2 - Nonblocking => False Ada.Text_IO.Unbounded_IO A.10.12 - Nonblocking => False Ada.Unchecked_Conversion 13.9 - Nonblocking => True (Pure but generic) Ada.Unchecked_Deallocate_Subpool 13.11.5 - Nonblocking => False (*** user calls) Ada.Unchecked_Deallocation 13.11.2 - Nonblocking => True Ada.Wide_Characters A.3.1 - Pure Ada.Wide_Characters.Handling A.3.5 - Pure Ada.Wide_Text_IO A.11 - Nonblocking => False (** String routines) Ada.Wide_Text_IO.Complex_IO G.1.4 - Nonblocking => False -- I/O Ada.Wide_Text_IO.Editing F.3.4 - Nonblocking => False (** String routines) Ada.Wide_Text_IO.Text_Streams A.12.3 - Nonblocking => False Ada.Wide_Text_IO.Wide_Bounded_IO A.11 - Nonblocking => False -- I/O Ada.Wide_Text_IO.Wide_Unbounded_IO A.11 - Nonblocking => False Ada.Wide_Wide_Characters A.3.1 - Pure Ada.Wide_Wide_Characters.Handling A.3.6 - Pure Ada.Wide_Wide_Text_IO A.11 - Nonblocking => False (** String routines) Ada.Wide_Wide_Text_IO.Complex_IO G.1.4 - Nonblocking => False -- I/O Ada.Wide_Wide_Text_IO.Editing F.3.4 - Nonblocking => False (** String routines) Ada.Wide_Wide_Text_IO.Text_Streams A.12.3 - Nonblocking => False Ada.Wide_Wide_Text_IO.Wide_Wide_Bounded_IO A.11 - Nonblocking => False -- I/O Ada.Wide_Wide_Text_IO.Wide_Wide_Unbounded_IO A.11 - Nonblocking => False Interfaces B.2 - Pure Interfaces.C B.3 - Pure Interfaces.C.Pointers B.3.2 - Nonblocking => True Interfaces.C.Strings B.3.1 - Nonblocking => True Interfaces.COBOL B.4 - Nonblocking => True Interfaces.Fortran B.5 - Pure System 13.7 - Pure System.Address_To_Access_Conversions 13.7.2 - Nonblocking => True System.Machine_Code 13.8 - (**** Impl def) System.Multiprocessors D.16 - Nonblocking => True System.Multiprocessors.Dispatching_Domains D.16.1 - Nonblocking => True System.RPC E.5 - Nonblocking => False (E.5(23) says this explicitly; that paragraph should be deleted.) System.Storage_Elements 13.7.1 - Pure System.Storage_Pools 13.11 - Nonblocking => False (*** user overriding) System.Storage_Pools.Subpools 13.11.4 - Nonblocking => False (*** user overriding)
Items marked "Pure" are pure, and thus automatically are Nonblocking.
Items marked "(* generic)" have Nonblocking given as a formula. This automatically matches the nonblocking setting to that of the actual parameters (see the !discussion for more on this). The containers will be like this as well.
Items marked "(** String routines)" have Get/Put routines that operate only on Strings -- those explicitly have Nonblocking => True specified. That's in accordance with the AARM note 9.5.1(18.a) (and an old AI).
Items marked "(*** user overriding)" are mainly used to provide a framework for user code (as in storage pools or streams). Since all dispatching calls have to "assume the worst" for nonblocking, and we have to keep compatibility with existing Ada code, we cannot make such packages (and types) nonblocking. The user can explicitly mark their overriding routines Nonblocking (overridings of "allows blocking" subprograms can be declared nonblocking, but the other way around is prohibited).
Items marked "(*** user calls)" make calls on code that is potentially user-defined via dispatching. These usually work in conjunction with types declared in packages associated with the previous item.
Items marked "(**** impl def)" have implementation-defined contents, so we need say nothing.
Items marked "(**** AB)" were verified with Alan Burns. Since explicit wording is needed in Ada 2012 to specify that a routine is potentially blocking, the lack of such wording could mean either that the subprogram was considered and should be nonblocking, or that no one considered whether the subprogram needs to be potentially blocking. As such, I verified with Alan Burns whether any packages that have no evidence that nonblocking was considered need to be explicitly potentially blocking (see e-mail of January 11, 2017, and the reply). In particular, Ada.Dispatching.EDF.Delay_Until_and_Set_Deadline, which includes the semantics of a delay statement, needs to be potentially blocking but isn't declared this way in the RM.
End lengthy editor's note.]
No ASIS effect.
!ACATS test
ACATS B-Tests can be written to check that language-defined subprograms with Nonblocking set to False cannot be called from a subprogram with Nonblocking => True.


Questions? Ask the ACAA Technical Agent