From bd717ec9b7edb898ec138f58a14821e776bb4fa3 Mon Sep 17 00:00:00 2001 From: Arnaud Charlet Date: Mon, 18 Apr 2016 12:47:29 +0200 Subject: [PATCH] Minor code cleanups. From-SVN: r235125 --- gcc/ada/a-exetim-mingw.ads | 1 - gcc/ada/sem_aggr.adb | 8 ++--- gcc/ada/sem_ch4.adb | 62 ++++++++++++++++++-------------------- gcc/ada/sem_warn.adb | 5 ++- 4 files changed, 36 insertions(+), 40 deletions(-) diff --git a/gcc/ada/a-exetim-mingw.ads b/gcc/ada/a-exetim-mingw.ads index 5ba3e08c386..4224d66033e 100644 --- a/gcc/ada/a-exetim-mingw.ads +++ b/gcc/ada/a-exetim-mingw.ads @@ -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; diff --git a/gcc/ada/sem_aggr.adb b/gcc/ada/sem_aggr.adb index 8e8b3988e68..4657336e726 100644 --- a/gcc/ada/sem_aggr.adb +++ b/gcc/ada/sem_aggr.adb @@ -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; diff --git a/gcc/ada/sem_ch4.adb b/gcc/ada/sem_ch4.adb index 04b9dbd9f4c..d7264ec977d 100644 --- a/gcc/ada/sem_ch4.adb +++ b/gcc/ada/sem_ch4.adb @@ -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 diff --git a/gcc/ada/sem_warn.adb b/gcc/ada/sem_warn.adb index a2fb50db7bd..09f9ac8858d 100644 --- a/gcc/ada/sem_warn.adb +++ b/gcc/ada/sem_warn.adb @@ -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