Commit 59262ebb by Arnaud Charlet

[multiple changes]

2009-04-09  Javier Miranda  <miranda@adacore.com>

	* sem_ch3.adb (Build_Derived_Record_Type): Fix typo.
	(Derive_Progenitor_Subprograms): Handle interfaces in subtypes of
	tagged types.

2009-04-09  Robert Dewar  <dewar@adacore.com>

	* s-direio.adb: Minor reformatting

	* exp_ch4.adb (Expand_Concatenate): Avoid overflow checks for String

From-SVN: r145808
parent fa969310
2009-04-09 Javier Miranda <miranda@adacore.com>
* sem_ch3.adb (Build_Derived_Record_Type): Fix typo.
(Derive_Progenitor_Subprograms): Handle interfaces in subtypes of
tagged types.
2009-04-09 Robert Dewar <dewar@adacore.com>
* s-direio.adb: Minor reformatting
* exp_ch4.adb (Expand_Concatenate): Avoid overflow checks for String
2009-04-09 Robert Dewar <dewar@adacore.com> 2009-04-09 Robert Dewar <dewar@adacore.com>
* exp_ch4.adb (Expand_Concatenate): Improve handling of overflow cases * exp_ch4.adb (Expand_Concatenate): Improve handling of overflow cases
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
-- GNAT COMPILER COMPONENTS -- -- GNAT COMPILER COMPONENTS --
-- -- -- --
-- E X P _ C H 4 -- -- E X P _ C H 4 --
-- g -- -- --
-- B o d y -- -- B o d y --
-- -- -- --
-- Copyright (C) 1992-2008, Free Software Foundation, Inc. -- -- Copyright (C) 1992-2008, Free Software Foundation, Inc. --
...@@ -2337,6 +2337,16 @@ package body Exp_Ch4 is ...@@ -2337,6 +2337,16 @@ package body Exp_Ch4 is
if Is_Enumeration_Type (Ityp) then if Is_Enumeration_Type (Ityp) then
Artyp := Standard_Integer; Artyp := Standard_Integer;
-- If index type is Positive, we use the standard unsigned type, to give
-- more room on the top of the range, obviating the need for an overflow
-- check when creating the upper bound. This is needed to avoid junk
-- overflow checks in the common case of String types.
-- ??? Disabled for now
-- elsif Istyp = Standard_Positive then
-- Artyp := Standard_Unsigned;
-- For modular types, we use a 32-bit modular type for types whose size -- For modular types, we use a 32-bit modular type for types whose size
-- is in the range 1-31 bits. For 32-bit unsigned types, we use the -- is in the range 1-31 bits. For 32-bit unsigned types, we use the
-- identity type, and for larger unsigned types we use 64-bits. -- identity type, and for larger unsigned types we use 64-bits.
...@@ -2417,7 +2427,7 @@ package body Exp_Ch4 is ...@@ -2417,7 +2427,7 @@ package body Exp_Ch4 is
Make_Op_Add (Loc, Make_Op_Add (Loc,
Left_Opnd => Left_Opnd =>
New_Copy_Tree (String_Literal_Low_Bound (Opnd_Typ)), New_Copy_Tree (String_Literal_Low_Bound (Opnd_Typ)),
Right_Opnd => Make_Artyp_Literal (1)); Right_Opnd => Make_Integer_Literal (Loc, 1));
end if; end if;
-- Skip null string literal -- Skip null string literal
...@@ -2729,9 +2739,14 @@ package body Exp_Ch4 is ...@@ -2729,9 +2739,14 @@ package body Exp_Ch4 is
Left_Opnd => New_Copy (Aggr_Length (NN)), Left_Opnd => New_Copy (Aggr_Length (NN)),
Right_Opnd => Make_Artyp_Literal (1)))); Right_Opnd => Make_Artyp_Literal (1))));
-- Now force overflow checking on High_Bound -- Note that calculation of the high bound may cause overflow in some
-- very weird cases, so in the general case we need an overflow check
-- on the high bound. We can avoid this for the common case of string
-- types since we chose a wider range for the arithmetic type.
Activate_Overflow_Check (High_Bound); if Istyp /= Standard_Positive then
Activate_Overflow_Check (High_Bound);
end if;
-- Handle the exceptional case where the result is null, in which case -- Handle the exceptional case where the result is null, in which case
-- case the bounds come from the last operand (so that we get the proper -- case the bounds come from the last operand (so that we get the proper
......
...@@ -63,7 +63,6 @@ package body System.Direct_IO is ...@@ -63,7 +63,6 @@ package body System.Direct_IO is
function AFCB_Allocate (Control_Block : Direct_AFCB) return FCB.AFCB_Ptr is function AFCB_Allocate (Control_Block : Direct_AFCB) return FCB.AFCB_Ptr is
pragma Unreferenced (Control_Block); pragma Unreferenced (Control_Block);
begin begin
return new Direct_AFCB; return new Direct_AFCB;
end AFCB_Allocate; end AFCB_Allocate;
...@@ -76,7 +75,6 @@ package body System.Direct_IO is ...@@ -76,7 +75,6 @@ package body System.Direct_IO is
procedure AFCB_Close (File : not null access Direct_AFCB) is procedure AFCB_Close (File : not null access Direct_AFCB) is
pragma Unreferenced (File); pragma Unreferenced (File);
begin begin
null; null;
end AFCB_Close; end AFCB_Close;
...@@ -110,8 +108,8 @@ package body System.Direct_IO is ...@@ -110,8 +108,8 @@ package body System.Direct_IO is
is is
Dummy_File_Control_Block : Direct_AFCB; Dummy_File_Control_Block : Direct_AFCB;
pragma Warnings (Off, Dummy_File_Control_Block); pragma Warnings (Off, Dummy_File_Control_Block);
-- Yes, we know this is never assigned a value, only the tag -- Yes, we know this is never assigned a value, only the tag is used for
-- is used for dispatching purposes, so that's expected. -- dispatching purposes, so that's expected.
begin begin
FIO.Open (File_Ptr => AP (File), FIO.Open (File_Ptr => AP (File),
...@@ -156,8 +154,8 @@ package body System.Direct_IO is ...@@ -156,8 +154,8 @@ package body System.Direct_IO is
is is
Dummy_File_Control_Block : Direct_AFCB; Dummy_File_Control_Block : Direct_AFCB;
pragma Warnings (Off, Dummy_File_Control_Block); pragma Warnings (Off, Dummy_File_Control_Block);
-- Yes, we know this is never assigned a value, only the tag -- Yes, we know this is never assigned a value, only the tag is used for
-- is used for dispatching purposes, so that's expected. -- dispatching purposes, so that's expected.
begin begin
FIO.Open (File_Ptr => AP (File), FIO.Open (File_Ptr => AP (File),
...@@ -254,10 +252,9 @@ package body System.Direct_IO is ...@@ -254,10 +252,9 @@ package body System.Direct_IO is
pragma Warnings (Off, File); pragma Warnings (Off, File);
-- File is actually modified via Unrestricted_Access below, but -- File is actually modified via Unrestricted_Access below, but
-- GNAT will generate a warning anyway. -- GNAT will generate a warning anyway.
-- Note that we do not use pragma Unmodified here, since in -gnatc --
-- mode, GNAT will complain that File is modified for -- Note that we do not use pragma Unmodified here, since in -gnatc mode,
-- "File.Index := 1;" -- GNAT will complain that File is modified for "File.Index := 1;"
begin begin
FIO.Reset (AP (File)'Unrestricted_Access, Mode); FIO.Reset (AP (File)'Unrestricted_Access, Mode);
File.Index := 1; File.Index := 1;
...@@ -267,7 +264,6 @@ package body System.Direct_IO is ...@@ -267,7 +264,6 @@ package body System.Direct_IO is
procedure Reset (File : in out File_Type) is procedure Reset (File : in out File_Type) is
pragma Warnings (Off, File); pragma Warnings (Off, File);
-- See above (other Reset procedure) for explanations on this pragma -- See above (other Reset procedure) for explanations on this pragma
begin begin
FIO.Reset (AP (File)'Unrestricted_Access); FIO.Reset (AP (File)'Unrestricted_Access);
File.Index := 1; File.Index := 1;
......
...@@ -6467,7 +6467,7 @@ package body Sem_Ch3 is ...@@ -6467,7 +6467,7 @@ package body Sem_Ch3 is
-- could still refer to the full type prior the change to the new -- could still refer to the full type prior the change to the new
-- subtype and hence would not match the new base type created here. -- subtype and hence would not match the new base type created here.
Derive_Subprograms (Parent_Type, Base_Type (Derived_Type)); Derive_Subprograms (Parent_Type, Derived_Type);
-- For tagged types the Discriminant_Constraint of the new base itype -- For tagged types the Discriminant_Constraint of the new base itype
-- is inherited from the first subtype so that no subtype conformance -- is inherited from the first subtype so that no subtype conformance
...@@ -11496,8 +11496,8 @@ package body Sem_Ch3 is ...@@ -11496,8 +11496,8 @@ package body Sem_Ch3 is
-- Step 2: Add primitives of progenitors that are not implemented by -- Step 2: Add primitives of progenitors that are not implemented by
-- parents of Tagged_Type -- parents of Tagged_Type
if Present (Interfaces (Tagged_Type)) then if Present (Interfaces (Base_Type (Tagged_Type))) then
Iface_Elmt := First_Elmt (Interfaces (Tagged_Type)); Iface_Elmt := First_Elmt (Interfaces (Base_Type (Tagged_Type)));
while Present (Iface_Elmt) loop while Present (Iface_Elmt) loop
Iface := Node (Iface_Elmt); Iface := Node (Iface_Elmt);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment