+2012-06-12 Robert Dewar <dewar@adacore.com>
+
+ * sem_dist.adb, exp_ch7.adb, sem_type.adb, exp_attr.adb,
+ sinfo.ads, sem_ch7.adb, exp_alfa.adb, sem_scil.adb, sem_ch12.adb,
+ sem_util.adb, sem_res.adb, sem_attr.adb, sem_elab.adb, exp_ch6.adb,
+ sem_ch4.adb, sem_warn.adb, scil_ll.adb, exp_cg.adb: Minor code
+ reorganization.
+
+2012-06-12 Eric Botcazou <ebotcazou@adacore.com>
+
+ * s-tasini.ads: Minor fix in comment.
+
+2012-06-12 Thomas Quinot <quinot@adacore.com>
+
+ * freeze.adb (Freeze_Record_Type): Warn on record with
+ Scalar_Storage_Order if there is no placed component.
+
+2012-06-12 Thomas Quinot <quinot@adacore.com>
+
+ * sem_ch3.adb: Minor comment fix.
+
+2012-06-12 Vincent Celier <celier@adacore.com>
+
+ * ali-util.adb (Time_Stamp_Mismatch): In minimal recompilation
+ mode, use Stringt Mark and Release to avoid growing the Stringt
+ internal tables uselessly.
+ * stringt.adb (Strings_Last): New global variable
+ (String_Chars_Last): New global variable.
+ (Mark, Release): New procedures.
+ * stringt.ads (Mark, Release) New procedures.
+
2012-06-12 Hristian Kirtchev <kirtchev@adacore.com>
* exp_ch7.adb (Process_Transient_Objects): Renamed constant
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2011, 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- --
with Scng;
with Sinput.C;
with Snames; use Snames;
+with Stringt;
with Styleg;
package body ALI.Util is
-- ??? It is probably worth updating the ALI file with a new
-- field to avoid recomputing it each time.
+ Stringt.Mark;
+
if Checksums_Match
(Get_File_Checksum (Sdep.Table (D).Sfile),
Source.Table (Src).Checksum)
Sdep.Table (D).Stamp := Source.Table (Src).Stamp;
end if;
+ Stringt.Release;
+
end if;
if (not Read_Only) or else Source.Table (Src).Source_Found then
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2011, 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- --
N_Subprogram_Body =>
Qualify_Entity_Names (N);
- when N_Function_Call |
- N_Procedure_Call_Statement =>
+ when N_Subprogram_Call =>
Expand_Alfa_Call (N);
when N_Expanded_Name |
Par := Parent (Par);
end if;
- if Nkind_In (Par, N_Procedure_Call_Statement, N_Function_Call)
+ if Nkind (Par) in N_Subprogram_Call
and then Is_Entity_Name (Name (Par))
then
Subp := Entity (Name (Par));
-- --
-- B o d y --
-- --
--- Copyright (C) 2010, Free Software Foundation, Inc. --
+-- Copyright (C) 2010-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- --
for J in Call_Graph_Nodes.First .. Call_Graph_Nodes.Last loop
N := Call_Graph_Nodes.Table (J);
- if Nkind_In (N, N_Procedure_Call_Statement, N_Function_Call) then
+ if Nkind (N) in N_Subprogram_Call then
Write_Call_Info (N);
else pragma Assert (Nkind (N) = N_Defining_Identifier);
procedure Register_CG_Node (N : Node_Id) is
begin
- if Nkind_In (N, N_Procedure_Call_Statement, N_Function_Call) then
+ if Nkind (N) in N_Subprogram_Call then
if Current_Scope = Main_Unit_Entity
or else Entity_Is_In_Main_Unit (Current_Scope)
then
-- Ada 2005 (AI-251): If some formal is a class-wide interface, expand
-- it to point to the correct secondary virtual table
- if Nkind_In (Call_Node, N_Function_Call, N_Procedure_Call_Statement)
+ if Nkind (Call_Node) in N_Subprogram_Call
and then CW_Interface_Formals_Present
then
Expand_Interface_Actuals (Call_Node);
-- back-ends directly handle the generation of dispatching calls and
-- would have to undo any expansion to an indirect call.
- if Nkind_In (Call_Node, N_Function_Call, N_Procedure_Call_Statement)
+ if Nkind (Call_Node) in N_Subprogram_Call
and then Present (Controlling_Argument (Call_Node))
then
declare
-- intermediate result after its use.
elsif Is_Build_In_Place_Function_Call (Call_Node)
- and then Nkind_In (Parent (Call_Node), N_Attribute_Reference,
- N_Function_Call,
- N_Indexed_Component,
- N_Object_Renaming_Declaration,
- N_Procedure_Call_Statement,
- N_Selected_Component,
- N_Slice)
+ and then
+ Nkind_In (Parent (Call_Node), N_Attribute_Reference,
+ N_Function_Call,
+ N_Indexed_Component,
+ N_Object_Renaming_Declaration,
+ N_Procedure_Call_Statement,
+ N_Selected_Component,
+ N_Slice)
then
Establish_Transient_Scope (Call_Node, Sec_Stack => True);
end if;
----------------------
function Requires_Hooking return Boolean is
- function Is_Subprogram_Call (Nod : Node_Id) return Boolean;
- -- Determine whether a particular node is a procedure of function
- -- call.
-
- ------------------------
- -- Is_Subprogram_Call --
- ------------------------
-
- function Is_Subprogram_Call (Nod : Node_Id) return Boolean is
- begin
- return
- Nkind_In (Nod, N_Function_Call, N_Procedure_Call_Statement);
- end Is_Subprogram_Call;
-
- -- Start of processing for Requires_Hooking
-
begin
-- The context is either a procedure or function call or an object
- -- declaration initialized by such a call. In all these cases, the
- -- calls are assumed to raise an exception.
+ -- declaration initialized by a function call. In all these cases,
+ -- the calls might raise an exception.
- return
- Is_Subprogram_Call (N)
- or else
- (Nkind (N) = N_Object_Declaration
- and then Is_Subprogram_Call (Expression (N)));
+ return Nkind (N) in N_Subprogram_Call
+ or else (Nkind (N) = N_Object_Declaration
+ and then Nkind (Expression (N)) = N_Function_Call);
end Requires_Hooking;
-- Local variables
Next_Entity (Comp);
end loop;
- -- Check compatibility of Scalar_Storage_Order with Bit_Order, if the
- -- former is specified.
-
ADC := Get_Attribute_Definition_Clause
(Rec, Attribute_Scalar_Storage_Order);
- if Present (ADC)
- and then Reverse_Bit_Order (Rec) /= Reverse_Storage_Order (Rec)
- then
- -- Note: report error on Rec, not on ADC, as ADC may apply to
- -- an ancestor type.
+ if Present (ADC) then
- Error_Msg_Sloc := Sloc (ADC);
- Error_Msg_N
- ("scalar storage order for& specified# inconsistent with "
- & "bit order", Rec);
+ -- Check compatibility of Scalar_Storage_Order with Bit_Order, if
+ -- the former is specified.
+
+ if Reverse_Bit_Order (Rec) /= Reverse_Storage_Order (Rec) then
+
+ -- Note: report error on Rec, not on ADC, as ADC may apply to
+ -- an ancestor type.
+
+ Error_Msg_Sloc := Sloc (ADC);
+ Error_Msg_N
+ ("scalar storage order for& specified# inconsistent with "
+ & "bit order", Rec);
+ end if;
+
+ -- Warn if there is a Scalar_Storage_Order but no component clause
+
+ if not Placed_Component then
+ Error_Msg_N
+ ("?scalar storage order specified but no component clause",
+ ADC);
+ end if;
end if;
-- Deal with Bit_Order aspect specifying a non-default bit order
if not Placed_Component then
ADC :=
Get_Attribute_Definition_Clause (Rec, Attribute_Bit_Order);
- Error_Msg_N ("?Bit_Order specification has no effect", ADC);
+ Error_Msg_N ("?bit order specification has no effect", ADC);
Error_Msg_N
("\?since no component clauses were specified", ADC);
if Is_Base_Type (Rec) and then Convention (Rec) = Convention_Ada then
if (Has_Discriminants (Rec) and then Debug_Flag_Dot_V)
- or else
- (not Has_Discriminants (Rec) and then Debug_Flag_Dot_R)
+ or else
+ (not Has_Discriminants (Rec) and then Debug_Flag_Dot_R)
then
Set_OK_To_Reorder_Components (Rec);
end if;
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2010, 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- --
-- Abort Defer/Undefer --
-------------------------
- -- Defer_Abort defers the affects of low-level abort and priority change
+ -- Defer_Abort defers the effects of low-level abort and priority change
-- in the calling task until a matching Undefer_Abort call is executed.
-- Undefer_Abort DOES MORE than just undo the effects of one call to
-- --
-- B o d y --
-- --
--- Copyright (C) 2010, Free Software Foundation, Inc. --
+-- Copyright (C) 2010-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- --
null;
when N_SCIL_Dispatching_Call =>
- pragma Assert (Nkind_In (N, N_Function_Call,
- N_Procedure_Call_Statement));
+ pragma Assert (Nkind (N) in N_Subprogram_Call);
null;
when N_SCIL_Membership_Test =>
-- Case of attribute used as actual for subprogram (positional)
- elsif Nkind_In (Parnt, N_Procedure_Call_Statement,
- N_Function_Call)
+ elsif Nkind (Parnt) in N_Subprogram_Call
and then Is_Entity_Name (Name (Parnt))
then
Must_Be_Imported (Entity (Name (Parnt)));
-- Case of attribute used as actual for subprogram (named)
elsif Nkind (Parnt) = N_Parameter_Association
- and then Nkind_In (GParnt, N_Procedure_Call_Statement,
- N_Function_Call)
+ and then Nkind (GParnt) in N_Subprogram_Call
and then Is_Entity_Name (Name (GParnt))
then
Must_Be_Imported (Entity (Name (GParnt)));
-- information on aggregates in instances.
if Nkind (N2) = Nkind (N)
- and then
- Nkind_In (Parent (N2), N_Procedure_Call_Statement,
- N_Function_Call)
+ and then Nkind (Parent (N2)) in N_Subprogram_Call
and then Comes_From_Source (Typ)
then
if Is_Immediately_Visible (Scope (Typ)) then
when E_Incomplete_Type =>
if Ada_Version >= Ada_2005 then
- -- A subtype of an incomplete type can be explicitly tagged
+ -- In Ada 2005 an incomplete type can be explicitly tagged:
+ -- propagate indication.
Set_Ekind (Id, E_Incomplete_Subtype);
Set_Is_Tagged_Type (Id, Is_Tagged_Type (T));
Analyze (P);
- if Nkind_In (N, N_Function_Call, N_Procedure_Call_Statement) then
+ if Nkind (N) in N_Subprogram_Call then
-- If P is an explicit dereference whose prefix is of a
-- remote access-to-subprogram type, then N has already
(N : Node_Id; CW_Test_Only : Boolean := False) return Boolean
is
K : constant Node_Kind := Nkind (Parent (N));
- Is_Subprg_Call : constant Boolean := Nkind_In
- (K, N_Procedure_Call_Statement,
- N_Function_Call);
+ Is_Subprg_Call : constant Boolean := K in N_Subprogram_Call;
Loc : constant Source_Ptr := Sloc (N);
Obj : constant Node_Id := Prefix (N);
-- Common case covering 1) Call to a procedure and 2) Call to a
-- function that has some additional actuals.
- if Nkind_In (Parent_Node, N_Function_Call,
- N_Procedure_Call_Statement)
+ if Nkind (Parent_Node) in N_Subprogram_Call
-- N is a selected component node containing the name of the
-- subprogram. If N is not the name of the parent node we must
begin
-- Check name of procedure or function calls
- if Nkind_In (N, N_Procedure_Call_Statement, N_Function_Call)
+ if Nkind (N) in N_Subprogram_Call
and then Is_Entity_Name (Name (N))
then
return Abandon;
Par : Node_Id;
begin
- if Nkind_In (N, N_Function_Call, N_Procedure_Call_Statement)
+ if Nkind (N) in N_Subprogram_Call
and then Nkind (Name (N)) in N_Has_Entity
and then Is_Remote_Call_Interface (Entity (Name (N)))
and then Has_All_Calls_Remote (Scope (Entity (Name (N))))
-- If the call is known to be within a local Suppress Elaboration
-- pragma, nothing to check. This can happen in task bodies.
- if (Nkind (N) = N_Function_Call
- or else Nkind (N) = N_Procedure_Call_Statement)
+ if Nkind (N) in N_Subprogram_Call
and then No_Elaboration_Check (N)
then
return;
-- which can happen if the body enclosing the call appears
-- itself in a call whose elaboration check is delayed.
- if Nkind_In (N, N_Function_Call,
- N_Procedure_Call_Statement)
- then
+ if Nkind (N) in N_Subprogram_Call then
Set_No_Elaboration_Check (N);
end if;
end if;
-- Nothing to do if this is not a call or attribute reference (happens
-- in some error conditions, and in some cases where rewriting occurs).
- elsif Nkind (N) /= N_Function_Call
- and then Nkind (N) /= N_Procedure_Call_Statement
+ elsif Nkind (N) not in N_Subprogram_Call
and then Nkind (N) /= N_Attribute_Reference
then
return;
Func : Entity_Id;
begin
- if (Nkind (Nod) = N_Function_Call
- or else Nkind (Nod) = N_Procedure_Call_Statement)
+ if Nkind (Nod) in N_Subprogram_Call
and then Is_Entity_Name (Name (Nod))
then
Func := Entity (Name (Nod));
-- of the arguments is Any_Type, and if so, suppress
-- the message, since it is a cascaded error.
- if Nkind_In (N, N_Function_Call,
- N_Procedure_Call_Statement)
- then
+ if Nkind (N) in N_Subprogram_Call then
declare
A : Node_Id;
E : Node_Id;
("\\possible interpretation#!", N);
end if;
- if Nkind_In
- (N, N_Procedure_Call_Statement, N_Function_Call)
+ if Nkind (N) in N_Subprogram_Call
and then Present (Parameter_Associations (N))
then
Report_Ambiguous_Argument;
-- For procedure or function calls, set the type of the name,
-- and also the entity pointer for the prefix.
- elsif Nkind_In (N, N_Procedure_Call_Statement, N_Function_Call)
+ elsif Nkind (N) in N_Subprogram_Call
and then Is_Entity_Name (Name (N))
then
Set_Etype (Name (N), Expr_Type);
if not Warn_On_Parameter_Order
or else No (Parameter_Associations (N))
- or else not Nkind_In (Original_Node (N), N_Procedure_Call_Statement,
- N_Function_Call)
+ or else Nkind (Original_Node (N)) not in N_Subprogram_Call
or else not Comes_From_Source (N)
then
return;
Par : constant Node_Id := Parent (N);
begin
- return
- Nkind_In (Par, N_Function_Call,
- N_Procedure_Call_Statement)
- and then Is_Entity_Name (Name (Par))
- and then Is_Dispatching_Operation (Entity (Name (Par)));
+ return Nkind (Par) in N_Subprogram_Call
+ and then Is_Entity_Name (Name (Par))
+ and then Is_Dispatching_Operation (Entity (Name (Par)));
end In_Dispatching_Context;
-- Start of processing for Resolve_Allocator
-- In the common case of a call which uses an explicitly null value
-- for an access parameter, give specialized error message.
- if Nkind_In (Parent (N), N_Procedure_Call_Statement,
- N_Function_Call)
- then
+ if Nkind (Parent (N)) in N_Subprogram_Call then
Error_Msg_N
("null is not allowed as argument for an access parameter", N);
-- --
-- B o d y --
-- --
--- Copyright (C) 2009-2010, Free Software Foundation, Inc. --
+-- Copyright (C) 2009-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- --
-- Parent of SCIL dispatching call nodes MUST be a subprogram call
- if not Nkind_In (N, N_Function_Call,
- N_Procedure_Call_Statement)
- then
- pragma Assert (False);
+ if Nkind (N) not in N_Subprogram_Call then
raise Program_Error;
-- In simple cases the controlling tag is the tag of the
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2011, 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- --
then
Add_Entry (Entity (N), Etype (N));
- elsif Nkind_In (N, N_Function_Call, N_Procedure_Call_Statement)
+ elsif Nkind (N) in N_Subprogram_Call
and then Is_Entity_Name (Name (N))
then
Add_Entry (Entity (Name (N)), Etype (N));
return It1;
else
- if Nkind (N) = N_Function_Call
- or else Nkind (N) = N_Procedure_Call_Statement
- then
+ if Nkind (N) in N_Subprogram_Call then
Act1 := First_Actual (N);
if Present (Act1) then
elsif In_Instance
and then not In_Generic_Actual (N)
then
- if Nkind (N) = N_Function_Call
- or else Nkind (N) = N_Procedure_Call_Statement
+ if Nkind (N) in N_Subprogram_Call
or else
(Nkind (N) in N_Has_Entity
and then
then
Call := Parent (Parnt);
- elsif Nkind_In (Parnt, N_Procedure_Call_Statement, N_Function_Call) then
+ elsif Nkind (Parnt) in N_Subprogram_Call then
Call := Parnt;
else
when N_Parameter_Association =>
return N = Explicit_Actual_Parameter (Parent (N));
- when N_Function_Call | N_Procedure_Call_Statement =>
+ when N_Subprogram_Call =>
return Is_List_Member (N)
and then
List_Containing (N) = Parameter_Associations (Parent (N));
function Is_Remote_Call (N : Node_Id) return Boolean is
begin
- if Nkind (N) /= N_Procedure_Call_Statement
- and then Nkind (N) /= N_Function_Call
- then
+ if Nkind (N) not in N_Subprogram_Call then
+
-- An entry call cannot be remote
return False;
-- In older versions of Ada function call arguments are never
-- lvalues. In Ada 2012 functions can have in-out parameters.
- when N_Function_Call |
- N_Procedure_Call_Statement |
- N_Entry_Call_Statement |
+ when N_Subprogram_Call |
+ N_Entry_Call_Statement |
N_Accept_Statement
=>
if Nkind (P) = N_Function_Call and then Ada_Version < Ada_2012 then
-- Call to subprogram
- elsif Nkind (N) = N_Procedure_Call_Statement
- or else Nkind (N) = N_Function_Call
- then
+ elsif Nkind (N) in N_Subprogram_Call then
+
-- If subprogram is within the scope of the entity we are dealing
-- with as the loop variable, then it could modify this parameter,
-- so we abandon in this case. In the case of a subprogram that is
-- Exclude calls rewritten as enumeration literals
- if not Nkind_In (N, N_Function_Call, N_Procedure_Call_Statement) then
+ if Nkind (N) not in N_Subprogram_Call then
return;
end if;
N_Conditional_Expression,
N_Explicit_Dereference,
N_Expression_With_Actions,
+
+ -- N_Subexpr, N_Has_Etype, N_Subprogram_Call
+
N_Function_Call,
+ N_Procedure_Call_Statement,
+
+ -- N_Subexpr, N_Has_Etype
+
N_Indexed_Component,
N_Integer_Literal,
N_Null,
- N_Procedure_Call_Statement,
N_Qualified_Expression,
N_Quantified_Expression,
-- (since overloading is possible, so it needs to go through the normal
-- overloading resolution for expressions).
+ subtype N_Subprogram_Call is Node_Kind range
+ N_Function_Call ..
+ N_Procedure_Call_Statement;
+
subtype N_Subprogram_Instantiation is Node_Kind range
N_Function_Instantiation ..
N_Procedure_Instantiation;
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2009, 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- --
-- when Start_String is called with a parameter that is the last string
-- currently allocated in the table.
+ Strings_Last : String_Id := First_String_Id;
+ String_Chars_Last : Int := 0;
+ -- Strings_Last and String_Chars_Last are used by procedure Mark and
+ -- Release to get a snapshot of the tables and to restore them to their
+ -- previous situation.
+
-------------------------------
-- Add_String_To_Name_Buffer --
-------------------------------
Strings.Release;
end Lock;
+ ----------
+ -- Mark --
+ ----------
+
+ procedure Mark is
+ begin
+ Strings_Last := Strings.Last;
+ String_Chars_Last := String_Chars.Last;
+ end Mark;
+
+ -------------
+ -- Release --
+ -------------
+
+ procedure Release is
+ begin
+ Strings.Set_Last (Strings_Last);
+ String_Chars.Set_Last (String_Chars_Last);
+ end Release;
+
------------------
-- Start_String --
------------------
-- --
-- S p e c --
-- --
--- Copyright (C) 1992-2009, 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- --
procedure Unlock;
-- Unlock internal tables, in case back end needs to modify them
+ procedure Mark;
+ -- Take a snapshot of the internal tables
+
+ procedure Release;
+ -- Restore the internal tables to the situation when Mark was last called.
+ -- Mark and Release are used when getting checksums of sources in minimal
+ -- recompilation mode, to reduce memory usage.
+
procedure Start_String;
-- Sets up for storing a new string in the table. To store a string, a
-- call is first made to Start_String, then successive calls are