Commit d3a26d5d by Arnaud Charlet

[multiple changes]

2012-03-09  Robert Dewar  <dewar@adacore.com>

	* a-direct.adb, comperr.adb, freeze.adb: Minor reformatting.

2012-03-09  Arnaud Charlet  <charlet@adacore.com>

	* s-taskin.adb (Initialize_ATCB): Set Task_Image_Len to
	0 so that we never access this field uninitialized (e.g. in
	Task_Primitives.Operations.Enter_Task for the environment task).

2012-03-09  Vincent Pucci  <pucci@adacore.com>

	* exp_ch5.adb (Expand_Iterator_Loop):
	Call to Expand_Iterator_Loop_Over_Array added.
	(Expand_Iterator_Loop_Over_Array): New routine. Expansion of
	"of" iterator loop over arrays. Multidimensional array case added.

2012-03-09  Eric Botcazou  <ebotcazou@adacore.com>

	* uintp.ads: Fix minor pasto in comment.

From-SVN: r185143
parent f91510fc
2012-03-09 Robert Dewar <dewar@adacore.com>
* a-direct.adb, comperr.adb, freeze.adb: Minor reformatting.
2012-03-09 Arnaud Charlet <charlet@adacore.com>
* s-taskin.adb (Initialize_ATCB): Set Task_Image_Len to
0 so that we never access this field uninitialized (e.g. in
Task_Primitives.Operations.Enter_Task for the environment task).
2012-03-09 Vincent Pucci <pucci@adacore.com>
* exp_ch5.adb (Expand_Iterator_Loop):
Call to Expand_Iterator_Loop_Over_Array added.
(Expand_Iterator_Loop_Over_Array): New routine. Expansion of
"of" iterator loop over arrays. Multidimensional array case added.
2012-03-09 Eric Botcazou <ebotcazou@adacore.com>
* uintp.ads: Fix minor pasto in comment.
2012-03-09 Vasiliy Fofanov <fofanov@adacore.com>
* a-direct.adb: Do not strip the trailing directory separator
......
......@@ -514,10 +514,10 @@ package body Ada.Directories is
begin
Local_Get_Current_Dir (Buffer'Address, Path_Len'Address);
-- We need to resolve links because of A.16(47), since we must not
-- return alternative names for files
return Normalize_Pathname (Buffer (1 .. Path_Len));
-- We need to resolve links because of RM A.16(47), which requires
-- that we not return alternative names for files.
return Normalize_Pathname (Buffer (1 .. Path_Len));
end Current_Directory;
----------------------
......
......@@ -502,8 +502,9 @@ package body Comperr is
when N_Package_Renaming_Declaration =>
Unit_Name := Defining_Unit_Name (Main);
when N_Generic_Package_Declaration =>
-- No SCIL file generated for generic package declarations
when N_Generic_Package_Declaration =>
return;
-- Should never happen, but can be ignored in production
......
......@@ -107,6 +107,9 @@ package body Exp_Ch5 is
-- Expand loop over arrays and containers that uses the form "for X of C"
-- with an optional subtype mark, or "for Y in C".
procedure Expand_Iterator_Loop_Over_Array (N : Node_Id);
-- Expand loop over arrays that uses the form "for X of C"
procedure Expand_Predicated_Loop (N : Node_Id);
-- Expand for loop over predicated subtype
......@@ -2946,63 +2949,12 @@ package body Exp_Ch5 is
-- Processing for arrays
if Is_Array_Type (Container_Typ) then
-- for Element of Array loop
--
-- This case requires an internally generated cursor to iterate over
-- the array.
if Of_Present (I_Spec) then
Iterator := Make_Temporary (Loc, 'C');
-- Generate:
-- Element : Component_Type renames Container (Iterator);
Prepend_To (Stats,
Make_Object_Renaming_Declaration (Loc,
Defining_Identifier => Id,
Subtype_Mark =>
New_Reference_To (Component_Type (Container_Typ), Loc),
Name =>
Make_Indexed_Component (Loc,
Prefix => Relocate_Node (Container),
Expressions => New_List (
New_Reference_To (Iterator, Loc)))));
-- for Index in Array loop
-- This case utilizes the already given iterator name
else
Iterator := Id;
Expand_Iterator_Loop_Over_Array (N);
return;
end if;
-- Generate:
-- for Iterator in [reverse] Container'Range loop
-- Element : Component_Type renames Container (Iterator);
-- -- for the "of" form
-- <original loop statements>
-- end loop;
New_Loop :=
Make_Loop_Statement (Loc,
Iteration_Scheme =>
Make_Iteration_Scheme (Loc,
Loop_Parameter_Specification =>
Make_Loop_Parameter_Specification (Loc,
Defining_Identifier => Iterator,
Discrete_Subtype_Definition =>
Make_Attribute_Reference (Loc,
Prefix => Relocate_Node (Container),
Attribute_Name => Name_Range),
Reverse_Present => Reverse_Present (I_Spec))),
Statements => Stats,
End_Label => Empty);
-- Processing for containers
else
-- For an "of" iterator the name is a container expression, which
-- is transformed into a call to the default iterator.
......@@ -3247,8 +3199,7 @@ package body Exp_Ch5 is
New_Occurrence_Of (
Next_Entity (First_Entity (Pack)), Loc),
Parameter_Associations =>
New_List (
New_Reference_To (Cursor, Loc)))),
New_List (New_Reference_To (Cursor, Loc)))),
Statements => Stats,
End_Label => Empty);
......@@ -3304,12 +3255,127 @@ package body Exp_Ch5 is
Insert_List_Before (N, Condition_Actions (Isc));
end if;
end;
end if;
Rewrite (N, New_Loop);
Analyze (N);
end Expand_Iterator_Loop;
-------------------------------------
-- Expand_Iterator_Loop_Over_Array --
-------------------------------------
procedure Expand_Iterator_Loop_Over_Array (N : Node_Id) is
Isc : constant Node_Id := Iteration_Scheme (N);
I_Spec : constant Node_Id := Iterator_Specification (Isc);
Array_Node : constant Node_Id := Name (I_Spec);
Array_Typ : constant Entity_Id := Base_Type (Etype (Array_Node));
Array_Dim : constant Pos := Number_Dimensions (Array_Typ);
Id : constant Entity_Id := Defining_Identifier (I_Spec);
Loc : constant Source_Ptr := Sloc (N);
Stats : constant List_Id := Statements (N);
Core_Loop : Node_Id;
Ind_Comp : Node_Id;
Iterator : Entity_Id;
-- Start of processing for Expand_Iterator_Loop_Over_Array
begin
-- for Element of Array loop
-- This case requires an internally generated cursor to iterate over
-- the array.
if Of_Present (I_Spec) then
Iterator := Make_Temporary (Loc, 'C');
-- Generate:
-- Element : Component_Type renames Array (Iterator);
Ind_Comp :=
Make_Indexed_Component (Loc,
Prefix => Relocate_Node (Array_Node),
Expressions => New_List (New_Reference_To (Iterator, Loc)));
Prepend_To (Stats,
Make_Object_Renaming_Declaration (Loc,
Defining_Identifier => Id,
Subtype_Mark =>
New_Reference_To (Component_Type (Array_Typ), Loc),
Name => Ind_Comp));
-- for Index in Array loop
-- This case utilizes the already given iterator name
else
Iterator := Id;
end if;
-- Generate:
-- for Iterator in [reverse] Array'Range (Array_Dim) loop
-- Element : Component_Type renames Array (Iterator);
-- <original loop statements>
-- end loop;
Core_Loop :=
Make_Loop_Statement (Loc,
Iteration_Scheme =>
Make_Iteration_Scheme (Loc,
Loop_Parameter_Specification =>
Make_Loop_Parameter_Specification (Loc,
Defining_Identifier => Iterator,
Discrete_Subtype_Definition =>
Make_Attribute_Reference (Loc,
Prefix => Relocate_Node (Array_Node),
Attribute_Name => Name_Range,
Expressions => New_List (
Make_Integer_Literal (Loc, Array_Dim))),
Reverse_Present => Reverse_Present (I_Spec))),
Statements => Stats,
End_Label => Empty);
-- Processing for multidimensional array
if Array_Dim > 1 then
for Dim in 1 .. Array_Dim - 1 loop
Iterator := Make_Temporary (Loc, 'C');
-- Generate the dimension loops starting from the innermost one
-- for Iterator in [reverse] Array'Range (Array_Dim - Dim) loop
-- <core loop>
-- end loop;
Core_Loop :=
Make_Loop_Statement (Loc,
Iteration_Scheme =>
Make_Iteration_Scheme (Loc,
Loop_Parameter_Specification =>
Make_Loop_Parameter_Specification (Loc,
Defining_Identifier => Iterator,
Discrete_Subtype_Definition =>
Make_Attribute_Reference (Loc,
Prefix => Relocate_Node (Array_Node),
Attribute_Name => Name_Range,
Expressions => New_List (
Make_Integer_Literal (Loc, Array_Dim - Dim))),
Reverse_Present => Reverse_Present (I_Spec))),
Statements => New_List (Core_Loop),
End_Label => Empty);
-- Update the previously created object renaming declaration with
-- the new iterator.
Prepend_To (Expressions (Ind_Comp),
New_Reference_To (Iterator, Loc));
end loop;
end if;
Rewrite (N, Core_Loop);
Analyze (N);
end Expand_Iterator_Loop_Over_Array;
-----------------------------
-- Expand_N_Loop_Statement --
-----------------------------
......
......@@ -2136,8 +2136,7 @@ package body Freeze is
(Rec, Attribute_Scalar_Storage_Order);
if Present (ADC)
and then
Reverse_Bit_Order (Rec) /= Reverse_Storage_Order (Rec)
and then Reverse_Bit_Order (Rec) /= Reverse_Storage_Order (Rec)
then
if Bytes_Big_Endian = not Reverse_Storage_Order (Rec) then
Error_Msg_N
......@@ -2147,7 +2146,6 @@ package body Freeze is
Error_Msg_N
("Scalar_Storage_Order Low_Order_First is inconsistent with"
& " Bit_Order", ADC);
end if;
end if;
......
......@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
-- Copyright (C) 1992-2011, Free Software Foundation, Inc. --
-- Copyright (C) 1992-2012, Free Software Foundation, Inc. --
-- --
-- GNARL is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
......@@ -137,6 +137,7 @@ package body System.Tasking is
T.Common.Fall_Back_Handler := null;
T.Common.Specific_Handler := null;
T.Common.Debug_Events := (others => False);
T.Common.Task_Image_Len := 0;
if T.Common.Parent = null then
......
......@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
-- Copyright (C) 1992-2010, Free Software Foundation, Inc. --
-- Copyright (C) 1992-2012, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
......@@ -32,7 +32,7 @@
-- Support for universal integer arithmetic
-- WARNING: There is a C version of this package. Any changes to this
-- source file must be properly reflected in the C header file sinfo.h
-- source file must be properly reflected in the C header file uintp.h
with Alloc;
with Table;
......
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