Commit 7c4b480f by Arnaud Charlet

[multiple changes]

2010-06-23  Thomas Quinot  <quinot@adacore.com>

	* sem_util.adb, sem_util.ads: Minor reformatting.

2010-06-23  Vincent Celier  <celier@adacore.com>

	* prj.ads (Gprclean_Flags.Missing_Source_Files): Set to Error to keep
	the previous behavior of gprclean when there are missing files.

2010-06-23  Ed Schonberg  <schonberg@adacore.com>

	* sem_ch12.adb (Load_Body_Of_Generic): In CodePeer mode, a missing
	generic body is not a fatal error.
	(Mark_Context): Handle properly names of child units.
	* sem.adb (Walk_Library_Items.Do_Action): Remove assertion on
	instantiations.

2010-06-23  Vincent Celier  <celier@adacore.com>

	* ali.adb (Scan_ALI): When ignoring R lines, do not skip the next
	non-empty line.

2010-06-23  Bob Duff  <duff@adacore.com>

	* g-pehage.ads, g-pehage.adb: Switch default optimization mode to
	Memory_Space, because CPU_Time doesn't seem to provide any significant
	speed advantage in practice. Cleanup: Get rid of constant
	Default_Optimization; doesn't seem to add anything. Use case
	statements instead of if statements; seems cleaner.

