From 76241f8f2445434f7e9430d9bb4ccb97f253f96e Mon Sep 17 00:00:00 2001 From: Arnaud Charlet Date: Wed, 16 Jul 2014 16:41:29 +0200 Subject: [PATCH] [multiple changes] 2014-07-16 Gary Dismukes * g-rewdat.adb, g-rewdat.ads: Minor reformatting. 2014-07-16 Doug Rupp * s-interr-hwint.adb: Casing error on parameter. 2014-07-16 Pascal Obry * Makefile.rtl: Add g-rewdat.o dependencies in GNATRTL_NONTASKING_OBJS. 2014-07-16 Ed Schonberg * sem_case.adb: Code clean up. From-SVN: r212660 --- gcc/ada/ChangeLog | 17 +++++++++++++++++ gcc/ada/Makefile.rtl | 1 + gcc/ada/g-rewdat.adb | 4 ++-- gcc/ada/g-rewdat.ads | 23 ++++++++++++----------- gcc/ada/s-interr-hwint.adb | 2 +- gcc/ada/sem_case.adb | 25 ++++++++++++++----------- 6 files changed, 47 insertions(+), 25 deletions(-) diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index b1be626e1a5..57c59f4215f 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,20 @@ +2014-07-16 Gary Dismukes + + * g-rewdat.adb, g-rewdat.ads: Minor reformatting. + +2014-07-16 Doug Rupp + + * s-interr-hwint.adb: Casing error on parameter. + +2014-07-16 Pascal Obry + + * Makefile.rtl: Add g-rewdat.o dependencies in + GNATRTL_NONTASKING_OBJS. + +2014-07-16 Ed Schonberg + + * sem_case.adb: Code clean up. + 2014-07-16 Vincent Celier * make.adb: Do not read gnat.adc when gnatmake is invoked diff --git a/gcc/ada/Makefile.rtl b/gcc/ada/Makefile.rtl index 6496dc7396c..25a30e04e2d 100644 --- a/gcc/ada/Makefile.rtl +++ b/gcc/ada/Makefile.rtl @@ -428,6 +428,7 @@ GNATRTL_NONTASKING_OBJS= \ g-rannum$(objext) \ g-regexp$(objext) \ g-regpat$(objext) \ + g-rewdat$(objext) \ g-sechas$(objext) \ g-sehamd$(objext) \ g-sehash$(objext) \ diff --git a/gcc/ada/g-rewdat.adb b/gcc/ada/g-rewdat.adb index 846ff9dcee8..855f78736ad 100644 --- a/gcc/ada/g-rewdat.adb +++ b/gcc/ada/g-rewdat.adb @@ -40,7 +40,7 @@ package body GNAT.Rewrite_Data is (B : in out Buffer; Data : Stream_Element_Array; Output : not null access procedure (Data : Stream_Element_Array)); - -- Do the actual output, this ensures that we properly send the data + -- Do the actual output. This ensures that we properly send the data -- through linked rewrite buffers if any. ------------ @@ -62,7 +62,7 @@ package body GNAT.Rewrite_Data is function To_SEAV is new Unchecked_Conversion (SV, SEAV); begin - -- Return result (can't be smaller than pattern + -- Return result (can't be smaller than pattern) return B : Buffer (SEO'Max (Size, SEO (Pattern'Length)), diff --git a/gcc/ada/g-rewdat.ads b/gcc/ada/g-rewdat.ads index 4fc8afd6461..b525192f28c 100644 --- a/gcc/ada/g-rewdat.ads +++ b/gcc/ada/g-rewdat.ads @@ -28,7 +28,7 @@ -- -- ------------------------------------------------------------------------------ --- This package can be used to rewrite data on the fly. All occurences of a +-- This package can be used to rewrite data on the fly. All occurrences of a -- string (named pattern) will be replaced by another string. -- It is not necessary to load all data in memory and so this package can be @@ -37,7 +37,7 @@ -- There is no dynamic allocation in the implementation. --- Example, to replace all occurences of "Gnat" with "GNAT": +-- For example, to replace all occurrences of "Gnat" with "GNAT": -- Rewriter : Buffer := Create (Pattern => "Gnat", Value => "GNAT"); @@ -80,12 +80,12 @@ package GNAT.Rewrite_Data is function Create (Pattern, Value : String; Size : Stream_Element_Offset := 1_024) return Buffer; - -- Create a rewriter buffer. Pattern is the string to be rewriten as Value. - -- Size represent the size of the internal buffer used to store the data - -- reeady to be output. A larger buffer may improve the performance as the + -- Create a rewrite buffer. Pattern is the string to be rewritten as Value. + -- Size represents the size of the internal buffer used to store the data + -- ready to be output. A larger buffer may improve the performance, as the -- Output routine (see Write, Rewrite below) will be called only when this - -- buffer is full. Note that Size cannot be lower than Pattern'Length, if - -- this is the case then Size value is set to Pattern'Length. + -- buffer is full. Note that Size cannot be lower than Pattern'Length, and + -- if this is the case, then Size value is set to Pattern'Length. function Size (B : Buffer) return Natural; -- Returns the current size of the buffer (count of Stream_Array_Element) @@ -114,12 +114,13 @@ package GNAT.Rewrite_Data is (Buffer : out Stream_Element_Array; Last : out Stream_Element_Offset); Output : not null access procedure (Data : Stream_Element_Array)); - -- Read data from Input, rewrite it and then call Output. When there is - -- no more data to be read from Input Last must be set to 0. Before leaving - -- this routine call Flush above to send all remaining data to Output. + -- Read data from Input, rewrite it, and then call Output. When there is + -- no more data to be read from Input, Last must be set to 0. Before + -- leaving this routine, call Flush above to send all remaining data to + -- Output. procedure Link (From : in out Buffer; To : Buffer_Ref); - -- Link two rewrite buffers, that is all data sent to From buffer will be + -- Link two rewrite buffers. That is, all data sent to From buffer will be -- rewritten and then passed to the To rewrite buffer. private diff --git a/gcc/ada/s-interr-hwint.adb b/gcc/ada/s-interr-hwint.adb index 5f5961cb912..654efdc3b21 100644 --- a/gcc/ada/s-interr-hwint.adb +++ b/gcc/ada/s-interr-hwint.adb @@ -711,7 +711,7 @@ package body System.Interrupts is procedure Unimplemented (Feature : String) is begin - raise Program_Error with feature & " not implemented on VxWorks"; + raise Program_Error with Feature & " not implemented on VxWorks"; end Unimplemented; ----------------------- diff --git a/gcc/ada/sem_case.adb b/gcc/ada/sem_case.adb index 3a2f815d91a..30e79b25834 100644 --- a/gcc/ada/sem_case.adb +++ b/gcc/ada/sem_case.adb @@ -23,7 +23,6 @@ -- -- ------------------------------------------------------------------------------ -with Aspects; use Aspects; with Atree; use Atree; with Einfo; use Einfo; with Errout; use Errout; @@ -647,6 +646,9 @@ package body Sem_Case is Bounds_Hi : constant Node_Id := Type_High_Bound (Bounds_Type); Bounds_Lo : constant Node_Id := Type_Low_Bound (Bounds_Type); Num_Choices : constant Nat := Choice_Table'Last; + Has_Predicate : constant Boolean := + Is_Static_Subtype (Bounds_Type) + and then Present (Static_Predicate (Bounds_Type)); Choice : Node_Id; Choice_Hi : Uint; @@ -679,17 +681,18 @@ package body Sem_Case is Sorting.Sort (Positive (Choice_Table'Last)); - -- If the type covered by the list of choices is actually a static - -- subtype subject to a static predicate, then the predicate defines - -- subsets of legal values and we must verify that the branches of the - -- case match those subsets. If there is no static_predicate there is no - -- compiler check to perform. In particular we don't want any checks on - -- a case expression that itself appears as the expression of a dynamic - -- predicate. A case expression that defines a static predicate is - -- expanded earlier into a membership test and is not subject to this - -- spurious self-check either. + -- The type covered by the list of choices is actually a static subtype + -- subject to a static predicate. The predicate defines subsets of legal + -- values and requires finer grained analysis. - if Has_Aspect (Bounds_Type, Aspect_Static_Predicate) then + -- Note that in GNAT the predicate is considered static if the predicate + -- expression is static, independently of whether the aspect mentions + -- Static explicitly. It is unclear whether this is RM-conforming, but + -- it's certainly useful, and GNAT source make use of this. The downside + -- is that currently case expressions cannot appear in predicates that + -- are not static. ??? + + if Has_Predicate then Pred := First (Static_Predicate (Bounds_Type)); Prev_Lo := Uint_Minus_1; Prev_Hi := Uint_Minus_1;