+2015-01-06 Robert Dewar <dewar@adacore.com>
+
+ * namet.ads: Document use of Boolean2 for No_Use_Of_Entity.
+ * restrict.ads (No_Use_Of_Entity): New table.
+ * sem_prag.adb (Process_Restrictions_Or_Restriction_Warnings):
+ Ignore No_Use_Of_Entity (will be processed in parser).
+ * snames.ads-tmpl: Add entry for Name_No_Use_Of_Entity.
+
+2015-01-06 Vincent Celier <celier@adacore.com>
+
+ * prj-tree.adb (Imported_Or_Extended_Project_Of): Do not try
+ to check for an extended project, if a project does not have
+ yet a project declaration.
+
2015-01-06 Pierre-Marie Derodat <derodat@adacore.com>
* scos.ads: Update documentation about the SCO table build
-- The Boolean1 field is used to mark address clauses to optimize the
-- performance of the Exp_Util.Following_Address_Clause function.
--- The Boolean2/Boolean3 fields are not used
+-- The Boolean2 field is used to mark simple names that appear in
+-- Restriction[_Warning]s pragmas for No_Use_Of_Entity. This avoids most
+-- unnecessary searches of the No_Use_Of_Entity table.
+
+-- The Boolean3 field is not used
-- In the binder, we have the following uses:
is
With_Clause : Project_Node_Id;
Result : Project_Node_Id := Empty_Node;
+ Decl : Project_Node_Id;
begin
-- First check all the imported projects
return Result;
end if;
- Result :=
- Extended_Project_Of
- (Project_Declaration_Of (Result, In_Tree), In_Tree);
+ Decl := Project_Declaration_Of (Result, In_Tree);
+
+ -- Do not try to check for an extended project, if the project
+ -- does not have yet a project declaration.
+
+ exit when Decl = Empty_Node;
+
+ Result := Extended_Project_Of (Decl, In_Tree);
end loop;
With_Clause := Next_With_Clause_Of (With_Clause, In_Tree);
-- set from package Standard by the processing in Targparm.
Restriction_Profile_Name : array (All_Restrictions) of Profile_Name;
- -- Entries in this array are valid only if the corresponding restriction
- -- in Restrictions set. The value is the corresponding profile name if the
+ -- Entries in this array are valid only if the corresponding restriction in
+ -- Restrictions is set. The value is the corresponding profile name if the
-- restriction was set by a Profile or Profile_Warnings pragma. The value
-- is No_Profile in all other cases.
SPARK_05 => True,
others => False);
+ --------------------------
+ -- No_Dependences Table --
+ --------------------------
+
-- The following table records entries made by Restrictions pragmas
-- that specify a parameter for No_Dependence. Each such pragma makes
-- an entry in this table.
Table_Increment => 200,
Table_Name => "Name_No_Dependences");
+ ----------------------------
+ -- No_Use_Of_Entity Table --
+ ----------------------------
+
+ -- The following table records entries made by Restrictions pragmas
+ -- that specify a parameter for No_Use_Of_Entity. Each such pragma makes
+ -- an entry in this table.
+
+ -- Note: we have chosen to implement this restriction in the "syntactic"
+ -- form, where we allow arbitrary fully qualified names to be specified.
+
+ type NE_Entry is record
+ Entity : Node_Id;
+ -- The entity parameter from the No_Use_Of_Entity pragma. This is in
+ -- the form of a selected component, since that is the way the parser
+ -- processes it, and we don't further analyze it.
+
+ Warn : Boolean;
+ -- True if from Restriction_Warnings, False if from Restrictions
+
+ Profile : Profile_Name;
+ -- Set to name of profile from which No_Use_Of_Entity entry came, or to
+ -- No_Profile if a pragma Restriction set the No_Use_Of_Entity entry.
+ end record;
+
+ package No_Use_Of_Entity is new Table.Table (
+ Table_Component_Type => NE_Entry,
+ Table_Index_Type => Int,
+ Table_Low_Bound => 0,
+ Table_Initial => 200,
+ Table_Increment => 200,
+ Table_Name => "Name_No_Use_Of_Entity");
+
+ -- Note that in addition to making an entry in this table, we also set the
+ -- Boolean2 flag of the Name_Table entry for the simple name of the entity.
+ -- This is used to avoid most useless searches of this table.
+
-----------------
-- Subprograms --
-----------------
raise Pragma_Exit;
end if;
- -- Case of No_Specification_Of_Aspect => Identifier.
+ -- Case of No_Specification_Of_Aspect => aspect-identifier
elsif Id = Name_No_Specification_Of_Aspect then
declare
end if;
end;
+ -- Case of No_Use_Of_Attribute => attribute-identifier
+
elsif Id = Name_No_Use_Of_Attribute then
if Nkind (Expr) /= N_Identifier
or else not Is_Attribute_Name (Chars (Expr))
Set_Restriction_No_Use_Of_Attribute (Expr, Warn);
end if;
+ -- Case of No_Use_Of_Entity => fully-qualified-name. Note that the
+ -- parser already processed this case commpletely, including error
+ -- checking and making an entry in the No_Use_Of_Entity table.
+
+ elsif Id = Name_No_Use_Of_Entity then
+ null;
+
+ -- Case of No_Use_Of_Pragma => pragma-identifier
+
elsif Id = Name_No_Use_Of_Pragma then
if Nkind (Expr) /= N_Identifier
or else not Is_Pragma_Name (Chars (Expr))
Name_No_Task_Attributes : constant Name_Id := N + $;
Name_No_Task_Attributes_Package : constant Name_Id := N + $;
Name_No_Use_Of_Attribute : constant Name_Id := N + $;
+ Name_No_Use_Of_Entity : constant Name_Id := N + $;
Name_No_Use_Of_Pragma : constant Name_Id := N + $;
Name_No_Unroll : constant Name_Id := N + $;
Name_No_Vector : constant Name_Id := N + $;