Commit 37da997b by Robert Dewar Committed by Arnaud Charlet

a-strhas.ads, [...]: Minor reformatting/code reorganization.

2012-01-30  Robert Dewar  <dewar@adacore.com>

	* a-strhas.ads, einfo.adb, einfo.ads, exp_ch7.adb, exp_ch9.adb,
	freeze.adb, prj.adb, prj.ads, prj-nmsc.adb, prj-proc.adb, s-llflex.ads,
	s-ransee.adb, s-ransee.ads, sem_ch13.adb, sem_dim.adb, sem_prag.adb:
	Minor reformatting/code reorganization.

From-SVN: r183710
parent 7873037f
2012-01-30 Robert Dewar <dewar@adacore.com>
* a-strhas.ads, einfo.adb, einfo.ads, exp_ch7.adb, exp_ch9.adb,
freeze.adb, prj.adb, prj.ads, prj-nmsc.adb, prj-proc.adb, s-llflex.ads,
s-ransee.adb, s-ransee.ads, sem_ch13.adb, sem_dim.adb, sem_prag.adb:
Minor reformatting/code reorganization.
2012-01-30 Thomas Quinot <quinot@adacore.com> 2012-01-30 Thomas Quinot <quinot@adacore.com>
* s-rannum.adb, s-ransee.adb, s-ransee.ads (Get_Seed): Return * s-rannum.adb, s-ransee.adb, s-ransee.ads (Get_Seed): Return
......
...@@ -18,8 +18,8 @@ pragma Compiler_Unit; ...@@ -18,8 +18,8 @@ pragma Compiler_Unit;
with Ada.Containers; with Ada.Containers;
function Ada.Strings.Hash (Key : String) return Containers.Hash_Type; function Ada.Strings.Hash (Key : String) return Containers.Hash_Type;
-- Note: this hash function has predictable collisions and is subject -- Note: this hash function has predictable collisions and is subject to
-- to equivalent substring attacks. It is not suitable to construct a hash -- equivalent substring attacks. It is not suitable for construction of a
-- table keyed on possibly malicious user input. -- hash table keyed on possibly malicious user input.
pragma Pure (Ada.Strings.Hash); pragma Pure (Ada.Strings.Hash);
...@@ -161,8 +161,8 @@ package body Einfo is ...@@ -161,8 +161,8 @@ package body Einfo is
-- Body_Entity Node19 -- Body_Entity Node19
-- Corresponding_Discriminant Node19 -- Corresponding_Discriminant Node19
-- Default_Aspect_Value Node19
-- Default_Aspect_Component_Value Node19 -- Default_Aspect_Component_Value Node19
-- Default_Aspect_Value Node19
-- Extra_Accessibility_Of_Result Node19 -- Extra_Accessibility_Of_Result Node19
-- Parent_Subtype Node19 -- Parent_Subtype Node19
-- Size_Check_Code Node19 -- Size_Check_Code Node19
...@@ -775,18 +775,18 @@ package body Einfo is ...@@ -775,18 +775,18 @@ package body Einfo is
return Node25 (Id); return Node25 (Id);
end Debug_Renaming_Link; end Debug_Renaming_Link;
function Default_Aspect_Value (Id : E) return N is
begin
pragma Assert (Is_Scalar_Type (Id));
return Node19 (Id);
end Default_Aspect_Value;
function Default_Aspect_Component_Value (Id : E) return N is function Default_Aspect_Component_Value (Id : E) return N is
begin begin
pragma Assert (Is_Array_Type (Id)); pragma Assert (Is_Array_Type (Id));
return Node19 (Id); return Node19 (Id);
end Default_Aspect_Component_Value; end Default_Aspect_Component_Value;
function Default_Aspect_Value (Id : E) return N is
begin
pragma Assert (Is_Scalar_Type (Id));
return Node19 (Id);
end Default_Aspect_Value;
function Default_Expr_Function (Id : E) return E is function Default_Expr_Function (Id : E) return E is
begin begin
pragma Assert (Is_Formal (Id)); pragma Assert (Is_Formal (Id));
...@@ -3276,18 +3276,18 @@ package body Einfo is ...@@ -3276,18 +3276,18 @@ package body Einfo is
Set_Node25 (Id, V); Set_Node25 (Id, V);
end Set_Debug_Renaming_Link; end Set_Debug_Renaming_Link;
procedure Set_Default_Aspect_Value (Id : E; V : E) is
begin
pragma Assert (Is_Scalar_Type (Id));
Set_Node19 (Id, V);
end Set_Default_Aspect_Value;
procedure Set_Default_Aspect_Component_Value (Id : E; V : E) is procedure Set_Default_Aspect_Component_Value (Id : E; V : E) is
begin begin
pragma Assert (Is_Array_Type (Id)); pragma Assert (Is_Array_Type (Id));
Set_Node19 (Id, V); Set_Node19 (Id, V);
end Set_Default_Aspect_Component_Value; end Set_Default_Aspect_Component_Value;
procedure Set_Default_Aspect_Value (Id : E; V : E) is
begin
pragma Assert (Is_Scalar_Type (Id));
Set_Node19 (Id, V);
end Set_Default_Aspect_Value;
procedure Set_Default_Expr_Function (Id : E; V : E) is procedure Set_Default_Expr_Function (Id : E; V : E) is
begin begin
pragma Assert (Is_Formal (Id)); pragma Assert (Is_Formal (Id));
......
...@@ -2844,7 +2844,7 @@ package body Exp_Ch7 is ...@@ -2844,7 +2844,7 @@ package body Exp_Ch7 is
-- which belongs to a protected type. -- which belongs to a protected type.
Loc : constant Source_Ptr := No_Location; Loc : constant Source_Ptr := No_Location;
HSS : Node_Id := Handled_Statement_Sequence (N); HSS : Node_Id;
begin begin
-- Do not perform this expansion in Alfa mode because we do not create -- Do not perform this expansion in Alfa mode because we do not create
...@@ -2856,6 +2856,7 @@ package body Exp_Ch7 is ...@@ -2856,6 +2856,7 @@ package body Exp_Ch7 is
-- The At_End handler should have been assimilated by the finalizer -- The At_End handler should have been assimilated by the finalizer
HSS := Handled_Statement_Sequence (N);
pragma Assert (No (At_End_Proc (HSS))); pragma Assert (No (At_End_Proc (HSS)));
-- If the construct to be cleaned up is a protected subprogram body, the -- If the construct to be cleaned up is a protected subprogram body, the
......
...@@ -9023,13 +9023,14 @@ package body Exp_Ch9 is ...@@ -9023,13 +9023,14 @@ package body Exp_Ch9 is
-- table parameter. Generate: -- table parameter. Generate:
-- Ada.Tags.Get_Entry_Index -- Ada.Tags.Get_Entry_Index
-- (T => To_Tag_Ptr (Obj'Address).all, -- (T => To_Tag_Ptr (Obj'Address).all,
-- Position => Ada.Tags.Get_Offset_Index -- Position =>
-- (Ada.Tags.Tag (Concval), -- Ada.Tags.Get_Offset_Index
-- i <interface dispatch table position of Ename>)); -- (Ada.Tags.Tag (Concval),
-- <interface dispatch table position of Ename>));
-- Note that Obj'Address is recursively expanded into a call to -- Note that Obj'Address is recursively expanded into a call to
-- Base_Address (Obj) -- Base_Address (Obj).
if Tagged_Type_Expansion then if Tagged_Type_Expansion then
Prepend_To (Params, Prepend_To (Params,
...@@ -9054,7 +9055,6 @@ package body Exp_Ch9 is ...@@ -9054,7 +9055,6 @@ package body Exp_Ch9 is
else else
Prepend_To (Params, Prepend_To (Params,
Make_Function_Call (Loc, Make_Function_Call (Loc,
Name => New_Reference_To (RTE (RE_Get_Entry_Index), Loc), Name => New_Reference_To (RTE (RE_Get_Entry_Index), Loc),
Parameter_Associations => New_List ( Parameter_Associations => New_List (
......
...@@ -4165,9 +4165,9 @@ package body Freeze is ...@@ -4165,9 +4165,9 @@ package body Freeze is
if Is_First_Subtype (E) and then Has_Default_Aspect (E) then if Is_First_Subtype (E) and then Has_Default_Aspect (E) then
declare declare
Nam : Name_Id; Nam : Name_Id;
Exp : Node_Id; Exp : Node_Id;
Typ : Entity_Id; Typ : Entity_Id;
begin begin
if Is_Scalar_Type (E) then if Is_Scalar_Type (E) then
...@@ -4176,8 +4176,8 @@ package body Freeze is ...@@ -4176,8 +4176,8 @@ package body Freeze is
Exp := Default_Aspect_Value (Typ); Exp := Default_Aspect_Value (Typ);
else else
Nam := Name_Default_Component_Value; Nam := Name_Default_Component_Value;
Exp := Default_Aspect_Component_Value (E);
Typ := Component_Type (E); Typ := Component_Type (E);
Exp := Default_Aspect_Component_Value (E);
end if; end if;
Analyze_And_Resolve (Exp, Typ); Analyze_And_Resolve (Exp, Typ);
......
...@@ -2546,18 +2546,17 @@ package body Prj.Nmsc is ...@@ -2546,18 +2546,17 @@ package body Prj.Nmsc is
Project.Decl.Attributes, Project.Decl.Attributes,
Shared); Shared);
List : String_List_Id; List : String_List_Id;
Element : String_Element; Element : String_Element;
Name : File_Name_Type; Name : File_Name_Type;
Iter : Source_Iterator; Iter : Source_Iterator;
Source : Source_Id; Source : Source_Id;
Project_2 : Project_Id; Project_2 : Project_Id;
Other : Source_Id; Other : Source_Id;
Unit_Found : Boolean;
Interface_ALIs : String_List_Id := Nil_String; Interface_ALIs : String_List_Id := Nil_String;
Unit_Found : Boolean;
begin begin
if not Interfaces.Default then if not Interfaces.Default then
...@@ -2583,9 +2582,9 @@ package body Prj.Nmsc is ...@@ -2583,9 +2582,9 @@ package body Prj.Nmsc is
Name := Canonical_Case_File_Name (Element.Value); Name := Canonical_Case_File_Name (Element.Value);
Project_2 := Project; Project_2 := Project;
Big_Loop : Big_Loop : while Project_2 /= No_Project loop
while Project_2 /= No_Project loop
if Project.Qualifier = Aggregate_Library then if Project.Qualifier = Aggregate_Library then
-- For an aggregate library we want to consider sources of -- For an aggregate library we want to consider sources of
-- all aggregated projects. -- all aggregated projects.
...@@ -2693,9 +2692,9 @@ package body Prj.Nmsc is ...@@ -2693,9 +2692,9 @@ package body Prj.Nmsc is
Unit_Found := False; Unit_Found := False;
Project_2 := Project; Project_2 := Project;
Big_Loop_2 : Big_Loop_2 : while Project_2 /= No_Project loop
while Project_2 /= No_Project loop
if Project.Qualifier = Aggregate_Library then if Project.Qualifier = Aggregate_Library then
-- For an aggregate library we want to consider sources of -- For an aggregate library we want to consider sources of
-- all aggregated projects. -- all aggregated projects.
...@@ -4492,8 +4491,8 @@ package body Prj.Nmsc is ...@@ -4492,8 +4491,8 @@ package body Prj.Nmsc is
end if; end if;
end if; end if;
-- Check value of attribute Library_Auto_Init and set -- Check value of attribute Library_Auto_Init and set Lib_Auto_Init
-- Lib_Auto_Init accordingly. -- accordingly.
if Lib_Auto_Init.Default then if Lib_Auto_Init.Default then
......
...@@ -2920,6 +2920,7 @@ package body Prj.Proc is ...@@ -2920,6 +2920,7 @@ package body Prj.Proc is
Shared); Shared);
List : Project_List := In_Tree.Projects; List : Project_List := In_Tree.Projects;
Is_Encapsulated : Boolean; Is_Encapsulated : Boolean;
begin begin
Get_Name_String (Lib_Standalone.Value); Get_Name_String (Lib_Standalone.Value);
To_Lower (Name_Buffer (1 .. Name_Len)); To_Lower (Name_Buffer (1 .. Name_Len));
......
...@@ -619,7 +619,7 @@ package body Prj is ...@@ -619,7 +619,7 @@ package body Prj is
(List.Project, Tree, (List.Project, Tree,
In_Aggregate_Lib, In_Aggregate_Lib,
From_Encapsulated_Lib From_Encapsulated_Lib
or (Project.Standalone_Library = Encapsulated)); or else Project.Standalone_Library = Encapsulated);
List := List.Next; List := List.Next;
end loop; end loop;
...@@ -644,8 +644,9 @@ package body Prj is ...@@ -644,8 +644,9 @@ package body Prj is
Recursive_Check Recursive_Check
(Agg.Project, T, (Agg.Project, T,
True, True,
From_Encapsulated_Lib or From_Encapsulated_Lib
Project.Standalone_Library = Encapsulated); or else
Project.Standalone_Library = Encapsulated);
else else
T := Agg.Tree; T := Agg.Tree;
......
...@@ -938,8 +938,8 @@ package Prj is ...@@ -938,8 +938,8 @@ package Prj is
type Project_List_Element; type Project_List_Element;
type Project_List is access all Project_List_Element; type Project_List is access all Project_List_Element;
type Project_List_Element is record type Project_List_Element is record
Project : Project_Id := No_Project; Project : Project_Id := No_Project;
From_Encapsulated_Lib : Boolean := False; From_Encapsulated_Lib : Boolean := False;
Next : Project_List := null; Next : Project_List := null;
end record; end record;
-- A list of projects -- A list of projects
...@@ -1408,8 +1408,8 @@ package Prj is ...@@ -1408,8 +1408,8 @@ package Prj is
function For_Each_Source function For_Each_Source
(In_Tree : Project_Tree_Ref; (In_Tree : Project_Tree_Ref;
Project : Project_Id := No_Project; Project : Project_Id := No_Project;
Language : Name_Id := No_Name; Language : Name_Id := No_Name;
Encapsulated_Libs : Boolean := True) return Source_Iterator; Encapsulated_Libs : Boolean := True) return Source_Iterator;
-- Returns an iterator for all the sources of a project tree, or a specific -- Returns an iterator for all the sources of a project tree, or a specific
-- project, or a specific language. Include sources from aggregated libs if -- project, or a specific language. Include sources from aggregated libs if
-- Aggregated_Libs is True. -- Aggregated_Libs is True.
...@@ -1601,8 +1601,9 @@ package Prj is ...@@ -1601,8 +1601,9 @@ package Prj is
-- aggregated projects, since they might not be using the same tree as 'By' -- aggregated projects, since they might not be using the same tree as 'By'
type Project_Context is record type Project_Context is record
In_Aggregate_Lib : Boolean; In_Aggregate_Lib : Boolean;
-- True if the project is part of an aggregate library -- True if the project is part of an aggregate library
From_Encapsulated_Lib : Boolean; From_Encapsulated_Lib : Boolean;
-- True if the project is imported from an encapsulated library -- True if the project is imported from an encapsulated library
end record; end record;
...@@ -1850,7 +1851,7 @@ private ...@@ -1850,7 +1851,7 @@ private
Language_Name : Name_Id; Language_Name : Name_Id;
-- Only sources of this language will be returned (or all if No_Name) -- Only sources of this language will be returned (or all if No_Name)
Current : Source_Id; Current : Source_Id;
Encapsulated_Libs : Boolean; Encapsulated_Libs : Boolean;
-- True if we want to include the sources from encapsulated libs -- True if we want to include the sources from encapsulated libs
......
...@@ -29,8 +29,8 @@ ...@@ -29,8 +29,8 @@
-- -- -- --
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
-- This package contains an instantiation of the exponentiation between two -- This package contains an instantiation of the exponentiation operator
-- long long floats. -- between two long long floats.
with Ada.Numerics.Long_Long_Elementary_Functions; with Ada.Numerics.Long_Long_Elementary_Functions;
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
-- -- -- --
-- GNAT RUN-TIME COMPONENTS -- -- GNAT RUN-TIME COMPONENTS --
-- -- -- --
-- S Y S T E M . R A N D O M _ S E E D -- -- S Y S T E M . R A N D O M _ S E E D --
-- -- -- --
-- B o d y -- -- B o d y --
-- -- -- --
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
-- -- -- --
-- GNAT RUN-TIME COMPONENTS -- -- GNAT RUN-TIME COMPONENTS --
-- -- -- --
-- S Y S T E M . R A N D O M _ S E E D -- -- S Y S T E M . R A N D O M _ S E E D --
-- -- -- --
-- S p e c -- -- S p e c --
-- -- -- --
......
...@@ -1429,6 +1429,7 @@ package body Sem_Ch13 is ...@@ -1429,6 +1429,7 @@ package body Sem_Ch13 is
-- Make sure we have a freeze node (it might otherwise be -- Make sure we have a freeze node (it might otherwise be
-- missing in cases like subtype X is Y, and we would not -- missing in cases like subtype X is Y, and we would not
-- have a place to build the predicate function). -- have a place to build the predicate function).
-- If the type is private, indicate that its completion -- If the type is private, indicate that its completion
-- has a freeze node, because that is the one that will be -- has a freeze node, because that is the one that will be
-- visible at freeze time. -- visible at freeze time.
...@@ -5068,9 +5069,7 @@ package body Sem_Ch13 is ...@@ -5068,9 +5069,7 @@ package body Sem_Ch13 is
-- The predicate function is shared between views of a type. -- The predicate function is shared between views of a type.
if Is_Private_Type (Typ) if Is_Private_Type (Typ) and then Present (Full_View (Typ)) then
and then Present (Full_View (Typ))
then
Set_Predicate_Function (Full_View (Typ), SId); Set_Predicate_Function (Full_View (Typ), SId);
end if; end if;
...@@ -6036,7 +6035,8 @@ package body Sem_Ch13 is ...@@ -6036,7 +6035,8 @@ package body Sem_Ch13 is
-- partial view is visible. The expression must be scalar, so use -- partial view is visible. The expression must be scalar, so use
-- the full view to resolve. -- the full view to resolve.
elsif (A_Id = Aspect_Default_Value or else elsif (A_Id = Aspect_Default_Value
or else
A_Id = Aspect_Default_Component_Value) A_Id = Aspect_Default_Component_Value)
and then Is_Private_Type (T) and then Is_Private_Type (T)
then then
......
...@@ -2248,7 +2248,8 @@ package body Sem_Dim is ...@@ -2248,7 +2248,8 @@ package body Sem_Dim is
return return
Package_Name = Name_Dim_Float_IO Package_Name = Name_Dim_Float_IO
or else Package_Name = Name_Dim_Integer_IO; or else
Package_Name = Name_Dim_Integer_IO;
end if; end if;
end if; end if;
end if; end if;
...@@ -2261,13 +2262,12 @@ package body Sem_Dim is ...@@ -2261,13 +2262,12 @@ package body Sem_Dim is
----------------- -----------------
function Item_Actual return Node_Id is function Item_Actual return Node_Id is
Actual : Node_Id; Actual : Node_Id;
begin begin
Actual := First (Actuals);
-- Look for the item actual as a parameter association -- Look for the item actual as a parameter association
Actual := First (Actuals);
while Present (Actual) loop while Present (Actual) loop
if Nkind (Actual) = N_Parameter_Association if Nkind (Actual) = N_Parameter_Association
and then Chars (Selector_Name (Actual)) = Name_Item and then Chars (Selector_Name (Actual)) = Name_Item
...@@ -2295,9 +2295,7 @@ package body Sem_Dim is ...@@ -2295,9 +2295,7 @@ package body Sem_Dim is
-- Start of processing for Expand_Put_Call_With_Dimension_Symbol -- Start of processing for Expand_Put_Call_With_Dimension_Symbol
begin begin
if Is_Procedure_Put_Call if Is_Procedure_Put_Call and then not Has_Dimension_Symbols then
and then not Has_Dimension_Symbols
then
Actual := Item_Actual; Actual := Item_Actual;
Dims_Of_Actual := Dimensions_Of (Actual); Dims_Of_Actual := Dimensions_Of (Actual);
Etyp := Etype (Actual); Etyp := Etype (Actual);
...@@ -2315,6 +2313,7 @@ package body Sem_Dim is ...@@ -2315,6 +2313,7 @@ package body Sem_Dim is
New_Str_Lit := Make_String_Literal (Loc, End_String); New_Str_Lit := Make_String_Literal (Loc, End_String);
-- Check that the item is not dimensionless -- Check that the item is not dimensionless
-- Create the new String_Literal with the new String_Id generated by -- Create the new String_Literal with the new String_Id generated by
-- the routine From_Dimension_To_String. -- the routine From_Dimension_To_String.
...@@ -2326,39 +2325,37 @@ package body Sem_Dim is ...@@ -2326,39 +2325,37 @@ package body Sem_Dim is
end if; end if;
if Present (New_Str_Lit) then if Present (New_Str_Lit) then
-- Insert all actuals in New_Actuals -- Insert all actuals in New_Actuals
Actual := First (Actuals); Actual := First (Actuals);
while Present (Actual) loop while Present (Actual) loop
-- Copy every actuals in New_Actuals except the Symbols -- Copy every actuals in New_Actuals except the Symbols
-- parameter association. -- parameter association.
if Nkind (Actual) = N_Parameter_Association if Nkind (Actual) = N_Parameter_Association
and then Chars (Selector_Name (Actual)) /= Name_Symbols and then Chars (Selector_Name (Actual)) /= Name_Symbols
then then
Append ( Append_To (New_Actuals,
Make_Parameter_Association (Loc, Make_Parameter_Association (Loc,
Selector_Name => New_Copy (Selector_Name (Actual)), Selector_Name => New_Copy (Selector_Name (Actual)),
Explicit_Actual_Parameter => Explicit_Actual_Parameter =>
New_Copy (Explicit_Actual_Parameter (Actual))), New_Copy (Explicit_Actual_Parameter (Actual))));
New_Actuals);
elsif Nkind (Actual) /= N_Parameter_Association then elsif Nkind (Actual) /= N_Parameter_Association then
Append (New_Copy (Actual), New_Actuals); Append_To (New_Actuals, New_Copy (Actual));
end if; end if;
Next (Actual); Next (Actual);
end loop; end loop;
-- Create the new Symbols parameter association and append it in -- Create new Symbols param association and append to New_Actuals
-- New_Actuals.
Append ( Append_To (New_Actuals,
Make_Parameter_Association (Loc, Make_Parameter_Association (Loc,
Selector_Name => Make_Identifier (Loc, Name_Symbols), Selector_Name => Make_Identifier (Loc, Name_Symbols),
Explicit_Actual_Parameter => New_Str_Lit), Explicit_Actual_Parameter => New_Str_Lit));
New_Actuals);
-- Rewrite and analyze the procedure call -- Rewrite and analyze the procedure call
......
...@@ -7084,7 +7084,7 @@ package body Sem_Prag is ...@@ -7084,7 +7084,7 @@ package body Sem_Prag is
Check_Interrupt_Or_Attach_Handler; Check_Interrupt_Or_Attach_Handler;
-- The expression that designates the attribute may depend on a -- The expression that designates the attribute may depend on a
-- discriminant, and is therefore a per- object expression, to -- discriminant, and is therefore a per-object expression, to
-- be expanded in the init proc. If expansion is enabled, then -- be expanded in the init proc. If expansion is enabled, then
-- perform semantic checks on a copy only. -- perform semantic checks on a copy only.
...@@ -15308,13 +15308,12 @@ package body Sem_Prag is ...@@ -15308,13 +15308,12 @@ package body Sem_Prag is
-- Make an aspect from any PPC pragma -- Make an aspect from any PPC pragma
Append ( Append_To (Aspects,
Make_Aspect_Specification (Loc, Make_Aspect_Specification (Loc,
Identifier => Identifier =>
Make_Identifier (Loc, Chars (Pragma_Identifier (Prag))), Make_Identifier (Loc, Chars (Pragma_Identifier (Prag))),
Expression => Expression =>
Copy_Separate_Tree (Expression (Prag_Arg_Ass))), Copy_Separate_Tree (Expression (Prag_Arg_Ass))));
Aspects);
-- Generate the analysis information in the pragma expression -- Generate the analysis information in the pragma expression
-- and then set the pragma node analyzed to avoid any further -- and then set the pragma node analyzed to avoid any further
......
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