Commit 0382062b by Arnaud Charlet

[multiple changes]

2014-07-29  Hristian Kirtchev  <kirtchev@adacore.com>

	* exp_ch7.adb (Build_BIP_Cleanup_Stmts): Remove
	formal parameter Obj_Id and update the comment on usage. Renamed
	Obj_Typ to Func_Typ and update all occurrences.
	(Find_Last_Init): Remove formal parameter Decl and update the comment
	on usage.
	Remove local constants Obj_Id and Obj_Typ. Remove local variables
	Init_Typ and Is_Conc. Remove the extraction of the initialization type.
	(Find_Last_Init_In_Block): Remove formal parameter
	Init_Typ and update the comment on usage.
	(Is_Init_Call): Remove formal parameter Init_Typ and update the comment
	on usage. Check whether the procedure call is an initialization
	procedure of either the object type or the initialization type.
	(Is_Init_Proc_Of): New routine.
	(Process_Object_Declaration): Obj_Id and Obj_Typ are now global to this
	routine. Add new variable Init_Typ. Add circuitry to extract the object
	type as well as the initialization type.

2014-07-29  Robert Dewar  <dewar@adacore.com>

	* sem_case.adb: Minor reformatting.
	* sem_aux.ads: Minor reformatting.

2014-07-29  Ed Schonberg  <schonberg@adacore.com>

	* sinfo.adb (Set_Else_Actions, Set_Then_Actions): Set parent
	pointer on these fields, even though they are semantic, because
	subsequent analysis and expansion of action nades may require
	exploring the tree, for example to locate a node to be wrapped
	when a function with controlled result is called.

2014-07-29  Claire Dross  <dross@adacore.com>

	* sem_aux.adb (Get_Binary_Nkind): Use case on
	Name_Id instead of an intermediate string.
	(Get_Unary_Nkind): Use case on Name_Id instead of an intermediate
	string.

2014-07-29  Sergey Rybin  <rybin@adacore.com frybin>

	* gnat_ugn.texi (gnatelim, gnatstub, gnatmetric): Add note
	about processing sources with preprocessor directives.

