Minor code cleanups.

From-SVN: r235125
This commit is contained in:
Arnaud Charlet 2016-04-18 12:47:29 +02:00
parent 87feba051d
commit bd717ec9b7
4 changed files with 36 additions and 40 deletions

View File

@ -41,7 +41,6 @@ with Ada.Real_Time;
package Ada.Execution_Time with
SPARK_Mode
is
type CPU_Time is private;
CPU_Time_First : constant CPU_Time;

View File

@ -4446,8 +4446,8 @@ package body Sem_Aggr is
Comp_Elmt := First_Elmt (Components);
while Present (Comp_Elmt) loop
if
Ekind (Node (Comp_Elmt)) /= E_Discriminant
if Ekind (Node (Comp_Elmt)) /=
E_Discriminant
then
Process_Component (Node (Comp_Elmt));
end if;
@ -4599,8 +4599,8 @@ package body Sem_Aggr is
elsif Others_Box = 1 and then Warn_On_Redundant_Constructs then
Error_Msg_N ("others choice is redundant?", Box_Node);
Error_Msg_N ("\previous choices cover all components?",
Box_Node);
Error_Msg_N
("\previous choices cover all components?", Box_Node);
end if;
exit Verification;

View File

@ -4108,6 +4108,9 @@ package body Sem_Ch4 is
-- conformant. If the parent node is not analyzed yet it may be an
-- indexed component rather than a function call.
function Has_Dereference (Nod : Node_Id) return Boolean;
-- Check whether prefix includes a dereference at any level
--------------------------------
-- Find_Component_In_Instance --
--------------------------------
@ -4209,6 +4212,23 @@ package body Sem_Ch4 is
return True;
end Has_Mode_Conformant_Spec;
---------------------
-- Has_Dereference --
---------------------
function Has_Dereference (Nod : Node_Id) return Boolean is
begin
if Nkind (Nod) = N_Explicit_Dereference then
return True;
elsif Nkind_In (Nod, N_Indexed_Component, N_Selected_Component) then
return Has_Dereference (Prefix (Nod));
else
return False;
end if;
end Has_Dereference;
-- Start of processing for Analyze_Selected_Component
begin
@ -4663,38 +4683,16 @@ package body Sem_Ch4 is
-- This is legal if prefix is an access to such type and there is
-- a dereference, or is a component with a dereferenced prefix.
if In_Scope and then not Is_Entity_Name (Name) then
declare
function Has_Dereference (N : Node_Id) return Boolean;
-- Check whether prefix includes a dereference at any level.
---------------------
-- Has_Dereference --
---------------------
function Has_Dereference (N : Node_Id) return Boolean is
begin
if Nkind (N) = N_Explicit_Dereference then
return True;
elsif
Nkind_In (N, N_Selected_Component, N_Indexed_Component)
then
return Has_Dereference (Prefix (N));
else
return False;
end if;
end Has_Dereference;
begin
if not Has_Dereference (Name) then
Error_Msg_NE ("invalid reference to internal operation "
& "of some object of type &", N, Type_To_Use);
Set_Entity (Sel, Any_Id);
Set_Etype (Sel, Any_Type);
return;
end if;
end;
if In_Scope
and then not Is_Entity_Name (Name)
and then not Has_Dereference (Name)
then
Error_Msg_NE
("invalid reference to internal operation of some object of "
& "type &", N, Type_To_Use);
Set_Entity (Sel, Any_Id);
Set_Etype (Sel, Any_Type);
return;
end if;
-- If there is no visible entity with the given name or none of the

View File

@ -1145,9 +1145,8 @@ package body Sem_Warn is
and then not Is_Imported (E1)
then
Error_Msg_N
("?k?& is not modified, " &
"consider pragma Export for volatile variable!",
E1);
("?k?& is not modified, consider pragma Export for "
& "volatile variable!", E1);
-- Another special case, Exception_Occurrence, this catches
-- the case of exception choice (and a bit more too, but not