[multiple changes]
authorArnaud Charlet <charlet@gcc.gnu.org>
Wed, 16 Jul 2014 14:41:29 +0000 (16:41 +0200)
committerArnaud Charlet <charlet@gcc.gnu.org>
Wed, 16 Jul 2014 14:41:29 +0000 (16:41 +0200)
2014-07-16  Gary Dismukes  <dismukes@adacore.com>

* g-rewdat.adb, g-rewdat.ads: Minor reformatting.

2014-07-16  Doug Rupp  <rupp@adacore.com>

* s-interr-hwint.adb: Casing error on parameter.

2014-07-16  Pascal Obry  <obry@adacore.com>

* Makefile.rtl: Add g-rewdat.o dependencies in
GNATRTL_NONTASKING_OBJS.

2014-07-16  Ed Schonberg  <schonberg@adacore.com>

* sem_case.adb: Code clean up.

From-SVN: r212660

gcc/ada/ChangeLog
gcc/ada/Makefile.rtl
gcc/ada/g-rewdat.adb
gcc/ada/g-rewdat.ads
gcc/ada/s-interr-hwint.adb
gcc/ada/sem_case.adb

index b1be626..57c59f4 100644 (file)
@@ -1,3 +1,20 @@
+2014-07-16  Gary Dismukes  <dismukes@adacore.com>
+
+       * g-rewdat.adb, g-rewdat.ads: Minor reformatting.
+
+2014-07-16  Doug Rupp  <rupp@adacore.com>
+
+       * s-interr-hwint.adb: Casing error on parameter.
+
+2014-07-16  Pascal Obry  <obry@adacore.com>
+
+       * Makefile.rtl: Add g-rewdat.o dependencies in
+       GNATRTL_NONTASKING_OBJS.
+
+2014-07-16  Ed Schonberg  <schonberg@adacore.com>
+
+       * sem_case.adb: Code clean up.
+
 2014-07-16  Vincent Celier  <celier@adacore.com>
 
        * make.adb: Do not read gnat.adc when gnatmake is invoked
index 6496dc7..25a30e0 100644 (file)
@@ -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) \
index 846ff9d..855f787 100644 (file)
@@ -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)),
index 4fc8afd..b525192 100644 (file)
@@ -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
index 5f5961c..654efdc 100644 (file)
@@ -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;
 
    -----------------------
index 3a2f815..30e79b2 100644 (file)
@@ -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.
-
-      if Has_Aspect (Bounds_Type, Aspect_Static_Predicate) then
+      --  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.
+
+      --  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;