From-SVN: r213155
parent 56386ab9
2014-07-29 Hristian Kirtchev <kirtchev@adacore.com>
* exp_ch7.adb (Build_BIP_Cleanup_Stmts): Remove
formal parameter Obj_Id and update the comment on usage. Renamed
Obj_Typ to Func_Typ and update all occurrences.
(Find_Last_Init): Remove formal parameter Decl and update the comment
on usage.
Remove local constants Obj_Id and Obj_Typ. Remove local variables
Init_Typ and Is_Conc. Remove the extraction of the initialization type.
(Find_Last_Init_In_Block): Remove formal parameter
Init_Typ and update the comment on usage.
(Is_Init_Call): Remove formal parameter Init_Typ and update the comment
on usage. Check whether the procedure call is an initialization
procedure of either the object type or the initialization type.
(Is_Init_Proc_Of): New routine.
(Process_Object_Declaration): Obj_Id and Obj_Typ are now global to this
routine. Add new variable Init_Typ. Add circuitry to extract the object
type as well as the initialization type.
2014-07-29 Robert Dewar <dewar@adacore.com>
* sem_case.adb: Minor reformatting.
* sem_aux.ads: Minor reformatting.
2014-07-29 Ed Schonberg <schonberg@adacore.com>
* sinfo.adb (Set_Else_Actions, Set_Then_Actions): Set parent
pointer on these fields, even though they are semantic, because
subsequent analysis and expansion of action nades may require
exploring the tree, for example to locate a node to be wrapped
when a function with controlled result is called.
2014-07-29 Claire Dross <dross@adacore.com>
* sem_aux.adb (Get_Binary_Nkind): Use case on
Name_Id instead of an intermediate string.
(Get_Unary_Nkind): Use case on Name_Id instead of an intermediate
string.
2014-07-29 Sergey Rybin <rybin@adacore.com frybin>
* gnat_ugn.texi (gnatelim, gnatstub, gnatmetric): Add note
about processing sources with preprocessor directives.
2014-07-24 Martin Liska <mliska@suse.cz> 2014-07-24 Martin Liska <mliska@suse.cz>
* gcc-interface/trans.c (finalize_nrv): Adjust function call. * gcc-interface/trans.c (finalize_nrv): Adjust function call.
......
...@@ -11418,6 +11418,12 @@ After a full successful build of the main subprogram @code{gnatelim} can be ...@@ -11418,6 +11418,12 @@ After a full successful build of the main subprogram @code{gnatelim} can be
called without specifying sources to analyse, in this case it computes called without specifying sources to analyse, in this case it computes
the source closure of the main unit from the @file{ALI} files. the source closure of the main unit from the @file{ALI} files.
If the set of sources to be processed by @code{gnatelim} contains sources with
preprocessing directives
then the needed options should be provided to run preprocessor as a part of
the @command{gnatelim} call, and the generated set of pragmas @code{Eliminate}
will correspond to preprocessed sources.
The following command will create the set of @file{ALI} files needed for The following command will create the set of @file{ALI} files needed for
@code{gnatelim}: @code{gnatelim}:
...@@ -15637,6 +15643,13 @@ Project Files}). Another possibility is to specify the source search ...@@ -15637,6 +15643,13 @@ Project Files}). Another possibility is to specify the source search
path and needed configuration files in @option{-cargs} section of @command{gnatmetric} path and needed configuration files in @option{-cargs} section of @command{gnatmetric}
call, see the description of the @command{gnatmetric} switches below. call, see the description of the @command{gnatmetric} switches below.
If the set of sources to be processed by @code{gnatmetric} contains sources with
preprocessing directives
then the needed options should be provided to run preprocessor as a part of
the @command{gnatmetric} call, and the computed metrics
will correspond to preprocessed sources.
The @command{gnatmetric} command has the form The @command{gnatmetric} command has the form
@smallexample @smallexample
...@@ -19373,6 +19386,11 @@ Project Files}). Another possibility is to specify the source search ...@@ -19373,6 +19386,11 @@ Project Files}). Another possibility is to specify the source search
path and needed configuration files in @option{-cargs} section of @command{gnatstub} path and needed configuration files in @option{-cargs} section of @command{gnatstub}
call, see the description of the @command{gnatstub} switches below. call, see the description of the @command{gnatstub} switches below.
If the @command{gnatstub} argument source contains preprocessing directives
then the needed options should be provided to run preprocessor as a part of
the @command{gnatstub} call, and the generated body stub will correspond to
the preprocessed source.
By default, all the program unit body stubs generated by @code{gnatstub} By default, all the program unit body stubs generated by @code{gnatstub}
raise the predefined @code{Program_Error} exception, which will catch raise the predefined @code{Program_Error} exception, which will catch
accidental calls of generated stubs. This behavior can be changed with accidental calls of generated stubs. This behavior can be changed with
...@@ -439,45 +439,45 @@ package body Sem_Aux is ...@@ -439,45 +439,45 @@ package body Sem_Aux is
--------------------- ---------------------
function Get_Binary_Nkind (Op : Entity_Id) return Node_Kind is function Get_Binary_Nkind (Op : Entity_Id) return Node_Kind is
Name : constant String := Get_Name_String (Chars (Op));
begin begin
if Name = "Oadd" then case Chars (Op) is
return N_Op_Add; when Name_Op_Add =>
elsif Name = "Oconcat" then return N_Op_Add;
return N_Op_Concat; when Name_Op_Concat =>
elsif Name = "Oexpon" then return N_Op_Concat;
return N_Op_Expon; when Name_Op_Expon =>
elsif Name = "Osubtract" then return N_Op_Expon;
return N_Op_Subtract; when Name_Op_Subtract =>
elsif Name = "Omod" then return N_Op_Subtract;
return N_Op_Mod; when Name_Op_Mod =>
elsif Name = "Omultiply" then return N_Op_Mod;
return N_Op_Multiply; when Name_Op_Multiply =>
elsif Name = "Odivide" then return N_Op_Multiply;
return N_Op_Divide; when Name_Op_Divide =>
elsif Name = "Orem" then return N_Op_Divide;
return N_Op_Rem; when Name_Op_Rem =>
elsif Name = "Oand" then return N_Op_Rem;
return N_Op_And; when Name_Op_And =>
elsif Name = "Oeq" then return N_Op_And;
return N_Op_Eq; when Name_Op_Eq =>
elsif Name = "Oge" then return N_Op_Eq;
return N_Op_Ge; when Name_Op_Ge =>
elsif Name = "Ogt" then return N_Op_Ge;
return N_Op_Gt; when Name_Op_Gt =>
elsif Name = "Ole" then return N_Op_Gt;
return N_Op_Le; when Name_Op_Le =>
elsif Name = "Olt" then return N_Op_Le;
return N_Op_Lt; when Name_Op_Lt =>
elsif Name = "One" then return N_Op_Lt;
return N_Op_Ne; when Name_Op_Ne =>
elsif Name = "Oxor" then return N_Op_Ne;
return N_Op_Or; when Name_Op_Or =>
elsif Name = "Oor" then return N_Op_Or;
return N_Op_Xor; when Name_Op_Xor =>
else return N_Op_Xor;
raise Program_Error; when others =>
end if; raise Program_Error;
end case;
end Get_Binary_Nkind; end Get_Binary_Nkind;
------------------ ------------------
...@@ -652,19 +652,19 @@ package body Sem_Aux is ...@@ -652,19 +652,19 @@ package body Sem_Aux is
--------------------- ---------------------
function Get_Unary_Nkind (Op : Entity_Id) return Node_Kind is function Get_Unary_Nkind (Op : Entity_Id) return Node_Kind is
Name : constant String := Get_Name_String (Chars (Op));
begin begin
if Name = "Oabs" then case Chars (Op) is
return N_Op_Abs; when Name_Op_Abs =>
elsif Name = "Osubtract" then return N_Op_Abs;
return N_Op_Minus; when Name_Op_Subtract =>
elsif Name = "Onot" then return N_Op_Minus;
return N_Op_Not; when Name_Op_Not =>
elsif Name = "Oadd" then return N_Op_Not;
return N_Op_Plus; when Name_Op_Add =>
else return N_Op_Plus;
raise Program_Error; when others =>
end if; raise Program_Error;
end case;
end Get_Unary_Nkind; end Get_Unary_Nkind;
--------------------------------- ---------------------------------
......
...@@ -152,6 +152,18 @@ package Sem_Aux is ...@@ -152,6 +152,18 @@ package Sem_Aux is
-- Typ must be a tagged record type. This function returns the Entity for -- Typ must be a tagged record type. This function returns the Entity for
-- the first _Tag field in the record type. -- the first _Tag field in the record type.
function Get_Binary_Nkind (Op : Entity_Id) return Node_Kind;
-- Op must be an entity with an Ekind of E_Operator. This function returns
-- the Nkind value that would be used to construct a binary operator node
-- referencing this entity. It is an error to call this function if Ekind
-- (Op) /= E_Operator.
function Get_Unary_Nkind (Op : Entity_Id) return Node_Kind;
-- Op must be an entity with an Ekind of E_Operator. This function returns
-- the Nkind value that would be used to construct a unary operator node
-- referencing this entity. It is an error to call this function if Ekind
-- (Op) /= E_Operator.
function Get_Rep_Item function Get_Rep_Item
(E : Entity_Id; (E : Entity_Id;
Nam : Name_Id; Nam : Name_Id;
...@@ -386,17 +398,4 @@ package Sem_Aux is ...@@ -386,17 +398,4 @@ package Sem_Aux is
-- package specification. Simplifies handling of child units, and better -- package specification. Simplifies handling of child units, and better
-- than the old idiom: Specification (Unit_Declaration_Node (Pack_Id)). -- than the old idiom: Specification (Unit_Declaration_Node (Pack_Id)).
function Get_Binary_Nkind (Op : Entity_Id) return Node_Kind;
-- Op must be an entity with an Ekind of E_Operator.
-- This function returns the Nkind value that would
-- be used to construct a binary operator node referencing
-- this entity. It is an error to call this function
-- if Ekind (Op) /= E_Operator.
function Get_Unary_Nkind (Op : Entity_Id) return Node_Kind;
-- Op must be an entity with an Ekind of E_Operator.
-- This function returns the Nkind value that would
-- be used to construct a unary operator node referencing
-- this entity. It is an error to call this function
-- if Ekind (Op) /= E_Operator.
end Sem_Aux; end Sem_Aux;
...@@ -647,7 +647,7 @@ package body Sem_Case is ...@@ -647,7 +647,7 @@ package body Sem_Case is
Bounds_Lo : constant Node_Id := Type_Low_Bound (Bounds_Type); Bounds_Lo : constant Node_Id := Type_Low_Bound (Bounds_Type);
Num_Choices : constant Nat := Choice_Table'Last; Num_Choices : constant Nat := Choice_Table'Last;
Has_Predicate : constant Boolean := Has_Predicate : constant Boolean :=
Is_Static_Subtype (Bounds_Type) Is_OK_Static_Subtype (Bounds_Type)
and then Present (Static_Predicate (Bounds_Type)); and then Present (Static_Predicate (Bounds_Type));
Choice : Node_Id; Choice : Node_Id;
...@@ -977,7 +977,7 @@ package body Sem_Case is ...@@ -977,7 +977,7 @@ package body Sem_Case is
-- Special case: only an others case is present. The others case -- Special case: only an others case is present. The others case
-- covers the full range of the type. -- covers the full range of the type.
if Is_Static_Subtype (Choice_Type) then if Is_OK_Static_Subtype (Choice_Type) then
Choice := New_Occurrence_Of (Choice_Type, Loc); Choice := New_Occurrence_Of (Choice_Type, Loc);
else else
Choice := New_Occurrence_Of (Base_Type (Choice_Type), Loc); Choice := New_Occurrence_Of (Base_Type (Choice_Type), Loc);
...@@ -1268,9 +1268,9 @@ package body Sem_Case is ...@@ -1268,9 +1268,9 @@ package body Sem_Case is
-- Do not insert non static choices in the table to be sorted -- Do not insert non static choices in the table to be sorted
elsif not Is_Static_Expression (Lo) elsif not Is_OK_Static_Expression (Lo)
or else or else
not Is_Static_Expression (Hi) not Is_OK_Static_Expression (Hi)
then then
Process_Non_Static_Choice (Choice); Process_Non_Static_Choice (Choice);
return; return;
...@@ -1498,7 +1498,7 @@ package body Sem_Case is ...@@ -1498,7 +1498,7 @@ package body Sem_Case is
-- Not predicated subtype case -- Not predicated subtype case
elsif not Is_Static_Subtype (E) then elsif not Is_OK_Static_Subtype (E) then
Process_Non_Static_Choice (Choice); Process_Non_Static_Choice (Choice);
else else
Check Check
...@@ -1522,7 +1522,7 @@ package body Sem_Case is ...@@ -1522,7 +1522,7 @@ package body Sem_Case is
begin begin
E := Entity (Subtype_Mark (Choice)); E := Entity (Subtype_Mark (Choice));
if not Is_Static_Subtype (E) then if not Is_OK_Static_Subtype (E) then
Process_Non_Static_Choice (Choice); Process_Non_Static_Choice (Choice);
else else
......
...@@ -4238,7 +4238,7 @@ package body Sinfo is ...@@ -4238,7 +4238,7 @@ package body Sinfo is
begin begin
pragma Assert (False pragma Assert (False
or else NT (N).Nkind = N_If_Expression); or else NT (N).Nkind = N_If_Expression);
Set_List3 (N, Val); -- semantic field, no parent set Set_List3_With_Parent (N, Val); -- semantic field, but needs parents
end Set_Else_Actions; end Set_Else_Actions;
procedure Set_Else_Statements procedure Set_Else_Statements
...@@ -6266,7 +6266,7 @@ package body Sinfo is ...@@ -6266,7 +6266,7 @@ package body Sinfo is
begin begin
pragma Assert (False pragma Assert (False
or else NT (N).Nkind = N_If_Expression); or else NT (N).Nkind = N_If_Expression);
Set_List2 (N, Val); -- semantic field, no parent set Set_List2_With_Parent (N, Val); -- semantic field, but needs parents
end Set_Then_Actions; end Set_Then_Actions;
procedure Set_Then_Statements procedure Set_Then_Statements
......
...@@ -4262,7 +4262,11 @@ package Sinfo is ...@@ -4262,7 +4262,11 @@ package Sinfo is
-- Note: the Then_Actions and Else_Actions fields are always set to -- Note: the Then_Actions and Else_Actions fields are always set to
-- No_List in the tree passed to Gigi. These fields are used only -- No_List in the tree passed to Gigi. These fields are used only
-- for temporary processing purposes in the expander. -- for temporary processing purposes in the expander. Even though they
-- are semantic fields, their parent pointers are set because analysis
-- of actions nodes in those lists may generate additional actions that
-- need to know their insertion point (for example for the creation of
-- transient scopes).
---------------------------- ----------------------------
-- 4.5.7 Case Expression -- -- 4.5.7 Case Expression --
......
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