+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
g-rannum$(objext) \
g-regexp$(objext) \
g-regpat$(objext) \
+ g-rewdat$(objext) \
g-sechas$(objext) \
g-sehamd$(objext) \
g-sehash$(objext) \
(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.
------------
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)),
-- --
------------------------------------------------------------------------------
--- 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
-- 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");
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)
(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
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;
-----------------------
-- --
------------------------------------------------------------------------------
-with Aspects; use Aspects;
with Atree; use Atree;
with Einfo; use Einfo;
with Errout; use Errout;
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;
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;