public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r12-6316] [Ada] Remove unnecessary declare block
@ 2022-01-06 17:15 Pierre-Marie de Rodat
  0 siblings, 0 replies; only message in thread
From: Pierre-Marie de Rodat @ 2022-01-06 17:15 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:1871f2cb3cef93485a11057b1bb9aff2c68dd512

commit r12-6316-g1871f2cb3cef93485a11057b1bb9aff2c68dd512
Author: Piotr Trojanek <trojanek@adacore.com>
Date:   Fri Dec 10 16:54:03 2021 +0100

    [Ada] Remove unnecessary declare block
    
    gcc/ada/
    
            * errout.adb (Adjust_Name_Case): Remove unnecessary declare
            block.

Diff:
---
 gcc/ada/errout.adb | 73 ++++++++++++++++++++++++++----------------------------
 1 file changed, 35 insertions(+), 38 deletions(-)

diff --git a/gcc/ada/errout.adb b/gcc/ada/errout.adb
index b40a8bb1e01..8ae6f17c75e 100644
--- a/gcc/ada/errout.adb
+++ b/gcc/ada/errout.adb
@@ -3391,60 +3391,57 @@ package body Errout is
      (Buf : in out Bounded_String;
       Loc : Source_Ptr)
    is
+      Src_Ind : constant Source_File_Index := Get_Source_File_Index (Loc);
+      Sbuffer : Source_Buffer_Ptr;
+      Ref_Ptr : Integer;
+      Src_Ptr : Source_Ptr;
+
    begin
       --  We have an all lower case name from Namet, and now we want to set
       --  the appropriate case. If possible we copy the actual casing from
       --  the source. If not we use standard identifier casing.
 
-      declare
-         Src_Ind : constant Source_File_Index := Get_Source_File_Index (Loc);
-         Sbuffer : Source_Buffer_Ptr;
-         Ref_Ptr : Integer;
-         Src_Ptr : Source_Ptr;
+      Ref_Ptr := 1;
+      Src_Ptr := Loc;
 
-      begin
-         Ref_Ptr := 1;
-         Src_Ptr := Loc;
+      --  For standard locations, always use mixed case
 
-         --  For standard locations, always use mixed case
+      if Loc <= No_Location then
+         Set_Casing (Buf, Mixed_Case);
 
-         if Loc <= No_Location then
-            Set_Casing (Buf, Mixed_Case);
+      else
+         --  Determine if the reference we are dealing with corresponds to text
+         --  at the point of the error reference. This will often be the case
+         --  for simple identifier references, and is the case where we can
+         --  copy the casing from the source.
+
+         Sbuffer := Source_Text (Src_Ind);
+
+         while Ref_Ptr <= Buf.Length loop
+            exit when
+              Fold_Lower (Sbuffer (Src_Ptr)) /=
+                Fold_Lower (Buf.Chars (Ref_Ptr));
+            Ref_Ptr := Ref_Ptr + 1;
+            Src_Ptr := Src_Ptr + 1;
+         end loop;
 
-         else
-            --  Determine if the reference we are dealing with corresponds to
-            --  text at the point of the error reference. This will often be
-            --  the case for simple identifier references, and is the case
-            --  where we can copy the casing from the source.
+         --  If we get through the loop without a mismatch, then output the
+         --  name the way it is cased in the source program.
 
-            Sbuffer := Source_Text (Src_Ind);
+         if Ref_Ptr > Buf.Length then
+            Src_Ptr := Loc;
 
-            while Ref_Ptr <= Buf.Length loop
-               exit when
-                 Fold_Lower (Sbuffer (Src_Ptr)) /=
-                   Fold_Lower (Buf.Chars (Ref_Ptr));
-               Ref_Ptr := Ref_Ptr + 1;
+            for J in 1 .. Buf.Length loop
+               Buf.Chars (J) := Sbuffer (Src_Ptr);
                Src_Ptr := Src_Ptr + 1;
             end loop;
 
-            --  If we get through the loop without a mismatch, then output the
-            --  name the way it is cased in the source program
-
-            if Ref_Ptr > Buf.Length then
-               Src_Ptr := Loc;
+         --  Otherwise set the casing using the default identifier casing
 
-               for J in 1 .. Buf.Length loop
-                  Buf.Chars (J) := Sbuffer (Src_Ptr);
-                  Src_Ptr := Src_Ptr + 1;
-               end loop;
-
-            --  Otherwise set the casing using the default identifier casing
-
-            else
-               Set_Casing (Buf, Identifier_Casing (Src_Ind));
-            end if;
+         else
+            Set_Casing (Buf, Identifier_Casing (Src_Ind));
          end if;
-      end;
+      end if;
    end Adjust_Name_Case;
 
    ---------------------------


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-01-06 17:15 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-06 17:15 [gcc r12-6316] [Ada] Remove unnecessary declare block Pierre-Marie de Rodat

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).