diff options
author | Justin Squirek <squirek@adacore.com> | 2019-08-21 08:29:23 +0000 |
---|---|---|
committer | Pierre-Marie de Rodat <pmderodat@gcc.gnu.org> | 2019-08-21 08:29:23 +0000 |
commit | df2d2fe0ee88ae01866e2437e00db0ccbea25c71 (patch) | |
tree | c42b70e7ad355b23c6053b93037eded6fd55990d /gcc/ada | |
parent | 1e78c638a7846b3c96c80b920ab38416abd35997 (diff) | |
download | gcc-df2d2fe0ee88ae01866e2437e00db0ccbea25c71.zip gcc-df2d2fe0ee88ae01866e2437e00db0ccbea25c71.tar.gz gcc-df2d2fe0ee88ae01866e2437e00db0ccbea25c71.tar.bz2 |
[Ada] Max_Entry_Queue_Length aspect for protected entries
Allow values of negative one to be accepted as a valid parameter as a
special case.
2019-08-21 Justin Squirek <squirek@adacore.com>
gcc/ada/
* doc/gnat_rm/implementation_defined_pragmas.rst: Modify
documentation to reflect expected behavior.
* gnat_rm.texi: Regenerate.
* sem_prag.adb (Analyze_Pragma): Modify handling of pragma
Max_Entry_Queue_Length to not reject integer values of negative
one.
* sem_util.adb (Get_Max_Queue_Length): Add processing for values
of negative one to fit within the current scheme.
From-SVN: r274774
Diffstat (limited to 'gcc/ada')
-rw-r--r-- | gcc/ada/ChangeLog | 11 | ||||
-rw-r--r-- | gcc/ada/doc/gnat_rm/implementation_defined_pragmas.rst | 6 | ||||
-rw-r--r-- | gcc/ada/gnat_rm.texi | 10 | ||||
-rw-r--r-- | gcc/ada/sem_prag.adb | 8 | ||||
-rw-r--r-- | gcc/ada/sem_util.adb | 17 |
5 files changed, 39 insertions, 13 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 6273a55..db94319 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,14 @@ +2019-08-21 Justin Squirek <squirek@adacore.com> + + * doc/gnat_rm/implementation_defined_pragmas.rst: Modify + documentation to reflect expected behavior. + * gnat_rm.texi: Regenerate. + * sem_prag.adb (Analyze_Pragma): Modify handling of pragma + Max_Entry_Queue_Length to not reject integer values of negative + one. + * sem_util.adb (Get_Max_Queue_Length): Add processing for values + of negative one to fit within the current scheme. + 2019-08-20 Arnaud Charlet <charlet@adacore.com> * exp_unst.adb (Unnest_Subprograms, Unnest_Subprogram): Take diff --git a/gcc/ada/doc/gnat_rm/implementation_defined_pragmas.rst b/gcc/ada/doc/gnat_rm/implementation_defined_pragmas.rst index 91c2d33..625a38f 100644 --- a/gcc/ada/doc/gnat_rm/implementation_defined_pragmas.rst +++ b/gcc/ada/doc/gnat_rm/implementation_defined_pragmas.rst @@ -3888,8 +3888,10 @@ Syntax:: This pragma is used to specify the maximum callers per entry queue for individual protected entries and entry families. It accepts a single -positive integer as a parameter and must appear after the declaration -of an entry. +integer (-1 or more) as a parameter and must appear after the declaration of an +entry. + +A value of -1 represents no additional restriction on queue length. Pragma No_Body ============== diff --git a/gcc/ada/gnat_rm.texi b/gcc/ada/gnat_rm.texi index dbd299c..d5aa396 100644 --- a/gcc/ada/gnat_rm.texi +++ b/gcc/ada/gnat_rm.texi @@ -1764,9 +1764,9 @@ Syntax: pragma Aggregate_Individually_Assign; @end example -Where possible GNAT will store the binary representation of a record aggregate +Where possible, GNAT will store the binary representation of a record aggregate in memory for space and performance reasons. This configuration pragma changes -this behaviour so that record aggregates are instead always converted into +this behavior so that record aggregates are instead always converted into individual assignment statements. @node Pragma Allow_Integer_Address,Pragma Annotate,Pragma Aggregate_Individually_Assign,Implementation Defined Pragmas @@ -5394,8 +5394,10 @@ pragma Max_Entry_Queue (static_integer_EXPRESSION); This pragma is used to specify the maximum callers per entry queue for individual protected entries and entry families. It accepts a single -positive integer as a parameter and must appear after the declaration -of an entry. +integer (-1 or more) as a parameter and must appear after the declaration of an +entry. + +A value of -1 represents no additional restriction on queue length. @node Pragma No_Body,Pragma No_Caching,Pragma Max_Queue_Length,Implementation Defined Pragmas @anchor{gnat_rm/implementation_defined_pragmas pragma-no-body}@anchor{a1} diff --git a/gcc/ada/sem_prag.adb b/gcc/ada/sem_prag.adb index 4a77451..4ec8611 100644 --- a/gcc/ada/sem_prag.adb +++ b/gcc/ada/sem_prag.adb @@ -19538,7 +19538,7 @@ package body Sem_Prag is | Pragma_Max_Entry_Queue_Depth | Pragma_Max_Queue_Length => - Max_Queue_Length : declare + Max_Entry_Queue_Length : declare Arg : Node_Id; Entry_Decl : Node_Id; Entry_Id : Entity_Id; @@ -19589,9 +19589,9 @@ package body Sem_Prag is Val := Expr_Value (Arg); - if Val <= 0 then + if Val < -1 then Error_Pragma_Arg - ("argument for pragma% must be positive", Arg1); + ("argument for pragma% cannot be less than -1", Arg1); elsif not UI_Is_In_Int_Range (Val) then Error_Pragma_Arg @@ -19609,7 +19609,7 @@ package body Sem_Prag is end if; Record_Rep_Item (Entry_Id, N); - end Max_Queue_Length; + end Max_Entry_Queue_Length; ----------------- -- Memory_Size -- diff --git a/gcc/ada/sem_util.adb b/gcc/ada/sem_util.adb index dcc8d64..f837b6f 100644 --- a/gcc/ada/sem_util.adb +++ b/gcc/ada/sem_util.adb @@ -9752,16 +9752,27 @@ package body Sem_Util is function Get_Max_Queue_Length (Id : Entity_Id) return Uint is pragma Assert (Is_Entry (Id)); Prag : constant Entity_Id := Get_Pragma (Id, Pragma_Max_Queue_Length); + Max : Uint; begin - -- A value of 0 represents no maximum specified, and entries and entry - -- families with no Max_Queue_Length aspect or pragma default to it. + -- A value of 0 or -1 represents no maximum specified, and entries and + -- entry families with no Max_Queue_Length aspect or pragma default to + -- it. if not Present (Prag) then return Uint_0; end if; - return Intval (Expression (First (Pragma_Argument_Associations (Prag)))); + Max := Intval (Expression (First (Pragma_Argument_Associations (Prag)))); + + -- Since -1 and 0 are equivalent, return 0 for instances of -1 for + -- uniformity. + + if Max = -1 then + return Uint_0; + end if; + + return Max; end Get_Max_Queue_Length; ------------------------ |