summaryrefslogtreecommitdiff
path: root/gcc/ada
diff options
context:
space:
mode:
authorcharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2010-06-23 08:46:08 +0000
committercharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2010-06-23 08:46:08 +0000
commit6e3d50ccc62420a6e6e90cf4d62f6547653bc6f5 (patch)
tree133edf7db0b7358ff43b599d5a6a541f92fce9f4 /gcc/ada
parenta204eb6dd7e0975d76798b5153e33e7b49b775fd (diff)
downloadgcc-6e3d50ccc62420a6e6e90cf4d62f6547653bc6f5.tar.gz
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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@161259 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada')
-rw-r--r--gcc/ada/ChangeLog30
-rw-r--r--gcc/ada/ali.adb4
-rw-r--r--gcc/ada/g-pehage.adb113
-rw-r--r--gcc/ada/g-pehage.ads7
-rw-r--r--gcc/ada/prj.ads2
-rw-r--r--gcc/ada/sem.adb11
-rw-r--r--gcc/ada/sem_ch12.adb30
-rw-r--r--gcc/ada/sem_util.adb147
-rw-r--r--gcc/ada/sem_util.ads216
9 files changed, 309 insertions, 251 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index 768c77c0229..acdcbd5d866 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,3 +1,33 @@
+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>
* gcc-interface/decl.c (gnat_to_gnu_entity) <case E_Procedure>: Use
diff --git a/gcc/ada/ali.adb b/gcc/ada/ali.adb
index 9effd220168..eb45dcaca50 100644
--- a/gcc/ada/ali.adb
+++ b/gcc/ada/ali.adb
@@ -6,7 +6,7 @@
-- --
-- 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 --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -1295,9 +1295,9 @@ package body ALI is
else
Skip_Space;
No_Deps.Append ((Id, Get_Name));
+ Skip_Eol;
end if;
- Skip_Eol;
C := Getc;
end loop;
diff --git a/gcc/ada/g-pehage.adb b/gcc/ada/g-pehage.adb
index 82cb6d03278..b59e1ecec98 100644
--- a/gcc/ada/g-pehage.adb
+++ b/gcc/ada/g-pehage.adb
@@ -1176,7 +1176,7 @@ package body GNAT.Perfect_Hash_Generators is
procedure Initialize
(Seed : Natural;
K_To_V : Float := Default_K_To_V;
- Optim : Optimization := CPU_Time;
+ Optim : Optimization := Memory_Space;
Tries : Positive := Default_Tries)
is
begin
@@ -1596,39 +1596,41 @@ package body GNAT.Perfect_Hash_Generators is
New_Line (File);
- if Opt = CPU_Time then
- Put_Int_Matrix
- (File,
- Array_Img ("T1", Type_Img (NV),
- Range_Img (0, T1_Len - 1),
- Range_Img (0, T2_Len - 1, Type_Img (256))),
- T1, T1_Len, T2_Len);
-
- else
- Put_Int_Matrix
- (File,
- Array_Img ("T1", Type_Img (NV),
- Range_Img (0, T1_Len - 1)),
- T1, T1_Len, 0);
- end if;
+ case Opt is
+ when CPU_Time =>
+ Put_Int_Matrix
+ (File,
+ Array_Img ("T1", Type_Img (NV),
+ Range_Img (0, T1_Len - 1),
+ Range_Img (0, T2_Len - 1, Type_Img (256))),
+ T1, T1_Len, T2_Len);
+
+ when Memory_Space =>
+ Put_Int_Matrix
+ (File,
+ Array_Img ("T1", Type_Img (NV),
+ Range_Img (0, T1_Len - 1)),
+ T1, T1_Len, 0);
+ end case;
New_Line (File);
- if Opt = CPU_Time then
- Put_Int_Matrix
- (File,
- Array_Img ("T2", Type_Img (NV),
- Range_Img (0, T1_Len - 1),
- Range_Img (0, T2_Len - 1, Type_Img (256))),
- T2, T1_Len, T2_Len);
-
- else
- Put_Int_Matrix
- (File,
- Array_Img ("T2", Type_Img (NV),
- Range_Img (0, T1_Len - 1)),
- T2, T1_Len, 0);
- end if;
+ case Opt is
+ when CPU_Time =>
+ Put_Int_Matrix
+ (File,
+ Array_Img ("T2", Type_Img (NV),
+ Range_Img (0, T1_Len - 1),
+ Range_Img (0, T2_Len - 1, Type_Img (256))),
+ T2, T1_Len, T2_Len);
+
+ when Memory_Space =>
+ Put_Int_Matrix
+ (File,
+ Array_Img ("T2", Type_Img (NV),
+ Range_Img (0, T1_Len - 1)),
+ T2, T1_Len, 0);
+ end case;
New_Line (File);
@@ -1650,11 +1652,12 @@ package body GNAT.Perfect_Hash_Generators is
Put (File, " J : ");
- if Opt = CPU_Time then
- Put (File, Type_Img (256));
- else
- Put (File, "Natural");
- end if;
+ case Opt is
+ when CPU_Time =>
+ Put (File, Type_Img (256));
+ when Memory_Space =>
+ Put (File, "Natural");
+ end case;
Put (File, ";");
New_Line (File);
@@ -1667,11 +1670,12 @@ package body GNAT.Perfect_Hash_Generators is
New_Line (File);
Put (File, " J := ");
- if Opt = CPU_Time then
- Put (File, "C");
- else
- Put (File, "Character'Pos");
- end if;
+ case Opt is
+ when CPU_Time =>
+ Put (File, "C");
+ when Memory_Space =>
+ Put (File, "Character'Pos");
+ end case;
Put (File, " (S (P (K) + F));");
New_Line (File);
@@ -2490,20 +2494,21 @@ package body GNAT.Perfect_Hash_Generators is
R : Natural;
begin
- if Opt = CPU_Time then
- for J in 0 .. T1_Len - 1 loop
- exit when Word (J + 1) = ASCII.NUL;
- R := Get_Table (Table, J, Get_Used_Char (Word (J + 1)));
- S := (S + R) mod NV;
- end loop;
+ case Opt is
+ when CPU_Time =>
+ for J in 0 .. T1_Len - 1 loop
+ exit when Word (J + 1) = ASCII.NUL;
+ R := Get_Table (Table, J, Get_Used_Char (Word (J + 1)));
+ S := (S + R) mod NV;
+ end loop;
- else
- for J in 0 .. T1_Len - 1 loop
- exit when Word (J + 1) = ASCII.NUL;
- R := Get_Table (Table, J, 0);
- S := (S + R * Character'Pos (Word (J + 1))) mod NV;
- end loop;
- end if;
+ when Memory_Space =>
+ for J in 0 .. T1_Len - 1 loop
+ exit when Word (J + 1) = ASCII.NUL;
+ R := Get_Table (Table, J, 0);
+ S := (S + R * Character'Pos (Word (J + 1))) mod NV;
+ end loop;
+ end case;
return S;
end Sum;
diff --git a/gcc/ada/g-pehage.ads b/gcc/ada/g-pehage.ads
index 63a5b900930..dfe926ef782 100644
--- a/gcc/ada/g-pehage.ads
+++ b/gcc/ada/g-pehage.ads
@@ -86,8 +86,9 @@ package GNAT.Perfect_Hash_Generators is
-- number of tries.
type Optimization is (Memory_Space, CPU_Time);
- Default_Optimization : constant Optimization := CPU_Time;
- -- Optimize either the memory space or the execution time
+ -- Optimize either the memory space or the execution time. Note: in
+ -- practice, the optimization mode has little effect on speed. The tables
+ -- are somewhat smaller with Memory_Space.
Verbose : Boolean := False;
-- Output the status of the algorithm. For instance, the tables, the random
@@ -97,7 +98,7 @@ package GNAT.Perfect_Hash_Generators is
procedure Initialize
(Seed : Natural;
K_To_V : Float := Default_K_To_V;
- Optim : Optimization := CPU_Time;
+ Optim : Optimization := Memory_Space;
Tries : Positive := Default_Tries);
-- Initialize the generator and its internal structures. Set the ratio of
-- vertices over keys in the random graphs. This value has to be greater
diff --git a/gcc/ada/prj.ads b/gcc/ada/prj.ads
index 75bb078b063..a6a79646a53 100644
--- a/gcc/ada/prj.ads
+++ b/gcc/ada/prj.ads
@@ -1630,7 +1630,7 @@ private
Error_On_Unknown_Language => True,
Require_Obj_Dirs => Warning,
Allow_Invalid_External => Error,
- Missing_Source_Files => Warning);
+ Missing_Source_Files => Error);
Gnatmake_Flags : constant Processing_Flags :=
(Report_Error => null,
diff --git a/gcc/ada/sem.adb b/gcc/ada/sem.adb
index 42adb52a44d..ce6887ef21a 100644
--- a/gcc/ada/sem.adb
+++ b/gcc/ada/sem.adb
@@ -1589,7 +1589,7 @@ package body Sem is
null;
- when N_Subprogram_Body =>
+ when N_Subprogram_Body =>
-- A subprogram body must be the main unit
@@ -1597,14 +1597,17 @@ package body Sem is
or else CU = Cunit (Main_Unit));
null;
- -- All other cases cannot happen
-
when N_Function_Instantiation |
N_Procedure_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;
+ -- All other cases cannot happen
+
when N_Subunit =>
pragma Assert (False, "subunit");
null;
diff --git a/gcc/ada/sem_ch12.adb b/gcc/ada/sem_ch12.adb
index 757276b0009..a50094d7e37 100644
--- a/gcc/ada/sem_ch12.adb
+++ b/gcc/ada/sem_ch12.adb
@@ -8748,11 +8748,16 @@ package body Sem_Ch12 is
-- 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
-- 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)
and then not Body_Optional
then
- if Serious_Errors_Detected = 0 then
+ if CodePeer_Mode then
+ null;
+
+ elsif Serious_Errors_Detected = 0 then
Error_Msg_NE
("cannot find body of generic package &", Inst_Node, Gen_Unit);
@@ -10451,7 +10456,9 @@ package body Sem_Ch12 is
loop
Mark_Context
(Inst_Decl,
- Unit_Declaration_Node (Generic_Parent (Parent (Scop))));
+ Unit_Declaration_Node
+ (Generic_Parent
+ (Specification (Unit_Declaration_Node (Scop)))));
Scop := Scope (Scop);
end loop;
@@ -10857,11 +10864,20 @@ package body Sem_Ch12 is
Get_Body_Name (Get_Unit_Name (Unit (Comp_Unit)));
begin
- 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;
+ -- In CodePeer mode, the missing body may make the
+ -- analysis incomplete, but we do not treat it as fatal.
+
+ if CodePeer_Mode then
+ 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 if;
end if;
diff --git a/gcc/ada/sem_util.adb b/gcc/ada/sem_util.adb
index b141ca41fe6..640e4ee86d8 100644
--- a/gcc/ada/sem_util.adb
+++ b/gcc/ada/sem_util.adb
@@ -63,6 +63,7 @@ with Ttypes; use Ttypes;
with Uname; use Uname;
with GNAT.HTable; use GNAT.HTable;
+
package body Sem_Util is
----------------------------------------
@@ -94,19 +95,20 @@ package body Sem_Util is
subtype NCT_Header_Num is Int range 0 .. 511;
-- 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
- -- indicates whether the corresponding formal is out or in out.
- -- Each top-level call (procedure call, condition, assignment)
- -- examines all the actuals for a possible order dependence.
- -- The table is reset after each such check.
+ -- Each actual in a call is entered into the table below. A flag indicates
+ -- whether the corresponding formal is OUT or IN OUT. Each top-level call
+ -- (procedure call, condition, assignment) examines all the actuals for a
+ -- possible order dependence. The table is reset after each such check.
type Actual_Name is record
- Act : Node_Id;
+ Act : Node_Id;
Is_Writable : Boolean;
+ -- Comments needed???
+
end record;
package Actuals_In_Call is new Table.Table (
@@ -117,65 +119,6 @@ package body Sem_Util is
Table_Increment => 10,
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 --
-----------------------
@@ -1226,6 +1169,48 @@ package body Sem_Util is
end if;
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 --
------------------------------------------
@@ -10583,6 +10568,32 @@ package body Sem_Util is
end if;
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 --
------------------------
diff --git a/gcc/ada/sem_util.ads b/gcc/ada/sem_util.ads
index daa1c9dd2ad..54878f326a1 100644
--- a/gcc/ada/sem_util.ads
+++ b/gcc/ada/sem_util.ads
@@ -132,9 +132,9 @@ package Sem_Util is
-- Check wrong use of dynamically tagged expression
procedure Check_Fully_Declared (T : Entity_Id; N : Node_Id);
- -- Verify that the full declaration of type T has been seen. If not,
- -- place error message on node N. Used in object declarations, type
- -- conversions, qualified expressions.
+ -- Verify that the full declaration of type T has been seen. If not, place
+ -- error message on node N. Used in object declarations, type conversions
+ -- and qualified expressions.
procedure Check_Nested_Access (Ent : Entity_Id);
-- Check whether Ent denotes an entity declared in an uplevel scope, which
@@ -158,10 +158,10 @@ package Sem_Util is
-- a possible unlocked access to data.
procedure Check_VMS (Construct : Node_Id);
- -- Check that this the target is OpenVMS, and if so, return with
- -- no effect, otherwise post an error noting this can only be used
- -- with OpenVMS ports. The argument is the construct in question
- -- and is used to post the error message.
+ -- Check that this the target is OpenVMS, and if so, return with no effect,
+ -- otherwise post an error noting this can only be used with OpenVMS ports.
+ -- The argument is the construct in question and is used to post the error
+ -- message.
procedure Collect_Interfaces
(T : Entity_Id;
@@ -192,10 +192,10 @@ package Sem_Util is
-- information on the same interface type.
function Collect_Primitive_Operations (T : Entity_Id) return Elist_Id;
- -- Called upon type derivation and extension. We scan the declarative
- -- part in which the type appears, and collect subprograms that have
- -- one subsidiary subtype of the type. These subprograms can only
- -- appear after the type itself.
+ -- Called upon type derivation and extension. We scan the declarative part
+ -- in which the type appears, and collect subprograms that have one
+ -- subsidiary subtype of the type. These subprograms can only appear after
+ -- the type itself.
function Compile_Time_Constraint_Error
(N : Node_Id;
@@ -207,12 +207,11 @@ package Sem_Util is
-- generates a warning (or error) message in the same manner, but it does
-- not replace any nodes. For convenience, the function always returns its
-- 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
- -- True.
+ -- we are operating in Ada 83 mode, or the Warn parameter is set to True.
procedure Conditional_Delay (New_Ent, Old_Ent : Entity_Id);
- -- Sets the Has_Delayed_Freeze flag of New if the Delayed_Freeze flag
- -- of Old is set and Old has no yet been Frozen (i.e. Is_Frozen is false);
+ -- Sets the Has_Delayed_Freeze flag of New if the Delayed_Freeze flag of
+ -- 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;
-- Utility to create a parameter profile for a new subprogram spec, when
@@ -241,21 +240,20 @@ package Sem_Util is
-- from a library package which is not within any subprogram.
function Defining_Entity (N : Node_Id) return Entity_Id;
- -- Given a declaration N, returns the associated defining entity. If
- -- the declaration has a specification, the entity is obtained from
- -- the specification. If the declaration has a defining unit name,
- -- then the defining entity is obtained from the defining unit name
- -- ignoring any child unit prefixes.
+ -- Given a declaration N, returns the associated defining entity. If the
+ -- declaration has a specification, the entity is obtained from the
+ -- specification. If the declaration has a defining unit name, then the
+ -- defining entity is obtained from the defining unit name ignoring any
+ -- child unit prefixes.
function Denotes_Discriminant
(N : Node_Id;
Check_Concurrent : Boolean := False) return Boolean;
- -- Returns True if node N is an Entity_Name node for a discriminant.
- -- If the flag Check_Concurrent is true, function also returns true
- -- when N denotes the discriminal of the discriminant of a concurrent
- -- type. This is necessary to disable some optimizations on private
- -- components of protected types, and constraint checks on entry
- -- families constrained by discriminants.
+ -- Returns True if node N is an Entity_Name node for a discriminant. If the
+ -- flag Check_Concurrent is true, function also returns true when N denotes
+ -- the discriminal of the discriminant of a concurrent type. This is needed
+ -- to disable some optimizations on private components of protected types,
+ -- and constraint checks on entry families constrained by discriminants.
function Denotes_Same_Object (A1, A2 : Node_Id) return Boolean;
function Denotes_Same_Prefix (A1, A2 : Node_Id) return Boolean;
@@ -277,49 +275,48 @@ package Sem_Util is
function Designate_Same_Unit
(Name1 : Node_Id;
Name2 : Node_Id) return Boolean;
- -- Return true if Name1 and Name2 designate the same unit name;
- -- each of these names is supposed to be a selected component name,
- -- an expanded name, a defining program unit name or an identifier
+ -- Return true if Name1 and Name2 designate the same unit name; each of
+ -- these names is supposed to be a selected component name, an expanded
+ -- name, a defining program unit name or an identifier.
function Enclosing_Generic_Body
(N : Node_Id) return Node_Id;
- -- Returns the Node_Id associated with the innermost enclosing
- -- generic body, if any. If none, then returns Empty.
+ -- Returns the Node_Id associated with the innermost enclosing generic
+ -- body, if any. If none, then returns Empty.
function Enclosing_Generic_Unit
(N : Node_Id) return Node_Id;
- -- Returns the Node_Id associated with the innermost enclosing
- -- generic unit, if any. If none, then returns Empty.
+ -- Returns the Node_Id associated with the innermost enclosing generic
+ -- unit, if any. If none, then returns Empty.
function Enclosing_Lib_Unit_Entity return Entity_Id;
-- Returns the entity of enclosing N_Compilation_Unit Node which is the
- -- root of the current scope (which must not be Standard_Standard, and
- -- the caller is responsible for ensuring this condition).
+ -- root of the current scope (which must not be Standard_Standard, and the
+ -- caller is responsible for ensuring this condition).
function Enclosing_Lib_Unit_Node (N : Node_Id) return Node_Id;
- -- Returns the enclosing N_Compilation_Unit Node that is the root
- -- of a subtree containing N.
+ -- Returns the enclosing N_Compilation_Unit Node that is the root of a
+ -- subtree containing N.
function Enclosing_Subprogram (E : Entity_Id) return Entity_Id;
-- Utility function to return the Ada entity of the subprogram enclosing
-- the entity E, if any. Returns Empty if no enclosing subprogram.
procedure Ensure_Freeze_Node (E : Entity_Id);
- -- Make sure a freeze node is allocated for entity E. If necessary,
- -- build and initialize a new freeze node and set Has_Delayed_Freeze
- -- true for entity E.
+ -- Make sure a freeze node is allocated for entity E. If necessary, build
+ -- and initialize a new freeze node and set Has_Delayed_Freeze True for E.
procedure Enter_Name (Def_Id : Entity_Id);
-- Insert new name in symbol table of current scope with check for
- -- duplications (error message is issued if a conflict is found)
- -- Note: Enter_Name is not used for overloadable entities, instead
- -- these are entered using Sem_Ch6.Enter_Overloadable_Entity.
+ -- duplications (error message is issued if a conflict is found).
+ -- Note: Enter_Name is not used for overloadable entities, instead these
+ -- are entered using Sem_Ch6.Enter_Overloadable_Entity.
procedure Explain_Limited_Type (T : Entity_Id; N : Node_Id);
- -- This procedure is called after issuing a message complaining
- -- about an inappropriate use of limited type T. If useful, it
- -- adds additional continuation lines to the message explaining
- -- why type T is limited. Messages are placed at node N.
+ -- This procedure is called after issuing a message complaining about an
+ -- inappropriate use of limited type T. If useful, it adds additional
+ -- continuation lines to the message explaining why type T is limited.
+ -- Messages are placed at node N.
procedure Find_Actual
(N : Node_Id;
@@ -376,7 +373,7 @@ package Sem_Util is
-- iterating through the actuals in declaration order is to use this
-- function to find the first actual, and then use Next_Actual to obtain
-- 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).
function Full_Qualified_Name (E : Entity_Id) return String_Id;
@@ -421,15 +418,15 @@ package Sem_Util is
function Get_Actual_Subtype (N : Node_Id) return Entity_Id;
-- Given a node for an expression, obtain the actual subtype of the
-- expression. In the case of a parameter where the formal is an
- -- unconstrained array or discriminated type, this will be the
- -- previously constructed subtype of the actual. Note that this is
- -- not quite the "Actual Subtype" of the RM, since it is always
- -- a constrained type, i.e. it is the subtype of the value of the
- -- actual. The actual subtype is also returned in other cases where
- -- it has already been constructed for an object. Otherwise the
- -- expression type is returned unchanged, except for the case of an
- -- unconstrained array type, where an actual subtype is created, using
- -- Insert_Actions if necessary to insert any associated actions.
+ -- unconstrained array or discriminated type, this will be the previously
+ -- constructed subtype of the actual. Note that this is not quite the
+ -- "Actual Subtype" of the RM, since it is always a constrained type, i.e.
+ -- it is the subtype of the value of the actual. The actual subtype is also
+ -- returned in other cases where it has already been constructed for an
+ -- object. Otherwise the expression type is returned unchanged, except for
+ -- the case of an unconstrained array type, where an actual subtype is
+ -- created, using Insert_Actions if necessary to insert any associated
+ -- actions.
function Get_Actual_Subtype_If_Available (N : Node_Id) return Entity_Id;
-- This is like Get_Actual_Subtype, except that it never constructs an
@@ -439,31 +436,29 @@ package Sem_Util is
function Get_Default_External_Name (E : Node_Or_Entity_Id) return Node_Id;
-- This is used to construct the string literal node representing a
- -- default external name, i.e. one that is constructed from the name
- -- of an entity, or (in the case of extended DEC import/export pragmas,
- -- an identifier provided as the external name. Letters in the name are
+ -- default external name, i.e. one that is constructed from the name of an
+ -- entity, or (in the case of extended DEC import/export pragmas, an
+ -- identifier provided as the external name. Letters in the name are
-- according to the setting of Opt.External_Name_Default_Casing.
function Get_Generic_Entity (N : Node_Id) return Entity_Id;
- -- Returns the true generic entity in an instantiation. If the name in
- -- the instantiation is a renaming, the function returns the renamed
- -- generic.
+ -- Returns the true generic entity in an instantiation. If the name in the
+ -- instantiation is a renaming, the function returns the renamed generic.
procedure Get_Index_Bounds (N : Node_Id; L, H : out Node_Id);
- -- This procedure assigns to L and H respectively the values of the
- -- low and high bounds of node N, which must be a range, subtype
- -- indication, or the name of a scalar subtype. The result in L, H
- -- may be set to Error if there was an earlier error in the range.
+ -- This procedure assigns to L and H respectively the values of the low and
+ -- high bounds of node N, which must be a range, subtype indication, or the
+ -- name of a scalar subtype. The result in L, H may be set to Error if
+ -- there was an earlier error in the range.
function Get_Enum_Lit_From_Pos
(T : Entity_Id;
Pos : Uint;
Loc : Source_Ptr) return Entity_Id;
- -- This function obtains the E_Enumeration_Literal entity for the
- -- specified value from the enumeration type or subtype T. The
- -- second argument is the Pos value, which is assumed to be in range.
- -- The third argument supplies a source location for constructed
- -- nodes returned by this function.
+ -- This function obtains the E_Enumeration_Literal entity for the specified
+ -- value from the enumeration type or subtype T. The second argument is the
+ -- Pos value, which is assumed to be in range. The third argument supplies
+ -- a source location for constructed nodes returned by this function.
procedure Get_Library_Unit_Name_String (Decl_Node : Node_Id);
-- Retrieve the fully expanded name of the library unit declared by
@@ -472,9 +467,9 @@ package Sem_Util is
function Get_Name_Entity_Id (Id : Name_Id) return Entity_Id;
pragma Inline (Get_Name_Entity_Id);
-- 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,
- -- which is the innermost visible entity with the given name. See the
- -- body of Sem_Ch8 for further details on handling of entity visibility.
+ -- Get_Name_Entity_Id function fetches the Entity_Id of this entity, which
+ -- is the innermost visible entity with the given name. See the body of
+ -- Sem_Ch8 for further details on handling of entity visibility.
function Get_Pragma_Id (N : Node_Id) return Pragma_Id;
pragma Inline (Get_Pragma_Id);
@@ -492,22 +487,20 @@ package Sem_Util is
-- with any other kind of entity.
function Get_Subprogram_Entity (Nod : Node_Id) return Entity_Id;
- -- Nod is either a procedure call statement, or a function call, or
- -- an accept statement node. This procedure finds the Entity_Id of the
- -- related subprogram or entry and returns it, or if no subprogram can
- -- be found, returns Empty.
+ -- Nod is either a procedure call statement, or a function call, or an
+ -- accept statement node. This procedure finds the Entity_Id of the related
+ -- subprogram or entry and returns it, or if no subprogram can be found,
+ -- returns Empty.
function Get_Subprogram_Body (E : Entity_Id) return Node_Id;
- -- Given the entity for a subprogram (E_Function or E_Procedure),
- -- return the corresponding N_Subprogram_Body node. If the corresponding
- -- body of the declaration is missing (as for an imported subprogram)
- -- return Empty.
+ -- Given the entity for a subprogram (E_Function or E_Procedure), return
+ -- the corresponding N_Subprogram_Body node. If the corresponding body
+ -- is missing (as for an imported subprogram), return Empty.
function Get_Task_Body_Procedure (E : Entity_Id) return Node_Id;
pragma Inline (Get_Task_Body_Procedure);
-- Given an entity for a task type or subtype, retrieves the
- -- Task_Body_Procedure field from the corresponding task type
- -- declaration.
+ -- Task_Body_Procedure field from the corresponding task type declaration.
function Has_Access_Values (T : Entity_Id) return Boolean;
-- Returns true if type or subtype T is an access type, or has a component
@@ -537,18 +530,18 @@ package Sem_Util is
--
-- 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
- -- that alignments have been explicitly or implicitly specified which
- -- are incompatible (whereas Unknown means that even this is not known).
- -- The appropriate reaction of a caller to Known_Incompatible is to treat
- -- it as Unknown, but issue a warning that there may be an alignment error.
+ -- that alignments have been explicitly or implicitly specified which are
+ -- incompatible (whereas Unknown means that even this is not known). The
+ -- appropriate reaction of a caller to Known_Incompatible is to treat it as
+ -- Unknown, but issue a warning that there may be an alignment error.
function Has_Declarations (N : Node_Id) return Boolean;
-- Determines if the node can have declarations
function Has_Discriminant_Dependent_Constraint
(Comp : Entity_Id) return Boolean;
- -- Returns True if and only if Comp has a constrained subtype
- -- that depends on a discriminant.
+ -- Returns True if and only if Comp has a constrained subtype that depends
+ -- on a discriminant.
function Has_Infinities (E : Entity_Id) return Boolean;
-- Determines if the range of the floating-point type E includes
@@ -578,18 +571,18 @@ package Sem_Util is
-- yet received a full declaration.
function Has_Stream (T : Entity_Id) return Boolean;
- -- Tests if type T is derived from Ada.Streams.Root_Stream_Type, or
- -- in the case of a composite type, has a component for which this
- -- predicate is True, and if so returns True. Otherwise a result of
- -- False means that there is no Stream type in sight. For a private
- -- type, the test is applied to the underlying type (or returns False
- -- if there is no underlying type).
+ -- Tests if type T is derived from Ada.Streams.Root_Stream_Type, or in the
+ -- case of a composite type, has a component for which this predicate is
+ -- True, and if so returns True. Otherwise a result of False means that
+ -- there is no Stream type in sight. For a private type, the test is
+ -- applied to the underlying type (or returns False if there is no
+ -- underlying type).
function Has_Tagged_Component (Typ : Entity_Id) return Boolean;
-- 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
-- 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.
function Implements_Interface
@@ -620,11 +613,11 @@ package Sem_Util is
-- Returns True if node N belongs to a parameter specification
function In_Subprogram_Or_Concurrent_Unit return Boolean;
- -- Determines if the current scope is within a subprogram compilation
- -- unit (inside a subprogram declaration, subprogram body, or generic
- -- subprogram declaration) or within a task or protected body. The test
- -- is for appearing anywhere within such a construct (that is it does not
- -- need to be directly within).
+ -- Determines if the current scope is within a subprogram compilation unit
+ -- (inside a subprogram declaration, subprogram body, or generic
+ -- subprogram declaration) or within a task or protected body. The test is
+ -- for appearing anywhere within such a construct (that is it does not need
+ -- to be directly within).
function In_Visible_Part (Scope_Id : Entity_Id) return Boolean;
-- Determine whether a declaration occurs within the visible part of a
@@ -656,8 +649,8 @@ package Sem_Util is
-- Determines if N is an actual parameter in a subprogram call
function Is_Aliased_View (Obj : Node_Id) return Boolean;
- -- Determine if Obj is an aliased view, i.e. the name of an
- -- object to which 'Access or 'Unchecked_Access can apply.
+ -- Determine if Obj is an aliased view, i.e. the name of an object to which
+ -- 'Access or 'Unchecked_Access can apply.
function Is_Ancestor_Package
(E1 : Entity_Id;
@@ -665,8 +658,8 @@ package Sem_Util is
-- Determine whether package E1 is an ancestor of E2
function Is_Atomic_Object (N : Node_Id) return Boolean;
- -- Determines if the given node denotes an atomic object in the sense
- -- of the legality checks described in RM C.6(12).
+ -- Determines if the given node denotes an atomic object in the sense of
+ -- the legality checks described in RM C.6(12).
function Is_Coextension_Root (N : Node_Id) return Boolean;
-- Determine whether node N is an allocator which acts as a coextension
@@ -1173,11 +1166,10 @@ package Sem_Util is
-- 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.
- procedure Save_Actual (N : Node_Id; Writable : Boolean := False);
- -- Enter an actual in a call in a table global, for subsequent check
- -- of possible order dependence in the presence of in out parameters
- -- for functions in Ada 2012 (or access parameters in older versions
- -- of the language).
+ procedure Save_Actual (N : Node_Id; Writable : Boolean := False);
+ -- Enter an actual in a call in a table global, for subsequent check of
+ -- possible order dependence in the presence of IN OUT parameters for
+ -- functions in Ada 2012 (or access parameters in older language versions).
function Scope_Within (Scope1, Scope2 : Entity_Id) return Boolean;
-- Like Scope_Within_Or_Same, except that this function returns