Commit 68f27c97 by Hristian Kirtchev Committed by Pierre-Marie de Rodat

[Ada] Minor reformatting

2019-07-01  Hristian Kirtchev  <kirtchev@adacore.com>

gcc/ada/

	* exp_attr.adb, exp_ch7.adb, exp_unst.adb, sem_ch3.adb,
	sem_util.adb, uintp.adb, uintp.ads: Minor reformatting.

From-SVN: r272859
parent 54948285
2019-07-01 Hristian Kirtchev <kirtchev@adacore.com>
* exp_attr.adb, exp_ch7.adb, exp_unst.adb, sem_ch3.adb,
sem_util.adb, uintp.adb, uintp.ads: Minor reformatting.
2019-07-01 Javier Miranda <miranda@adacore.com>
* exp_attr.adb (Expand_Min_Max_Attribute): Disable expansion of
......
......@@ -4248,8 +4248,8 @@ package body Exp_Attr is
when Attribute_Invalid_Value =>
Rewrite (N, Get_Simple_Init_Val (Ptyp, N));
-- The value produced may be a conversion of a literal, which
-- must be resolved to establish its proper type.
-- The value produced may be a conversion of a literal, which must be
-- resolved to establish its proper type.
Analyze_And_Resolve (N);
......
......@@ -379,10 +379,6 @@ package body Exp_Ch7 is
-- references within these nested subprograms (typically generated
-- subprograms to handle finalization actions).
function Contains_Subprogram (Blk : Entity_Id) return Boolean;
-- Check recursively whether a loop or block contains a subprogram that
-- may need an activation record.
procedure Check_Visibly_Controlled
(Prim : Final_Primitives;
Typ : Entity_Id;
......@@ -400,6 +396,10 @@ package body Exp_Ch7 is
-- and use it instead. This is one case that might be solved more cleanly
-- once Overriding pragmas or declarations are in place.
function Contains_Subprogram (Blk : Entity_Id) return Boolean;
-- Check recursively whether a loop or block contains a subprogram that
-- may need an activation record.
function Convert_View
(Proc : Entity_Id;
Arg : Node_Id;
......@@ -5187,6 +5187,7 @@ package body Exp_Ch7 is
Set_Finalizer (Id, Fin_Id);
end if;
Check_Unnesting_In_Declarations (Visible_Declarations (Spec));
Check_Unnesting_In_Declarations (Private_Declarations (Spec));
end Expand_N_Package_Declaration;
......
......@@ -254,8 +254,7 @@ package body Exp_Unst is
Typ := Full_View (Typ);
end if;
return Is_Array_Type (Typ)
and then not Is_Constrained (Typ);
return Is_Array_Type (Typ) and then not Is_Constrained (Typ);
else
return False;
end if;
......@@ -2188,8 +2187,7 @@ package body Exp_Unst is
and then Present (Constant_Value (UPJ.Ent))
and then Is_Static_Expression (Constant_Value (UPJ.Ent))
then
Rewrite (UPJ.Ref,
New_Copy_Tree (Constant_Value (UPJ.Ent)));
Rewrite (UPJ.Ref, New_Copy_Tree (Constant_Value (UPJ.Ent)));
goto Continue;
end if;
......
......@@ -10376,10 +10376,9 @@ package body Sem_Ch3 is
-- build-in-place library function, child unit or not.
if (Nkind (Nod) in N_Entity and then Is_Compilation_Unit (Nod))
or else
(Nkind_In (Nod,
N_Defining_Program_Unit_Name, N_Subprogram_Declaration)
and then Is_Compilation_Unit (Defining_Entity (Nod)))
or else (Nkind_In (Nod, N_Defining_Program_Unit_Name,
N_Subprogram_Declaration)
and then Is_Compilation_Unit (Defining_Entity (Nod)))
then
Add_Global_Declaration (IR);
else
......
......@@ -9201,12 +9201,12 @@ package body Sem_Util is
Next_Entity (Func);
end loop;
-- If not found, no way to resolve remaining primitives.
-- If not found, no way to resolve remaining primitives
if Cursor = Any_Type then
Error_Msg_N
("primitive operation for Iterable type must appear "
& "in the same list of declarations as the type", Aspect);
("primitive operation for Iterable type must appear in the same "
& "list of declarations as the type", Aspect);
end if;
return Cursor;
......
......@@ -1492,6 +1492,49 @@ package body Uintp is
end;
end UI_From_Int;
----------------------
-- UI_From_Integral --
----------------------
function UI_From_Integral (Input : In_T) return Uint is
begin
-- If in range of our normal conversion function, use it so we can use
-- direct access and our cache.
if In_T'Size <= Int'Size
or else Input in In_T (Int'First) .. In_T (Int'Last)
then
return UI_From_Int (Int (Input));
else
-- For values of larger magnitude, compute digits into a vector and
-- call Vector_To_Uint.
declare
Max_For_In_T : constant Int := 3 * In_T'Size / Int'Size;
Our_Base : constant In_T := In_T (Base);
Temp_Integer : In_T := Input;
-- Base is defined so that 3 Uint digits is sufficient to hold the
-- largest possible Int value.
U : Uint;
V : UI_Vector (1 .. Max_For_In_T);
begin
for J in reverse V'Range loop
V (J) := Int (abs (Temp_Integer rem Our_Base));
Temp_Integer := Temp_Integer / Our_Base;
end loop;
U := Vector_To_Uint (V, Input < 0);
Uints_Min := Uints.Last;
Udigits_Min := Udigits.Last;
return U;
end;
end if;
end UI_From_Integral;
------------
-- UI_GCD --
------------
......@@ -2324,50 +2367,4 @@ package body Uintp is
return Uint_0;
end Vector_To_Uint;
----------------------
-- UI_From_Integral --
----------------------
function UI_From_Integral (Input : In_T) return Uint is
U : Uint;
begin
-- If in range of our normal conversion function, use it so we can
-- use direct access and our cache.
if In_T'Size <= Int'Size
or else Input in In_T (Int'First) .. In_T (Int'Last)
then
return UI_From_Int (Int (Input));
else
-- pragma Warnings (Off);
-- For values of larger magnitude, compute digits into a vector
-- and call Vector_To_Uint.
declare
Max_For_In_T : constant Int := 3 * In_T'Size / Int'Size;
Our_Base : constant In_T := In_T (Base);
Temp_Integer : In_T := Input;
-- Base is defined so that 3 Uint digits is sufficient to hold the
-- largest possible Int value.
V : UI_Vector (1 .. Max_For_In_T);
begin
for J in reverse V'Range loop
V (J) := Int (abs (Temp_Integer rem Our_Base));
Temp_Integer := Temp_Integer / Our_Base;
end loop;
U := Vector_To_Uint (V, Input < 0);
Uints_Min := Uints.Last;
Udigits_Min := Udigits.Last;
return U;
end;
-- pragma Warnings (On);
end if;
end UI_From_Integral;
end Uintp;
......@@ -251,9 +251,9 @@ package Uintp is
generic
type In_T is range <>;
function UI_From_Integral (Input : In_T) return Uint;
-- Likewise, but converts from any integer type.
-- Must not be applied to biased types (instantiation will provide
-- a warning if actual is a biased type).
-- Likewise, but converts from any integer type. Must not be applied to
-- biased types (instantiation will provide a warning if actual is a biased
-- type).
function UI_From_CC (Input : Char_Code) return Uint;
-- Converts Char_Code value to universal integer form
......
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