Minor code cleanups.
authorArnaud Charlet <charlet@gcc.gnu.org>
Mon, 18 Apr 2016 10:47:29 +0000 (12:47 +0200)
committerArnaud Charlet <charlet@gcc.gnu.org>
Mon, 18 Apr 2016 10:47:29 +0000 (12:47 +0200)
From-SVN: r235125

gcc/ada/a-exetim-mingw.ads
gcc/ada/sem_aggr.adb
gcc/ada/sem_ch4.adb
gcc/ada/sem_warn.adb

index 5ba3e08..4224d66 100644 (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;
index 8e8b398..4657336 100644 (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;
index 04b9dbd..d7264ec 100644 (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
index a2fb50d..09f9ac8 100644 (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