Commit 39486058 by Robert Dewar Committed by Arnaud Charlet

sem_attr.adb (Eval_Attribute, case Width): Avoid ludicrous long loop for case of…

sem_attr.adb (Eval_Attribute, case Width): Avoid ludicrous long loop for case of Wide_[Wide_]Character.

2010-10-08  Robert Dewar  <dewar@adacore.com>

	* sem_attr.adb (Eval_Attribute, case Width): Avoid ludicrous long loop
	for case of Wide_[Wide_]Character.

2010-10-08  Robert Dewar  <dewar@adacore.com>

	* exp_ch3.adb: Minor reformating
	Minor code reorganization.

From-SVN: r165166
parent fe2eee8e
2010-10-08 Robert Dewar <dewar@adacore.com>
* sem_attr.adb (Eval_Attribute, case Width): Avoid ludicrous long loop
for case of Wide_[Wide_]Character.
2010-10-08 Robert Dewar <dewar@adacore.com>
* exp_ch3.adb: Minor reformating
Minor code reorganization.
2010-10-08 Javier Miranda <miranda@adacore.com> 2010-10-08 Javier Miranda <miranda@adacore.com>
* sem_prag.adb (Analyze_Pragma): Add missing checks on wrong use of * sem_prag.adb (Analyze_Pragma): Add missing checks on wrong use of
......
...@@ -5938,7 +5938,6 @@ package body Exp_Ch3 is ...@@ -5938,7 +5938,6 @@ package body Exp_Ch3 is
-- declaration. -- declaration.
Comp := First_Component (Def_Id); Comp := First_Component (Def_Id);
while Present (Comp) loop while Present (Comp) loop
Comp_Typ := Etype (Comp); Comp_Typ := Etype (Comp);
...@@ -6010,14 +6009,14 @@ package body Exp_Ch3 is ...@@ -6010,14 +6009,14 @@ package body Exp_Ch3 is
-- Similarly, if this is an inherited operation whose parent is -- Similarly, if this is an inherited operation whose parent is
-- not frozen yet, it is not in the DT of the parent, and we -- not frozen yet, it is not in the DT of the parent, and we
-- generate an explicit freeze node for the inherited operation -- generate an explicit freeze node for the inherited operation
-- so that it is properly inserted in the DT of the current -- so it is properly inserted in the DT of the current type.
-- type.
declare declare
Elmt : Elmt_Id := First_Elmt (Primitive_Operations (Def_Id)); Elmt : Elmt_Id;
Subp : Entity_Id; Subp : Entity_Id;
begin begin
Elmt := First_Elmt (Primitive_Operations (Def_Id));
while Present (Elmt) loop while Present (Elmt) loop
Subp := Node (Elmt); Subp := Node (Elmt);
...@@ -6053,6 +6052,14 @@ package body Exp_Ch3 is ...@@ -6053,6 +6052,14 @@ package body Exp_Ch3 is
then then
null; null;
-- Do not add the spec of predefined primitives in case of
-- CIL and Java tagged types
elsif Convention (Def_Id) = Convention_CIL
or else Convention (Def_Id) = Convention_Java
then
null;
-- Do not add the spec of the predefined primitives if we are -- Do not add the spec of the predefined primitives if we are
-- compiling under restriction No_Dispatching_Calls -- compiling under restriction No_Dispatching_Calls
...@@ -6179,7 +6186,6 @@ package body Exp_Ch3 is ...@@ -6179,7 +6186,6 @@ package body Exp_Ch3 is
declare declare
Comps : constant Node_Id := Comps : constant Node_Id :=
Component_List (Type_Definition (Type_Decl)); Component_List (Type_Definition (Type_Decl));
begin begin
if Present (Comps) if Present (Comps)
and then Present (Variant_Part (Comps)) and then Present (Variant_Part (Comps))
...@@ -6247,11 +6253,10 @@ package body Exp_Ch3 is ...@@ -6247,11 +6253,10 @@ package body Exp_Ch3 is
end if; end if;
-- For tagged type that are not interfaces, build bodies of primitive -- For tagged type that are not interfaces, build bodies of primitive
-- operations. Note that we do this after building the record -- operations. Note: do this after building the record initialization
-- initialization procedure, since the primitive operations may need -- procedure, since the primitive operations may need the initialization
-- the initialization routine. There is no need to add predefined -- routine. There is no need to add predefined primitives of interfaces
-- primitives of interfaces because all their predefined primitives -- because all their predefined primitives are abstract.
-- are abstract.
if Is_Tagged_Type (Def_Id) if Is_Tagged_Type (Def_Id)
and then not Is_Interface (Def_Id) and then not Is_Interface (Def_Id)
...@@ -6264,6 +6269,14 @@ package body Exp_Ch3 is ...@@ -6264,6 +6269,14 @@ package body Exp_Ch3 is
then then
null; null;
-- Do not add the body of predefined primitives in case of
-- CIL and Java tagged types.
elsif Convention (Def_Id) = Convention_CIL
or else Convention (Def_Id) = Convention_Java
then
null;
-- Do not add the body of the predefined primitives if we are -- Do not add the body of the predefined primitives if we are
-- compiling under restriction No_Dispatching_Calls or if we are -- compiling under restriction No_Dispatching_Calls or if we are
-- compiling a CPP tagged type. -- compiling a CPP tagged type.
......
...@@ -7410,7 +7410,11 @@ package body Sem_Attr is ...@@ -7410,7 +7410,11 @@ package body Sem_Attr is
-- All wide characters look like Hex_hhhhhhhh -- All wide characters look like Hex_hhhhhhhh
if J > 255 then if J > 255 then
W := 12;
-- No need to compute this more than once!
W := Int'Max (W, 12);
exit;
else else
C := Character'Val (J); C := Character'Val (J);
......
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