From-SVN: r161259
parent bb511fbd
2010-06-23 Thomas Quinot <quinot@adacore.com>
* sem_util.adb, sem_util.ads: Minor reformatting.
2010-06-23 Vincent Celier <celier@adacore.com>
* prj.ads (Gprclean_Flags.Missing_Source_Files): Set to Error to keep
the previous behavior of gprclean when there are missing files.
2010-06-23 Ed Schonberg <schonberg@adacore.com>
* sem_ch12.adb (Load_Body_Of_Generic): In CodePeer mode, a missing
generic body is not a fatal error.
(Mark_Context): Handle properly names of child units.
* sem.adb (Walk_Library_Items.Do_Action): Remove assertion on
instantiations.
2010-06-23 Vincent Celier <celier@adacore.com>
* ali.adb (Scan_ALI): When ignoring R lines, do not skip the next
non-empty line.
2010-06-23 Bob Duff <duff@adacore.com>
* g-pehage.ads, g-pehage.adb: Switch default optimization mode to
Memory_Space, because CPU_Time doesn't seem to provide any significant
speed advantage in practice. Cleanup: Get rid of constant
Default_Optimization; doesn't seem to add anything. Use case
statements instead of if statements; seems cleaner.
2010-06-23 Olivier Hainque <hainque@adacore.com> 2010-06-23 Olivier Hainque <hainque@adacore.com>
* gcc-interface/decl.c (gnat_to_gnu_entity) <case E_Procedure>: Use * gcc-interface/decl.c (gnat_to_gnu_entity) <case E_Procedure>: Use
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- -- -- --
-- B o d y -- -- B o d y --
-- -- -- --
-- Copyright (C) 1992-2009, Free Software Foundation, Inc. -- -- Copyright (C) 1992-2010, Free Software Foundation, Inc. --
-- -- -- --
-- GNAT is free software; you can redistribute it and/or modify it under -- -- 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- -- -- terms of the GNU General Public License as published by the Free Soft- --
...@@ -1295,9 +1295,9 @@ package body ALI is ...@@ -1295,9 +1295,9 @@ package body ALI is
else else
Skip_Space; Skip_Space;
No_Deps.Append ((Id, Get_Name)); No_Deps.Append ((Id, Get_Name));
Skip_Eol;
end if; end if;
Skip_Eol;
C := Getc; C := Getc;
end loop; end loop;
......
...@@ -1176,7 +1176,7 @@ package body GNAT.Perfect_Hash_Generators is ...@@ -1176,7 +1176,7 @@ package body GNAT.Perfect_Hash_Generators is
procedure Initialize procedure Initialize
(Seed : Natural; (Seed : Natural;
K_To_V : Float := Default_K_To_V; K_To_V : Float := Default_K_To_V;
Optim : Optimization := CPU_Time; Optim : Optimization := Memory_Space;
Tries : Positive := Default_Tries) Tries : Positive := Default_Tries)
is is
begin begin
...@@ -1596,39 +1596,41 @@ package body GNAT.Perfect_Hash_Generators is ...@@ -1596,39 +1596,41 @@ package body GNAT.Perfect_Hash_Generators is
New_Line (File); New_Line (File);
if Opt = CPU_Time then case Opt is
Put_Int_Matrix when CPU_Time =>
(File, Put_Int_Matrix
Array_Img ("T1", Type_Img (NV), (File,
Range_Img (0, T1_Len - 1), Array_Img ("T1", Type_Img (NV),
Range_Img (0, T2_Len - 1, Type_Img (256))), Range_Img (0, T1_Len - 1),
T1, T1_Len, T2_Len); Range_Img (0, T2_Len - 1, Type_Img (256))),
T1, T1_Len, T2_Len);
else
Put_Int_Matrix when Memory_Space =>
(File, Put_Int_Matrix
Array_Img ("T1", Type_Img (NV), (File,
Range_Img (0, T1_Len - 1)), Array_Img ("T1", Type_Img (NV),
T1, T1_Len, 0); Range_Img (0, T1_Len - 1)),
end if; T1, T1_Len, 0);
end case;
New_Line (File); New_Line (File);
if Opt = CPU_Time then case Opt is
Put_Int_Matrix when CPU_Time =>
(File, Put_Int_Matrix
Array_Img ("T2", Type_Img (NV), (File,
Range_Img (0, T1_Len - 1), Array_Img ("T2", Type_Img (NV),
Range_Img (0, T2_Len - 1, Type_Img (256))), Range_Img (0, T1_Len - 1),
T2, T1_Len, T2_Len); Range_Img (0, T2_Len - 1, Type_Img (256))),
T2, T1_Len, T2_Len);
else
Put_Int_Matrix when Memory_Space =>
(File, Put_Int_Matrix
Array_Img ("T2", Type_Img (NV), (File,
Range_Img (0, T1_Len - 1)), Array_Img ("T2", Type_Img (NV),
T2, T1_Len, 0); Range_Img (0, T1_Len - 1)),
end if; T2, T1_Len, 0);
end case;
New_Line (File); New_Line (File);
...@@ -1650,11 +1652,12 @@ package body GNAT.Perfect_Hash_Generators is ...@@ -1650,11 +1652,12 @@ package body GNAT.Perfect_Hash_Generators is
Put (File, " J : "); Put (File, " J : ");
if Opt = CPU_Time then case Opt is
Put (File, Type_Img (256)); when CPU_Time =>
else Put (File, Type_Img (256));
Put (File, "Natural"); when Memory_Space =>
end if; Put (File, "Natural");
end case;
Put (File, ";"); Put (File, ";");
New_Line (File); New_Line (File);
...@@ -1667,11 +1670,12 @@ package body GNAT.Perfect_Hash_Generators is ...@@ -1667,11 +1670,12 @@ package body GNAT.Perfect_Hash_Generators is
New_Line (File); New_Line (File);
Put (File, " J := "); Put (File, " J := ");
if Opt = CPU_Time then case Opt is
Put (File, "C"); when CPU_Time =>
else Put (File, "C");
Put (File, "Character'Pos"); when Memory_Space =>
end if; Put (File, "Character'Pos");
end case;
Put (File, " (S (P (K) + F));"); Put (File, " (S (P (K) + F));");
New_Line (File); New_Line (File);
...@@ -2490,20 +2494,21 @@ package body GNAT.Perfect_Hash_Generators is ...@@ -2490,20 +2494,21 @@ package body GNAT.Perfect_Hash_Generators is
R : Natural; R : Natural;
begin begin
if Opt = CPU_Time then case Opt is
for J in 0 .. T1_Len - 1 loop when CPU_Time =>
exit when Word (J + 1) = ASCII.NUL; for J in 0 .. T1_Len - 1 loop
R := Get_Table (Table, J, Get_Used_Char (Word (J + 1))); exit when Word (J + 1) = ASCII.NUL;
S := (S + R) mod NV; R := Get_Table (Table, J, Get_Used_Char (Word (J + 1)));
end loop; S := (S + R) mod NV;
end loop;
else when Memory_Space =>
for J in 0 .. T1_Len - 1 loop for J in 0 .. T1_Len - 1 loop
exit when Word (J + 1) = ASCII.NUL; exit when Word (J + 1) = ASCII.NUL;
R := Get_Table (Table, J, 0); R := Get_Table (Table, J, 0);
S := (S + R * Character'Pos (Word (J + 1))) mod NV; S := (S + R * Character'Pos (Word (J + 1))) mod NV;
end loop; end loop;
end if; end case;
return S; return S;
end Sum; end Sum;
......
...@@ -86,8 +86,9 @@ package GNAT.Perfect_Hash_Generators is ...@@ -86,8 +86,9 @@ package GNAT.Perfect_Hash_Generators is
-- number of tries. -- number of tries.
type Optimization is (Memory_Space, CPU_Time); type Optimization is (Memory_Space, CPU_Time);
Default_Optimization : constant Optimization := CPU_Time; -- Optimize either the memory space or the execution time. Note: in
-- Optimize either the memory space or the execution time -- practice, the optimization mode has little effect on speed. The tables
-- are somewhat smaller with Memory_Space.
Verbose : Boolean := False; Verbose : Boolean := False;
-- Output the status of the algorithm. For instance, the tables, the random -- Output the status of the algorithm. For instance, the tables, the random
...@@ -97,7 +98,7 @@ package GNAT.Perfect_Hash_Generators is ...@@ -97,7 +98,7 @@ package GNAT.Perfect_Hash_Generators is
procedure Initialize procedure Initialize
(Seed : Natural; (Seed : Natural;
K_To_V : Float := Default_K_To_V; K_To_V : Float := Default_K_To_V;
Optim : Optimization := CPU_Time; Optim : Optimization := Memory_Space;
Tries : Positive := Default_Tries); Tries : Positive := Default_Tries);
-- Initialize the generator and its internal structures. Set the ratio of -- Initialize the generator and its internal structures. Set the ratio of
-- vertices over keys in the random graphs. This value has to be greater -- vertices over keys in the random graphs. This value has to be greater
......
...@@ -1630,7 +1630,7 @@ private ...@@ -1630,7 +1630,7 @@ private
Error_On_Unknown_Language => True, Error_On_Unknown_Language => True,
Require_Obj_Dirs => Warning, Require_Obj_Dirs => Warning,
Allow_Invalid_External => Error, Allow_Invalid_External => Error,
Missing_Source_Files => Warning); Missing_Source_Files => Error);
Gnatmake_Flags : constant Processing_Flags := Gnatmake_Flags : constant Processing_Flags :=
(Report_Error => null, (Report_Error => null,
......
...@@ -1589,7 +1589,7 @@ package body Sem is ...@@ -1589,7 +1589,7 @@ package body Sem is
null; null;
when N_Subprogram_Body => when N_Subprogram_Body =>
-- A subprogram body must be the main unit -- A subprogram body must be the main unit
...@@ -1597,14 +1597,17 @@ package body Sem is ...@@ -1597,14 +1597,17 @@ package body Sem is
or else CU = Cunit (Main_Unit)); or else CU = Cunit (Main_Unit));
null; null;
-- All other cases cannot happen
when N_Function_Instantiation | when N_Function_Instantiation |
N_Procedure_Instantiation | N_Procedure_Instantiation |
N_Package_Instantiation => N_Package_Instantiation =>
pragma Assert (False, "instantiation");
-- Can only happen if some generic body (needed for gnat2scil
-- traversal, but not by GNAT) is not available, ignore.
null; null;
-- All other cases cannot happen
when N_Subunit => when N_Subunit =>
pragma Assert (False, "subunit"); pragma Assert (False, "subunit");
null; null;
......
...@@ -8748,11 +8748,16 @@ package body Sem_Ch12 is ...@@ -8748,11 +8748,16 @@ package body Sem_Ch12 is
-- If we have no body, and the unit requires a body, then complain. This -- If we have no body, and the unit requires a body, then complain. This
-- complaint is suppressed if we have detected other errors (since a -- complaint is suppressed if we have detected other errors (since a
-- common reason for missing the body is that it had errors). -- common reason for missing the body is that it had errors).
-- In CodePeer mode, a warning has been emitted already, no need for
-- further messages.
elsif Unit_Requires_Body (Gen_Unit) elsif Unit_Requires_Body (Gen_Unit)
and then not Body_Optional and then not Body_Optional
then then
if Serious_Errors_Detected = 0 then if CodePeer_Mode then
null;
elsif Serious_Errors_Detected = 0 then
Error_Msg_NE Error_Msg_NE
("cannot find body of generic package &", Inst_Node, Gen_Unit); ("cannot find body of generic package &", Inst_Node, Gen_Unit);
...@@ -10451,7 +10456,9 @@ package body Sem_Ch12 is ...@@ -10451,7 +10456,9 @@ package body Sem_Ch12 is
loop loop
Mark_Context Mark_Context
(Inst_Decl, (Inst_Decl,
Unit_Declaration_Node (Generic_Parent (Parent (Scop)))); Unit_Declaration_Node
(Generic_Parent
(Specification (Unit_Declaration_Node (Scop)))));
Scop := Scope (Scop); Scop := Scope (Scop);
end loop; end loop;
...@@ -10857,11 +10864,20 @@ package body Sem_Ch12 is ...@@ -10857,11 +10864,20 @@ package body Sem_Ch12 is
Get_Body_Name (Get_Unit_Name (Unit (Comp_Unit))); Get_Body_Name (Get_Unit_Name (Unit (Comp_Unit)));
begin begin
Error_Msg_Unit_1 := Bname; -- In CodePeer mode, the missing body may make the
Error_Msg_N ("this instantiation requires$!", N); -- analysis incomplete, but we do not treat it as fatal.
Error_Msg_File_1 := Get_File_Name (Bname, Subunit => False);
Error_Msg_N ("\but file{ was not found!", N); if CodePeer_Mode then
raise Unrecoverable_Error; return;
else
Error_Msg_Unit_1 := Bname;
Error_Msg_N ("this instantiation requires$!", N);
Error_Msg_File_1
:= Get_File_Name (Bname, Subunit => False);
Error_Msg_N ("\but file{ was not found!", N);
raise Unrecoverable_Error;
end if;
end; end;
end if; end if;
end if; end if;
......
...@@ -63,6 +63,7 @@ with Ttypes; use Ttypes; ...@@ -63,6 +63,7 @@ with Ttypes; use Ttypes;
with Uname; use Uname; with Uname; use Uname;
with GNAT.HTable; use GNAT.HTable; with GNAT.HTable; use GNAT.HTable;
package body Sem_Util is package body Sem_Util is
---------------------------------------- ----------------------------------------
...@@ -94,19 +95,20 @@ package body Sem_Util is ...@@ -94,19 +95,20 @@ package body Sem_Util is
subtype NCT_Header_Num is Int range 0 .. 511; subtype NCT_Header_Num is Int range 0 .. 511;
-- Defines range of headers in hash tables (512 headers) -- Defines range of headers in hash tables (512 headers)
----------------------------------- ----------------------------------
-- Order dependence : AI05-0144 -- -- Order Dependence (AI05-0144) --
----------------------------------- ----------------------------------
-- Each actual in a call is entered into the table below. A flag -- Each actual in a call is entered into the table below. A flag indicates
-- indicates whether the corresponding formal is out or in out. -- whether the corresponding formal is OUT or IN OUT. Each top-level call
-- Each top-level call (procedure call, condition, assignment) -- (procedure call, condition, assignment) examines all the actuals for a
-- examines all the actuals for a possible order dependence. -- possible order dependence. The table is reset after each such check.
-- The table is reset after each such check.
type Actual_Name is record type Actual_Name is record
Act : Node_Id; Act : Node_Id;
Is_Writable : Boolean; Is_Writable : Boolean;
-- Comments needed???
end record; end record;
package Actuals_In_Call is new Table.Table ( package Actuals_In_Call is new Table.Table (
...@@ -117,65 +119,6 @@ package body Sem_Util is ...@@ -117,65 +119,6 @@ package body Sem_Util is
Table_Increment => 10, Table_Increment => 10,
Table_Name => "Actuals"); Table_Name => "Actuals");
procedure Save_Actual (N : Node_Id; Writable : Boolean := False) is
begin
if Is_Entity_Name (N)
or else Nkind_In (N,
N_Indexed_Component, N_Selected_Component, N_Slice)
or else (Nkind (N) = N_Attribute_Reference
and then Attribute_Name (N) = Name_Access)
then
-- We are only interested in in out parameters of inner calls.
if not Writable
or else Nkind (Parent (N)) = N_Function_Call
or else Nkind (Parent (N)) in N_Op
then
Actuals_In_Call.Increment_Last;
Actuals_In_Call.Table (Actuals_In_Call.Last) := (N, Writable);
end if;
end if;
end Save_Actual;
procedure Check_Order_Dependence is
Act1, Act2 : Node_Id;
begin
for J in 0 .. Actuals_In_Call.Last loop
if Actuals_In_Call.Table (J).Is_Writable then
Act1 := Actuals_In_Call.Table (J).Act;
if Nkind (Act1) = N_Attribute_Reference then
Act1 := Prefix (Act1);
end if;
for K in 0 .. Actuals_In_Call.Last loop
if K /= J then
Act2 := Actuals_In_Call.Table (K).Act;
if Nkind (Act2) = N_Attribute_Reference then
Act2 := Prefix (Act2);
end if;
if Actuals_In_Call.Table (K).Is_Writable
and then K < J
then
-- already checked
null;
elsif Denotes_Same_Object (Act1, Act2)
and then False
then
Error_Msg_N ("?,mighty suspicious!!!", Act1);
end if;
end if;
end loop;
end if;
end loop;
Actuals_In_Call.Set_Last (0);
end Check_Order_Dependence;
----------------------- -----------------------
-- Local Subprograms -- -- Local Subprograms --
----------------------- -----------------------
...@@ -1226,6 +1169,48 @@ package body Sem_Util is ...@@ -1226,6 +1169,48 @@ package body Sem_Util is
end if; end if;
end Check_Nested_Access; end Check_Nested_Access;
----------------------------
-- Check_Order_Dependence --
----------------------------
procedure Check_Order_Dependence is
Act1, Act2 : Node_Id;
begin
for J in 0 .. Actuals_In_Call.Last loop
if Actuals_In_Call.Table (J).Is_Writable then
Act1 := Actuals_In_Call.Table (J).Act;
if Nkind (Act1) = N_Attribute_Reference then
Act1 := Prefix (Act1);
end if;
for K in 0 .. Actuals_In_Call.Last loop
if K /= J then
Act2 := Actuals_In_Call.Table (K).Act;
if Nkind (Act2) = N_Attribute_Reference then
Act2 := Prefix (Act2);
end if;
if Actuals_In_Call.Table (K).Is_Writable
and then K < J
then
-- Already checked
null;
elsif Denotes_Same_Object (Act1, Act2)
and then False
then
Error_Msg_N ("?,mighty suspicious!!!", Act1);
end if;
end if;
end loop;
end if;
end loop;
Actuals_In_Call.Set_Last (0);
end Check_Order_Dependence;
------------------------------------------ ------------------------------------------
-- Check_Potentially_Blocking_Operation -- -- Check_Potentially_Blocking_Operation --
------------------------------------------ ------------------------------------------
...@@ -10583,6 +10568,32 @@ package body Sem_Util is ...@@ -10583,6 +10568,32 @@ package body Sem_Util is
end if; end if;
end Same_Value; end Same_Value;
-----------------
-- Save_Actual --
-----------------
procedure Save_Actual (N : Node_Id; Writable : Boolean := False) is
begin
if Is_Entity_Name (N)
or else
Nkind_In (N, N_Indexed_Component, N_Selected_Component, N_Slice)
or else
(Nkind (N) = N_Attribute_Reference
and then Attribute_Name (N) = Name_Access)
then
-- We are only interested in IN OUT parameters of inner calls
if not Writable
or else Nkind (Parent (N)) = N_Function_Call
or else Nkind (Parent (N)) in N_Op
then
Actuals_In_Call.Increment_Last;
Actuals_In_Call.Table (Actuals_In_Call.Last) := (N, Writable);
end if;
end if;
end Save_Actual;
------------------------ ------------------------
-- Scope_Is_Transient -- -- Scope_Is_Transient --
------------------------ ------------------------
......
...@@ -132,9 +132,9 @@ package Sem_Util is ...@@ -132,9 +132,9 @@ package Sem_Util is
-- Check wrong use of dynamically tagged expression -- Check wrong use of dynamically tagged expression
procedure Check_Fully_Declared (T : Entity_Id; N : Node_Id); procedure Check_Fully_Declared (T : Entity_Id; N : Node_Id);
-- Verify that the full declaration of type T has been seen. If not, -- Verify that the full declaration of type T has been seen. If not, place
-- place error message on node N. Used in object declarations, type -- error message on node N. Used in object declarations, type conversions
-- conversions, qualified expressions. -- and qualified expressions.
procedure Check_Nested_Access (Ent : Entity_Id); procedure Check_Nested_Access (Ent : Entity_Id);
-- Check whether Ent denotes an entity declared in an uplevel scope, which -- Check whether Ent denotes an entity declared in an uplevel scope, which
...@@ -158,10 +158,10 @@ package Sem_Util is ...@@ -158,10 +158,10 @@ package Sem_Util is
-- a possible unlocked access to data. -- a possible unlocked access to data.
procedure Check_VMS (Construct : Node_Id); procedure Check_VMS (Construct : Node_Id);
-- Check that this the target is OpenVMS, and if so, return with -- Check that this the target is OpenVMS, and if so, return with no effect,
-- no effect, otherwise post an error noting this can only be used -- otherwise post an error noting this can only be used with OpenVMS ports.
-- with OpenVMS ports. The argument is the construct in question -- The argument is the construct in question and is used to post the error
-- and is used to post the error message. -- message.
procedure Collect_Interfaces procedure Collect_Interfaces
(T : Entity_Id; (T : Entity_Id;
...@@ -192,10 +192,10 @@ package Sem_Util is ...@@ -192,10 +192,10 @@ package Sem_Util is
-- information on the same interface type. -- information on the same interface type.
function Collect_Primitive_Operations (T : Entity_Id) return Elist_Id; function Collect_Primitive_Operations (T : Entity_Id) return Elist_Id;
-- Called upon type derivation and extension. We scan the declarative -- Called upon type derivation and extension. We scan the declarative part
-- part in which the type appears, and collect subprograms that have -- in which the type appears, and collect subprograms that have one
-- one subsidiary subtype of the type. These subprograms can only -- subsidiary subtype of the type. These subprograms can only appear after
-- appear after the type itself. -- the type itself.
function Compile_Time_Constraint_Error function Compile_Time_Constraint_Error
(N : Node_Id; (N : Node_Id;
...@@ -207,12 +207,11 @@ package Sem_Util is ...@@ -207,12 +207,11 @@ package Sem_Util is
-- generates a warning (or error) message in the same manner, but it does -- generates a warning (or error) message in the same manner, but it does
-- not replace any nodes. For convenience, the function always returns its -- not replace any nodes. For convenience, the function always returns its
-- first argument. The message is a warning if the message ends with ?, or -- first argument. The message is a warning if the message ends with ?, or
-- we are operating in Ada 83 mode, or if the Warn parameter is set to -- we are operating in Ada 83 mode, or the Warn parameter is set to True.
-- True.
procedure Conditional_Delay (New_Ent, Old_Ent : Entity_Id); procedure Conditional_Delay (New_Ent, Old_Ent : Entity_Id);
-- Sets the Has_Delayed_Freeze flag of New if the Delayed_Freeze flag -- Sets the Has_Delayed_Freeze flag of New if the Delayed_Freeze flag of
-- of Old is set and Old has no yet been Frozen (i.e. Is_Frozen is false); -- Old is set and Old has no yet been Frozen (i.e. Is_Frozen is false).
function Copy_Parameter_List (Subp_Id : Entity_Id) return List_Id; function Copy_Parameter_List (Subp_Id : Entity_Id) return List_Id;
-- Utility to create a parameter profile for a new subprogram spec, when -- Utility to create a parameter profile for a new subprogram spec, when
...@@ -241,21 +240,20 @@ package Sem_Util is ...@@ -241,21 +240,20 @@ package Sem_Util is
-- from a library package which is not within any subprogram. -- from a library package which is not within any subprogram.
function Defining_Entity (N : Node_Id) return Entity_Id; function Defining_Entity (N : Node_Id) return Entity_Id;
-- Given a declaration N, returns the associated defining entity. If -- Given a declaration N, returns the associated defining entity. If the
-- the declaration has a specification, the entity is obtained from -- declaration has a specification, the entity is obtained from the
-- the specification. If the declaration has a defining unit name, -- specification. If the declaration has a defining unit name, then the
-- then the defining entity is obtained from the defining unit name -- defining entity is obtained from the defining unit name ignoring any
-- ignoring any child unit prefixes. -- child unit prefixes.
function Denotes_Discriminant function Denotes_Discriminant
(N : Node_Id; (N : Node_Id;
Check_Concurrent : Boolean := False) return Boolean; Check_Concurrent : Boolean := False) return Boolean;
-- Returns True if node N is an Entity_Name node for a discriminant. -- Returns True if node N is an Entity_Name node for a discriminant. If the
-- If the flag Check_Concurrent is true, function also returns true -- flag Check_Concurrent is true, function also returns true when N denotes
-- when N denotes the discriminal of the discriminant of a concurrent -- the discriminal of the discriminant of a concurrent type. This is needed
-- type. This is necessary to disable some optimizations on private -- to disable some optimizations on private components of protected types,
-- components of protected types, and constraint checks on entry -- and constraint checks on entry families constrained by discriminants.
-- families constrained by discriminants.
function Denotes_Same_Object (A1, A2 : Node_Id) return Boolean; function Denotes_Same_Object (A1, A2 : Node_Id) return Boolean;
function Denotes_Same_Prefix (A1, A2 : Node_Id) return Boolean; function Denotes_Same_Prefix (A1, A2 : Node_Id) return Boolean;
...@@ -277,49 +275,48 @@ package Sem_Util is ...@@ -277,49 +275,48 @@ package Sem_Util is
function Designate_Same_Unit function Designate_Same_Unit
(Name1 : Node_Id; (Name1 : Node_Id;
Name2 : Node_Id) return Boolean; Name2 : Node_Id) return Boolean;
-- Return true if Name1 and Name2 designate the same unit name; -- Return true if Name1 and Name2 designate the same unit name; each of
-- each of these names is supposed to be a selected component name, -- these names is supposed to be a selected component name, an expanded
-- an expanded name, a defining program unit name or an identifier -- name, a defining program unit name or an identifier.
function Enclosing_Generic_Body function Enclosing_Generic_Body
(N : Node_Id) return Node_Id; (N : Node_Id) return Node_Id;
-- Returns the Node_Id associated with the innermost enclosing -- Returns the Node_Id associated with the innermost enclosing generic
-- generic body, if any. If none, then returns Empty. -- body, if any. If none, then returns Empty.
function Enclosing_Generic_Unit function Enclosing_Generic_Unit
(N : Node_Id) return Node_Id; (N : Node_Id) return Node_Id;
-- Returns the Node_Id associated with the innermost enclosing -- Returns the Node_Id associated with the innermost enclosing generic
-- generic unit, if any. If none, then returns Empty. -- unit, if any. If none, then returns Empty.
function Enclosing_Lib_Unit_Entity return Entity_Id; function Enclosing_Lib_Unit_Entity return Entity_Id;
-- Returns the entity of enclosing N_Compilation_Unit Node which is the -- Returns the entity of enclosing N_Compilation_Unit Node which is the
-- root of the current scope (which must not be Standard_Standard, and -- root of the current scope (which must not be Standard_Standard, and the
-- the caller is responsible for ensuring this condition). -- caller is responsible for ensuring this condition).
function Enclosing_Lib_Unit_Node (N : Node_Id) return Node_Id; function Enclosing_Lib_Unit_Node (N : Node_Id) return Node_Id;
-- Returns the enclosing N_Compilation_Unit Node that is the root -- Returns the enclosing N_Compilation_Unit Node that is the root of a
-- of a subtree containing N. -- subtree containing N.
function Enclosing_Subprogram (E : Entity_Id) return Entity_Id; function Enclosing_Subprogram (E : Entity_Id) return Entity_Id;
-- Utility function to return the Ada entity of the subprogram enclosing -- Utility function to return the Ada entity of the subprogram enclosing
-- the entity E, if any. Returns Empty if no enclosing subprogram. -- the entity E, if any. Returns Empty if no enclosing subprogram.
procedure Ensure_Freeze_Node (E : Entity_Id); procedure Ensure_Freeze_Node (E : Entity_Id);
-- Make sure a freeze node is allocated for entity E. If necessary, -- Make sure a freeze node is allocated for entity E. If necessary, build
-- build and initialize a new freeze node and set Has_Delayed_Freeze -- and initialize a new freeze node and set Has_Delayed_Freeze True for E.
-- true for entity E.
procedure Enter_Name (Def_Id : Entity_Id); procedure Enter_Name (Def_Id : Entity_Id);
-- Insert new name in symbol table of current scope with check for -- Insert new name in symbol table of current scope with check for
-- duplications (error message is issued if a conflict is found) -- duplications (error message is issued if a conflict is found).
-- Note: Enter_Name is not used for overloadable entities, instead -- Note: Enter_Name is not used for overloadable entities, instead these
-- these are entered using Sem_Ch6.Enter_Overloadable_Entity. -- are entered using Sem_Ch6.Enter_Overloadable_Entity.
procedure Explain_Limited_Type (T : Entity_Id; N : Node_Id); procedure Explain_Limited_Type (T : Entity_Id; N : Node_Id);
-- This procedure is called after issuing a message complaining -- This procedure is called after issuing a message complaining about an
-- about an inappropriate use of limited type T. If useful, it -- inappropriate use of limited type T. If useful, it adds additional
-- adds additional continuation lines to the message explaining -- continuation lines to the message explaining why type T is limited.
-- why type T is limited. Messages are placed at node N. -- Messages are placed at node N.
procedure Find_Actual procedure Find_Actual
(N : Node_Id; (N : Node_Id;
...@@ -376,7 +373,7 @@ package Sem_Util is ...@@ -376,7 +373,7 @@ package Sem_Util is
-- iterating through the actuals in declaration order is to use this -- iterating through the actuals in declaration order is to use this
-- function to find the first actual, and then use Next_Actual to obtain -- function to find the first actual, and then use Next_Actual to obtain
-- the next actual in declaration order. Note that the value returned -- the next actual in declaration order. Note that the value returned
-- is always the expression (not the N_Parameter_Association nodes -- is always the expression (not the N_Parameter_Association nodes,
-- even if named association is used). -- even if named association is used).
function Full_Qualified_Name (E : Entity_Id) return String_Id; function Full_Qualified_Name (E : Entity_Id) return String_Id;
...@@ -421,15 +418,15 @@ package Sem_Util is ...@@ -421,15 +418,15 @@ package Sem_Util is
function Get_Actual_Subtype (N : Node_Id) return Entity_Id; function Get_Actual_Subtype (N : Node_Id) return Entity_Id;
-- Given a node for an expression, obtain the actual subtype of the -- Given a node for an expression, obtain the actual subtype of the
-- expression. In the case of a parameter where the formal is an -- expression. In the case of a parameter where the formal is an
-- unconstrained array or discriminated type, this will be the -- unconstrained array or discriminated type, this will be the previously
-- previously constructed subtype of the actual. Note that this is -- constructed subtype of the actual. Note that this is not quite the
-- not quite the "Actual Subtype" of the RM, since it is always -- "Actual Subtype" of the RM, since it is always a constrained type, i.e.
-- a constrained type, i.e. it is the subtype of the value of the -- it is the subtype of the value of the actual. The actual subtype is also
-- actual. The actual subtype is also returned in other cases where -- returned in other cases where it has already been constructed for an
-- it has already been constructed for an object. Otherwise the -- object. Otherwise the expression type is returned unchanged, except for
-- expression type is returned unchanged, except for the case of an -- the case of an unconstrained array type, where an actual subtype is
-- unconstrained array type, where an actual subtype is created, using -- created, using Insert_Actions if necessary to insert any associated
-- Insert_Actions if necessary to insert any associated actions. -- actions.
function Get_Actual_Subtype_If_Available (N : Node_Id) return Entity_Id; function Get_Actual_Subtype_If_Available (N : Node_Id) return Entity_Id;
-- This is like Get_Actual_Subtype, except that it never constructs an -- This is like Get_Actual_Subtype, except that it never constructs an
...@@ -439,31 +436,29 @@ package Sem_Util is ...@@ -439,31 +436,29 @@ package Sem_Util is
function Get_Default_External_Name (E : Node_Or_Entity_Id) return Node_Id; function Get_Default_External_Name (E : Node_Or_Entity_Id) return Node_Id;
-- This is used to construct the string literal node representing a -- This is used to construct the string literal node representing a
-- default external name, i.e. one that is constructed from the name -- default external name, i.e. one that is constructed from the name of an
-- of an entity, or (in the case of extended DEC import/export pragmas, -- entity, or (in the case of extended DEC import/export pragmas, an
-- an identifier provided as the external name. Letters in the name are -- identifier provided as the external name. Letters in the name are
-- according to the setting of Opt.External_Name_Default_Casing. -- according to the setting of Opt.External_Name_Default_Casing.
function Get_Generic_Entity (N : Node_Id) return Entity_Id; function Get_Generic_Entity (N : Node_Id) return Entity_Id;
-- Returns the true generic entity in an instantiation. If the name in -- Returns the true generic entity in an instantiation. If the name in the
-- the instantiation is a renaming, the function returns the renamed -- instantiation is a renaming, the function returns the renamed generic.
-- generic.
procedure Get_Index_Bounds (N : Node_Id; L, H : out Node_Id); procedure Get_Index_Bounds (N : Node_Id; L, H : out Node_Id);
-- This procedure assigns to L and H respectively the values of the -- This procedure assigns to L and H respectively the values of the low and
-- low and high bounds of node N, which must be a range, subtype -- high bounds of node N, which must be a range, subtype indication, or the
-- indication, or the name of a scalar subtype. The result in L, H -- name of a scalar subtype. The result in L, H may be set to Error if
-- may be set to Error if there was an earlier error in the range. -- there was an earlier error in the range.
function Get_Enum_Lit_From_Pos function Get_Enum_Lit_From_Pos
(T : Entity_Id; (T : Entity_Id;
Pos : Uint; Pos : Uint;
Loc : Source_Ptr) return Entity_Id; Loc : Source_Ptr) return Entity_Id;
-- This function obtains the E_Enumeration_Literal entity for the -- This function obtains the E_Enumeration_Literal entity for the specified
-- specified value from the enumeration type or subtype T. The -- value from the enumeration type or subtype T. The second argument is the
-- second argument is the Pos value, which is assumed to be in range. -- Pos value, which is assumed to be in range. The third argument supplies
-- The third argument supplies a source location for constructed -- a source location for constructed nodes returned by this function.
-- nodes returned by this function.
procedure Get_Library_Unit_Name_String (Decl_Node : Node_Id); procedure Get_Library_Unit_Name_String (Decl_Node : Node_Id);
-- Retrieve the fully expanded name of the library unit declared by -- Retrieve the fully expanded name of the library unit declared by
...@@ -472,9 +467,9 @@ package Sem_Util is ...@@ -472,9 +467,9 @@ package Sem_Util is
function Get_Name_Entity_Id (Id : Name_Id) return Entity_Id; function Get_Name_Entity_Id (Id : Name_Id) return Entity_Id;
pragma Inline (Get_Name_Entity_Id); pragma Inline (Get_Name_Entity_Id);
-- An entity value is associated with each name in the name table. The -- An entity value is associated with each name in the name table. The
-- Get_Name_Entity_Id function fetches the Entity_Id of this entity, -- Get_Name_Entity_Id function fetches the Entity_Id of this entity, which
-- which is the innermost visible entity with the given name. See the -- is the innermost visible entity with the given name. See the body of
-- body of Sem_Ch8 for further details on handling of entity visibility. -- Sem_Ch8 for further details on handling of entity visibility.
function Get_Pragma_Id (N : Node_Id) return Pragma_Id; function Get_Pragma_Id (N : Node_Id) return Pragma_Id;
pragma Inline (Get_Pragma_Id); pragma Inline (Get_Pragma_Id);
...@@ -492,22 +487,20 @@ package Sem_Util is ...@@ -492,22 +487,20 @@ package Sem_Util is
-- with any other kind of entity. -- with any other kind of entity.
function Get_Subprogram_Entity (Nod : Node_Id) return Entity_Id; function Get_Subprogram_Entity (Nod : Node_Id) return Entity_Id;
-- Nod is either a procedure call statement, or a function call, or -- Nod is either a procedure call statement, or a function call, or an
-- an accept statement node. This procedure finds the Entity_Id of the -- accept statement node. This procedure finds the Entity_Id of the related
-- related subprogram or entry and returns it, or if no subprogram can -- subprogram or entry and returns it, or if no subprogram can be found,
-- be found, returns Empty. -- returns Empty.
function Get_Subprogram_Body (E : Entity_Id) return Node_Id; function Get_Subprogram_Body (E : Entity_Id) return Node_Id;
-- Given the entity for a subprogram (E_Function or E_Procedure), -- Given the entity for a subprogram (E_Function or E_Procedure), return
-- return the corresponding N_Subprogram_Body node. If the corresponding -- the corresponding N_Subprogram_Body node. If the corresponding body
-- body of the declaration is missing (as for an imported subprogram) -- is missing (as for an imported subprogram), return Empty.
-- return Empty.
function Get_Task_Body_Procedure (E : Entity_Id) return Node_Id; function Get_Task_Body_Procedure (E : Entity_Id) return Node_Id;
pragma Inline (Get_Task_Body_Procedure); pragma Inline (Get_Task_Body_Procedure);
-- Given an entity for a task type or subtype, retrieves the -- Given an entity for a task type or subtype, retrieves the
-- Task_Body_Procedure field from the corresponding task type -- Task_Body_Procedure field from the corresponding task type declaration.
-- declaration.
function Has_Access_Values (T : Entity_Id) return Boolean; function Has_Access_Values (T : Entity_Id) return Boolean;
-- Returns true if type or subtype T is an access type, or has a component -- Returns true if type or subtype T is an access type, or has a component
...@@ -537,18 +530,18 @@ package Sem_Util is ...@@ -537,18 +530,18 @@ package Sem_Util is
-- --
-- Note: Known_Incompatible does not mean that at run time the alignment -- Note: Known_Incompatible does not mean that at run time the alignment
-- of Expr is known to be wrong for Obj, just that it can be determined -- of Expr is known to be wrong for Obj, just that it can be determined
-- that alignments have been explicitly or implicitly specified which -- that alignments have been explicitly or implicitly specified which are
-- are incompatible (whereas Unknown means that even this is not known). -- incompatible (whereas Unknown means that even this is not known). The
-- The appropriate reaction of a caller to Known_Incompatible is to treat -- appropriate reaction of a caller to Known_Incompatible is to treat it as
-- it as Unknown, but issue a warning that there may be an alignment error. -- Unknown, but issue a warning that there may be an alignment error.
function Has_Declarations (N : Node_Id) return Boolean; function Has_Declarations (N : Node_Id) return Boolean;
-- Determines if the node can have declarations -- Determines if the node can have declarations
function Has_Discriminant_Dependent_Constraint function Has_Discriminant_Dependent_Constraint
(Comp : Entity_Id) return Boolean; (Comp : Entity_Id) return Boolean;
-- Returns True if and only if Comp has a constrained subtype -- Returns True if and only if Comp has a constrained subtype that depends
-- that depends on a discriminant. -- on a discriminant.
function Has_Infinities (E : Entity_Id) return Boolean; function Has_Infinities (E : Entity_Id) return Boolean;
-- Determines if the range of the floating-point type E includes -- Determines if the range of the floating-point type E includes
...@@ -578,18 +571,18 @@ package Sem_Util is ...@@ -578,18 +571,18 @@ package Sem_Util is
-- yet received a full declaration. -- yet received a full declaration.
function Has_Stream (T : Entity_Id) return Boolean; function Has_Stream (T : Entity_Id) return Boolean;
-- Tests if type T is derived from Ada.Streams.Root_Stream_Type, or -- Tests if type T is derived from Ada.Streams.Root_Stream_Type, or in the
-- in the case of a composite type, has a component for which this -- case of a composite type, has a component for which this predicate is
-- predicate is True, and if so returns True. Otherwise a result of -- True, and if so returns True. Otherwise a result of False means that
-- False means that there is no Stream type in sight. For a private -- there is no Stream type in sight. For a private type, the test is
-- type, the test is applied to the underlying type (or returns False -- applied to the underlying type (or returns False if there is no
-- if there is no underlying type). -- underlying type).
function Has_Tagged_Component (Typ : Entity_Id) return Boolean; function Has_Tagged_Component (Typ : Entity_Id) return Boolean;
-- Returns True if Typ is a composite type (array or record) which is -- Returns True if Typ is a composite type (array or record) which is
-- either itself a tagged type, or has a component (recursively) which is -- either itself a tagged type, or has a component (recursively) which is
-- a tagged type. Returns False for non-composite type, or if no tagged -- a tagged type. Returns False for non-composite type, or if no tagged
-- component is present. This function is used to check if '=' has to be -- component is present. This function is used to check if "=" has to be
-- expanded into a bunch component comparisons. -- expanded into a bunch component comparisons.
function Implements_Interface function Implements_Interface
...@@ -620,11 +613,11 @@ package Sem_Util is ...@@ -620,11 +613,11 @@ package Sem_Util is
-- Returns True if node N belongs to a parameter specification -- Returns True if node N belongs to a parameter specification
function In_Subprogram_Or_Concurrent_Unit return Boolean; function In_Subprogram_Or_Concurrent_Unit return Boolean;
-- Determines if the current scope is within a subprogram compilation -- Determines if the current scope is within a subprogram compilation unit
-- unit (inside a subprogram declaration, subprogram body, or generic -- (inside a subprogram declaration, subprogram body, or generic
-- subprogram declaration) or within a task or protected body. The test -- subprogram declaration) or within a task or protected body. The test is
-- is for appearing anywhere within such a construct (that is it does not -- for appearing anywhere within such a construct (that is it does not need
-- need to be directly within). -- to be directly within).
function In_Visible_Part (Scope_Id : Entity_Id) return Boolean; function In_Visible_Part (Scope_Id : Entity_Id) return Boolean;
-- Determine whether a declaration occurs within the visible part of a -- Determine whether a declaration occurs within the visible part of a
...@@ -656,8 +649,8 @@ package Sem_Util is ...@@ -656,8 +649,8 @@ package Sem_Util is
-- Determines if N is an actual parameter in a subprogram call -- Determines if N is an actual parameter in a subprogram call
function Is_Aliased_View (Obj : Node_Id) return Boolean; function Is_Aliased_View (Obj : Node_Id) return Boolean;
-- Determine if Obj is an aliased view, i.e. the name of an -- Determine if Obj is an aliased view, i.e. the name of an object to which
-- object to which 'Access or 'Unchecked_Access can apply. -- 'Access or 'Unchecked_Access can apply.
function Is_Ancestor_Package function Is_Ancestor_Package
(E1 : Entity_Id; (E1 : Entity_Id;
...@@ -665,8 +658,8 @@ package Sem_Util is ...@@ -665,8 +658,8 @@ package Sem_Util is
-- Determine whether package E1 is an ancestor of E2 -- Determine whether package E1 is an ancestor of E2
function Is_Atomic_Object (N : Node_Id) return Boolean; function Is_Atomic_Object (N : Node_Id) return Boolean;
-- Determines if the given node denotes an atomic object in the sense -- Determines if the given node denotes an atomic object in the sense of
-- of the legality checks described in RM C.6(12). -- the legality checks described in RM C.6(12).
function Is_Coextension_Root (N : Node_Id) return Boolean; function Is_Coextension_Root (N : Node_Id) return Boolean;
-- Determine whether node N is an allocator which acts as a coextension -- Determine whether node N is an allocator which acts as a coextension
...@@ -1173,11 +1166,10 @@ package Sem_Util is ...@@ -1173,11 +1166,10 @@ package Sem_Util is
-- are only partially ordered, so Scope_Within_Or_Same (A,B) and -- are only partially ordered, so Scope_Within_Or_Same (A,B) and
-- Scope_Within_Or_Same (B,A) can both be False for a given pair A,B. -- Scope_Within_Or_Same (B,A) can both be False for a given pair A,B.
procedure Save_Actual (N : Node_Id; Writable : Boolean := False); procedure Save_Actual (N : Node_Id; Writable : Boolean := False);
-- Enter an actual in a call in a table global, for subsequent check -- Enter an actual in a call in a table global, for subsequent check of
-- of possible order dependence in the presence of in out parameters -- possible order dependence in the presence of IN OUT parameters for
-- for functions in Ada 2012 (or access parameters in older versions -- functions in Ada 2012 (or access parameters in older language versions).
-- of the language).
function Scope_Within (Scope1, Scope2 : Entity_Id) return Boolean; function Scope_Within (Scope1, Scope2 : Entity_Id) return Boolean;
-- Like Scope_Within_Or_Same, except that this function returns -- Like Scope_Within_Or_Same, except that this function returns
......
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